:root {
  color-scheme: light;
  --uv: #444ce7;
  --uv-dark: #3038bd;
  --space: #141414;
  --off-white: #f8fafc;
  --paper: #ffffff;
  --muted: #626574;
  --lavender: #e8e9ff;
  --lime: #b7f36b;
  --cyan: #86e8ff;
  --pink: #ff8fc3;
  --line: #d9dce8;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--space);
  background-color: var(--off-white);
  background-image:
    radial-gradient(circle at 8% 4%, rgba(68, 76, 231, .18), transparent 25rem),
    radial-gradient(circle at 90% 18%, rgba(255, 143, 195, .2), transparent 19rem),
    linear-gradient(rgba(68, 76, 231, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(68, 76, 231, .055) 1px, transparent 1px);
  background-size: auto, auto, 32px 32px, 32px 32px;
}

button { font: inherit; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }

.shell {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 56px;
}

header, .game-heading, .brand-lockup {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.header-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; }
.player-identity {
  position: fixed;
  top: 10px;
  right: 14px;
  z-index: 10;
  max-width: calc(100vw - 28px);
  overflow: hidden;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .72rem;
  font-weight: 700;
  opacity: .58;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

.brand-lockup { justify-content: flex-start; }
.brand-mark {
  display: grid;
  flex: 0 0 auto;
  width: 62px;
  height: 62px;
  place-items: center;
  border: 2px solid var(--space);
  border-radius: 17px;
  color: white;
  background: var(--uv);
  box-shadow: 5px 5px 0 var(--space);
  font-size: 2rem;
}

h1, h2, p { margin-top: 0; }
h1 {
  margin-bottom: 2px;
  font-size: clamp(2rem, 7vw, 4rem);
  letter-spacing: -.055em;
  line-height: .95;
}
h2 { margin-bottom: 8px; font-size: clamp(1.5rem, 4vw, 2.15rem); letter-spacing: -.035em; }
.tagline { margin: 7px 0 0; color: var(--muted); font-size: .95rem; }

.eyebrow {
  margin-bottom: 7px;
  color: var(--uv);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.status-rail {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 26px;
  border-radius: 999px;
  padding: 9px 14px;
  color: white;
  background: var(--space);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .72rem;
  letter-spacing: .03em;
}
.status-rail span { width: 9px; height: 9px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 4px rgba(183, 243, 107, .16); }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.stat, .card, .game {
  border: 2px solid var(--space);
  border-radius: 18px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 6px 7px 0 rgba(20, 20, 20, .11);
}

.stat { padding: 14px; }
.stat:nth-child(1) { background: var(--lavender); }
.stat:nth-child(2) { background: var(--cyan); }
.stat:nth-child(3) { background: var(--lime); }
.stat strong { display: block; font-size: 1.4rem; line-height: 1; }
.stat span { color: #41434d; font-size: .71rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.card, .game { padding: clamp(22px, 5vw, 40px); }

.auth-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}
.auth-card { display: flex; flex-direction: column; gap: 14px; }
.auth-card h2 { margin-bottom: 0; }
.auth-card label { display: grid; gap: 6px; color: var(--muted); font-size: .76rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.auth-card input {
  width: 100%;
  border: 2px solid var(--space);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--space);
  background: var(--paper);
  font: inherit;
  text-transform: none;
}

.point-shop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 18px;
  border: 2px solid var(--space);
  border-radius: 16px;
  padding: 13px 15px;
  background: linear-gradient(110deg, var(--paper), var(--lavender));
}
.point-shop strong, .point-shop span { display: block; }
.point-shop span { margin-top: 2px; color: var(--muted); font-size: .76rem; }

.catalog-heading { margin: 26px 0 14px; }
.catalog-heading h2 { margin-bottom: 0; }
.campaigns { display: grid; gap: 18px; }
.campaign-description { margin-bottom: 18px; color: var(--muted); line-height: 1.5; }
.campaign-card {
  border: 2px solid var(--space);
  border-radius: 15px;
  padding: 18px;
  background: linear-gradient(135deg, var(--paper), var(--lavender));
}
.campaign-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.campaign-heading h3 { margin: 0; font-size: 1.35rem; }
.campaign-heading .eyebrow { margin-bottom: 4px; }
.campaign-availability { margin: 7px 0 0; color: var(--muted); font-size: .76rem; font-weight: 800; }
.campaign-countdown {
  display: inline-block;
  width: 12ch;
  color: var(--space);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}
.workflow-link.compact { flex: 0 0 auto; padding: 7px 11px; font-size: .72rem; }
.campaign-progress { margin-bottom: 12px; font-size: .82rem; font-weight: 800; }
.campaign-levels { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.campaign-level {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--paper);
  font-size: .72rem;
  font-weight: 850;
}
.campaign-level.available { border-color: var(--space); color: white; background: var(--uv); }
.campaign-level.active { border-color: var(--space); color: var(--space); background: var(--pink); }
.campaign-level.complete { border-color: var(--space); color: var(--space); background: var(--lime); }
.campaign-unlock { min-width: 270px; }
.campaign-unlock-countdown {
  display: inline-block;
  width: 8ch;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  text-align: left;
}

.notice {
  position: fixed;
  top: 16px;
  left: 50%;
  z-index: 20;
  width: min(520px, calc(100% - 32px));
  border: 2px solid var(--space);
  border-radius: 12px;
  padding: 12px 15px;
  color: white;
  background: var(--space);
  box-shadow: 4px 4px 0 var(--uv);
  transform: translateX(-50%);
}

.primary, .quiet, .hints button {
  border: 2px solid var(--space);
  border-radius: 999px;
  padding: 10px 17px;
  cursor: pointer;
  font-weight: 800;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}

.workflow-link { display: inline-flex; align-items: center; text-decoration: none; }

.primary { color: white; background: var(--uv); box-shadow: 3px 3px 0 var(--space); }
.primary:hover { background: var(--uv-dark); transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--space); }
.quiet { color: var(--space); background: var(--paper); }
.quiet:hover, .hints button:hover { background: var(--lavender); }
.primary:active, .quiet:active, .hints button:active { transform: translate(2px, 2px); box-shadow: none; }
button:disabled, .workflow-link[aria-disabled="true"] { cursor: not-allowed; opacity: .42; pointer-events: none; transform: none; box-shadow: none; }

.game { margin-top: 12px; }
.game-heading { align-items: flex-start; }
.game-layout { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; }
.game-play { min-width: 0; }
.game-meta { display: flex; flex: 0 0 auto; flex-direction: column; align-items: flex-end; gap: 8px; }
.game-meta p { margin: 0; border: 1px solid var(--line); border-radius: 999px; padding: 7px 11px; font-size: .76rem; font-weight: 750; }
.game-meta .workflow-link { padding: 7px 11px; font-size: .72rem; }
.event { margin: 16px 0; border: 2px solid var(--space); border-radius: 12px; padding: 10px 13px; background: linear-gradient(100deg, var(--pink), var(--lavender)); font-weight: 750; }
.bonus-panel {
  position: fixed;
  top: 50%;
  left: max(18px, calc(50vw - 718px));
  z-index: 5;
  width: 180px;
  border: 2px solid var(--space);
  border-radius: 16px;
  padding: 14px;
  background: linear-gradient(110deg, var(--lime), var(--cyan));
  box-shadow: 5px 6px 0 rgba(20, 20, 20, .14);
  transform: translateY(-50%);
}
.bonus-panel > .eyebrow { margin-bottom: 6px; color: var(--space); }
.bonus-item { border-top: 1px solid rgba(20, 20, 20, .22); padding: 10px 0; }
.bonus-item:last-child { padding-bottom: 0; }
.bonus-item span { display: block; font-size: .72rem; font-weight: 800; }
.bonus-item strong { display: block; margin-top: 2px; font-size: 1.25rem; line-height: 1.05; }
.bonus-item small {
  display: block;
  margin-top: 5px;
  color: #41434d;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .65rem;
  line-height: 1.3;
}

@media (max-width: 1469px) {
  .bonus-panel {
    position: static;
    display: grid;
    width: auto;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 16px 0 0;
    transform: none;
  }
  .bonus-panel > .eyebrow { grid-column: 1 / -1; margin-bottom: 0; }
  .bonus-item { border: 1px solid rgba(20, 20, 20, .22); border-radius: 10px; padding: 10px; }
  .bonus-item:last-child { padding-bottom: 10px; }
}

.crossword {
  display: grid;
  justify-content: center;
  gap: 4px;
  min-height: 250px;
  margin: 30px auto 20px;
}

.cell {
  display: grid;
  width: clamp(30px, 7.5vw, 46px);
  aspect-ratio: 1;
  place-items: center;
  border: 2px solid var(--space);
  border-radius: 7px;
  background: var(--paper);
  font-size: 1.25rem;
  font-weight: 900;
  text-transform: uppercase;
}

.cell.revealed { border-color: var(--space); color: white; background: var(--uv); }
.cell.hinted { border-color: var(--space); color: var(--space); background: var(--lime); }
.cell-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin: -8px 0 20px;
  color: var(--muted);
  font-size: .75rem;
}
.cell-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-cell { width: 14px; height: 14px; border: 2px solid var(--space); border-radius: 4px; }
.legend-cell.found { background: var(--uv); }
.legend-cell.hinted { background: var(--lime); }
.guess { min-height: 32px; text-align: center; font-size: 1.4rem; font-weight: 900; letter-spacing: .14em; }

