:root {
  color-scheme: dark;
  --page: #101d19;
  --rail: #14241e;
  --panel: #1b3027;
  --line: #345045;
  --ink: #f8f5e9;
  --muted: #b6c6b8;
  --gold: #f7d58a;
  --coral: #ffc4a8;
  --mint: #b5e2c3;
  --display: Georgia, 'Times New Roman', serif;
  --body: system-ui, -apple-system, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); font: 15px/1.5 var(--body); }
h1, h2, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
[hidden] { display: none !important; }
.skip { position: fixed; inset: 8px auto auto 8px; z-index: 5; background: var(--panel); padding: 10px; transform: translateY(-200%); }
.skip:focus { transform: none; }
.studio { min-height: 100svh; display: grid; grid-template-columns: 221px minmax(0, 1fr); }
.sidebar { background: var(--rail); border-right: 1px solid var(--line); padding: 25px 16px; display: flex; flex-direction: column; gap: 22px; }
.brand { display: inline-flex; gap: 10px; align-items: center; width: fit-content; white-space: nowrap; }
.brand strong { font: bold 23px/1 var(--display); letter-spacing: -.035em; }
.brand-mark { display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; color: var(--page); background: var(--gold); font: bold italic 23px/1 var(--display); border-radius: 11px 11px 11px 3px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 43px; padding: 8px 14px; border: 1px solid transparent; border-radius: 9px; font-size: 13px; font-weight: 750; line-height: 1.2; text-align: center; }
.button.primary { background: var(--coral); color: #2b2019; }
.button.primary:hover:not(:disabled) { background: #ffdfc8; }
.button.secondary { background: var(--rail); border-color: var(--line); }
.button.secondary:hover:not(:disabled), .library-item:hover { background: var(--panel); border-color: #648375; }
.button.new-game { background: #294639; border-color: #4f7460; color: var(--mint); justify-content: flex-start; }
.button.new-game:hover { background: #345b48; }
.sidebar h2 { margin: 12px 8px 6px; color: var(--muted); font-size: 11px; letter-spacing: .105em; text-transform: uppercase; }
.sidebar h2:not(:first-child) { margin-top: 20px; }
.library-item { display: flex; align-items: center; gap: 9px; min-height: 42px; width: 100%; padding: 7px 8px; background: transparent; border: 1px solid transparent; border-radius: 7px; text-align: left; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.library-item.current { background: var(--panel); color: var(--ink); border-color: var(--line); }
.library-item span { flex: none; color: var(--gold); }
.room-item span { color: var(--mint); }
.maker-device { margin-top: auto; margin-inline: 8px; }
.studio-main, .room-page { width: 100%; max-width: 1510px; margin-inline: auto; padding: 21px clamp(16px, 3vw, 43px) 32px; }
.room-page { max-width: 1280px; }
.topline, .room-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 19px; }
.topline > span { color: var(--muted); font-size: 13px; font-weight: 700; }
.toolbar, .room-top-actions { display: flex; align-items: center; gap: 10px; }
.save-status { color: var(--muted); font-size: 12px; }
.marquee { position: relative; isolation: isolate; overflow: hidden; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 13px 22px; min-height: 170px; padding: clamp(18px, 3.1vw, 38px); border: 1px solid #486456; border-radius: 17px; background: #203b33; }
.marquee.christmas { background: #214735; border-color: #597b62; }
.marquee-copy { min-width: 0; }
.marquee h1 { font: bold italic clamp(43px, 5.7vw, 87px)/.99 var(--display); overflow-wrap: anywhere; letter-spacing: -.062em; }
.marquee-meta { margin-bottom: 9px; color: var(--gold); font-size: 11px; font-weight: 800; letter-spacing: .135em; text-transform: uppercase; }
.marquee-actions:empty { display: none; }
.marquee-art { position: absolute; z-index: -1; inset: 0 0 0 43%; overflow: hidden; mask-image: linear-gradient(90deg, transparent, black 28%); }
.marquee-art i { position: absolute; width: 365px; height: 365px; top: -215px; right: -24px; border: 1px solid #769482; border-radius: 50%; }
.marquee-art i:nth-child(2) { top: -194px; right: -42px; }
.marquee-art i:nth-child(3) { top: -172px; right: -58px; }
.marquee-art span { position: absolute; right: 22%; top: 14%; color: var(--gold); opacity: .7; font-size: 31px; }
.marquee-art span:nth-of-type(2) { right: 8%; top: 24%; font-size: 47px; }
.marquee-art span:nth-of-type(3) { right: 33%; top: 58%; font-size: 14px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(246px, 294px); align-items: start; gap: clamp(13px, 2vw, 24px); margin-top: 24px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
h2 { font-size: 18px; letter-spacing: -.025em; line-height: 1.2; }
.section-head p, .editor-head p, .room-help { margin-top: 4px; font-size: 13px; color: var(--muted); }
.ai-button span { color: var(--gold); }
.board { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: clamp(4px, .8vw, 10px); }
.board-column { display: grid; min-width: 0; grid-template-rows: 61px repeat(5, minmax(49px, 1fr)); gap: clamp(4px, .8vw, 10px); }
.category { display: grid; place-items: center; text-align: center; min-width: 0; padding: 4px; color: var(--ink); font-size: clamp(10px, 1.06vw, 15px); line-height: 1.08; font-weight: 800; border-radius: 9px; border: 1px solid #6d8b76; background: #284937; overflow-wrap: anywhere; }
.category.tone-1 { background: #3c414f; border-color: #7f829b; }
.category.tone-2 { background: #514536; border-color: #a0886b; }
.category.tone-3 { background: #513c3e; border-color: #9a797b; }
.category.tone-4 { background: #244749; border-color: #678a8b; }
.category textarea { padding: 3px 2px; min-height: 32px; color: inherit; text-align: center; background: transparent; border-color: transparent; font-size: inherit; font-weight: inherit; line-height: 1.15; field-sizing: content; resize: none; overflow-wrap: anywhere; }
.category textarea:hover { border-color: currentColor; }
.square { position: relative; display: grid; place-items: center; min-width: 0; min-height: 51px; border: 1px solid #3b574b; border-radius: 9px; color: var(--gold); background: #20372e; font: bold clamp(19px, 2.4vw, 36px)/1 var(--display); letter-spacing: -.055em; }
button.square:hover:not(:disabled) { background: #2d4c3e; border-color: #8ba394; }
.square.selected { border-color: var(--gold); background: #3b4935; box-shadow: inset 0 0 0 1px var(--gold); }
.square.incomplete { color: #adbbae; }
.square.incomplete::after { content: ''; position: absolute; inset: 6px 6px auto auto; width: 4px; height: 4px; border-radius: 50%; background: #9fb0a1; }
.square.finished { color: #a4b7a8; background: #172b23; }
.board-footer { display: flex; gap: 6px 12px; flex-wrap: wrap; justify-content: space-between; margin-top: 12px; color: var(--muted); font-size: 12px; }
.text-button { border: 0; background: none; color: var(--mint); font-size: 13px; font-weight: 700; text-align: left; padding: 4px 0; }
.text-button:hover { text-decoration: underline; }
.panel { padding: 16px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); min-width: 0; }
.editor-head { display: flex; align-items: start; justify-content: space-between; gap: 8px; margin-bottom: 13px; }
.point-badge { flex: none; min-width: 47px; padding: 6px 9px; border-radius: 7px; background: #45513b; color: var(--gold); text-align: center; }
label { display: block; font-size: 13px; font-weight: 700; }
label + label { margin-top: 12px; }
label small { color: var(--muted); font-weight: 500; margin-left: 5px; }
textarea, input, select { width: 100%; min-width: 0; background: var(--page); border: 1px solid #4e695b; border-radius: 7px; padding: 9px; }
label :is(textarea, input, select) { margin-top: 4px; }
textarea { display: block; resize: vertical; }
textarea::placeholder, input::placeholder { color: #a6b6a9; }
.editor-move, .dialog-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 13px; }
.editor-move .button { flex: 1; padding-inline: 7px; min-height: 39px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.connection { color: var(--mint); font-size: 12px; }
.scoreboard { display: grid; gap: 6px; list-style: none; padding: 0; margin: 12px 0 0; }
.scoreboard li { display: flex; gap: 9px; align-items: center; justify-content: space-between; background: var(--rail); border: 1px solid var(--line); border-radius: 7px; padding: 6px 10px; }
.scoreboard li.my-team { border-color: var(--gold); }
.scoreboard li span, .judging span { overflow-wrap: anywhere; }
.scoreboard strong { color: var(--gold); font: bold 22px/1 var(--display); }
.buzzer { width: 100%; margin-top: 10px; min-height: 50px; }
.clue-stage { display: grid; align-content: center; min-height: 330px; padding: clamp(18px, 5vw, 70px); border: 1px solid #476758; border-radius: 14px; background: var(--panel); }
.clue-kicker { color: var(--gold); font-weight: 750; }
.clue-kicker span { margin-inline: 4px; }
.clue-text { margin-top: 13px; font: bold clamp(25px, 4.1vw, 51px)/1.15 var(--display); letter-spacing: -.026em; overflow-wrap: anywhere; }
.private-answer { padding: 10px; border: 1px solid #6f9275; border-radius: 8px; background: #284438; display: grid; gap: 4px; overflow-wrap: anywhere; }
.private-answer span { color: var(--mint); font-size: 11px; text-transform: uppercase; letter-spacing: .09em; font-weight: 750; }
.private-answer strong { font: bold 21px/1.2 var(--display); }
.buzz-status { display: flex; justify-content: space-between; gap: 7px; align-items: center; margin-top: 10px; color: var(--mint); }
.judging { display: grid; gap: 6px; margin-top: 10px; font-size: 13px; }
.judging > div { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 6px; }
.adjudicate { min-height: 42px; padding-inline: 9px; border-color: var(--line); }
.adjudicate.right { background: #345c44; color: #e0ffe6; }
.adjudicate.wrong { background: #563c3d; color: #ffe0db; }
.adjudicate:hover:not(:disabled) { border-color: var(--gold); }
.return-button { width: 100%; margin-top: 11px; }
dialog { width: min(530px, calc(100% - 26px)); max-height: calc(100svh - 26px); padding: 20px; border: 1px solid #668677; border-radius: 14px; background: var(--panel); }
dialog::backdrop { background: #07100bd9; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.dialog-head h2 { font: bold 27px/1.05 var(--display); }
.icon-button { flex: none; min-width: 40px; min-height: 40px; border-radius: 8px; border: 1px solid var(--line); background: var(--rail); font-size: 24px; line-height: 1; }
dialog p { color: var(--muted); margin-bottom: 10px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 12px; }
.form-grid label { margin: 0; }
.form-grid .wide { grid-column: 1 / -1; }
.form-message { margin: 9px 0 0; color: var(--gold); overflow-wrap: anywhere; }
.form-message:empty { display: none; }
.clipboard { position: fixed; left: -200vw; }
.loading { display: grid; justify-items: center; align-content: center; gap: 12px; min-height: 80svh; padding: 14px; text-align: center; }
.access h1 { font: bold 46px/1 var(--display); }
.toast { position: fixed; z-index: 3; inset: auto 14px 14px auto; max-width: calc(100% - 28px); padding: 11px 14px; border: 1px solid #85aa91; border-radius: 8px; color: var(--ink); background: var(--panel); box-shadow: 0 5px 22px #0007; }
.toast.error { border-color: var(--coral); }

@media (max-width: 1120px) {
  .studio { grid-template-columns: 177px minmax(0, 1fr); }
  .workspace { grid-template-columns: minmax(0, 1fr) minmax(210px, 250px); }
  .studio-main { padding-inline: 19px; }
}
@media (max-width: 930px) {
  .studio { grid-template-columns: 1fr; }
  .sidebar { padding: 11px 16px; border-right: 0; border-bottom: 1px solid var(--line); flex-direction: row; align-items: center; flex-wrap: wrap; gap: 8px 14px; }
  .sidebar nav { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
  .sidebar h2, .sidebar h2:not(:first-child) { margin: 0 3px; }
  .library-item { width: auto; }
  .sidebar .new-game { margin-left: auto; }
  .maker-device { margin-top: 0; }
}
@media (max-width: 759px) {
  .workspace { grid-template-columns: 1fr; }
  .marquee { min-height: 145px; }
  .marquee-actions { width: 100%; }
  .board-column { grid-template-rows: 52px repeat(5, minmax(48px, 1fr)); }
  .square { min-height: 48px; }
  .category { font-size: clamp(10px, 2.12vw, 14px); }
  .category textarea { padding-inline: 0; }
  .board-footer { margin-top: 9px; }
  .clue-stage { min-height: 210px; }
  input, select, textarea { font-size: 16px; }
  .category textarea { font-size: inherit; }
}
@media (max-width: 420px) {
  .studio-main, .room-page { padding-inline: 12px; }
  .brand strong { font-size: 20px; }
  .button { padding-inline: 10px; }
  .room-top-actions { gap: 7px; }
  .room-top-actions .text-button { font-size: 12px; }
  .marquee { padding: 16px; }
  .marquee-art { inset-inline-start: 17%; opacity: .65; }
  .board-column { grid-template-rows: 48px repeat(5, minmax(45px, 1fr)); }
  .square { min-height: 45px; }
}
