/* You're Hired — "interview paperwork" look.
   Every player holds a copy of the same record; the paper colour tells you your role:
   white = Interviewer (employer copy), yellow = Candidate (applicant copy), pink = Panel. */

:root {
  --paper: #FAFAF7;
  --yellow: #FFF3A3;
  --yellow-light: #FFFCE6;
  --pink: #F8D3DA;
  --pink-light: #FDF0F2;
  --navy: #1B2B6F;
  --navy-deep: #0F1A47;
  --navy-wash: #EEF0F8;
  --red: #C8281C;
  --ink: #1A1A1A;
  --muted: #5F5F5A;
  --desk: #DADBD6;
  --rule: #9AA0BE;
  --sheet-bg: var(--paper);
  --field-bg: #fff;
  --label: 600 12px/1.2 "Barlow Condensed", "Arial Narrow", sans-serif;
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --type: "Courier Prime", "Courier New", monospace;
  color: var(--ink);
  background: var(--desk);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--desk); }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--desk);
  color: var(--ink);
  font: 400 16px/1.45 var(--type);
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--navy); }
a:hover { color: var(--navy-deep); }
h1, h2, h3, p { margin: 0; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

:focus-visible { outline: 3px solid var(--red); outline-offset: 1px; }

/* ---------- type ---------- */
.l {
  font: var(--label);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--navy);
}
.t { font-family: var(--type); color: var(--ink); }
.display {
  font-family: var(--display);
  font-weight: 800;
  line-height: 0.92;
  text-transform: uppercase;
  color: var(--navy);
}
.muted { color: var(--muted); }
.small { font-size: 13px; line-height: 1.4; }
.center { text-align: center; }

/* ---------- the sheet ---------- */
#app { padding: 44px 24px 64px; }
.sheet {
  --sheet-bg: var(--paper);
  --field-bg: #fff;
  position: relative;
  width: 100%;
  max-width: 600px;
  min-height: min(860px, calc(100vh - 108px));
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  background: var(--sheet-bg);
  box-shadow: 12px 12px 0 var(--yellow), 24px 24px 0 var(--pink);
  animation: sheet-in 220ms cubic-bezier(0.23, 1, 0.32, 1) both;
}
.sheet.tone-applicant { --sheet-bg: var(--yellow); --field-bg: var(--yellow-light); box-shadow: 12px 12px 0 var(--paper), 24px 24px 0 var(--pink); }
.sheet.tone-panel { --sheet-bg: var(--pink); --field-bg: var(--pink-light); box-shadow: 12px 12px 0 var(--paper), 24px 24px 0 var(--yellow); }
.sheet.sheet-wide { max-width: 1100px; min-height: 0; padding: 40px 48px 44px; }
.sheet.no-anim { animation: none; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.sheet-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--navy);
}
.sheet-sub {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 16px;
  padding: 9px 0;
  border-bottom: 1px solid var(--navy);
}
.head-actions { display: flex; gap: 18px; }
.link-button {
  margin: -12px 0;
  padding: 12px 0;
  border: 0;
  background: none;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.link-button:hover { color: var(--navy-deep); }
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--navy);
}
.push { margin-top: auto; }
.foot-note { margin-top: 10px; font-size: 13px; text-align: center; }

/* ---------- buttons & fields ---------- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 0 18px;
  border: 2px solid var(--navy);
  border-radius: 2px;
  font: 700 19px/1 var(--display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  transition: transform 140ms ease-out, background-color 140ms ease-out;
}
.btn-primary { background: var(--navy); color: #fff; }
.btn-secondary { background: transparent; color: var(--navy); }
.btn-small { min-height: 46px; padding: 0 16px; font-size: 16px; }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { cursor: not-allowed; opacity: 0.45; }
@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover:not(:disabled) { background: var(--navy-deep); }
  .btn-secondary:hover:not(:disabled) { background: var(--navy-wash); }
}
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-row > .grow { flex: 1.5 1 160px; }
.btn-row > .grow-less { flex: 1 1 110px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.input {
  width: 100%;
  height: 52px;
  padding: 0 14px;
  border: 1.5px solid var(--navy);
  border-radius: 0;
  background: var(--field-bg);
  font: 400 18px/1.2 var(--type);
  color: var(--ink);
}
.input::placeholder, textarea::placeholder { color: #6B6B66; }
.input:focus, textarea:focus { outline: 3px solid var(--red); outline-offset: 1px; }

/* 4-letter room code: one letter per printed box */
.comb {
  width: 211px;
  height: 54px;
  padding: 0 0 0 17px;
  background-color: var(--field-bg);
  background-image: repeating-linear-gradient(90deg, transparent 0 51px, var(--navy) 51px 52px);
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 36.4px;
  color: var(--red);
  text-transform: uppercase;
}
.comb::placeholder { color: #B9B9B3; }

.or-rule { display: flex; align-items: center; gap: 10px; }
.or-rule::before, .or-rule::after { content: ""; flex: 1; border-top: 1px solid var(--navy); }

/* ---------- rubber stamps ---------- */
.stamp {
  display: inline-block;
  margin: 0;
  padding: 0.11em 0.19em 0.07em;
  border: 0.055em solid currentColor;
  border-radius: 0.07em;
  font: 800 var(--s, 82px)/0.86 var(--display);
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--navy);
  transform: rotate(-4deg);
}
.stamp-red { color: var(--red); transform: rotate(4deg); border-radius: 0; }
.stamp-small {
  flex: none;
  padding: 4px 8px 2px;
  border: 2.5px solid var(--red);
  border-radius: 3px;
  font: 800 15px/1 var(--display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--red);
  background: var(--sheet-bg);
  transform: rotate(-4deg);
}
.stamp-thud { animation: thud 320ms cubic-bezier(0.2, 0.9, 0.3, 1.2) both; }
@keyframes thud {
  from { opacity: 0; transform: scale(1.35) rotate(var(--rot, -6deg)); }
  to { opacity: 1; transform: scale(1) rotate(var(--rot, -6deg)); }
}

