/* Misrule web. Same world as the app: black stage, light from above, three mode colours, gold only in the crown. */

@font-face { font-family: 'Barlow Condensed'; font-style: italic; font-weight: 800; font-display: swap; src: url('/assets/barlow-800i.woff2') format('woff2'); }
@font-face { font-family: 'Bricolage Grotesque'; font-style: normal; font-weight: 500; font-display: swap; src: url('/assets/bricolage-500.woff2') format('woff2'); }
@font-face { font-family: 'Bricolage Grotesque'; font-style: normal; font-weight: 800; font-display: swap; src: url('/assets/bricolage-800.woff2') format('woff2'); }

:root {
  color-scheme: dark;
  --bg: #0B0B0F;
  --surface: #15141B;
  --surface-2: #1D1B24;
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.28);
  --text: #F6F2EC;
  --muted: #ABA5B3;
  --burgundy: #4B0015;
  --connect: #E54B7D;
  --chaos: #FF9933;
  --compete: #3A7FFB;
  --error: #FF7A7A;
  --display: 'Barlow Condensed', 'Arial Narrow', Impact, sans-serif;
  --ui: 'Bricolage Grotesque', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --gutter: 20px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  background: var(--bg);
  color: var(--text);
  font: 500 17px/1.5 var(--ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
/* The light from above: a burgundy spill behind the crown. */
body::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 620px;
  background:
    radial-gradient(60% 70% at 50% 0%, rgba(120, 8, 40, 0.55), rgba(75, 0, 21, 0.18) 55%, transparent 80%);
  pointer-events: none;
  z-index: 0;
}
img { display: block; max-width: 100%; }
a { color: var(--text); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--text); outline-offset: 3px; border-radius: 6px; }

.shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: max(28px, env(safe-area-inset-top)) max(var(--gutter), env(safe-area-inset-right)) max(32px, env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
}

/* ---------- hero */
.hero { text-align: center; padding-top: 12px; }
.logo {
  width: 104px; height: 104px;
  margin: 0 auto 18px;
  border-radius: 24px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 18px 60px rgba(150, 10, 50, 0.55);
}
.wordmark {
  margin: 0;
  font: italic 800 clamp(76px, 25vw, 116px)/0.86 var(--display);
  letter-spacing: 0.005em;
  text-transform: uppercase;
}
.kicker {
  margin: 12px 0 0;
  font: 800 13px/1.2 var(--ui);
  letter-spacing: 0.26em;
  color: var(--muted);
}
.tagline {
  margin: 30px 0 0;
  font: italic 800 clamp(36px, 11vw, 54px)/0.95 var(--display);
  text-transform: uppercase;
}
.lead { margin: 10px 0 0; color: var(--muted); font-size: 18px; }

