/* Quiz AWS Student Builder Group USFQ — jugadores y proyector */
:root {
  --ink-950: #0f141c;
  --ink-900: #161e2d;   /* squid ink profundo */
  --ink-800: #1d2635;
  --ink-750: #232f3e;   /* squid ink */
  --ink-700: #2c3a4d;
  --ink-600: #414d5c;
  --fog-400: #8d99a8;
  --fog-200: #c6ccd5;
  --paper: #f4f6f8;
  --white: #ffffff;
  --orange: #ff9900;
  --orange-press: #ec7211;
  --ok: #29ad32;
  --bad: #ff5d64;

  /* Opciones: colores de categorías de los íconos de arquitectura de AWS */
  --c0: #dd344c;   /* Security */
  --c1: #01a88d;   /* Machine Learning */
  --c2: #ed7100;   /* Compute */
  --c3: #7aa116;   /* Storage */

  --font: "Open Sans", "Helvetica Neue", Arial, sans-serif;
  --r-sm: 4px;
  --r-md: 8px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --z-bar: 10;
  --z-controls: 20;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { scroll-behavior: smooth; }
body {
  background: var(--ink-900);
  color: var(--paper);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  font-variant-numeric: tabular-nums;
}
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 16px; top: -60px; background: var(--orange); color: var(--ink-900); padding: 10px 14px; font-weight: 700; z-index: 100; border-radius: var(--r-sm); }
.skip:focus { top: 12px; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; }
::selection { background: var(--orange); color: var(--ink-900); }
h1, h2, h3, p { margin: 0; }
h1, h2 { text-wrap: balance; letter-spacing: -0.02em; }
p { text-wrap: pretty; }
a { color: var(--orange); }

/* ---------- Barra superior (estilo consola) ---------- */
.bar {
  position: sticky; top: 0; z-index: var(--z-bar);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 52px; padding: 0 20px;
  background: var(--ink-950);
  color: var(--fog-200); font-size: 14px;
}
.wordmark { display: inline-flex; align-items: baseline; gap: 8px; color: var(--white); text-decoration: none; font-weight: 600; white-space: nowrap; }
.wordmark b { font-weight: 800; font-size: 19px; letter-spacing: -0.03em; color: var(--white); }
.wordmark b span { color: var(--orange); }
.wordmark small { font-size: 14px; color: var(--fog-200); font-weight: 600; }
.region { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.region i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(41, 173, 50, .25); }
.region.off i { background: var(--bad); box-shadow: 0 0 0 3px rgba(255, 93, 100, .25); }

