/* QUIZ WEEK — pixel styling.
   Rules of the look: no border-radius, no gradients, no soft shadows.
   Depth comes from hard offset blocks, borders are 4px, motion is stepped. */

:root {
  --bg:        #12101c;
  --bg-deep:   #0a0812;
  --panel:     #1e1b2e;
  --panel-2:   #272340;
  --ink:       #f4f1e8;
  --dim:       #8b85a8;
  --line:      #3c3660;

  --green:     #63c74d;
  --red:       #d94b3a;
  --yellow:    #ffd23f;
  --blue:      #4d8ff5;
  --purple:    #a45cd6;
  --orange:    #f28c28;

  --px: 4px;
  --shadow: var(--px) var(--px) 0 0 var(--bg-deep);
  --shadow-lg: 6px 6px 0 0 var(--bg-deep);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Press Start 2P', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.9;
  -webkit-font-smoothing: none;
  image-rendering: pixelated;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* Faint checkerboard, drawn with hard-stop gradients so it stays crisp. */
  background-image:
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(255,255,255,.017) 31px 32px),
    repeating-linear-gradient(90deg, transparent 0 31px, rgba(255,255,255,.017) 31px 32px);
}

/* CRT scanline overlay */
.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  background: repeating-linear-gradient(
    to bottom, rgba(0,0,0,.16) 0 2px, transparent 2px 4px
  );
  mix-blend-mode: multiply;
}

/* ------------------------------------------------------------------ chrome */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: var(--px) solid var(--line);
  background: var(--bg-deep);
  flex-wrap: wrap;
}

.logo {
  color: var(--ink);
  text-decoration: none;
  font-size: 15px;
  letter-spacing: 1px;
}
.logo-mark { color: var(--green); }
.logo-dim  { color: var(--purple); }

.topbar-right { display: flex; gap: 8px; align-items: center; }

.pill {
  font: inherit;
  font-size: 10px;
  padding: 8px 10px;
  color: var(--dim);
  background: var(--panel);
  border: var(--px) solid var(--line);
  cursor: pointer;
}
.pill:hover { color: var(--ink); border-color: var(--purple); }
.pill-code { color: var(--yellow); border-color: var(--yellow); cursor: default; }

.footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  padding: 14px 18px;
  font-size: 9px;
  color: var(--dim);
  border-top: var(--px) solid var(--line);
  background: var(--bg-deep);
}

.blink { animation: blink 1s steps(1) infinite; color: var(--green); }
@keyframes blink { 50% { opacity: 0; } }

main {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 26px 18px 44px;
}

/* ------------------------------------------------------------- typography */

h1, h2, h3 { margin: 0; line-height: 1.5; font-weight: normal; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 12px; }

p { margin: 0 0 14px; line-height: 2; }

.muted { color: var(--dim); font-size: 10px; line-height: 2; }
.tiny  { font-size: 9px; color: var(--dim); }
.center { text-align: center; }

/* ----------------------------------------------------------------- panels */

.panel {
  background: var(--panel);
  border: var(--px) solid var(--line);
  box-shadow: var(--shadow-lg);
  padding: 22px;
  margin-bottom: 22px;
}

.panel-tight { padding: 16px; }

/* --------------------------------------------------------------- buttons */

.btn {
  font: inherit;
  font-size: 12px;
  display: block;
  width: 100%;
  padding: 16px;
  color: var(--bg-deep);
  background: var(--green);
  border: var(--px) solid var(--bg-deep);
  box-shadow: var(--shadow);
  cursor: pointer;
  text-align: center;
  transition: transform .06s steps(1), box-shadow .06s steps(1);
}
.btn:hover:not(:disabled) { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 0 var(--bg-deep); }
.btn:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 0 0 0 0 var(--bg-deep); }
.btn:disabled { background: var(--panel-2); color: var(--dim); cursor: not-allowed; box-shadow: none; }

.btn-ghost { background: var(--panel-2); color: var(--ink); border-color: var(--line); }
.btn-yellow { background: var(--yellow); }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

/* ----------------------------------------------------------------- input */

.input {
  font: inherit;
  font-size: 14px;
  width: 100%;
  padding: 16px;
  color: var(--ink);
  background: var(--bg-deep);
  border: var(--px) solid var(--line);
  outline: none;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.input:focus { border-color: var(--green); }
.input::placeholder { color: var(--dim); }

/* ------------------------------------------------------------ day cards */

.days { display: grid; gap: 14px; }

.daycard {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 18px;
  background: var(--panel);
  border: var(--px) solid var(--line);
  box-shadow: var(--shadow);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: var(--ink);
  width: 100%;
  transition: transform .06s steps(1);
}
.daycard:hover:not(.locked) { transform: translate(-2px, -2px); border-color: var(--green); }
.daycard.locked { opacity: .45; cursor: not-allowed; }
.daycard.done { border-color: var(--green); }

/* These are spans inside a grid cell, so they need blockifying to stack. */
.daycard-icon { font-size: 30px; line-height: 1; text-align: center; }
.daycard-num { display: block; font-size: 9px; color: var(--purple); margin-bottom: 6px; }
.daycard-title { display: block; font-size: 13px; margin-bottom: 6px; line-height: 1.5; }
.daycard-sub { display: block; font-size: 9px; color: var(--dim); line-height: 1.7; }
.daycard-state { font-size: 9px; color: var(--dim); white-space: nowrap; }
.daycard.done .daycard-state { color: var(--green); }

/* ------------------------------------------------------------- progress */

.progress {
  display: flex;
  gap: 3px;
  margin-bottom: 20px;
}
.progress-cell {
  flex: 1;
  height: 12px;
  background: var(--panel-2);
  border: 2px solid var(--bg-deep);
}
.progress-cell.on { background: var(--green); }
.progress-cell.cur { background: var(--yellow); }

.qmeta {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--dim);
  margin-bottom: 14px;
}