/* ---------- form */
.card {
  margin-top: 28px;
  padding: 22px 18px 20px;
  border-radius: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.field + .field { margin-top: 22px; }
.label {
  display: block;
  margin: 0 0 8px;
  font: 800 13px/1.2 var(--ui);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.input {
  width: 100%;
  height: 58px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1.5px solid var(--line-strong);
  background: var(--bg);
  color: var(--text);
  font: 500 18px var(--ui); /* 16px+ stops iPhone zooming in */
  -webkit-appearance: none;
  appearance: none;
}
.input::placeholder { color: #6E6876; }
.input:focus { outline: none; border-color: var(--text); }
.input[aria-invalid='true'] { border-color: var(--error); }

.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; padding: 0; border: 0; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.choice span {
  display: flex; align-items: center; justify-content: center;
  height: 64px;
  border-radius: 14px;
  border: 1.5px solid var(--line-strong);
  background: var(--bg);
  font: 800 19px var(--ui);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.choice input:checked + span { background: var(--text); color: #0B0B0F; border-color: var(--text); }
.choice input:focus-visible + span { outline: 3px solid var(--text); outline-offset: 3px; }
.choices[aria-invalid='true'] .choice span { border-color: var(--error); }

.consent {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 12px;
  align-items: start;
  margin-top: 22px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1.4;
}
.consent input {
  width: 28px; height: 28px; margin: 0;
  border-radius: 8px;
  border: 1.5px solid var(--line-strong);
  background: var(--bg);
  -webkit-appearance: none; appearance: none;
  display: grid; place-content: center;
  cursor: pointer;
}
.consent input::after {
  content: '';
  width: 13px; height: 7px;
  border: solid #0B0B0F; border-width: 0 0 3px 3px;
  transform: rotate(-45deg) translate(1px, -1px) scale(0);
  transition: transform 0.12s;
}
.consent input:checked { background: var(--text); border-color: var(--text); }
.consent input:checked::after { transform: rotate(-45deg) translate(1px, -1px) scale(1); }
.consent input[aria-invalid='true'] { border-color: var(--error); }
.consent span { padding-top: 3px; }

.error { margin: 8px 0 0; color: var(--error); font-size: 15px; line-height: 1.35; min-height: 0; }
.error:empty { display: none; }
.hint { margin: 8px 0 0; font-size: 15px; color: var(--muted); }
.hint:empty { display: none; }
.hint button { all: unset; cursor: pointer; color: var(--text); text-decoration: underline; text-underline-offset: 3px; }

.cta {
  display: flex; align-items: center; justify-content: center;
  width: 100%;
  height: 62px;
  margin-top: 24px;
  border: 0;
  border-radius: 999px;
  background: var(--text);
  color: #0B0B0F;
  font: 800 19px var(--ui);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s, opacity 0.15s;
}
.cta:active { transform: scale(0.98); }
.cta[disabled] { opacity: 0.6; cursor: progress; }
.cta.slim { width: auto; height: 48px; margin: 0; padding: 0 22px; font-size: 16px; }
.fineprint { margin: 14px 0 0; text-align: center; font-size: 14px; color: var(--muted); }
.trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- success */
.done { text-align: center; padding: 30px 18px 26px; }
.done[hidden] { display: none; }
.done .crown { width: 96px; margin: 0 auto 14px; }
.done h2 { margin: 0; font: italic 800 clamp(44px, 14vw, 64px)/0.92 var(--display); text-transform: uppercase; }
.done p { margin: 12px 0 0; font-size: 18px; color: var(--muted); }
.follow-title { margin: 28px 0 12px !important; font: 800 13px/1.2 var(--ui) !important; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.socials { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.socials a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 72px;
  border-radius: 14px;
  border: 1.5px solid var(--line-strong);
  padding: 8px 4px;
  text-decoration: none;
  font: 800 13px var(--ui);
}
.socials svg { width: 22px; height: 22px; }

/* ---------- modes */
.modes { margin-top: 44px; }
.modes[hidden] { display: none; }
.section-title {
  margin: 0 0 14px;
  font: italic 800 34px/1 var(--display);
  text-transform: uppercase;
  text-align: center;
}
.mode {
  --c: var(--connect);
  --glow: 229, 75, 125;
  --deep: #22121A;
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 132px;
  padding: 18px 0 18px 20px;
  border-radius: 22px;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 100% 50%, rgba(var(--glow), 0.3), transparent 70%),
    var(--deep);
  border: 1px solid rgba(var(--glow), 0.45);
  box-shadow: 0 0 34px rgba(var(--glow), 0.18);
}
.mode + .mode { margin-top: 12px; }
.mode.chaos { --c: var(--chaos); --glow: 255, 153, 51; --deep: #221A12; }
.mode.compete { --c: var(--compete); --glow: 58, 127, 251; --deep: #121A2B; }
.mode h3 { margin: 0; font: italic 800 40px/0.9 var(--display); text-transform: uppercase; color: var(--c); }
.mode .game { margin: 8px 0 0; font: 800 17px/1.2 var(--ui); }
.mode .line { margin: 3px 0 0; font-size: 15px; line-height: 1.35; color: var(--muted); }
.mode img { height: 108px; width: auto; max-width: 150px; object-fit: contain; object-position: right center; margin-right: -6px; filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.5)); }

/* ---------- footer */
.footer { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--line); text-align: center; font-size: 15px; color: var(--muted); }
.footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; }
.footer a { color: var(--text); display: inline-block; padding: 8px 2px; }
.footer p { margin: 12px 0 0; }

/* ---------- plain pages (privacy, table link, 404, admin) */
.brand-mini { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font: italic 800 30px/1 var(--display); }
.brand-mini img { width: 40px; height: auto; }
.plain .title { margin: 36px 0 0; font: italic 800 clamp(46px, 13vw, 64px)/0.92 var(--display); text-transform: uppercase; }
.plain .title.small { margin: 0; font-size: 44px; }
.plain .cta { max-width: 360px; }
.prose h2 { margin: 30px 0 6px; font: 800 19px/1.3 var(--ui); }
.prose p, .prose li { color: #D9D4DE; }
.prose ul { padding-left: 20px; }
.prose li + li { margin-top: 4px; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 4px; font: 800 12px/1.2 var(--ui); letter-spacing: 0.2em; color: var(--muted); }

/* admin */
.wide .shell { max-width: 880px; }
.admin-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-top: 28px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 24px; }
.stat { padding: 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.stat-num { display: block; font: italic 800 46px/1 var(--display); }
.stat-label { color: var(--muted); font-size: 14px; }
.h2 { margin: 34px 0 10px; font: 800 18px var(--ui); }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-weight: 800; font-size: 13px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.gone td { color: #77717E; }
.scroll { overflow-x: auto; }
.bars .bar { display: grid; grid-template-columns: 52px 1fr 48px; align-items: center; gap: 10px; padding: 4px 0; }
.bars .fill { height: 12px; border-radius: 6px; background: var(--chaos); min-width: 3px; }
.bars .day { color: var(--muted); font-size: 14px; }
.bars .num { text-align: right; }
.search, .delete { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.search input, .delete input[type='email'] { flex: 1 1 220px; height: 46px; padding: 0 14px; border-radius: 12px; border: 1.5px solid var(--line-strong); background: var(--bg); color: var(--text); font: 500 16px var(--ui); }
.search button, .delete button { height: 46px; padding: 0 18px; border-radius: 12px; border: 0; background: var(--text); color: #0B0B0F; font: 800 15px var(--ui); cursor: pointer; }
.delete button { background: var(--error); }
.tick { display: inline-flex; gap: 8px; align-items: center; color: var(--muted); }
.note { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); margin-top: 18px; }
.note.ok { border: 1px solid var(--chaos); }

.lead, .done p, .mode .line, .tagline { text-wrap: balance; }

/* Short screens (in-app browsers with their own bars): keep the form in reach. */
@media (max-height: 740px) {
  .shell { padding-top: max(16px, env(safe-area-inset-top)); }
  .hero { padding-top: 4px; }
  .logo { width: 76px; height: 76px; border-radius: 18px; margin-bottom: 12px; }
  .wordmark { font-size: clamp(64px, 20vw, 96px); }
  .tagline { margin-top: 20px; }
  .card { margin-top: 20px; }
}

@media (min-width: 720px) {
  .shell { padding-top: 56px; }
}
@media (prefers-reduced-motion: no-preference) {
  .rise { animation: rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .rise.d1 { animation-delay: 0.06s; }
  .rise.d2 { animation-delay: 0.12s; }
  .rise.d3 { animation-delay: 0.18s; }
  @keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
}