/* ---------- Formularios y botones ---------- */
.field { display: grid; gap: 6px; }
.field label { font-size: 15px; font-weight: 600; color: var(--fog-200); }
input, select {
  width: 100%; font: inherit; font-size: 20px; padding: 13px 14px;
  border-radius: var(--r-sm); border: 2px solid var(--ink-600);
  background: var(--ink-950); color: var(--white);
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
input::placeholder { color: var(--fog-400); }
input:hover { border-color: var(--fog-400); }
input:focus { outline: none; border-color: var(--orange); }
input[aria-invalid="true"] { border-color: var(--bad); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font: inherit; font-size: 18px; font-weight: 700; line-height: 1.2;
  min-height: 52px; padding: 12px 22px; border: 0; border-radius: 999px;
  background: var(--orange); color: var(--ink-900); cursor: pointer; text-decoration: none;
  transition: background .2s var(--ease), transform .15s var(--ease);
}
.btn:hover { background: #ffac31; }
.btn:active { transform: translateY(1px) scale(.99); background: var(--orange-press); }
.btn[disabled] { background: var(--ink-600); color: var(--fog-400); cursor: not-allowed; }
.btn.quiet { background: var(--ink-750); color: var(--white); }
.btn.quiet:hover { background: var(--ink-700); }
.btn.link { background: none; color: var(--fog-200); min-height: 44px; padding: 8px 4px; font-weight: 600; text-decoration: underline; text-underline-offset: 4px; }
.btn.link:hover { color: var(--white); }
.btn svg { width: 18px; height: 18px; flex: none; }

.err { color: var(--bad); font-size: 15px; font-weight: 600; min-height: 1.5em; }

/* ---------- Pantalla del jugador ---------- */
.player { min-height: 100dvh; display: flex; flex-direction: column; }
.screen { flex: 1; display: flex; flex-direction: column; padding: 28px 20px 36px; gap: 24px; width: 100%; max-width: 520px; margin: 0 auto; }
.screen.center { justify-content: center; }
.hero-title { font-size: clamp(40px, 11vw, 64px); font-weight: 800; line-height: .98; letter-spacing: -0.035em; color: var(--white); }
.lede { font-size: 18px; color: var(--fog-200); max-width: 34ch; }
.join-form { display: grid; gap: 18px; margin-top: 8px; }
#pin { font-size: 34px; font-weight: 800; letter-spacing: .14em; text-align: center; padding: 14px; }
.foot-note { margin-top: auto; font-size: 14px; color: var(--fog-400); }

.status-line { display: inline-flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 700; color: var(--ok); }
.status-line i { width: 10px; height: 10px; border-radius: 50%; background: currentColor; animation: pulse 1.8s var(--ease) infinite; }
.me-name { font-size: clamp(40px, 12vw, 72px); font-weight: 800; line-height: 1; letter-spacing: -0.035em; color: var(--white); overflow-wrap: anywhere; }
.me-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; background: var(--ink-950); border-radius: var(--r-md); overflow: hidden; }
.me-meta div { background: var(--ink-800); padding: 14px 16px; display: grid; gap: 2px; min-width: 0; }
.me-meta span { font-size: 14px; color: var(--fog-400); }
.me-meta strong { font-size: 22px; color: var(--white); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.answer-grid { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px; }
.answer-grid.two { grid-template-columns: 1fr; }
.ans {
  position: relative; border: 0; border-radius: var(--r-md); color: var(--white); cursor: pointer;
  font: inherit; font-weight: 700; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 16px; text-align: left; min-height: 120px;
  transition: transform .15s var(--ease), opacity .25s var(--ease), filter .2s var(--ease);
}
.ans:hover { filter: brightness(1.08); }
.ans:active { transform: scale(.97); }
.ans .shape { width: 44px; height: 44px; flex: none; }
.ans .shape svg { width: 100%; height: 100%; display: block; }
.ans .txt { font-size: 19px; line-height: 1.25; overflow-wrap: anywhere; }
.a0 { background: var(--c0); } .a1 { background: var(--c1); } .a2 { background: var(--c2); } .a3 { background: var(--c3); }
.ans.dim { opacity: .22; }
.ans.chosen { transform: scale(.98); box-shadow: inset 0 0 0 4px var(--white); }
.q-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px 0; color: var(--fog-200); font-size: 15px; font-weight: 600; }
.q-text-mobile { padding: 6px 16px 0; font-size: 19px; font-weight: 700; color: var(--white); line-height: 1.3; }
.timebar { height: 6px; background: var(--ink-750); margin: 10px 16px 0; border-radius: 3px; overflow: hidden; }
.timebar span { display: block; height: 100%; width: 100%; background: var(--orange); transform-origin: left; }

.verdict { font-size: clamp(48px, 15vw, 88px); font-weight: 800; line-height: .95; letter-spacing: -0.04em; }
.verdict.ok { color: var(--ok); } .verdict.bad { color: var(--bad); } .verdict.none { color: var(--fog-200); }
.points { font-size: 30px; font-weight: 800; color: var(--white); }
.correct-was { font-size: 18px; color: var(--fog-200); }
.correct-was strong { color: var(--white); }

.place { font-size: clamp(96px, 34vw, 180px); font-weight: 800; line-height: .85; letter-spacing: -0.05em; color: var(--orange); }

/* ---------- Proyector (host) ---------- */
.stage { min-height: 100dvh; display: flex; flex-direction: column; }
.stage-body { flex: 1; display: flex; flex-direction: column; padding: clamp(24px, 4vw, 56px); padding-bottom: 120px; gap: clamp(20px, 3vw, 40px); width: 100%; max-width: 1600px; margin: 0 auto; }
.stage-body.center { justify-content: center; align-items: center; }

.login-panel { width: 100%; max-width: 520px; display: grid; gap: 20px; }
.login-panel h1 { font-size: clamp(36px, 5vw, 56px); font-weight: 800; line-height: 1; color: var(--white); }
.login-panel .lede { max-width: none; }

.quiz-pick { display: grid; gap: 4px; max-height: 46vh; overflow: auto; border-radius: var(--r-md); background: var(--ink-950); padding: 4px; }
.quiz-pick label { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--r-sm); background: var(--ink-800); cursor: pointer; transition: background .2s var(--ease); }
.quiz-pick label:hover { background: var(--ink-750); }
.quiz-pick input { width: 20px; height: 20px; accent-color: var(--orange); }
.quiz-pick strong { color: var(--white); font-size: 18px; }
.quiz-pick span { color: var(--fog-400); font-size: 15px; white-space: nowrap; }
.quiz-pick label:has(input:checked) { background: var(--ink-700); box-shadow: inset 4px 0 0 var(--orange); }
.quiz-pick .empty { padding: 18px; color: var(--fog-200); }
.row-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