/* ---------- home / sign-in sheet ---------- */
.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 1fr);
  grid-template-areas: "title form" "rules form";
  align-items: start;
  gap: 28px 64px;
  margin-top: 36px;
}
.home-title { grid-area: title; }
.home-form { grid-area: form; }
.home-rules { grid-area: rules; }
.lockup {
  --s: 128px;
  position: relative;
  display: inline-block;
  margin: 12px 0 calc(var(--s) * 0.22) 6px;
}
.lede { max-width: 520px; margin-top: 16px; font-size: 19px; line-height: 1.5; }
.home-rules ol { margin: 8px 0 0; padding-left: 24px; max-width: 560px; font-size: 15px; line-height: 1.5; }
.home-form {
  display: flex;
  flex-direction: column;
  padding: 24px;
  border: 2px solid var(--navy);
  background: #fff;
  --field-bg: var(--paper);
}
.code-row { display: flex; flex-wrap: wrap; gap: 12px; }
.code-row .btn { flex: 1 1 90px; }
.copies { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.copy-card { padding: 14px 16px; border: 1.5px solid var(--navy); background: #fff; }
.copy-card.yellow { background: var(--yellow); }
.copy-card.pink { background: var(--pink); }
.copy-card .t { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 14px; }
.redact { display: inline-block; height: 16px; width: 140px; max-width: 60%; background: var(--ink); }

/* ---------- lobby ---------- */
.code-banner { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-top: 16px; }
.room-code { margin-top: 4px; font: 700 60px/1 var(--type); letter-spacing: 0.12em; color: var(--red); }
.seat {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-height: 38px;
  padding-top: 9px;
  border-bottom: 1px solid var(--navy);
}
.seat .n { width: 14px; font: 600 12px/1 var(--display); color: var(--navy); }
.seat .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; }
.seat .offline { color: var(--red); }
fieldset.choice { margin: 20px 0 0; padding: 0; border: 0; min-width: 0; }
fieldset.choice + fieldset.choice { margin-top: 14px; }
fieldset.choice legend { padding: 0; margin-bottom: 6px; }
.opts { display: flex; padding-left: 1.5px; }
.opt {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  margin-left: -1.5px;
  border: 1.5px solid var(--navy);
  background: #fff;
  font: 400 15px/1 var(--type);
  color: var(--ink);
  cursor: pointer;
}
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt .box {
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--navy);
  font: 700 15px/11px var(--type);
  text-align: center;
  color: var(--red);
}
.opt input:checked + .box::after { content: "x"; }
.opt:has(input:checked) { background: var(--navy-wash); }
.opt:has(input:focus-visible) { outline: 3px solid var(--red); outline-offset: 1px; z-index: 1; }
.opt:has(input:disabled) { cursor: default; }
.lobby-rules ol { margin: 6px 0 0; padding-left: 22px; font-size: 13px; line-height: 1.4; }

/* ---------- position record ---------- */
.record {
  position: relative;
  padding: 14px 16px 16px;
  border: 2px solid var(--navy);
  background: var(--field-bg);
}
.record-title { margin-top: 8px; font: 700 27px/1.1 var(--type); overflow-wrap: anywhere; }
.record .redact { display: block; margin-top: 8px; height: 34px; width: 250px; }
.record .stamp-big {
  position: absolute;
  right: -8px;
  bottom: -18px;
  padding: 5px 10px 3px;
  border: 3px solid var(--red);
  border-radius: 4px;
  background: var(--paper);
  font: 800 22px/1 var(--display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--red);
  transform: rotate(-5deg);
}
.record-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding: 10px 14px;
  border: 2px solid var(--navy);
  background: var(--field-bg);
}
.record-strip .job { margin-top: 4px; font: 700 20px/1.2 var(--type); overflow-wrap: anywhere; }
.record-strip .redact { display: block; margin-top: 6px; height: 24px; width: 196px; }

