:root {
  --bg: #0f1117;
  --surface: #181b24;
  --surface-2: #20242f;
  --border: #2c313d;
  --text: #e7e9ee;
  --text-dim: #9aa1b1;
  --accent: #5b8cff;
  --accent-hover: #4577f0;
  --danger: #ff5b6e;
  --ok: #43d18a;
  --radius: 10px;
  --wrap: 760px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-2: #eef1f7;
    --border: #d7dce6;
    --text: #1a1d26;
    --text-dim: #5b6273;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
}

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--accent); color: #fff;
  padding: 8px 14px; z-index: 100; border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

/* Focus visibility for keyboard users */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.site-header { border-bottom: 1px solid var(--border); background: var(--surface); }
.header-inner { padding: 20px 16px; }
.brand { margin: 0; font-size: 1.5rem; display: flex; align-items: center; gap: 8px; }
.brand-mark { color: var(--accent); }
.tagline { margin: 4px 0 0; color: var(--text-dim); font-size: 0.95rem; }

.address-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin: 24px 0;
}

.address-row { display: flex; gap: 8px; }
.address-input {
  flex: 1; min-width: 0;
  font-size: 1.1rem; font-family: ui-monospace, "SF Mono", Menlo, monospace;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
}

.address-meta {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 14px; gap: 12px; flex-wrap: wrap;
}
.expiry { margin: 0; color: var(--text-dim); font-size: 0.9rem; }
.expiry.expiring { color: var(--danger); font-weight: 600; }
.address-actions { display: flex; gap: 8px; }

.btn {
  font: inherit; font-size: 0.95rem; cursor: pointer;
  padding: 10px 16px; border-radius: var(--radius);
  border: 1px solid transparent; transition: background 0.15s, border-color 0.15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn.copied { background: var(--ok); border-color: var(--ok); color: #04110a; }

.inbox-bar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.inbox-bar h2 { margin: 0; font-size: 1.2rem; }
.inbox-bar-actions { display: flex; align-items: center; gap: 10px; }
.refresh-status { color: var(--text-dim); font-size: 0.85rem; }

.message-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.message-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px; cursor: pointer;
  display: flex; flex-direction: column; gap: 4px;
  text-align: left; width: 100%; color: inherit; font: inherit;
}
.message-item:hover { background: var(--surface-2); }
.message-item.unseen { border-left: 3px solid var(--accent); }
.message-top { display: flex; justify-content: space-between; gap: 12px; }
.message-from { font-weight: 600; }
.message-time { color: var(--text-dim); font-size: 0.82rem; white-space: nowrap; }
.message-subject { color: var(--text); }
.message-preview { color: var(--text-dim); font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-state { color: var(--text-dim); text-align: center; padding: 32px 0; }

.viewer { border: none; border-radius: var(--radius); padding: 0; max-width: 720px; width: 92%; background: var(--surface); color: var(--text); }
.viewer::backdrop { background: rgba(0,0,0,0.6); }
.viewer-inner { padding: 20px; }
.viewer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.viewer-subject { margin: 0; font-size: 1.25rem; }
.viewer-meta { margin: 12px 0; display: flex; flex-direction: column; gap: 4px; }
.viewer-meta div { display: flex; gap: 8px; }
.viewer-meta dt { color: var(--text-dim); min-width: 70px; margin: 0; }
.viewer-meta dd { margin: 0; }
.viewer-tabs { display: flex; gap: 4px; margin: 12px 0; border-bottom: 1px solid var(--border); }
.tab { background: none; border: none; color: var(--text-dim); padding: 8px 14px; cursor: pointer; font: inherit; border-bottom: 2px solid transparent; }
.tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.viewer-text { white-space: pre-wrap; word-break: break-word; background: var(--surface-2); padding: 14px; border-radius: var(--radius); max-height: 50vh; overflow: auto; margin: 0; font-family: ui-monospace, Menlo, monospace; font-size: 0.9rem; }
.viewer-html { width: 100%; height: 50vh; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
.viewer-foot { margin-top: 16px; display: flex; justify-content: flex-end; }

.site-footer { border-top: 1px solid var(--border); margin-top: 40px; padding: 20px 0; }
.site-footer p { color: var(--text-dim); font-size: 0.85rem; margin: 0; }

@media (max-width: 520px) {
  .address-row { flex-direction: column; }
  .message-time { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ------------------------------------------------------------------ *
 * Status banner, dead-address styling and custom-address picker.
 * Appended so the original rules above stay untouched.
 * ------------------------------------------------------------------ */

.address-actions { flex-wrap: wrap; }

.address-input.is-dead {
  color: var(--danger);
  border-color: var(--danger);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.address-hint {
  margin: 14px 0 0;
  color: var(--text-dim);
  font-size: 0.82rem;
  line-height: 1.45;
}
.address-hint em { color: var(--text); font-style: normal; font-weight: 600; }

.notice {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 12px 14px;
  margin-bottom: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 0.9rem;
}
.notice[hidden] { display: none; }
.notice-text { flex: 1; min-width: 200px; }
.notice[data-kind="info"] { border-color: var(--accent); }
.notice[data-kind="warn"] {
  border-color: #c99a2e;
  background: rgba(201, 154, 46, 0.12);
}
.notice[data-kind="dead"] {
  border-color: var(--danger);
  background: rgba(255, 91, 110, 0.12);
}
.notice[data-kind="dead"] .notice-text { font-weight: 500; }

.custom-form {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 14px;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.custom-form[hidden] { display: none; }
.custom-input {
  flex: 1; min-width: 120px;
  font: inherit; font-size: 0.95rem;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
}
.custom-domain {
  color: var(--text-dim);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.95rem;
}
