@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,600;12..96,800&family=Work+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500;600&display=swap');
:root {
  --excel: #217346;
  --excel-dark: #185c37;
  --excel-soft: #e9f5ee;
  --ms-blue: #0078d4;
  --ms-blue-dark: #106ebe;
  --bg: #f3f2f1;
  --surface: #ffffff;
  --surface-2: #f0f8f4;
  --surface-3: #c5e0d1;
  --ink: #201f1e;
  --ink-soft: #484644;
  --ink-faint: #8a8886;
  --accent: #217346;
  --accent-ink: #0b3d22;
  --accent-soft: #e9f5ee;
  --good: #217346;
  --bad: #d13438;
  --gold: #ffb900;
  --shadow: 0 18px 40px -22px rgba(33, 115, 70, 0.45);
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: 'Segoe UI', 'Work Sans', sans-serif; }
body {
  min-height: 100vh;
  background-color: #f3f2f1;
  background-image:
    linear-gradient(rgba(33,115,70,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,120,212,.05) 1px, transparent 1px);
  background-size: 32px 32px;
}
button, .btn { font-family: 'Segoe UI', 'Bricolage Grotesque', sans-serif; }
.wrap { width: min(1100px, 100%); margin: 0 auto; padding: 20px; }
.eyebrow { font-family: 'Segoe UI', sans-serif; font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--excel); font-weight: 700; }
h1, h2 { font-family: 'Segoe UI', 'Bricolage Grotesque', sans-serif; margin: 6px 0; }
.card {
  background: var(--surface);
  border: 1px solid var(--surface-3);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  border-top: 4px solid var(--excel);
}
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 18px; border-radius: 4px; border: 0; background: var(--excel); color: #fff; font-weight: 700; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--excel-dark); }
.btn.ghost { background: transparent; color: var(--ms-blue); border: 1px solid var(--ms-blue); }
.btn.ghost:hover { background: #e6f2fb; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.input { width: 100%; min-height: 44px; padding: 10px 14px; border-radius: 4px; border: 1px solid #8a8886; font-size: 1rem; font-family: inherit; }
.input:focus { outline: 2px solid var(--ms-blue); border-color: var(--ms-blue); }
.err { color: var(--bad); font-family: 'IBM Plex Mono', monospace; font-size: .8rem; min-height: 1.2em; }
.hide { display: none !important; }
.zodiac-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (min-width: 720px) { .zodiac-grid { grid-template-columns: repeat(6, 1fr); } }
.zodiac-opt { border: 0; background: var(--surface-2); border-radius: 8px; padding: 8px; cursor: pointer; min-height: 88px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.zodiac-opt svg { width: 56px; height: 56px; }
.zodiac-opt .lbl { font-size: .78rem; font-weight: 600; }
.zodiac-opt[aria-pressed="true"] { outline: 3px solid var(--excel); background: var(--excel-soft); }
.timer { height: 10px; background: #d4e8dc; border-radius: 99px; overflow: hidden; }
.timer > span { display: block; height: 100%; background: linear-gradient(90deg, var(--excel), var(--ms-blue)); width: 100%; transform-origin: left; }
.opt {
  display: flex; align-items: flex-start; gap: 12px; width: 100%; min-height: 56px;
  text-align: left; padding: 12px 14px; border-radius: 10px;
  border: 2px solid #c8c6c4; background: #fff; margin: 10px 0;
  cursor: pointer; font-size: 1.05rem; line-height: 1.45; color: #201f1e;
}
.opt .opt-letter {
  flex: 0 0 36px; height: 36px; border-radius: 8px; background: #0078d4; color: #fff;
  font-weight: 800; display: inline-flex; align-items: center; justify-content: center;
}
.opt .opt-text { flex: 1; font-weight: 600; }
.opt .opt-tag {
  align-self: center; font-size: .75rem; font-weight: 800; color: #185c37;
  background: #e9f5ee; border-radius: 999px; padding: 4px 8px; white-space: nowrap;
}
.opt .opt-tag.bad { color: #a4262c; background: #fde7e9; }
.opt.picked { border-color: #0078d4; background: #deecf9; }
.opt.picked .opt-letter { background: #106ebe; }
.opt.good { border-color: #107c10; background: #dff6dd; }
.opt.good .opt-letter { background: #107c10; }
.opt.bad { border-color: #d13438; background: #fde7e9; }
.opt.bad .opt-letter { background: #d13438; }
.opt:disabled { cursor: default; }
.q-card {
  background: #fff; border: 2px solid #217346; border-radius: 12px;
  padding: 16px 18px; margin: 12px 0 8px;
}
.q-card h2 { margin: 0; font-size: clamp(1.2rem, 3vw, 1.7rem); line-height: 1.35; color: #0b3d22; }
.scenario-card {
  background: #fff8e1; border-left: 6px solid #ffb900; border-radius: 8px;
  padding: 12px 14px; line-height: 1.55; color: #201f1e;
}
.result-banner {
  display: grid; gap: 4px; padding: 14px 16px; border-radius: 12px; margin: 14px 0;
}
.result-banner strong { font-size: 1.25rem; }
.result-banner.is-good { background: #dff6dd; border: 2px solid #107c10; color: #0b5a08; }
.result-banner.is-bad { background: #fde7e9; border: 2px solid #d13438; color: #a4262c; }
.result-banner p { margin: 6px 0 0; color: #323130; font-weight: 500; }
.rank-panel {
  margin-top: 16px; background: #f3f2f1; border-radius: 12px; padding: 12px 14px;
  border: 1px solid #c8c6c4;
}
.rank-panel h3 { margin: 0 0 10px; color: #185c37; }
.rank-row {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; margin: 6px 0;
  background: #fff; border-radius: 10px;
}
.rank-row .rank-name { flex: 1; font-weight: 600; }
.rank-row.me { outline: 3px solid #0078d4; background: #deecf9; }
.rank-row svg { width: 32px; height: 32px; }
.mcq-click { margin-top: 4px; }
.players { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: flex; align-items: center; gap: 8px; background: var(--excel-soft); border-radius: 999px; padding: 4px 10px 4px 4px; }
.chip svg { width: 32px; height: 32px; }
.top3 { display: grid; grid-template-columns: 1fr 1.2fr 1fr; gap: 10px; align-items: end; }
.podium { text-align: center; background: var(--surface-2); border-radius: 8px; padding: 12px; }
.podium.first { background: #fff4ce; min-height: 160px; }
.bar { display: flex; gap: 6px; align-items: flex-end; height: 80px; }
.bar i { flex: 1; background: var(--excel-soft); border-radius: 8px 8px 0 0; display: block; }
code.room { font-family: 'IBM Plex Mono', 'Consolas', monospace; font-size: clamp(2rem, 6vw, 3.4rem); letter-spacing: .22em; color: var(--excel-dark); font-weight: 700; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.muted { color: var(--ink-soft); }
.day1, .day2, .day3 { --accent: #217346; }

.ms-bar {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(90deg, #217346 0%, #0f7b4c 42%, #0078d4 100%);
  color: #fff; padding: 10px 20px; margin: -20px -20px 18px;
  border-radius: 8px 8px 0 0; font-weight: 700;
}
.ms-squares { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; width: 22px; height: 22px; }
.ms-squares i { display: block; }
.ms-squares i:nth-child(1) { background: #f25022; }
.ms-squares i:nth-child(2) { background: #7fba00; }
.ms-squares i:nth-child(3) { background: #00a4ef; }
.ms-squares i:nth-child(4) { background: #ffb900; }

.lobby-board {
  display: grid;
  grid-template-columns: 1fr minmax(240px, 380px);
  gap: 28px;
  align-items: center;
}
@media (max-width: 800px) {
  .lobby-board { grid-template-columns: 1fr; }
}
.qr-panel {
  background: #fff;
  border: 3px solid var(--excel);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  box-shadow: 0 12px 32px rgba(33,115,70,.18);
}
.qr-panel img, .qr-panel svg { width: min(360px, 100%); height: auto; display: block; margin: 0 auto; }
.qr-panel .qr-hint { margin: 12px 0 0; font-weight: 700; color: var(--excel-dark); font-size: 1.05rem; }
.qr-panel .qr-sub { margin: 4px 0 0; font-size: .9rem; color: var(--ink-soft); }
.play-stage.hide-on-lobby { display: none; }
body.is-lobby .play-stage { display: none; }
body.is-playing .qr-panel { max-width: 180px; padding: 8px; }
body.is-playing .qr-panel img { width: 140px; }
body.is-playing .lobby-board { grid-template-columns: 1fr 180px; }
.dept-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 560px) { .dept-grid { grid-template-columns: 1fr 1fr; } }
.dept-opt {
  min-height: 48px; text-align: left; padding: 10px 14px;
  border: 1px solid var(--surface-3); border-radius: 8px; background: #fff;
  cursor: pointer; font-weight: 600;
}
.dept-opt[aria-pressed="true"] { outline: 3px solid var(--ms-blue); background: #e6f2fb; }
.part-banner {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 8px; color: #fff; font-weight: 700; margin: 12px 0;
}
.part-steps { font-family: 'IBM Plex Mono', monospace; font-size: .85rem; color: var(--ink-faint); }
.prompt-box {
  position: sticky; bottom: 0; background: var(--surface);
  padding: 10px 0 4px; margin-top: 8px;
}
.prompt-box textarea {
  width: 100%; min-height: 96px; resize: vertical; font-size: 1rem;
  padding: 12px; border-radius: 8px; border: 1px solid #8a8886;
  font-family: inherit; line-height: 1.45;
}
.prompt-box textarea:focus { outline: 2px solid var(--ms-blue); border-color: var(--ms-blue); }
.assembled {
  white-space: pre-wrap; background: var(--surface-2); border-radius: 8px;
  padding: 12px; font-size: .92rem; line-height: 1.5;
}
.score-grid { display: grid; gap: 8px; margin: 12px 0; }
.score-row { display: flex; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); }
.warn { color: var(--bad); font-weight: 600; }
#qText { white-space: pre-wrap; }
.dnd-pool, .dnd-slots { display: grid; gap: 8px; margin: 10px 0; }
.dnd-slots { grid-template-columns: 1fr; }
@media (min-width: 640px) { .dnd-slots { grid-template-columns: 1fr 1fr; } }
.dnd-slot {
  min-height: 88px; border: 2px dashed #c8c6c4; border-radius: 10px; padding: 10px;
  background: #faf9f8;
}
.dnd-slot.over { background: #fff4ce; }
.dnd-slot.good { border-style: solid; background: #dff6dd; }
.dnd-slot.bad { border-style: solid; background: #fde7e9; }
.dnd-slot .slot-lbl { font-size: .78rem; font-weight: 700; margin-bottom: 6px; }
.dnd-card {
  display: block; width: 100%; text-align: left; padding: 10px 12px; border-radius: 8px;
  border: 1px solid #c8c6c4; background: #fff; cursor: grab; font-size: .95rem; font-weight: 600;
}
.dnd-card[aria-pressed="true"] { outline: 3px solid var(--ms-blue); background: #deecf9; }
.dnd-slot .dnd-card { margin-top: 4px; cursor: default; }
.fill-answer { margin-top: 10px; padding: 10px 12px; border-radius: 8px; background: #dff6dd; color: #0b5a08; font-weight: 600; }

