/* Windbell Mail — public UI */
:root {
  --ink: #14302d;
  --ink-soft: #2d4643;
  --muted: #667b77;
  --paper: #f7f5ee;
  --card: #fffdf8;
  --teal: #0f766e;
  --teal-dark: #0b5d57;
  --deep: #0f3d3a;
  --mint: #d9efe7;
  --mint-strong: #b9e3d7;
  --coral: #e07a5f;
  --coral-dark: #b9553d;
  --yellow: #f2c14e;
  --line: rgba(20, 48, 45, .105);
  --line-strong: rgba(20, 48, 45, .18);
  --shadow-card: 0 30px 80px -34px rgba(15, 61, 58, .38);
  --shadow-soft: 0 16px 40px -30px rgba(20, 48, 45, .35);
  --sans: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Source Han Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -3;
  background:
    radial-gradient(900px 620px at 4% -8%, rgba(15, 118, 110, .16), transparent 62%),
    radial-gradient(760px 520px at 102% 8%, rgba(224, 122, 95, .13), transparent 58%),
    linear-gradient(180deg, #faf9f3 0%, #f4f2ea 100%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  opacity: .4;
  background-image: radial-gradient(rgba(20, 48, 45, .085) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, .6), transparent 62%);
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, .6), transparent 62%);
}

.page-glow {
  position: fixed;
  width: 420px;
  height: 420px;
  right: -160px;
  bottom: -180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(242, 193, 78, .16), transparent 66%);
  z-index: -1;
  pointer-events: none;
}

::selection { background: var(--mint-strong); color: var(--deep); }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: var(--teal-dark); }
svg { display: block; flex: none; }
h1, h2, h3, p { margin-top: 0; }
.is-hidden { display: none !important; }

:focus-visible {
  outline: 3px solid rgba(15, 118, 110, .38);
  outline-offset: 2px;
}

/* ---------- header ---------- */
.site-header {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 22px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
  border-radius: 14px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #f8f3e6;
  background: linear-gradient(145deg, #128077, #0b5751);
  box-shadow: 0 9px 22px -10px rgba(15, 118, 110, .8), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.brand-mark svg { width: 26px; height: 26px; }
.brand-mark-sm { width: 34px; height: 34px; border-radius: 11px; }
.brand-mark-sm svg { width: 20px; height: 20px; }

.brand-text strong {
  display: block;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: .02em;
  line-height: 1.3;
}
.brand-text small {
  display: block;
  font-size: 10px;
  letter-spacing: .22em;
  color: var(--muted);
  font-weight: 600;
}
.brand-text small::before { content: ""; }

.header-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, .58);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #b9c5c1;
  transition: background .25s, box-shadow .25s;
}
.status-dot.is-ok { background: #17a673; box-shadow: 0 0 0 4px rgba(23, 166, 115, .12); }
.status-dot.is-down { background: #dc5a4b; box-shadow: 0 0 0 4px rgba(220, 90, 75, .12); }

/* ---------- layout ---------- */
.page-shell {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 22px 24px 88px;
}

.landing { animation: fadeUp .55s cubic-bezier(.2, .7, .3, 1) both; }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.03fr) minmax(360px, .87fr);
  gap: clamp(32px, 5vw, 76px);
  align-items: center;
  min-height: calc(100vh - 240px);
  padding: 18px 0 64px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 22px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .26em;
  color: var(--teal);
}
.eyebrow span {
  display: block;
  width: 30px;
  height: 1.5px;
  background: currentColor;
  opacity: .65;
}

.hero h1 {
  margin: 0;
  color: #0f2b28;
  font-size: clamp(43px, 5.5vw, 67px);
  line-height: 1.06;
  letter-spacing: -.045em;
  font-weight: 850;
}
.hero h1 em {
  position: relative;
  z-index: 0;
  font-style: normal;
  color: var(--teal-dark);
  white-space: nowrap;
}
.hero h1 em::after {
  content: "";
  position: absolute;
  z-index: -1;
  left: -2%;
  right: -2%;
  bottom: 7px;
  height: 15px;
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(242, 193, 78, .62), rgba(185, 227, 215, .9));
  transform: rotate(-1.2deg);
}

