:root {
  --navy: #142833;
  --slate: #325563;
  --accent: #3c6e8c;
  --accent-2: #5389a8;
  --sky: #7fb0cc;
  --bg: #f6f7f5;
  --mist: #e9eef1;
  --line: #d6dfe4;
  --muted: #5f7480;
  --ok: #2f7a55;
  --ok-bg: #e3f2ea;
  --bad: #a4452c;
  --bad-bg: #f8e6e0;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--navy);
  font-family: "IBM Plex Sans", Arial, sans-serif;
  font-size: 18px;
  line-height: 1.45;
}
h1, h2, h3 { font-family: "DM Serif Display", Georgia, serif; font-weight: 400; margin: 0; line-height: 1.15; }
.mono { font-family: "JetBrains Mono", "Courier New", monospace; }
.eyebrow {
  font-family: "JetBrains Mono", "Courier New", monospace;
  font-size: 13px; letter-spacing: 3px; text-transform: uppercase; color: var(--accent);
}
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* Barra superior */
.topbar {
  background: var(--navy); color: var(--bg);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 20px; border-bottom: 6px solid var(--accent-2);
}
.topbar img { height: 34px; display: block; }
.topbar .who { font-size: 14px; color: #b9ceda; text-align: right; }

/* Botones y campos */
button {
  font: inherit; cursor: pointer; border: 0; border-radius: 10px;
  padding: 12px 18px; background: var(--accent); color: #fff; font-weight: 600;
}
button:hover { background: var(--slate); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.ghost { background: transparent; color: var(--accent); border: 1px solid var(--line); }
button.ghost:hover { background: var(--mist); }
button.danger { background: transparent; color: var(--bad); border: 1px solid var(--bad); }
input, select, textarea {
  font: inherit; width: 100%; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; color: var(--navy);
}
label { display: block; font-weight: 600; margin: 14px 0 6px; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }

/* Estudiante */
.wrap { max-width: 640px; margin: 0 auto; padding: 20px 16px 48px; }
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px;
}
.card + .card { margin-top: 16px; }
.prompt { font-size: 22px; font-weight: 600; margin: 8px 0 18px; }
.options { display: grid; gap: 10px; }
.option {
  text-align: left; background: var(--mist); color: var(--navy); font-weight: 500;
  border: 2px solid transparent; padding: 16px; font-size: 18px;
}
.option:hover { background: #dde6eb; }
.option.selected { border-color: var(--accent); background: #dbe8f0; }
.option.correct { border-color: var(--ok); background: var(--ok-bg); }
.option.wrong { border-color: var(--bad); background: var(--bad-bg); }
.option:disabled { opacity: .7; }
.option.correct:disabled, .option.wrong:disabled, .option.selected:disabled { opacity: 1; }
.order-pool, .order-picked { display: grid; gap: 8px; }
.order-picked { margin-bottom: 14px; }
.order-picked .option { background: #dbe8f0; border-color: var(--accent); }
.order-picked .num { font-family: "JetBrains Mono", monospace; color: var(--accent); margin-right: 8px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.status { margin-top: 14px; font-weight: 600; }
.status.ok { color: var(--ok); }
.status.bad { color: var(--bad); }
.feedback { border-radius: 10px; padding: 14px 16px; margin-top: 16px; }
.feedback.ok { background: var(--ok-bg); }
.feedback.bad { background: var(--bad-bg); }
.timer { font-family: "JetBrains Mono", monospace; font-size: 15px; color: var(--accent); }
.waiting { text-align: center; padding: 36px 18px; }
.waiting h2 { font-size: 30px; margin-bottom: 8px; }
.pill {
  display: inline-block; padding: 4px 12px; border-radius: 999px; background: var(--mist);
  font-size: 14px; color: var(--slate);
}
.squads { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.squads button { background: var(--mist); color: var(--navy); border: 2px solid transparent; }
.squads button.selected { border-color: var(--accent); background: #dbe8f0; }

/* Presentador */
.stage { display: grid; grid-template-columns: 320px 1fr; min-height: calc(100vh - 64px); }
.sidebar { background: #fff; border-right: 1px solid var(--line); padding: 16px; overflow-y: auto; max-height: calc(100vh - 64px); }
.sidebar h3 { font-family: "JetBrains Mono", monospace; font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: var(--accent); margin: 18px 0 8px; }
.sidebar h3:first-child { margin-top: 0; }
.act {
  display: block; width: 100%; text-align: left; background: transparent; color: var(--navy);
  font-weight: 400; font-size: 15px; padding: 9px 10px; border-radius: 8px; border: 1px solid transparent;
}
.act:hover { background: var(--mist); }
.act.current { background: var(--navy); color: #fff; }
.act .tag { font-family: "JetBrains Mono", monospace; font-size: 11px; opacity: .75; margin-right: 6px; text-transform: uppercase; }
.act .count { float: right; font-size: 12px; opacity: .7; }
.main { padding: 28px 36px; display: flex; flex-direction: column; gap: 20px; }
.join-banner {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  background: var(--navy); color: #fff; border-radius: var(--radius); padding: 18px 24px;
}
.join-banner .url { font-family: "JetBrains Mono", monospace; font-size: 26px; color: var(--sky); word-break: break-all; }
.big-prompt { font-family: "DM Serif Display", Georgia, serif; font-size: 44px; line-height: 1.15; }
.controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.bars { display: grid; gap: 12px; }
.bar { display: grid; grid-template-columns: 1fr 70px; gap: 12px; align-items: center; }
.bar .track { position: relative; background: var(--mist); border-radius: 10px; min-height: 52px; overflow: hidden; border: 2px solid transparent; }
.bar .fill { position: absolute; inset: 0 auto 0 0; background: #c9dbe6; transition: width .4s ease; }
.bar .label { position: relative; padding: 13px 16px; font-size: 20px; }
.bar.is-correct .track { border-color: var(--ok); }
.bar.is-correct .fill { background: #bfe0cd; }
.bar .pct { font-family: "JetBrains Mono", monospace; font-size: 20px; text-align: right; }
.meta { display: flex; gap: 24px; flex-wrap: wrap; color: var(--muted); font-size: 16px; }
.meta b { color: var(--navy); font-size: 22px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.tile .n { font-family: "DM Serif Display", Georgia, serif; font-size: 40px; color: var(--accent); }
.answers { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.answers .tile { font-size: 17px; }
.cloud { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; justify-content: center; padding: 24px; background: #fff; border-radius: var(--radius); border: 1px solid var(--line); }
.cloud span { font-family: "DM Serif Display", Georgia, serif; color: var(--slate); }
.explain { background: var(--ok-bg); border-radius: var(--radius); padding: 16px 20px; font-size: 20px; }
.order-answer { counter-reset: n; display: grid; gap: 8px; font-size: 20px; }
.order-answer li { background: var(--ok-bg); border-radius: 10px; padding: 10px 14px; list-style: none; }
.people { display: flex; flex-wrap: wrap; gap: 6px; }
.people .pill button { background: none; color: var(--bad); padding: 0 0 0 6px; font-weight: 400; }
details summary { cursor: pointer; color: var(--accent); font-weight: 600; }

@media (max-width: 900px) {
  .stage { grid-template-columns: 1fr; }
  .sidebar { max-height: 260px; border-right: 0; border-bottom: 1px solid var(--line); }
  .main { padding: 20px 16px; }
  .big-prompt { font-size: 30px; }
  .grid3 { grid-template-columns: 1fr; }
}