/* -------------------------------------------------------------- options */

.opts { display: grid; gap: 10px; margin-bottom: 18px; }
.opts.grid2 { grid-template-columns: repeat(2, 1fr); }

.opt {
  font: inherit;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  text-align: left;
  color: var(--ink);
  background: var(--panel-2);
  border: var(--px) solid var(--line);
  cursor: pointer;
  line-height: 1.6;
  transition: transform .06s steps(1);
}
.opt:hover { transform: translate(-2px, -2px); border-color: var(--purple); box-shadow: var(--shadow); }
.opt.sel {
  background: var(--green);
  color: var(--bg-deep);
  border-color: var(--bg-deep);
  box-shadow: var(--shadow);
}
.opt-icon { font-size: 20px; line-height: 1; flex: 0 0 auto; }
.opt-check {
  margin-left: auto;
  font-size: 10px;
  opacity: 0;
}
.opt.sel .opt-check { opacity: 1; }

/* ---------------------------------------------------------- versus screen */

.versus {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  gap: 10px;
  margin-bottom: 18px;
}

.vs-side {
  font: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 30px 14px;
  color: var(--ink);
  background: var(--panel-2);
  border: var(--px) solid var(--line);
  cursor: pointer;
  transition: transform .06s steps(1);
}
.vs-side:hover { transform: translate(-2px, -2px); border-color: var(--purple); box-shadow: var(--shadow); }
.vs-side.sel { background: var(--green); color: var(--bg-deep); border-color: var(--bg-deep); box-shadow: var(--shadow); }

.vs-icon { font-size: 46px; line-height: 1; }
.vs-label { font-size: 11px; text-align: center; line-height: 1.6; }

.vs-mid {
  align-self: center;
  font-size: 13px;
  color: var(--red);
  padding: 0 4px;
}

/* ------------------------------------------------------- type readout */

.typeread {
  background: var(--bg-deep);
  border: var(--px) solid var(--line);
  padding: 14px;
  margin-bottom: 18px;
}

.type-code {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 14px;
}
.type-code .tl {
  font-size: 24px;
  color: var(--line);
  width: 26px;
  text-align: center;
}
.type-code .tl.on { color: var(--yellow); text-shadow: 3px 3px 0 var(--bg); }

.type-rows { display: grid; gap: 9px; }

.type-row {
  display: grid;
  grid-template-columns: 16px 1fr 16px auto;
  gap: 10px;
  align-items: center;
  font-size: 10px;
  color: var(--dim);
}
.type-row .lit { color: var(--yellow); }
.type-pct { font-size: 9px; color: var(--dim); min-width: 34px; text-align: right; }

.type-track {
  position: relative;
  display: block;
  height: 14px;
  background: var(--bg);
  border: 3px solid var(--line);
}
.type-mid {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--line);
}
.type-knob {
  position: absolute;
  top: -3px;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  background: var(--blue);
  border: 3px solid var(--bg-deep);
  transition: left .12s steps(4);
}
.type-knob.idle { background: var(--line); }

/* --------------------------------------------------- house + type pair */

.duo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: start;
  margin-bottom: 22px;
}
.duo .house-card { margin-bottom: 0; height: 100%; }

.type-card {
  padding: 24px 20px;
  text-align: center;
  color: var(--ink);
  background: var(--panel);
  border: var(--px) solid var(--blue);
  box-shadow: var(--shadow-lg);
  height: 100%;
}
.type-big {
  font-size: 30px;
  color: var(--blue);
  letter-spacing: 4px;
  margin: 10px 0 4px;
  text-shadow: var(--px) var(--px) 0 var(--bg-deep);
}
.type-name { font-size: 14px; margin: 8px 0 4px; line-height: 1.6; }

/* ---------------------------------------------------------------- slider */

.slider-wrap { margin: 10px 0 22px; }

.slider-readout {
  text-align: center;
  font-size: 30px;
  color: var(--yellow);
  margin-bottom: 16px;
  text-shadow: var(--px) var(--px) 0 var(--bg-deep);
}

input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 20px;
  background: var(--bg-deep);
  border: var(--px) solid var(--line);
  outline: none;
  cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  background: var(--green);
  border: var(--px) solid var(--bg-deep);
  cursor: grab;
}
input[type=range]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 0;
  background: var(--green);
  border: var(--px) solid var(--bg-deep);
  cursor: grab;
}

