:root {
  --bg: #f6f6f1;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-strong: #ffffff;
  --text-main: #181713;
  --text-soft: #4b453f;
  --line: #dad4cd;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --danger: #b42318;
  --shadow: 0 18px 44px rgba(22, 28, 45, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at 10% 10%, #fff2dd 0%, transparent 34%),
    radial-gradient(circle at 90% 18%, #d9fbff 0%, transparent 40%),
    var(--bg);
  padding: 2.5rem 1rem 3rem;
  overflow-x: hidden;
}

.bg-orb {
  position: fixed;
  width: 18rem;
  height: 18rem;
  border-radius: 999px;
  filter: blur(70px);
  opacity: 0.3;
  pointer-events: none;
  z-index: 0;
}

.orb-a {
  top: -5rem;
  right: -4rem;
  background: #70e1d8;
}

.orb-b {
  bottom: -7rem;
  left: -6rem;
  background: #f5b985;
}

.container {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  gap: 1rem;
}

.hero {
  margin-bottom: 0.2rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.62rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  margin: 0 0 0.6rem;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 2.6rem);
  line-height: 1.08;
}

.subtitle {
  margin: 0.52rem 0 0;
  color: var(--text-soft);
}

.panel {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 1rem;
}

.mailbox-row,
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.mailbox-controls {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.label {
  font-weight: 600;
  font-size: 0.95rem;
}

.mailbox-wrap {
  margin-top: 0.8rem;
}

.mailbox {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-strong);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.95rem;
  color: var(--text-main);
  padding: 0.72rem 0.78rem;
}

.mailbox:focus-visible,
.btn:focus-visible,
.message-btn:focus-visible {
  outline: 2px solid #0ea5a3;
  outline-offset: 2px;
}

.status {
  min-height: 1.2rem;
  margin: 0.52rem 0 0;
  color: var(--text-soft);
  font-size: 0.88rem;
}

.interval-row {
  margin-top: 0.72rem;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.label-small {
  font-size: 0.82rem;
  color: var(--text-soft);
}

.interval-select {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-strong);
  color: var(--text-main);
  padding: 0.36rem 0.52rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
}

.btn {
  border: 1px solid var(--line);
  background: #fefefe;
  border-radius: 10px;
  padding: 0.52rem 0.78rem;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #f9fffe;
}

.btn-primary:hover {
  background: var(--accent-strong);
}

.btn-danger {
  border-color: #f1d2d0;
  color: #7a1713;
  background: #fff6f5;
}

.btn-danger:hover {
  background: #ffeceb;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 1rem;
}

.inbox-panel,
.message-panel {
  min-height: 460px;
}

h2 {
  margin: 0;
  font-size: 1.05rem;
}

.count,
.meta {
  font-size: 0.8rem;
  color: var(--text-soft);
}

.message-list {
  list-style: none;
  margin: 0.9rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

.message-btn {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 11px;
  padding: 0.7rem;
  text-align: left;
  cursor: pointer;
}

.message-btn.is-active {
  border-color: #0ea5a3;
  box-shadow: 0 0 0 2px rgba(14, 165, 163, 0.14);
}

.msg-subject {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-from,
.msg-date {
  margin: 0.32rem 0 0;
  color: var(--text-soft);
  font-size: 0.8rem;
  font-family: "IBM Plex Mono", monospace;
}

.message-view {
  margin-top: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  min-height: 380px;
  padding: 0.95rem;
  overflow: auto;
}

.message-view iframe {
  width: 100%;
  height: 360px;
  border: 0;
  border-radius: 8px;
  background: #fff;
}

.message-view pre {
  margin: 0.7rem 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
  color: #2f2a24;
}

.placeholder {
  margin: 0;
  color: var(--text-soft);
}

.text-error {
  color: var(--danger);
}

@media (max-width: 900px) {
  .grid {
    grid-template-columns: 1fr;
  }

  .inbox-panel,
  .message-panel {
    min-height: 300px;
  }

  .message-view {
    min-height: 280px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}