.lobby { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(260px, .8fr); gap: clamp(24px, 4vw, 64px); align-items: center; }
.lobby-url { font-size: clamp(22px, 2.4vw, 34px); color: var(--fog-200); font-weight: 600; }
.lobby-url strong { color: var(--white); }
.pin-label { font-size: clamp(18px, 1.6vw, 24px); color: var(--fog-200); font-weight: 600; margin-top: clamp(12px, 2vw, 28px); }
.pin-big { font-size: clamp(88px, 13vw, 220px); font-weight: 800; line-height: .9; letter-spacing: .02em; color: var(--orange); }
.lobby-title { font-size: clamp(20px, 1.8vw, 28px); color: var(--white); font-weight: 700; margin-top: 18px; }
.qr { background: var(--white); border-radius: var(--r-md); padding: 16px; width: min(100%, 360px); aspect-ratio: 1; justify-self: end; }
.qr img { width: 100%; height: 100%; display: block; }

.instances-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.instances-head h2 { font-size: clamp(26px, 2.6vw, 40px); font-weight: 800; color: var(--white); }
.instances-head p { color: var(--fog-400); font-size: 16px; }
.instances { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px; background: var(--ink-950); border-radius: var(--r-md); padding: 4px; min-height: 64px; }
.instances:empty::before { content: "Esperando la primera instancia…"; color: var(--fog-400); padding: 16px; font-size: 18px; }
.inst { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--ink-800); border: 0; border-radius: var(--r-sm); color: var(--white); font: inherit; font-size: 19px; font-weight: 700; cursor: pointer; text-align: left; animation: launch .45s var(--ease) both; transition: background .2s var(--ease); min-width: 0; }
.inst:hover, .inst:focus-visible { background: #3a2a30; }
.inst:hover::after, .inst:focus-visible::after { content: "Sacar"; margin-left: auto; font-size: 14px; color: var(--bad); }
.inst i { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); flex: none; }
.inst span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.q-top { display: flex; justify-content: space-between; align-items: center; gap: 20px; font-size: clamp(18px, 1.6vw, 24px); font-weight: 600; color: var(--fog-200); }
.q-top strong { color: var(--white); }
.q-main { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: clamp(20px, 3vw, 48px); align-items: start; }
.q-title { font-size: clamp(34px, 4.4vw, 76px); font-weight: 800; line-height: 1.04; letter-spacing: -0.03em; color: var(--white); max-width: 24ch; }
.clock { font-size: clamp(72px, 8vw, 150px); font-weight: 800; line-height: .85; color: var(--orange); min-width: 2ch; text-align: right; }
.clock.low { color: var(--bad); }
.stage .timebar { margin: 0; height: 10px; border-radius: 5px; }
.stage .answer-grid { padding: 0; gap: 14px; flex: 0; }
.stage .ans { cursor: default; min-height: clamp(110px, 14vh, 170px); flex-direction: row; align-items: center; justify-content: flex-start; padding: 20px 26px; gap: 22px; }
.stage .ans:hover { filter: none; }
.stage .ans .shape { width: clamp(40px, 4vw, 64px); height: clamp(40px, 4vw, 64px); }
.stage .ans .txt { font-size: clamp(22px, 2.3vw, 38px); }
.stage .ans .tick { margin-left: auto; width: clamp(40px, 4vw, 60px); height: clamp(40px, 4vw, 60px); flex: none; }
.stage .ans.right { box-shadow: inset 0 0 0 6px var(--white); }

.bars { display: grid; gap: 14px; align-items: end; height: clamp(160px, 24vh, 280px); }
.bar-col { display: grid; grid-template-rows: auto 1fr; gap: 8px; height: 100%; }
.bar-col b { font-size: clamp(28px, 3vw, 48px); font-weight: 800; color: var(--white); }
.bar-track { display: flex; align-items: flex-end; }
.bar-fill { width: 100%; border-radius: var(--r-sm) var(--r-sm) 0 0; transform-origin: bottom; animation: grow .7s var(--ease) both; min-height: 8px; }
.bar-col.off { opacity: .3; }

