:root {
  --bg: #eef2f8;
  --card: #ffffff;
  --text: #0e1526;
  --muted: #5f6b82;
  --border: #d8dfeb;
  --accent: #0b6fa4;
  --accent-text: #ffffff;
  --build: #c77a12;
  --track: #dde4ef;
  --danger: #c0392b;
  --display: "Unbounded", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b111e;
    --card: #121a2b;
    --text: #e6ebf5;
    --muted: #8a96ad;
    --border: #212b40;
    --accent: #6cc8f5;
    --accent-text: #04121c;
    --build: #f2b25c;
    --track: #1c2538;
    --danger: #ff8a7a;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "Golos Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.page { max-width: 1040px; margin: 0 auto; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

.credit { font-size: 13px; }
.credit a { color: inherit; }
.credit a:hover { color: var(--accent); }
.footer { padding: 24px 16px 32px; text-align: center; }
/* with a mailbox the inbox fills the screen, so the credit sits in the left column instead */
body:has(#mailbox:not(.hidden)) .footer { display: none; }
.side-credit { padding-top: 6px; text-align: center; }

.btn {
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger:hover { color: var(--danger); }
.btn.big { padding: 13px 26px; font-size: 16px; }
.btn.small { padding: 5px 11px; font-size: 13px; border-radius: 8px; }
.btn.wide { width: 100%; }
a.btn { text-decoration: none; display: inline-block; }

.provider-select, .extend-select {
  font: inherit;
  font-size: 14px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  max-width: 100%;
}
.provider-select:focus-visible, .extend-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.provider-select.small, .extend-select.small { padding: 5px 8px; font-size: 13px; border-radius: 8px; }
.create-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; align-items: center; }
.create-row .provider-select { padding: 13px 14px; font-size: 15px; }
.via { font-size: 13px; text-align: center; }

.status {
  margin: 16px 16px 0;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--danger);
  color: var(--danger);
  background: var(--card);
}

/* the ring: an empty dashed one before there's a mailbox, filling with the
   registration steps, then draining over the mailbox's 15 minutes */
.ring { position: relative; width: 220px; max-width: 100%; aspect-ratio: 1; flex: none; }
.ring svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.ring-track { fill: none; stroke: var(--track); stroke-width: 10; }
.ring-track.idle { stroke: var(--muted); stroke-width: 6; stroke-dasharray: 3 9; opacity: .5; }
.ring-arc { fill: none; stroke: var(--accent); stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.ring-arc.build { stroke: var(--build); transition: stroke-dashoffset .6s ease; }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-value { font-family: var(--display); font-weight: 600; font-size: 42px; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ring-value.long { font-size: 32px; }
.ring-label { margin-top: 8px; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .12em; }

.solo {
  max-width: 520px;
  margin: 0 auto;
  padding: 56px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}
.solo h1 { font-family: var(--display); font-weight: 600; font-size: 26px; line-height: 1.2; margin: 10px 0 0; text-wrap: balance; }
.solo h2 { font-size: 20px; margin: 6px 0 0; }
.solo p { margin: 0; max-width: 42ch; }

.steps { list-style: none; margin: 10px 0 0; padding: 0; display: flex; gap: 6px; }
.steps li { width: 30px; height: 4px; border-radius: 2px; background: var(--track); transition: background .3s; }
.steps li.done { background: var(--accent); }
.steps li.active { background: var(--build); }
.elapsed { font-size: 13px; font-variant-numeric: tabular-nums; }

.grid { display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: 100vh; }

.side {
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  border-right: 1px solid var(--border);
}
.caption { margin-top: 6px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .12em; }
.address {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 500;
  text-align: center;
  overflow-wrap: anywhere;
  user-select: all;
}
.side-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.extend-row { display: flex; gap: 6px; justify-content: center; align-items: center; }

.main { padding: 28px; min-width: 0; }
.inbox { display: flex; flex-direction: column; gap: 12px; }
.inbox-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.inbox-head h2, .reader-subject { margin: 0; }
.inbox-head h2 { font-family: var(--display); font-size: 20px; font-weight: 600; }
.inbox-head .muted { font-size: 14px; }

.waiting { padding: 64px 0; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.waiting b { font-size: 18px; }
.radar { position: relative; width: 64px; height: 64px; margin-bottom: 8px; }
.radar::before, .radar::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--accent);
  animation: ping 2s ease-out infinite;
}
.radar::after { animation-delay: 1s; }

.messages { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.messages li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
}
.messages li:hover { border-color: var(--muted); }
.messages li.unread { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
.msg-main { min-width: 0; }
.msg-top { display: flex; gap: 8px; align-items: baseline; font-weight: 600; }
.msg-from { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-time { flex: none; color: var(--muted); font-size: 13px; font-weight: 400; font-variant-numeric: tabular-nums; }
.msg-new {
  flex: none;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
}
.msg-subject, .msg-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-preview { color: var(--muted); font-size: 13px; }

/* the code / action link found in a letter: next to it in the list, above it in the reader */
.verify { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.verify-code { font-family: var(--display); font-weight: 600; font-size: 22px; letter-spacing: .04em; font-variant-numeric: tabular-nums; user-select: all; }
.messages .verify { flex-direction: column; align-items: flex-end; gap: 6px; }
.reader-verify { gap: 10px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--card); }
.reader-verify .verify-code { font-size: 26px; margin-right: 6px; }

.reader { display: flex; flex-direction: column; gap: 14px; }
.reader-subject { font-size: 20px; line-height: 1.3; overflow-wrap: anywhere; text-wrap: balance; }
.images-note { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.reader-html { width: 100%; height: 65vh; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.reader-text {
  margin: 0;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  font: inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.attachments { margin: 0; padding-left: 18px; color: var(--muted); }
.attachments:empty { display: none; }

@keyframes ping { from { transform: scale(.3); opacity: 1; } to { transform: scale(1); opacity: 0; } }

@media (max-width: 720px) {
  .grid { grid-template-columns: 1fr; min-height: 0; }
  .side {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    align-items: center;
    gap: 12px 16px;
    padding: 20px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .side .ring { width: 120px; grid-row: span 2; }
  .side .ring-value { font-size: 24px; }
  .side .ring-value.long { font-size: 18px; }
  .side .ring-label { margin-top: 4px; font-size: 10px; }
  .side .ring-track, .side .ring-arc { stroke-width: 12; }
  .caption { display: none; }
  .address { font-size: 14px; text-align: left; }
  .side-actions, .extend-row { grid-column: 1 / -1; justify-content: flex-start; }
  .side-credit { grid-column: 1 / -1; padding-top: 0; text-align: left; }
  .main { padding: 20px 16px; }
  .messages li { grid-template-columns: 1fr; }
  .messages .verify { flex-direction: row; align-items: center; }
  .solo { padding: 32px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .ring-arc, .steps li { transition: none; }
  .radar::before, .radar::after { animation: none; }
}