.slider-ends {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--dim);
  margin-top: 10px;
}

/* ----------------------------------------------------------------- bars */

.bars { display: grid; gap: 14px; margin: 8px 0 4px; }

.bar-head {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--dim);
  margin-bottom: 5px;
}
.bar-head b { color: var(--ink); font-weight: normal; }

/* A -100..100 axis: center tick, fill grows left or right from the middle. */
.bar-track {
  position: relative;
  height: 18px;
  background: var(--bg-deep);
  border: 3px solid var(--line);
}
.bar-mid {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--line);
}
.bar-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--green);
}
.bar-fill.neg { background: var(--blue); }

/* ------------------------------------------------------------- verdict */

.verdict {
  border: var(--px) solid var(--yellow);
  box-shadow: var(--shadow-lg);
  background: var(--panel);
  padding: 0;
  margin-bottom: 22px;
}
.verdict-top {
  padding: 26px 22px;
  text-align: center;
  border-bottom: var(--px) solid var(--yellow);
  background: var(--bg-deep);
}
.verdict-icon { font-size: 54px; line-height: 1.2; }
.verdict-name {
  font-size: 18px;
  color: var(--yellow);
  margin: 12px 0 8px;
  line-height: 1.6;
}
.verdict-tag { font-size: 9px; color: var(--dim); line-height: 1.9; }
.verdict-body { padding: 22px; }

.match-line { font-size: 9px; color: var(--green); margin-top: 10px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.chip {
  font-size: 9px;
  padding: 8px 10px;
  background: var(--panel-2);
  border: 3px solid var(--line);
  color: var(--ink);
}

.age-box {
  text-align: center;
  padding: 20px;
  background: var(--bg-deep);
  border: var(--px) solid var(--line);
  margin-bottom: 22px;
}
.age-num {
  font-size: 46px;
  color: var(--orange);
  text-shadow: var(--px) var(--px) 0 var(--bg-deep);
  line-height: 1.4;
}

/* -------------------------------------------------------------- houses */

.house-card {
  padding: 24px 20px;
  text-align: center;
  border: var(--px) solid currentColor;
  box-shadow: var(--shadow-lg);
  margin-bottom: 22px;
}
.house-icon { font-size: 48px; line-height: 1.3; }
.house-name { font-size: 20px; margin: 10px 0 6px; letter-spacing: 1px; }
.house-motto { font-size: 9px; opacity: .85; }
.house-blurb { font-size: 10px; line-height: 2; margin-top: 16px; opacity: .95; }

.house-bars { display: grid; gap: 9px; margin-top: 6px; }
.house-row { display: grid; grid-template-columns: 24px 1fr 40px; gap: 10px; align-items: center; font-size: 9px; }
/* Both are spans, so they need blockifying or the percentage width is ignored. */
.house-track { display: block; height: 14px; background: var(--bg-deep); border: 3px solid var(--line); }
.house-fill { display: block; height: 100%; }

/* ------------------------------------------------------------- avatar */

.avatar {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  width: 108px;
  height: 108px;
  margin: 0 auto 16px;
  border: var(--px) solid var(--bg-deep);
  box-shadow: var(--shadow);
}
.avatar i { display: block; }

/* ------------------------------------------------------------- roster */

.roster-row {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  background: var(--panel);
  border: var(--px) solid var(--line);
  margin-bottom: 10px;
  font-size: 10px;
}
.roster-name { font-size: 11px; }
.roster-arch { font-size: 9px; color: var(--dim); margin-top: 5px; }
.roster-right { text-align: right; font-size: 9px; color: var(--dim); }

/* ------------------------------------------------------------- misc */

.divider {
  height: var(--px);
  background: var(--line);
  margin: 22px 0;
}

.section-label {
  font-size: 9px;
  color: var(--purple);
  margin-bottom: 12px;
  letter-spacing: 1px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--yellow);
  color: var(--bg-deep);
  border: var(--px) solid var(--bg-deep);
  box-shadow: var(--shadow);
  padding: 12px 16px;
  font-size: 10px;
  z-index: 200;
}

.err { color: var(--red); font-size: 10px; margin-bottom: 12px; }

/* Stepped entrance — no easing, keeps the retro feel. */
.pop { animation: pop .18s steps(3) both; }
@keyframes pop {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

@media (max-width: 560px) {
  html, body { font-size: 12px; }
  main { padding: 18px 12px 36px; }
  .panel { padding: 16px; }
  .opts.grid2 { grid-template-columns: 1fr; }
  .daycard { grid-template-columns: 40px 1fr; }
  .daycard-state { grid-column: 2; }
  .verdict-name { font-size: 15px; }
  .age-num { font-size: 38px; }
  .house-name { font-size: 16px; }

  /* Stack the VS panels with the divider between them. */
  .versus { grid-template-columns: 1fr; }
  .vs-side { padding: 20px 12px; flex-direction: row; gap: 14px; justify-content: flex-start; }
  .vs-icon { font-size: 34px; }
  .vs-mid { text-align: center; }

  .duo { grid-template-columns: 1fr; }
  .type-big { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