.letters {
  position: relative;
  width: 242px;
  height: 242px;
  margin: 0 auto 22px;
  border: 2px solid var(--space);
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--space) 0 34px, transparent 35px),
    radial-gradient(circle at center, var(--lavender), var(--paper) 68%);
  box-shadow: 6px 7px 0 var(--uv);
}
.letters::before {
  content: "LETTER\A QUEUE";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: white;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .55rem;
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  white-space: pre;
  pointer-events: none;
}

.letter {
  position: absolute;
  width: 48px;
  height: 48px;
  border: 2px solid var(--space);
  border-radius: 50%;
  color: var(--space);
  background: var(--paper);
  box-shadow: 3px 3px 0 var(--space);
  font-size: 1.15rem;
  font-weight: 900;
  transform: translate(-50%, -50%);
  cursor: pointer;
}
.letter:hover { color: white; background: var(--uv); }
.letter.selected { color: var(--space); background: var(--lime); box-shadow: 3px 3px 0 var(--uv); }

.actions, .hints { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.hints { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 14px; }
.hints button { color: var(--space); background: var(--lavender); }
.hints button.paid { background: var(--pink); }
.rejected-panel {
  position: fixed;
  top: 50%;
  right: max(18px, calc(50vw - 718px));
  z-index: 5;
  display: flex;
  width: 180px;
  max-height: calc(100vh - 36px);
  flex-direction: column;
  min-height: 260px;
  margin: 0;
  border: 2px solid var(--space);
  border-radius: 14px;
  padding: 16px;
  background: linear-gradient(145deg, var(--paper), var(--lavender));
  box-shadow: 4px 5px 0 rgba(20, 20, 20, .11);
  transform: translateY(-50%);
}
.rejected-panel h3 { margin: 0; font-size: 1.05rem; letter-spacing: -.02em; }
.rejected-words { display: grid; flex: 1; gap: 7px; min-height: 0; max-height: 430px; margin: 15px 0 0; padding: 0; overflow-y: auto; list-style: none; }
.rejected-words li { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--paper); font-weight: 850; letter-spacing: .08em; }
.rejected-empty { margin: 16px 0 0; color: var(--muted); font-size: .8rem; line-height: 1.45; }