.role-title { margin-top: 6px; font-size: clamp(48px, 15vw, 62px); }
.countdown-bar { display: block; height: 6px; border: 1.5px solid var(--navy); }
.countdown-bar > span { display: block; height: 100%; width: 100%; background: var(--navy); transition: width 250ms linear; }

/* ---------- interview transcript ---------- */
.exchange { display: flex; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--navy); }
.exchange .n, .blank .n, .active-row .n { flex: none; width: 18px; font: 700 15px/1.5 var(--display); color: var(--navy); }
.exchange .body { min-width: 0; }
.exchange .q { font-size: 15px; line-height: 1.4; overflow-wrap: anywhere; }
.exchange .a { margin-top: 6px; padding-left: 12px; border-left: 3px solid var(--ink); font-size: 15px; line-height: 1.4; overflow-wrap: anywhere; }
.exchange .a.none { color: var(--muted); font-style: italic; }
.blank { display: flex; min-height: 34px; padding-top: 8px; border-bottom: 1px solid var(--navy); }
.blank .n { line-height: 1; }
.active-row {
  display: flex;
  gap: 8px;
  margin: 0 -10px;
  padding: 12px 10px 14px;
  border: 2px solid var(--navy);
  border-top: 0;
  background: var(--field-bg);
}
.active-row .n { line-height: 1.3; font-size: 18px; }
.active-row .stack { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.active-row .asked { font: 700 19px/1.3 var(--type); overflow-wrap: anywhere; }
.waiting-line { font-size: 15px; line-height: 1.4; }
.dots::after { content: ""; animation: dots 1.4s steps(4, end) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

textarea.ruled {
  width: 100%;
  height: 80px;
  padding: 0 10px;
  border: 1.5px solid var(--navy);
  border-radius: 0;
  resize: vertical;
  background: var(--field-bg) repeating-linear-gradient(transparent 0 25px, var(--rule) 25px 26px);
  background-attachment: local;
  font: 400 15px/26px var(--type);
}

.presets { display: grid; grid-template-columns: 1fr; column-gap: 24px; }
.pre {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px dashed var(--navy);
  background: none;
  text-align: left;
  font: 400 14px/1.35 var(--type);
  color: var(--ink);
}
@media (hover: hover) and (pointer: fine) { .pre:hover { background: var(--navy-wash); } }

/* ---------- timer ---------- */
.timer { margin-top: 14px; }
.timer-top { display: flex; align-items: baseline; justify-content: space-between; }
.timer-value { font: 700 34px/1 var(--type); }
.timer-track { margin-top: 6px; height: 12px; border: 1.5px solid var(--navy); background: var(--field-bg); }
.timer-fill {
  height: 100%;
  width: 100%;
  background-color: var(--navy);
  background-image: repeating-linear-gradient(90deg, transparent 0 10.4px, var(--sheet-bg) 10.4px 11.4px);
  transition: width 250ms linear;
}
.timer.urgent .timer-value { color: var(--red); }
.timer.urgent .timer-fill { background-color: var(--red); }
.timer.urgent .timer-track { border-color: var(--red); }

.hint-slip { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 9px 12px; border: 1.5px dashed var(--navy); }
.hint-slip .word { font: 700 18px/1 var(--type); letter-spacing: 0.12em; text-transform: uppercase; }
.hint-slip .l:last-child { margin-left: auto; }

.guess-input { height: 60px; border: 3px solid var(--red); font-size: 23px; font-weight: 700; }

/* ---------- result & final ---------- */
.result-stage { position: relative; min-height: 200px; display: flex; align-items: center; padding: 12px 0 12px 14px; }
.result-stage .stamp { --s: 96px; --rot: -7deg; transform: rotate(-7deg); }
.result-stage .stamp-red { --s: 62px; --rot: 4deg; transform: rotate(4deg); line-height: 0.9; padding: 0.19em 0.29em 0.13em; border-width: 5px; }
.earn-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--navy); font-size: 17px; }
.earn-row .who { min-width: 0; overflow-wrap: anywhere; }
.earn-row .nums { white-space: nowrap; }
.earn-row .nums b { display: inline-block; min-width: 2.6em; text-align: right; }
.earn-row .nums span { display: inline-block; min-width: 2.2em; text-align: right; }

