:root {
  --bg: #07070a;
  --panel: #120a0d;
  --panel-2: #1a0b10;
  --text: #f4f1f2;
  --muted: #a8969b;
  --line: rgba(229, 9, 20, .55);
  --line-soft: rgba(229, 9, 20, .22);
  --red: #e50914;
  --red-hot: #ff2a3a;
  --red-deep: #5a0710;
  --good: #59e08a;
  --bad: #ff5f6d;
  --glow: 0 0 18px rgba(229, 9, 20, .55), 0 0 42px rgba(229, 9, 20, .25);
  --display: "Bebas Neue", Impact, "Arial Narrow", sans-serif;
  --body: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--text);
  font: 15px/1.6 var(--body);
  background:
    radial-gradient(900px 520px at 85% -10%, rgba(229, 9, 20, .35), transparent 65%),
    radial-gradient(700px 500px at -10% 45%, rgba(140, 5, 20, .28), transparent 70%),
    radial-gradient(800px 500px at 110% 95%, rgba(120, 4, 16, .3), transparent 70%),
    linear-gradient(180deg, #170609 0%, var(--bg) 38%, #0b0507 100%);
  background-attachment: fixed;
}
body::before {
  /* faint scanline grain for the cinematic feel */
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .018) 0 1px, transparent 1px 3px);
  z-index: 0;
}
header, main, footer { position: relative; z-index: 1; }
.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 16px; }
main.wrap { flex: 1; padding-top: 28px; padding-bottom: 56px; }

/* ---------- header ---------- */
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 76px; }
.brand {
  font: 2.1rem/1 var(--display);
  letter-spacing: .04em;
  color: var(--red);
  text-transform: uppercase;
  text-decoration: none;
  text-shadow: 0 0 22px rgba(229, 9, 20, .45);
}
.top-right { display: flex; align-items: center; gap: 14px; }
.who { color: var(--muted); font-size: .85rem; display: flex; align-items: center; gap: 6px; }
.who::before {
  content: "";
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 10px var(--good);
}

/* ---------- type ---------- */
h1, h2 { font-family: var(--display); font-weight: 400; letter-spacing: .03em; margin: 0; line-height: 1.05; }
h1 { font-size: clamp(2.4rem, 6vw, 3.6rem); }
h2 { font-size: 1.9rem; margin-bottom: 14px; }
.eyebrow { font-weight: 600; letter-spacing: .02em; font-size: 1.05rem; }
.meta { display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: 1rem; margin: 6px 0 14px; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.mono { font-family: ui-monospace, Consolas, monospace; }
.big { font-size: 1.15rem; font-weight: 700; letter-spacing: .12em; }

/* ---------- glow divider ---------- */
.glow-line {
  height: 2px;
  width: min(560px, 80%);
  margin: 34px auto;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--red-hot), transparent);
  box-shadow: 0 0 14px 2px rgba(229, 9, 20, .6), 0 0 40px 10px rgba(229, 9, 20, .18);
}

/* ---------- buttons ---------- */
.btn {
  font: 600 .9rem/1 var(--body);
  color: var(--text);
  background: transparent;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 10px 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: box-shadow .2s, border-color .2s, background .2s;
}
.btn:hover, .btn:focus-visible { border-color: var(--red-hot); box-shadow: var(--glow); outline: none; }
.btn.primary {
  background: var(--red);
  border-color: var(--red);
  border-radius: 2px;
  font: 1.35rem/1 var(--display);
  letter-spacing: .18em;
  padding: 12px 26px;
}
.btn.primary::after { content: ""; border-left: 10px solid currentColor; border-block: 7px solid transparent; }
.btn.primary:hover { background: var(--red-hot); }
.btn.small { padding: 6px 13px; font-size: .8rem; }
.btn.danger { color: var(--bad); }
.btn.ghost { border-color: rgba(255, 255, 255, .25); }

/* ---------- forms ---------- */
input, select, textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: rgba(0, 0, 0, .45);
  border: 1.5px solid var(--line-soft);
  border-radius: 4px;
  padding: 11px 13px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--red-hot); box-shadow: var(--glow); }
