:root {
  --ink: #101312;
  --paper: #f4f0e5;
  --card: #fffdf7;
  --line: rgba(16, 19, 18, 0.17);
  --muted: #68716d;
  --signal: #ff4c35;
  --acid: #d2ff54;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 92% 5%, rgba(255, 76, 53, 0.22), transparent 28rem),
    linear-gradient(rgba(16,19,18,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16,19,18,.04) 1px, transparent 1px),
    var(--paper);
  background-size: auto, 2rem 2rem, 2rem 2rem, auto;
  font-family: "Bahnschrift", "Trebuchet MS", sans-serif;
}
button, input, select { font: inherit; }
button, input, select { min-height: 3rem; }
button { border: 0; cursor: pointer; touch-action: manipulation; }
main { width: min(76rem, calc(100% - 1.25rem)); margin: 0 auto; padding: 1.5rem 0 2rem; }
header { position: relative; padding: 2rem .25rem 3rem; }
.kicker, .number { color: var(--signal); font-size: .875rem; font-weight: 900; letter-spacing: .2em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 1rem; font: 500 clamp(4.5rem, 22vw, 8rem)/.82 Georgia, serif; letter-spacing: -.075em; }
h1 span { color: var(--signal); }
.intro { max-width: 38rem; color: var(--muted); line-height: 1.55; }
.health { display: flex; align-items: center; gap: .65rem; width: max-content; padding: .8rem 1rem; color: #fff; background: var(--ink); border-radius: .8rem; }
.health i { width: .7rem; height: .7rem; background: var(--acid); border-radius: 50%; box-shadow: 0 0 0 .4rem rgba(210,255,84,.13); }
.panel { display: grid; gap: 1.25rem; margin-bottom: 1rem; padding: 1.25rem; background: rgba(255,253,247,.92); border: 1px solid var(--line); border-radius: 1.25rem; box-shadow: 0 1.5rem 4rem rgba(32,28,20,.12); }
.panel-title h2 { margin-bottom: .45rem; font: 500 2rem/1 Georgia, serif; }
.panel-title p { color: var(--muted); line-height: 1.5; }
.form-grid { display: grid; gap: .85rem; }
label span { display: block; margin-bottom: .4rem; color: var(--muted); font-size: .875rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
input, select { width: 100%; padding: .7rem .8rem; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: .65rem; outline: none; }
input:focus, select:focus { border-color: var(--signal); box-shadow: 0 0 0 .25rem rgba(255,76,53,.1); }
form button, .modal button, .mailbar button { padding: .75rem 1rem; color: #fff; background: var(--ink); border-radius: .65rem; font-weight: 900; }
button.secondary { color: var(--ink); background: #e6e0d2; }
.mailbox { overflow: hidden; margin-top: 1rem; background: var(--card); border: 1px solid var(--line); border-radius: 1.25rem; box-shadow: 0 1.5rem 4rem rgba(32,28,20,.12); }
.mailbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem; color: #fff; background: var(--ink); }
.mailbar span, .mailbar strong, .mailbar small { display: block; }
.mailbar span { color: var(--acid); font-size: .875rem; font-weight: 900; letter-spacing: .15em; }
.mailbar strong { margin: .25rem 0; overflow-wrap: anywhere; }
.mailbar small { color: #aab4af; }
.mailbar button { color: var(--ink); background: var(--acid); }
.mailgrid { display: grid; min-height: 28rem; }
.message-list { border-bottom: 1px solid var(--line); }
.message-item { width: 100%; padding: 1rem; text-align: left; background: transparent; border-bottom: 1px solid var(--line); }
.message-item:hover, .message-item.active { background: var(--paper); }
.message-item strong, .message-item span { display: block; }
.message-item span { margin-top: .35rem; color: var(--muted); font-size: .875rem; }
.message-view { min-width: 0; padding: 1rem; overflow-wrap: anywhere; }
.message-view h2 { font: 500 1.7rem/1.1 Georgia, serif; }
.message-view .meta { color: var(--muted); }
.message-view pre { max-height: 28rem; padding: 1rem; overflow: auto; white-space: pre-wrap; background: var(--paper); border-radius: .7rem; font: .875rem/1.55 Consolas, monospace; }
.empty { padding: 1rem; color: var(--muted); }
footer { padding: 1.5rem .25rem 0; color: var(--muted); font-size: .875rem; }
.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 1rem; background: rgba(16,19,18,.76); }
.modal[hidden] { display: none; }
.modal-card { width: min(34rem, 100%); padding: 1.5rem; background: var(--card); border-radius: 1rem; box-shadow: 0 2rem 6rem rgba(0,0,0,.35); }
.modal-card h2 { overflow-wrap: anywhere; font: 500 1.7rem/1.1 Georgia, serif; }
.modal-card code { display: block; margin: 1rem 0; padding: 1rem; overflow-wrap: anywhere; background: var(--paper); border-radius: .65rem; }
.modal-card button { width: 100%; margin-top: .6rem; }
.toast { position: fixed; right: 1rem; bottom: 1rem; z-index: 30; max-width: calc(100% - 2rem); padding: .85rem 1rem; color: #fff; background: var(--ink); border-radius: .65rem; opacity: 0; transform: translateY(.75rem); transition: 180ms ease; pointer-events: none; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (min-width: 768px) {
  main { width: min(76rem, calc(100% - 2.5rem)); padding-top: 2.5rem; }
  header { padding: 3rem .25rem 4rem; }
  h1 { font-size: clamp(6rem, 14vw, 11rem); }
  .health { position: absolute; right: .25rem; bottom: 4rem; }
  .panel { grid-template-columns: 4rem minmax(15rem, .7fr) minmax(28rem, 1.3fr); align-items: start; padding: 1.75rem; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-grid button { align-self: end; }
  .wide { grid-column: 1 / -1; }
  .mailgrid { grid-template-columns: minmax(15rem, .72fr) minmax(24rem, 1.28fr); }
  .message-list { border-right: 1px solid var(--line); border-bottom: 0; }
  .message-view { padding: 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; }
}