.dear { margin-top: 30px; font-size: 16px; overflow-wrap: anywhere; }
.final-stage { min-height: 228px; display: flex; align-items: center; padding: 14px 0 14px 10px; }
.final-stage .stamp { --s: 100px; --rot: -5deg; transform: rotate(-5deg); }
.standing { display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 0 14px; border-bottom: 1px solid var(--navy); }
.standing .rank { width: 26px; font: 800 30px/1 var(--display); color: var(--navy); }
.standing .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 20px; }
.standing .score { font-size: 20px; }
.standing.winner { background: var(--navy); border-bottom-color: var(--navy); }
.standing.winner .rank, .standing.winner .name, .standing.winner .score { color: #fff; font-weight: 700; }
.standing.winner + .standing.winner { border-top: 1px solid rgba(255, 255, 255, 0.3); }
.standing { opacity: 0; animation: row-in 200ms cubic-bezier(0.23, 1, 0.32, 1) forwards; animation-delay: calc(var(--i) * 60ms); }
@keyframes row-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- overlays, dialog, toast ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(26, 26, 26, 0.55);
}
.overlay-card {
  width: min(100%, 460px);
  padding: 22px 24px 24px;
  background: var(--paper);
  border: 2px solid var(--navy);
  box-shadow: 12px 12px 0 var(--yellow), 24px 24px 0 var(--pink);
}
.overlay-card h2 { margin-top: 18px; font-size: 40px; }
.overlay-card p { margin-top: 10px; font-size: 15px; }
.overlay-card .btn { margin-top: 18px; width: 100%; }
.help-dialog {
  width: min(92vw, 600px);
  padding: 24px;
  border: 2px solid var(--navy);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 12px 12px 0 var(--yellow), 24px 24px 0 var(--pink);
}
.help-dialog::backdrop { background: rgba(26, 26, 26, 0.55); }
.help-dialog h2 { margin-top: 20px; font-size: 48px; }
.rules-list { margin: 14px 0 0; padding-left: 22px; display: grid; gap: 10px; font-size: 15px; line-height: 1.45; }
.rules-list li::marker { font-family: var(--display); font-weight: 700; color: var(--navy); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 60;
  max-width: min(90vw, 480px);
  padding: 12px 16px;
  border: 2px solid var(--navy);
  background: #fff;
  color: var(--ink);
  box-shadow: 6px 6px 0 var(--yellow);
  font: 700 15px/1.35 var(--type);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: transform 200ms ease-out, opacity 200ms ease-out;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.connection-slip {
  position: fixed;
  top: 12px;
  left: 50%;
  z-index: 45;
  padding: 6px 12px 4px;
  border: 2.5px solid var(--red);
  background: var(--paper);
  transform: translateX(-50%) rotate(-2deg);
  font: 800 15px/1 var(--display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--red);
}

.confetti { position: fixed; inset: 0; z-index: 50; overflow: hidden; pointer-events: none; }
.confetti-piece { position: absolute; top: -12px; width: 9px; height: 16px; animation: fall 2.6s linear forwards; }
@keyframes fall { to { transform: translate3d(var(--drift), 110vh, 0) rotate(720deg); } }

/* ---------- responsive ---------- */
@media (min-width: 900px) {
  .presets { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .home-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "title" "form" "rules"; }
  .sheet.sheet-wide { padding: 32px 28px 36px; }
}
@media (max-width: 640px) {
  #app { padding: 0; }
  .wide-only { display: none; }
  body:has(.tone-applicant) { background: var(--yellow); }
  body:has(.tone-panel) { background: var(--pink); }
  body:has(.sheet:not(.tone-applicant):not(.tone-panel)) { background: var(--paper); }
  .sheet, .sheet.sheet-wide { max-width: none; min-height: 100vh; min-height: 100dvh; padding: 24px 20px 28px; box-shadow: none; }
  .home-grid { margin-top: 22px; gap: 22px; }
  .lockup { --s: clamp(62px, 21vw, 82px); margin-top: 6px; }
  .lede { font-size: 15px; margin-top: 4px; }
  .home-form { padding: 0; border: 0; background: none; --field-bg: #fff; }
  .home-rules { padding-top: 14px; border-top: 1px solid var(--navy); }
  .home-rules ol { font-size: 13px; line-height: 1.4; padding-left: 22px; }
  .copies { grid-template-columns: 1fr; gap: 10px; }
  .room-code { font-size: clamp(44px, 14vw, 60px); }
  .result-stage .stamp { --s: clamp(72px, 24vw, 96px); }
  .final-stage .stamp { --s: clamp(76px, 25vw, 100px); }
  .record .stamp-big { right: -4px; }
}
@media (max-width: 360px) {
  .comb { width: 211px; }
  .code-row .btn { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