select option { background: #160a0d; }
textarea { resize: vertical; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .9rem; }
label .muted { font-weight: 400; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.grid-form { display: grid; grid-template-columns: 1.4fr 1.6fr 1fr .7fr auto; gap: 14px; align-items: end; }
.mailbox-form { grid-template-columns: 1.5fr 1.3fr 1fr 1fr auto; }
.tab-panel[hidden] { display: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

/* ---------- generate-code window ---------- */
.wizard {
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 22px 24px 24px;
  color: var(--text);
  background: linear-gradient(160deg, #2a060d, #0d0507 70%);
  border: 1.5px solid var(--red-hot);
  border-radius: 6px;
  box-shadow: var(--glow), 0 30px 80px rgba(0, 0, 0, .7);
}
.wizard::backdrop { background: rgba(4, 2, 3, .78); backdrop-filter: blur(3px); }
.wizard h2 { margin: 6px 0 4px; }
.wizard input[name="label"] { margin: 12px 0 4px; font-size: 1.05rem; }
.wiz-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.wiz-close {
  background: none; border: 0; color: var(--muted); font-size: 1.8rem; line-height: 1;
  cursor: pointer; padding: 0 4px;
}
.wiz-close:hover { color: var(--text); }
.wiz-steps { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; font-size: .8rem; }
.wiz-steps li { color: var(--muted); display: flex; align-items: center; gap: 6px; }
.wiz-steps li + li::before { content: ""; width: 18px; height: 1px; background: var(--line-soft); }
.wiz-steps li.on { color: var(--red-hot); font-weight: 600; }
.wiz-steps li.done { color: var(--text); }
.wiz-picked { margin: 0; min-height: 1.2em; }
.choice-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.choice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.choice {
  font: inherit;
  color: var(--text);
  text-align: left;
  background: rgba(0, 0, 0, .35);
  border: 1.5px solid var(--line-soft);
  border-radius: 4px;
  padding: 13px 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.choice-grid .choice { text-align: center; align-items: center; padding: 16px 8px; }
.choice:hover, .choice:focus-visible, .choice.picked {
  outline: none;
  border-color: var(--red-hot);
  background: rgba(229, 9, 20, .14);
  box-shadow: var(--glow);
}
.choice:disabled:not(.picked) { opacity: .4; }
.wiz-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.wiz-actions .btn.primary { font-size: 1.1rem; padding: 10px 20px; }
.result-code {
  font: clamp(3.4rem, 14vw, 5rem)/1 var(--display);
  letter-spacing: .2em;
  text-align: center;
  margin: 18px 0 6px;
  text-shadow: 0 0 28px rgba(255, 60, 70, .6);
}
.result-message { margin-top: 14px; font-size: .85rem; resize: none; }
.result-to { font-size: clamp(1.3rem, 5vw, 1.7rem); overflow-wrap: anywhere; }
.wiz-error { color: var(--bad); margin: 6px 0 0; }
.chapter-to { margin: -8px 0 14px; overflow-wrap: anywhere; }
@media (max-width: 480px) { .choice-grid { grid-template-columns: repeat(2, 1fr); } }
.admin-head .tabs a { padding: 8px 16px; }
.grid-form label { white-space: nowrap; }
.grid-form label .muted { white-space: normal; }
h2.sub { font-size: 1.4rem; margin: 26px 0 12px; }
.inline-select { width: auto; max-width: 220px; padding: 5px 8px; font-size: .82rem; }
.mb-filters {
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  padding: 10px 14px;
}
.mb-filters[open] { display: flex; flex-direction: column; gap: 12px; padding-bottom: 14px; }
.mb-filters summary { cursor: pointer; font-weight: 600; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.mb-filters summary::before { content: "▸"; color: var(--red-hot); }
.mb-filters[open] summary::before { content: "▾"; }
.mb-filters summary::-webkit-details-marker { display: none; }
.preview-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.preview-controls select { width: auto; min-width: 200px; }
code { font-family: ui-monospace, Consolas, monospace; font-size: .9em; }

/* ---------- framed panel (neon offset frame like the chapter cards) ---------- */
.card {
  position: relative;
  background: linear-gradient(160deg, rgba(40, 6, 12, .85), rgba(10, 5, 7, .9));
  border: 1.5px solid var(--line);
  border-radius: 4px;
  padding: 24px;
  margin: 28px 0;
  box-shadow: inset 0 0 40px rgba(229, 9, 20, .08);
}
.card::before {
  content: "";
  position: absolute;
  inset: -12px 12px 12px -12px;
  border: 1.5px solid var(--line-soft);
  border-radius: 4px;
  pointer-events: none;
}

/* ---------- login hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 32px;
  align-items: center;
  min-height: 62vh;
}
.hero p.lead { max-width: 30em; margin: 0 0 22px; }
.code-form { display: flex; flex-direction: column; gap: 14px; max-width: 340px; }
.code-input {
  text-align: center;
  font: 2.6rem/1 var(--display);
  letter-spacing: .6em;
  padding: 12px 0 10px .6em;
  border-color: var(--line);
}
.code-form .btn.primary { align-self: flex-start; }
.title-art {
  position: relative;
  text-align: center;
  font: clamp(4rem, 11vw, 7.5rem)/.86 var(--display);
  text-transform: uppercase;
  color: transparent;
  -webkit-text-stroke: 2px var(--red);
  text-shadow: 0 0 30px rgba(229, 9, 20, .45);
  letter-spacing: .02em;
  user-select: none;
}
.title-art span { display: block; }
.title-art span:first-child { color: rgba(229, 9, 20, .14); }

/* ---------- inbox ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.status { margin: 10px 0 0; font-size: .85rem; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 56px 12px; }
.empty strong { display: block; font: 2rem/1 var(--display); color: var(--text); letter-spacing: .04em; margin-bottom: 8px; }

.chapter {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 32px;
  align-items: center;
}
.chapter.flip .chapter-info { order: 2; text-align: right; }
.chapter.flip .chapter-info .chapter-head { flex-direction: row-reverse; }
.chapter-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.chapter-label { font-weight: 600; font-size: 1.05rem; }
.chapter-num { font: 4.2rem/1 var(--display); letter-spacing: .02em; }
.chapter-from { font-weight: 600; overflow-wrap: anywhere; }
.chapter-from .muted { font-weight: 400; }
.chapter-subject { margin: 4px 0 14px; overflow-wrap: anywhere; }
.tabs {
  display: inline-flex;
  border: 1.5px solid var(--line);
  border-radius: 2px;
  font-size: .82rem;
}
.tabs > * { padding: 6px 12px; color: var(--text); text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer; }
.tabs > .on { color: var(--red-hot); font-weight: 600; }

.screen {
  position: relative;
  min-height: 190px;
  padding: 22px;
  border-radius: 4px;
  background:
    radial-gradient(120% 90% at 20% 0%, rgba(255, 42, 58, .55), transparent 60%),
    linear-gradient(135deg, #3a040b 0%, #120306 70%);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .55), inset 0 0 0 1px rgba(255, 255, 255, .06);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
}
.screen::before {
  /* offset neon frame behind the "screen" */
  content: "";
  position: absolute;
  inset: -16px 16px 16px -16px;
  border: 1.5px solid var(--line);
  border-radius: 4px;
  z-index: -1;
}
.chapter.flip .screen::before { inset: -16px -16px 16px 16px; }
.screen-top { display: flex; justify-content: space-between; gap: 12px; font-size: .85rem; }
.screen-top .tag { font: 1.05rem/1 var(--display); letter-spacing: .12em; color: var(--red-hot); }
.code {
  font: clamp(3rem, 8vw, 4.6rem)/1 var(--display);
  letter-spacing: .14em;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .5), 0 0 28px rgba(255, 60, 70, .55);
  overflow-wrap: anywhere;
}
.code.none { font: 600 1rem/1.4 var(--body); letter-spacing: 0; text-shadow: none; color: var(--muted); }
.screen-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.screen .btn { background: rgba(0, 0, 0, .35); border-color: rgba(255, 90, 100, .8); box-shadow: 0 0 12px rgba(229, 9, 20, .4); }

.mail-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: .85rem/1.55 var(--body);
  background: rgba(0, 0, 0, .55);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  padding: 14px;
  margin: 16px 0 0;
  max-height: 360px;
  overflow: auto;
}
.hidden-mail { opacity: .45; filter: grayscale(.6); }

/* ---------- flash + pills ---------- */
.flash {
  padding: 11px 16px;
  margin-bottom: 14px;
  border-left: 3px solid var(--red);
  background: rgba(229, 9, 20, .12);
}
.flash.error { color: #ffc2c7; }
.flash.ok { border-color: var(--good); background: rgba(89, 224, 138, .1); color: #c8f7d8; font-weight: 600; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .74rem; font-weight: 600; border: 1px solid currentColor; }
.pill.good { color: var(--good); }
.pill.bad { color: var(--bad); }

/* ---------- admin ---------- */
.admin-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid rgba(229, 9, 20, .18); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; text-transform: uppercase; font-size: .72rem; letter-spacing: .08em; }
tbody tr:hover { background: rgba(229, 9, 20, .06); }
tr.dim td { opacity: .5; }
.actions { display: flex; gap: 6px; }
.actions form { margin: 0; }
.preview-list { display: flex; flex-direction: column; gap: 46px; margin-top: 26px; }

/* ---------- footer ---------- */
.foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 22px 16px 30px;
  color: var(--muted);
  font-size: .8rem;
}
.foot-links { display: flex; gap: 22px; flex-wrap: wrap; }
.badge {
  color: var(--text);
  border: 1.5px solid var(--red-hot);
  border-radius: 6px;
  padding: 6px 12px;
  box-shadow: var(--glow);
}

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .hero, .chapter { grid-template-columns: 1fr; }
  .hero { min-height: 0; gap: 8px; }
  .title-art { order: -1; font-size: 4rem; margin: 10px 0 8px; }
  .chapter.flip .chapter-info { order: 0; text-align: left; }
  .chapter.flip .chapter-info .chapter-head { flex-direction: row; }
  .chapter { gap: 26px; }
  .screen::before, .chapter.flip .screen::before { inset: -10px 10px 10px -10px; }
  .card::before { inset: -8px 8px 8px -8px; }
  .grid-form { grid-template-columns: 1fr; }
  .brand { font-size: 1.7rem; }
  .who { display: none; }
}

/* link emails (password reset, verify, sign-in) */
.link-title {
  font: clamp(1.8rem, 5vw, 2.6rem)/1.05 var(--display);
  letter-spacing: .06em;
  text-shadow: 0 0 22px rgba(255, 60, 70, .5);
  overflow-wrap: anywhere;
}
.link-host { margin-top: -10px; }
a.btn { text-decoration: none; }