.hero-lead {
  max-width: 445px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.85;
  letter-spacing: .01em;
}

.feature-list {
  display: flex;
  flex-wrap: wrap;
  gap: 9px 18px;
  margin: 26px 0 0;
  padding: 0;
  list-style: none;
}
.feature-list li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--ink-soft);
}
.tick {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--mint);
  color: var(--teal-dark);
  font-size: 10px;
  font-weight: 900;
}

.hero-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  max-width: 430px;
  margin-top: 38px;
  padding-top: 18px;
  border-top: 1px dashed var(--line-strong);
  color: #8a6a56;
  font-size: 11.5px;
  line-height: 1.7;
}
.hero-note svg { width: 15px; height: 15px; margin-top: 2px; color: var(--coral); }

/* ---------- create card ---------- */
.create-card {
  position: relative;
  padding: 27px;
  border: 1px solid rgba(20, 48, 45, .09);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .66), transparent 42%),
    var(--card);
  box-shadow: var(--shadow-card), inset 0 1px 0 #fff;
}
.create-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 21px;
}
.card-kicker { font-size: 15.5px; font-weight: 800; letter-spacing: -.01em; }
.ttl-pill {
  flex: none;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--mint);
  color: var(--teal-dark);
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: .01em;
}

.domain-field label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 650;
}
.select-wrap { position: relative; }
.select-wrap select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  padding: 13px 42px 13px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #f5f4ed;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.select-wrap select:hover { border-color: var(--line-strong); }
.select-wrap select:focus {
  outline: 0;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .12);
}
.select-chevron {
  position: absolute;
  right: 14px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  margin: 18px 0 16px;
  padding: 4px;
  border-radius: 13px;
  background: #edede4;
}
.mode-tab {
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  transition: background .18s, color .18s, box-shadow .18s;
}
.mode-tab.is-active {
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(20, 48, 45, .09);
}