.board-title { font-size: clamp(40px, 5vw, 84px); font-weight: 800; line-height: 1; letter-spacing: -0.035em; color: var(--white); }
.board { display: grid; gap: 6px; }
.board-row { display: grid; grid-template-columns: 2.4ch minmax(0, 1fr) auto; align-items: center; gap: 24px; padding: 18px 24px; border-radius: var(--r-md); background: var(--ink-800); position: relative; overflow: hidden; animation: rise .5s var(--ease) both; }
.board-row .meter { position: absolute; inset: 0 auto 0 0; background: var(--ink-700); transform-origin: left; animation: meter .9s var(--ease) both; }
.board-row > :not(.meter) { position: relative; }
.board-row .rk { font-size: clamp(28px, 2.6vw, 44px); font-weight: 800; color: var(--fog-400); }
.board-row .nm { font-size: clamp(26px, 2.6vw, 44px); font-weight: 700; color: var(--white); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-row .sc { font-size: clamp(26px, 2.6vw, 44px); font-weight: 800; color: var(--white); }
.board-row.first .meter { background: #4a3514; }
.board-row.first .rk, .board-row.first .sc { color: var(--orange); }
.board-empty { font-size: 24px; color: var(--fog-200); }

.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(10px, 1.6vw, 24px); align-items: end; max-width: 1100px; width: 100%; margin: 0 auto; }
.step { display: grid; align-content: start; gap: 6px; padding: clamp(16px, 2vw, 28px); border-radius: var(--r-md) var(--r-md) 0 0; background: var(--ink-800); animation: rise .7s var(--ease) both; min-width: 0; }
.step .n { font-size: clamp(64px, 8vw, 140px); font-weight: 800; line-height: .85; letter-spacing: -0.05em; color: var(--fog-200); }
.step h2 { font-size: clamp(22px, 2.4vw, 40px); font-weight: 800; color: var(--white); overflow-wrap: anywhere; }
.step p { font-size: clamp(18px, 1.6vw, 26px); color: var(--fog-200); font-weight: 600; }
.step.p1 { min-height: clamp(260px, 42vh, 460px); background: var(--orange); animation-delay: .5s; }
.step.p1 .n, .step.p1 h2, .step.p1 p { color: var(--ink-900); }
.step.p2 { min-height: clamp(200px, 32vh, 360px); animation-delay: .25s; }
.step.p3 { min-height: clamp(160px, 24vh, 280px); }
.final-foot { display: flex; justify-content: center; gap: 20px; flex-wrap: wrap; align-items: center; color: var(--fog-200); }

.controls { position: fixed; right: clamp(16px, 3vw, 40px); bottom: clamp(16px, 3vw, 32px); z-index: var(--z-controls); display: flex; gap: 12px; align-items: center; }
.controls .hint { color: var(--fog-400); font-size: 14px; }
.controls .btn { min-height: 60px; font-size: 20px; padding: 14px 28px; box-shadow: 0 12px 30px rgba(8, 12, 18, .55); }

/* ---------- 404 ---------- */
.notfound .code { font-size: clamp(120px, 30vw, 260px); font-weight: 800; line-height: .8; letter-spacing: -0.06em; color: var(--orange); }

/* ---------- Movimiento ---------- */
.enter > * { animation: rise .55s var(--ease) both; }
.enter > *:nth-child(2) { animation-delay: .07s; }
.enter > *:nth-child(3) { animation-delay: .14s; }
.enter > *:nth-child(4) { animation-delay: .21s; }
.enter > *:nth-child(5) { animation-delay: .28s; }
.enter > *:nth-child(6) { animation-delay: .35s; }
.answer-grid .ans { animation: rise .45s var(--ease) both; }
.answer-grid .ans:nth-child(2) { animation-delay: .06s; }
.answer-grid .ans:nth-child(3) { animation-delay: .12s; }
.answer-grid .ans:nth-child(4) { animation-delay: .18s; }
.pop { animation: pop .5s var(--ease) both; }

@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes launch { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes meter { from { transform: scaleX(0); } }
@keyframes pop { 0% { opacity: 0; transform: scale(.85); } 60% { opacity: 1; transform: scale(1.04); } 100% { transform: scale(1); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

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

@media (max-width: 900px) {
  .lobby { grid-template-columns: 1fr; }
  .qr { justify-self: start; width: min(100%, 260px); }
  .q-main { grid-template-columns: 1fr; }
  .clock { text-align: left; }
}
@media (max-width: 560px) {
  .bar { padding: 0 16px; }
  .wordmark small { display: none; }
  .region span { display: none; }
  .stage .answer-grid { grid-template-columns: 1fr; }
}

.player-main, .q-screen { flex: 1; display: flex; flex-direction: column; }
.status-line.done { color: var(--fog-200); }
.status-line.done i { animation: none; }
.contents { display: contents; }
.login-panel.wide { max-width: 720px; }
.pin-input { max-width: 200px; letter-spacing: .1em; font-weight: 700; }
.stage .answer-grid.two { grid-template-columns: 1fr 1fr; }
/* La pregunta llena la pantalla; al revelar todo cabe sobre el botón */
#question.stage-body .answer-grid { flex: 1; }
#question.stage-body .ans { min-height: clamp(110px, 16vh, 220px); }
#reveal.stage-body { gap: clamp(16px, 2.2vw, 28px); }
#reveal .q-title { font-size: clamp(28px, 3.4vw, 56px); }
#reveal .bars { height: clamp(110px, 18vh, 220px); }
#reveal .ans { min-height: clamp(84px, 11vh, 130px); }