@media (max-width: 1469px) {
  .rejected-panel {
    position: static;
    width: auto;
    min-height: 0;
    max-height: none;
    margin-top: 24px;
    transform: none;
  }
}

.complete { text-align: center; background: linear-gradient(145deg, var(--paper), var(--lavender)); }

.leaderboard-shell { width: min(1000px, calc(100% - 40px)); margin: 0 auto; padding: 34px 0 56px; }
.leaderboard-card { margin-top: 22px; border: 2px solid var(--space); border-radius: 18px; overflow: hidden; background: rgba(255, 255, 255, .96); box-shadow: 7px 8px 0 rgba(20, 20, 20, .12); }
.leaderboard-heading, .leaderboard-row { display: grid; grid-template-columns: 90px minmax(180px, 1fr) 100px 130px; align-items: center; gap: 16px; }
.leaderboard-heading { padding: 12px 20px; color: white; background: var(--space); font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.leaderboard-heading span:nth-child(n+3) { text-align: right; }
.leaderboard-entries { min-height: 436px; margin: 0; padding: 0; list-style: none; }
.leaderboard-row { min-height: 58px; border-bottom: 1px solid var(--line); padding: 10px 20px; font-size: 1.05rem; }
.leaderboard-row:nth-child(1) { background: linear-gradient(90deg, rgba(183, 243, 107, .55), transparent); }
.leaderboard-row:nth-child(2) { background: linear-gradient(90deg, rgba(134, 232, 255, .4), transparent); }
.leaderboard-row:nth-child(3) { background: linear-gradient(90deg, rgba(255, 143, 195, .3), transparent); }
.leaderboard-row span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 750; }
.leaderboard-row span:nth-child(3), .leaderboard-row strong:last-child { text-align: right; }
.leaderboard-row strong:last-child { color: var(--uv); font-size: 1.25rem; }
.leaderboard-empty { padding: 80px 24px; text-align: center; color: var(--muted); }
.leaderboard-status { margin: 14px 4px 0; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .72rem; }