.mode-hint {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.address-input {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 11px;
  padding: 3px 11px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.address-input:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .12);
}
.address-input input {
  flex: 0 1 46%;
  min-width: 0;
  padding: 11px 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-family: var(--mono);
  font-size: 13px;
}
.address-input input::placeholder { color: #a6b3ae; }
.at-sign { color: var(--muted); font-size: 13px; }
.domain-echo {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border: 1px solid transparent;
  border-radius: 13px;
  font-size: 13px;
  font-weight: 750;
  letter-spacing: .01em;
  text-decoration: none;
  white-space: nowrap;
  transition: transform .16s, box-shadow .16s, background .16s, opacity .16s;
}
.btn svg { width: 17px; height: 17px; }
.btn-primary {
  background: linear-gradient(135deg, #128077, #0b5d57);
  color: #fff;
  box-shadow: 0 12px 24px -12px rgba(15, 118, 110, .8);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 16px 28px -12px rgba(15, 118, 110, .75);
}
.btn-primary:active:not(:disabled) { transform: translateY(0); }
.btn-primary:disabled { opacity: .55; box-shadow: none; }
.btn-ghost {
  background: #f0f0e8;
  border-color: var(--line);
  color: var(--ink);
}
.btn-ghost:hover { background: #e9e9df; }
.btn-cream {
  background: #f8f3e6;
  color: var(--deep);
  border-color: rgba(255, 255, 255, .18);
  box-shadow: 0 8px 20px -12px rgba(0, 0, 0, .5);
}
.btn-cream:hover { background: #fffaf0; transform: translateY(-1px); }
.btn-glass {
  background: rgba(255, 255, 255, .1);
  border-color: rgba(255, 255, 255, .2);
  color: #f8f3e6;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.btn-glass:hover { background: rgba(255, 255, 255, .17); }
.btn-block { width: 100%; }
.btn-tall { padding: 14px 18px; font-size: 13.5px; }

.link-btn {
  padding: 3px;
  border: 0;
  background: none;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 750;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(15, 118, 110, .35);
}
.link-btn:hover { text-decoration-color: currentColor; }
.link-btn.danger { color: var(--coral-dark); text-decoration-color: rgba(185, 85, 61, .35); }

.fineprint {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin: 14px 0 0;
  color: #87958f;
  font-size: 10.5px;
  line-height: 1.6;
}
.fineprint svg { width: 13px; height: 13px; margin-top: 1px; }

.form-error {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(185, 85, 61, .22);
  border-radius: 10px;
  background: #fdf0ec;
  color: #9c4430;
  font-size: 12px;
  line-height: 1.55;
}
.no-domain {
  margin-top: 12px;
  padding: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

/* ---------- recent ---------- */
.recent-card {
  margin: 0 0 54px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 253, 248, .72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-soft);
}
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.section-head h2 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.section-head p { margin: 0; color: var(--muted); font-size: 12.5px; }
.recent-list { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.recent-item {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 13px;
  background: #fffdf9;
  transition: border-color .15s, background .15s;
}
.recent-item:hover { border-color: var(--line); background: #fff; }
.recent-open {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px;
  border: 0;
  background: none;
  text-align: left;
}
.recent-icon {
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--mint);
  color: var(--teal-dark);
}
.recent-icon svg { width: 18px; height: 18px; }
.recent-main { min-width: 0; flex: 1; }
.recent-address {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}
.recent-expiry { display: block; margin-top: 2px; color: var(--muted); font-size: 10.5px; }
.recent-arrow { width: 16px; height: 16px; color: #9baba5; flex: none; }
.recent-remove {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  margin-right: 5px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #a4b0ab;
}
.recent-remove:hover { background: #f6e9e5; color: var(--coral-dark); }
.recent-remove svg { width: 15px; height: 15px; }

/* ---------- how ---------- */
.how-section { padding-top: 4px; }
.how-section > .section-head { margin-bottom: 17px; }
.how-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
.how-card {
  position: relative;
  overflow: hidden;
  padding: 23px;
  border: 1px solid var(--line);
  border-radius: 21px;
  background: rgba(255, 253, 248, .68);
}
.how-card::after {
  content: "";
  position: absolute;
  right: -30px;
  bottom: -40px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(185, 227, 215, .5), transparent 69%);
}
.step-number {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 6px;
  background: #fbece6;
  color: var(--coral-dark);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
}
.how-card h3 { margin: 16px 0 7px; font-size: 16px; letter-spacing: -.01em; }
.how-card p { position: relative; z-index: 1; margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.75; }

/* ---------- inbox ---------- */
.inbox { animation: fadeUp .4s ease both; }
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 16px;
  padding: 4px 2px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}
.back-link:hover { color: var(--ink); }
.back-link svg { width: 16px; height: 16px; }

.mailbox-card {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 26px;
  padding: 30px;
  border-radius: 28px;
  color: #fbf7ec;
  background:
    radial-gradient(560px 260px at 88% -20%, rgba(242, 193, 78, .22), transparent 70%),
    linear-gradient(120deg, #0b3834 0%, #0e4f49 56%, #0d655c 100%);
  box-shadow: 0 34px 70px -38px rgba(9, 52, 48, .9), inset 0 1px 0 rgba(255, 255, 255, .08);
}
.mailbox-card::before {
  content: "";
  position: absolute;
  top: -80px;
  right: 8%;
  width: 240px;
  height: 240px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 50%;
}
.mailbox-card::after {
  content: "";
  position: absolute;
  right: -45px;
  bottom: -110px;
  width: 250px;
  height: 250px;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 50%;
}
.mailbox-main { position: relative; z-index: 1; min-width: 0; flex: 1; }
.mailbox-deco {
  position: absolute;
  top: 25px;
  right: 32px;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  opacity: .45;
}
.mailbox-deco span { display: block; width: 2px; border-radius: 2px; background: #f2c14e; }
.mailbox-deco span:nth-child(1) { height: 12px; }
.mailbox-deco span:nth-child(2) { height: 21px; opacity: .65; }
.mailbox-deco span:nth-child(3) { height: 8px; opacity: .45; }

.mailbox-kicker {
  margin: 0 0 10px;
  color: rgba(251, 247, 236, .54);
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: .24em;
}
.address-line { display: flex; align-items: center; flex-wrap: wrap; gap: 11px; }
.address-line h1 {
  margin: 0;
  color: #fffdf6;
  font-family: var(--mono);
  font-size: clamp(17px, 3vw, 28px);
  font-weight: 550;
  line-height: 1.35;
  letter-spacing: -.035em;
  word-break: break-all;
}
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 9px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 9px;
  background: rgba(255, 255, 255, .09);
  color: #fbf7ec;
  font-size: 10.5px;
  font-weight: 700;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background .15s;
}
.copy-btn:hover { background: rgba(255, 255, 255, .17); }
.copy-btn svg { width: 14px; height: 14px; }
.mailbox-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }
.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border: 1px solid rgba(255, 255, 255, .11);
  border-radius: 999px;
  background: rgba(255, 255, 255, .07);
  color: rgba(251, 247, 236, .73);
  font-size: 10.5px;
}
.meta-chip svg { width: 12px; height: 12px; opacity: .75; }
.meta-chip b { color: #f6df9d; font-weight: 700; font-variant-numeric: tabular-nums; }
.mailbox-actions {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 7px;
  flex: none;
}
.mailbox-actions .btn { font-size: 12px; padding: 9px 13px; }
.mailbox-actions .btn svg { width: 15px; height: 15px; }
.icon-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f4f3ec;
  color: var(--ink-soft);
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: #eaeae0; color: var(--ink); }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn-glass {
  border-color: rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .08);
  color: rgba(251, 247, 236, .7);
}
.icon-btn-glass:hover { background: rgba(220, 90, 75, .24); color: #ffe9e4; }

.inbox-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 25px 0 11px;
}
.inbox-tabs { display: flex; gap: 3px; padding: 4px; border-radius: 12px; background: #eaeae1; }
.inbox-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.inbox-tab.is-active { background: var(--card); color: var(--ink); box-shadow: 0 2px 7px rgba(20, 48, 45, .08); }
.count-badge {
  min-width: 17px;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--teal);
  color: #fff;
  font-size: 9.5px;
  line-height: 1.5;
  text-align: center;
}
.refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 650;
}
.refresh-btn:hover { background: rgba(255, 253, 248, .8); color: var(--ink); }
.refresh-btn svg { width: 15px; height: 15px; }
.refresh-btn.is-spinning svg { animation: spin .8s linear infinite; }

.message-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  box-shadow: var(--shadow-soft);
}
.message-row {
  position: relative;
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  gap: 12px;
  width: 100%;
  padding: 16px 19px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  transition: background .14s;
}
.message-row:last-child { border-bottom: 0; }
.message-row:hover { background: #faf9f2; }
.message-row.is-unread { background: linear-gradient(90deg, rgba(217, 239, 231, .55), rgba(255, 253, 248, 0) 63%); }
.message-row.is-unread:hover { background: linear-gradient(90deg, rgba(217, 239, 231, .72), rgba(250, 249, 242, .8) 63%); }
.unread-dot { width: 6px; height: 6px; margin-top: 8px; border-radius: 50%; background: transparent; }
.is-unread .unread-dot { background: var(--coral); box-shadow: 0 0 0 3px rgba(224, 122, 95, .11); }
.message-main { min-width: 0; }
.message-topline { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.message-from {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 600;
}
.is-unread .message-from { color: var(--teal-dark); font-weight: 750; }
.message-time { flex: none; color: #93a19c; font-size: 10.5px; font-variant-numeric: tabular-nums; }
.message-subject {
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 550;
}
.is-unread .message-subject { font-weight: 780; }
.message-snippet {
  margin-top: 2px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  color: #86948f;
  font-size: 11.5px;
  line-height: 1.55;
}
.message-side { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; padding-top: 1px; }
.direction-tag {
  padding: 2px 5px;
  border-radius: 4px;
  background: #edf0e9;
  color: #62736d;
  font-size: 9px;
  font-weight: 750;
}
.direction-tag.out { background: #e8eff8; color: #42658a; }
.direction-tag.failed { background: #fbeae7; color: #a14636; }
.attach-mark { display: inline-flex; align-items: center; gap: 3px; color: #96a39e; font-size: 9.5px; }
.attach-mark svg { width: 12px; height: 12px; }

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 44px 16px;
  color: var(--muted);
  font-size: 12px;
}
.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(15, 118, 110, .2);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin .75s linear infinite;
}

.empty-state {
  padding: 46px 22px 40px;
  border: 1px dashed var(--line-strong);
  border-radius: 20px;
  background: rgba(255, 253, 248, .52);
  text-align: center;
}
.empty-illustration { display: flex; justify-content: center; margin-bottom: 12px; }
.empty-illustration svg { width: 150px; height: auto; }
.empty-state h3 { margin: 0 0 7px; font-size: 16px; letter-spacing: -.01em; }
.empty-state p { margin: 0 auto 18px; max-width: 430px; color: var(--muted); font-size: 12px; line-height: 1.75; }
.poll-note { margin: 13px 0 0; color: #9aa8a2; font-size: 10.5px; text-align: center; }

/* ---------- footer ---------- */
.site-footer { padding: 0 24px 34px; }
.footer-inner {
  width: 100%;
  max-width: 1072px;
  margin: 0 auto;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: #93a09b;
  font-size: 10.5px;
}
.footer-brand { display: flex; align-items: center; gap: 9px; }
.footer-brand span:last-child { display: flex; flex-direction: column; }
.footer-brand strong { color: var(--ink-soft); font-size: 12px; }
.footer-brand small { color: #93a09b; font-size: 10px; }

/* ---------- modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(9, 31, 29, .55);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  animation: fadeIn .2s ease both;
}
.modal-panel {
  position: relative;
  z-index: 1;
  width: min(550px, 100%);
  max-height: min(92vh, 880px);
  overflow: auto;
  padding: 25px;
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: 23px;
  background: var(--card);
  box-shadow: 0 40px 100px -30px rgba(0, 0, 0, .55);
  animation: popIn .26s cubic-bezier(.2, .8, .3, 1) both;
  overscroll-behavior: contain;
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 20px; }
.modal-kicker { margin: 0 0 3px; color: var(--coral-dark); font-size: 9px; font-weight: 800; letter-spacing: .24em; }
.modal-head h2 { margin: 0; font-size: 21px; letter-spacing: -.025em; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

.compose-form .field { margin-bottom: 14px; }
.field label {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 700;
}
.field label span { color: #9aa8a2; font-weight: 500; }
.field input,
.field textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fbfaf4;
  color: var(--ink);
  font-size: 13px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.field textarea { resize: vertical; min-height: 130px; line-height: 1.7; }
.field input:focus,
.field textarea:focus {
  outline: 0;
  border-color: var(--teal);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .1);
}
.readonly-address {
  padding: 10px 13px;
  border: 1px dashed var(--line-strong);
  border-radius: 11px;
  background: #f4f5ee;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  word-break: break-all;
}

.modal-panel-wide {
  width: min(860px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}
.message-head {
  flex: none;
  padding: 22px 25px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fffdf8, #fbfaf3);
}
.message-head-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.direction-badge {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 5px;
  background: var(--mint);
  color: var(--teal-dark);
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: .05em;
}
.direction-badge.out { background: #e8eff8; color: #42658a; }
.message-head h2 {
  margin: 0 0 15px;
  max-width: 92%;
  font-size: clamp(19px, 3vw, 25px);
  line-height: 1.4;
  letter-spacing: -.025em;
  overflow-wrap: anywhere;
}
.message-addresses {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr .8fr;
  gap: 12px;
}
.message-addresses div { min-width: 0; }
.message-addresses span { display: block; color: #97a49f; font-size: 9.5px; font-weight: 650; letter-spacing: .04em; }
.message-addresses strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 600;
}
.message-toolbar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 25px;
  border-bottom: 1px solid var(--line);
  background: #fffdf8;
}
.segmented { display: flex; gap: 2px; padding: 3px; border-radius: 8px; background: #ecece3; }
.segmented button {
  padding: 5px 11px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
}
.segmented button.is-active { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(20, 48, 45, .1); }
.segmented button:disabled { opacity: .35; }
.attachments {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 11px 25px;
  border-bottom: 1px solid var(--line);
  background: #fbfaf4;
}
.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 10.5px;
  text-decoration: none;
}
.attachment-chip:hover { border-color: var(--teal); color: var(--teal-dark); }
.attachment-chip svg { width: 13px; height: 13px; color: var(--teal); }
.attachment-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-chip em { color: #97a49f; font-style: normal; flex: none; }

.message-body {
  flex: 1;
  min-height: 240px;
  overflow: auto;
  background: #fff;
  overscroll-behavior: contain;
}
#msg-frame { display: block; width: 100%; min-height: 300px; border: 0; background: #fff; }
.msg-text {
  margin: 0;
  padding: 22px 25px;
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1.8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.msg-fallback { flex: none; padding: 14px 25px; background: #fbfaf4; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.notice {
  flex: none;
  margin: 12px 25px;
  padding: 9px 11px;
  border-radius: 8px;
  background: #fdf1ed;
  color: #9c4430;
  font-size: 11.5px;
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: max(26px, env(safe-area-inset-bottom));
  z-index: 100;
  max-width: min(420px, calc(100vw - 32px));
  padding: 10px 17px;
  border-radius: 999px;
  background: #123c38;
  color: #fbf7ec;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 16px 40px -14px rgba(0, 0, 0, .5);
  opacity: 0;
  transform: translate(-50%, 14px);
  pointer-events: none;
  transition: opacity .22s, transform .22s;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: #7f2f24; }

/* ---------- animation ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- responsive ---------- */
@media (max-width: 940px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr) minmax(340px, .9fr);
    gap: 34px;
  }
  .hero h1 { font-size: clamp(41px, 5.8vw, 56px); }
  .hero-lead { font-size: 14.5px; }
  .create-card { padding: 23px; }
}

@media (max-width: 800px) {
  .page-shell { padding: 8px 20px 72px; }
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 34px;
    min-height: 0;
    padding: 22px 0 48px;
  }
  .hero { max-width: 610px; }
  .hero h1 { font-size: clamp(42px, 10.3vw, 58px); }
  .hero-lead { margin-top: 18px; }
  .hero-note { margin-top: 26px; }
  .create-card { width: 100%; max-width: 590px; margin: 0 auto; }
  .recent-card { margin-bottom: 42px; }
  .how-grid { grid-template-columns: 1fr; gap: 10px; }
  .how-card { padding: 19px 21px; }
  .how-card h3 { margin-top: 11px; }
  .mailbox-card { flex-direction: column; align-items: stretch; gap: 20px; padding: 25px; }
  .mailbox-actions { justify-content: flex-start; }
  .mailbox-deco { top: 22px; right: 24px; }
}

@media (max-width: 600px) {
  .site-header { padding: 16px 16px 12px; }
  .brand-mark { width: 39px; height: 39px; border-radius: 12px; }
  .brand-mark svg { width: 23px; height: 23px; }
  .brand-text strong { font-size: 15.5px; }
  .brand-text small { font-size: 9px; }
  .header-status { padding: 7px 10px; font-size: 10px; }
  .page-shell { padding: 6px 16px 64px; }
  .hero-grid { gap: 28px; padding-top: 16px; }
  .eyebrow { margin-bottom: 16px; font-size: 9.5px; }
  .hero h1 { font-size: clamp(38px, 11.6vw, 52px); letter-spacing: -.05em; }
  .hero h1 em::after { bottom: 4px; height: 12px; }
  .hero-lead { font-size: 13.5px; line-height: 1.8; }
  .feature-list { gap: 8px 14px; margin-top: 20px; }
  .feature-list li { font-size: 11.5px; }
  .hero-note { margin-top: 22px; font-size: 10.5px; }
  .create-card { padding: 21px 19px; border-radius: 23px; }
  .create-card::before, .create-card::after { display: none; }
  .create-head { margin-bottom: 17px; }
  .card-kicker { font-size: 14.5px; }
  .mode-tabs { margin: 15px 0 13px; }
  .address-input input { flex: 1; font-size: 12.5px; }
  .domain-echo { flex: 1.1; font-size: 10.5px; }
  .section-head h2 { font-size: 16.5px; }
  .recent-card { padding: 16px; border-radius: 18px; }
  .recent-address { font-size: 11px; }
  .how-card { border-radius: 17px; }
  .back-link { margin-bottom: 10px; }
  .mailbox-card { padding: 22px 18px; border-radius: 23px; gap: 17px; }
  .address-line h1 { font-size: clamp(15px, 4.4vw, 20px); }
  .copy-btn span { display: none; }
  .copy-btn { padding: 7px; border-radius: 8px; }
  .mailbox-meta { gap: 5px; margin-top: 13px; }
  .meta-chip { font-size: 9.5px; padding: 4px 7px; }
  .mailbox-actions { gap: 6px; }
  .mailbox-actions .btn { flex: 1; }
  .mailbox-actions .icon-btn { flex: none; }
  .inbox-toolbar { margin-top: 19px; }
  .inbox-tab { padding: 6px 10px; font-size: 11px; }
  .refresh-btn span { display: none; }
  .refresh-btn { padding: 7px; }
  .message-row { padding: 14px 14px; grid-template-columns: 7px minmax(0, 1fr) auto; gap: 9px; }
  .message-subject { font-size: 12.5px; }
  .message-from { font-size: 11.5px; }
  .message-time { font-size: 9.5px; }
  .message-snippet { font-size: 10.5px; }
  .empty-state { padding: 32px 16px 28px; }
  .empty-illustration svg { width: 120px; }
  .empty-state h3 { font-size: 14.5px; }
  .empty-state p { font-size: 11px; }
  .site-footer { padding: 0 16px calc(24px + env(safe-area-inset-bottom)); }
  .footer-inner { align-items: flex-start; flex-direction: column; gap: 10px; }
  .modal { padding: 0; align-items: end; }
  .modal-panel { width: 100%; max-height: 94dvh; border-radius: 22px 22px 0 0; padding: 21px 18px; border-bottom: 0; }
  .modal-panel-wide { max-height: 96dvh; height: 96dvh; border-radius: 18px 18px 0 0; }
  .message-head { padding: 18px 17px 13px; }
  .message-head h2 { max-width: 100%; font-size: 18px; margin-bottom: 12px; }
  .message-addresses { grid-template-columns: 1fr 1fr; gap: 8px; }
  .message-addresses div:last-child { grid-column: 1 / -1; }
  .message-toolbar { padding: 9px 17px; }
  .attachments { padding: 9px 17px; }
  .msg-text { padding: 18px; font-size: 12.5px; }
  .modal-actions .btn { flex: 1; }
  .field input, .field textarea { font-size: 16px; }
  .toast { bottom: calc(18px + env(safe-area-inset-bottom)); }
}

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