:root {
  --ink: #13212b;
  --muted: #5a6b76;
  --line: #d5dee5;
  --paper: #f4f7f9;
  --panel: #ffffff;
  --accent: #0f8a7a;
  --accent-2: #0b5f54;
  --danger: #c23b3b;
  --shadow: 0 18px 50px rgba(19, 33, 43, 0.08);
  --radius: 14px;
  --font: "Sora", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, #d9f3ee 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #e7eef4 0%, transparent 50%),
    var(--paper);
}

.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(19, 33, 43, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(19, 33, 43, 0.04) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem 1.5rem;
  position: relative;
  z-index: 2;
}
.brand {
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.brand span { color: var(--accent); }
.topbar a { color: var(--muted); text-decoration: none; font-size: 0.92rem; }
.topbar a:hover { color: var(--accent-2); }

.hero {
  position: relative;
  z-index: 1;
  max-width: 820px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
  animation: rise 0.55s ease both;
}

.eyebrow {
  display: inline-block;
  margin: 0 0 0.6rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--accent-2);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
h1 {
  margin: 0;
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  letter-spacing: -0.04em;
  line-height: 1.05;
}
.lede {
  margin: 0.85rem 0 1.6rem;
  color: var(--muted);
  max-width: 36rem;
  line-height: 1.55;
  font-size: 1.02rem;
}

.address-bar {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 0.55rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.55rem;
  box-shadow: var(--shadow);
  animation: rise 0.7s ease both;
}
.address-bar input {
  border: 0;
  outline: none;
  font-family: var(--mono);
  font-size: 0.95rem;
  padding: 0.7rem 0.85rem;
  background: transparent;
  color: var(--ink);
  min-width: 0;
}
.meta {
  margin: 0.7rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.65rem 0.95rem;
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.ghost { background: #eef3f6; color: var(--ink); border-color: var(--line); }
.btn.danger { background: #f8e8e8; color: var(--danger); border-color: #efcccc; }

.inbox {
  margin-top: 2rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: rise 0.85s ease both;
}
.inbox-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--line);
}
.inbox-head h2 { margin: 0; font-size: 1rem; }
.inbox-head span { color: var(--muted); font-size: 0.85rem; }

.message-list { list-style: none; margin: 0; padding: 0; }
.message-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem 1rem;
  padding: 0.95rem 1.15rem;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.15s ease;
}
.message-list li:hover { background: #f7fbfa; }
.message-list li.unread .subject { font-weight: 700; }
.message-list .from { font-size: 0.86rem; color: var(--muted); }
.message-list .subject { margin: 0.15rem 0 0; font-size: 0.98rem; }
.message-list .when { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); align-self: start; }

.empty {
  padding: 2.5rem 1.25rem;
  text-align: center;
  color: var(--muted);
}
.empty.hidden, .message-list:empty + .empty { display: block; }
.message-list:not(:empty) + .empty { display: none; }

dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  width: min(720px, 94vw);
  padding: 0;
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(19, 33, 43, 0.35); }
.dialog-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--line);
  margin: 0;
}
.dialog-meta {
  padding: 0.75rem 1.1rem;
  font-size: 0.86rem;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
}
.dialog-body {
  padding: 1.1rem;
  max-height: 55vh;
  overflow: auto;
  line-height: 1.55;
  white-space: pre-wrap;
}
.dialog-body iframe {
  width: 100%;
  min-height: 320px;
  border: 0;
  background: #fff;
}
.dialog-actions {
  padding: 0.85rem 1.1rem 1.1rem;
  display: flex;
  justify-content: flex-end;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 720px) {
  .address-bar {
    grid-template-columns: 1fr 1fr;
  }
  .address-bar input {
    grid-column: 1 / -1;
  }
}