@media (max-width: 620px) {
  header { align-items: flex-start; }
  .header-actions { flex-direction: column; align-items: flex-end; }
  .auth-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .leaderboard-heading, .leaderboard-row { grid-template-columns: 58px minmax(100px, 1fr) 65px 75px; gap: 8px; }
  .leaderboard-heading, .leaderboard-row { padding-left: 12px; padding-right: 12px; }
  header { align-items: flex-start; }
  .brand-mark { width: 48px; height: 48px; border-radius: 13px; font-size: 1.5rem; box-shadow: 3px 3px 0 var(--space); }
  header > .workflow-link { padding: 8px 10px; font-size: .7rem; }
  .tagline { font-size: .8rem; }
  .cell {
    width: min(30px, calc((100vw - 140px) / var(--grid-columns)));
    font-size: clamp(.72rem, 3.5vw, 1.1rem);
  }
  .game-heading { gap: 10px; }
  .game-meta p { font-size: .68rem; }
  .point-shop { align-items: flex-start; flex-direction: column; }
  .campaign-heading { flex-direction: column; }
  .bonus-panel { grid-template-columns: 1fr; }
}

@media (max-width: 800px) {
  .game-layout { grid-template-columns: 1fr; }
  .rejected-panel { min-height: 0; margin-top: 6px; }
  .rejected-words { grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); max-height: 180px; }
}

@media (max-width: 420px) {
  .shell { width: min(100% - 20px, 820px); padding-top: 20px; }
  header { align-items: stretch; flex-direction: column; }
  .brand-lockup { gap: 12px; }
  header > .workflow-link { align-self: flex-start; }
  .game-heading { flex-direction: column; }
  .game-meta { align-items: flex-start; }
  .campaign-unlock { width: 100%; min-width: 0; }
  .card, .game { padding: 20px 14px; }
  .letters { width: 224px; height: 224px; }
}
