:root {
  color-scheme: light;
  --ink: #151b30;
  --slate: #535d72;
  --line: #dce1eb;
  --paper: #f1f3f7;
  --white: #fff;
  --navy: #111629;
  --navy-2: #1c2541;
  --blue: #293aa8;
  --blue-light: #edf0ff;
  --lime: #dcfa80;
  --green: #185c40;
  --green-light: #def6e8;
  --red: #a72839;
  --radius: 19px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
button, input, select { font: inherit; }
button, a, summary, select { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button, summary, select { cursor: pointer; }
button:disabled { cursor: default; }
button, input, select, a, summary { outline-offset: 3px; }
:focus-visible { outline: 3px solid #5868ec; }
h1, h2, h3, p, figure { margin: 0; }
p { line-height: 1.52; }
img { display: block; max-width: 100%; }
.pre { white-space: pre-line; }
.muted { color: var(--slate); }
.small { font-size: .86rem; }
.invalid, .form-error { color: var(--red); }
.form-error { font-size: .88rem; }
.form-error:not(:empty) { margin: 10px 0; }
.narrow { width: min(calc(100% - 32px), 620px); margin: 0 auto; }
.space-top { margin-top: 32px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  clip-path: inset(50%);
  white-space: nowrap;
  overflow: hidden;
}

.top { background: var(--navy); color: var(--white); }
.top-inner {
  width: min(calc(100% - 64px), 1280px);
  min-height: 68px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 850; letter-spacing: -.045em; font-size: 1.23rem; white-space: nowrap; }
.bang, .loading-mark span, .hero h1 span { color: var(--lime); }
.brand-mark { display: grid; grid-template-columns: repeat(2, 9px); align-items: center; gap: 2px; transform: rotate(-15deg); }
.brand-mark i { display: block; height: 12px; border-radius: 2px; background: var(--lime); }
.brand-mark i + i { transform: translateY(4px); background: #a6a9fb; }
.top-actions { display: flex; align-items: center; gap: 22px; }
.nav-label, .quiet-link { color: #e0e4f4; font-size: .9rem; font-weight: 650; }
.quiet-link:hover { color: var(--lime); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 730;
  line-height: 1.15;
  text-align: center;
  transition: background-color .15s ease, border-color .15s ease;
}
.primary { background: var(--lime); border-color: var(--lime); color: #20281a; }
.primary:hover { background: #cbee5f; border-color: #cbee5f; }
.primary:disabled { background: #e4e8de; border-color: #e4e8de; color: #5b6658; }
.secondary { background: var(--blue-light); color: #243486; border-color: #dbe0fb; }
.secondary:hover { background: #e0e6ff; }
.secondary:disabled { opacity: .55; }
.outline { border-color: #a6acc35e; color: var(--white); background: #ffffff0c; }
.outline:hover { background: #ffffff19; }
.button.small { min-height: 38px; padding: 8px 12px; }
.text-link { border: 0; padding: 0; background: none; color: var(--blue); font-weight: 700; text-align: left; }
.text-link:hover { text-decoration: underline; text-underline-offset: .23em; }

.home-page { min-height: 100svh; background: #101527; color: #f8f9ff; }
.home-page .top { border-bottom: 1px solid #323a55; }
.hero-wrap { width: min(calc(100% - 64px), 1200px); margin: 0 auto; padding: 46px 0 56px; }
.hero { display: grid; grid-template-columns: 1fr 1fr; min-height: 490px; border: 1px solid #393f61; border-radius: 24px; overflow: hidden; background: #1b2240; }
.hero-content { min-width: 0; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; padding: clamp(30px, 4vw, 65px); }
.eyebrow { font-size: .74rem; letter-spacing: .075em; text-transform: uppercase; font-weight: 850; line-height: 1.3; color: var(--blue); }
.hero .eyebrow { color: #c1c8ff; }
.hero h1 { margin: 12px 0 16px; font-size: clamp(3.65rem, 7.65vw, 7.2rem); line-height: .96; letter-spacing: -.059em; font-weight: 875; }
.hero-lead { max-width: 31ch; color: #e1e5fb; font-size: clamp(1rem, 1.55vw, 1.25rem); }
.hero-cta { margin-top: 26px; min-height: 51px; padding: 13px 17px; }
.join-note { margin-top: 18px; color: #c2c9e3; font-size: .91rem; }
.hero-visual { min-width: 0; overflow: hidden; background: #141c31; position: relative; }
.hero-visual img { width: 100%; height: 100%; position: absolute; inset: 0; object-fit: cover; object-position: 51% 51%; }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); border-block: 1px solid #343d58; margin-top: 24px; }
.hero-stats div { display: flex; gap: 12px; align-items: baseline; padding: 22px 24px; }
.hero-stats div + div { border-left: 1px solid #343d58; }
.hero-stats strong { color: var(--lime); font-size: 1.75rem; letter-spacing: -.05em; white-space: nowrap; }
.hero-stats small { font-size: .8rem; letter-spacing: 0; }
.hero-stats span { color: #d6ddfa; font-size: .9rem; }
.login { margin-top: 24px; width: 100%; }
.login > label { display: block; color: #e0e5fa; font-size: .9rem; margin-bottom: 8px; font-weight: 660; }
.login-row { display: flex; align-items: stretch; gap: 8px; }
.login input { background: #10162e; border-color: #525d85; color: #f6f7ff; min-width: 0; }
.login .form-error { color: #ffbec6; }
.loading { padding: 90px 24px; min-height: 100svh; background: var(--navy); color: var(--white); text-align: center; }
.loading-mark { font-size: 2.6rem; font-weight: 870; letter-spacing: -.065em; }
.loading p { color: #d1d7ef; margin-top: 8px; }

.workspace { width: min(calc(100% - 64px), 1240px); margin: 0 auto; padding: 32px 0 56px; }
.page-heading { margin-bottom: 24px; }
.page-heading h1, .room-banner h1 { font-size: clamp(2rem, 4.1vw, 3.4rem); letter-spacing: -.055em; font-weight: 850; line-height: 1.09; margin: 6px 0 8px; }
.page-heading > p:last-child { color: var(--slate); }
.builder { display: grid; grid-template-columns: minmax(0, .83fr) minmax(0, 1.17fr); align-items: start; gap: 16px; }
.setup { display: grid; gap: 16px; }
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.card h2 { font-size: 1.22rem; letter-spacing: -.025em; margin-bottom: 13px; }
.card h1 { margin-bottom: 12px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.section-head h2 { margin: 0; }
.presets { display: grid; gap: 7px; margin-bottom: 14px; }
.preset { display: flex; justify-content: space-between; gap: 8px; align-items: center; width: 100%; border: 1px solid var(--line); text-align: left; border-radius: 10px; padding: 11px 12px; background: #f7f8fb; color: var(--ink); font-weight: 650; }
.preset strong { color: var(--slate); font-size: .86rem; white-space: nowrap; }
.preset[aria-pressed="true"] { border-color: #7279ce; background: #eeefff; color: #253484; }
.preset[aria-pressed="true"] strong { color: #253484; }
.input-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.field { display: grid; gap: 7px; font-size: .92rem; font-weight: 700; min-width: 0; }
input, select { width: 100%; min-height: 44px; min-width: 0; padding: 8px 10px; border: 1px solid #b9c3d4; border-radius: 8px; background: var(--white); color: var(--ink); }
input:focus, select:focus { border-color: #5969d4; }
.round-summary { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 5px 12px; color: var(--slate); font-size: .85rem; margin: 4px 0 10px; }
.edit-list, .order-list, .own-breakdown, .room-plan ol { list-style: none; margin: 0; padding: 0; }
.edit-list li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 74px max-content;
  align-items: center;
  gap: 8px;
  padding: 9px 0;
  border-top: 1px solid #e3e6ef;
}
.round-number, .order-index { display: grid; width: 27px; height: 27px; place-items: center; border-radius: 8px; background: #edf0ff; color: #2a3b96; font-size: .81rem; font-weight: 850; }
.round-title { min-width: 0; display: grid; gap: 2px; text-align: left; border: 0; background: transparent; color: var(--ink); padding: 0; }
.round-title:hover strong { color: var(--blue); text-decoration: underline; }
.round-title strong { font-size: .93rem; overflow-wrap: anywhere; }
.round-title span { color: var(--slate); font-size: .79rem; }
.round-duration select { min-height: 35px; padding: 4px 6px; font-size: .82rem; }
.edit-actions { display: flex; gap: 3px; }
.icon { width: 32px; height: 34px; border-radius: 8px; border: 1px solid #dfe4ef; background: #f7f8fb; color: #313b55; font-size: 1rem; font-weight: 800; }
.icon:hover { background: #edf0ff; }
.icon:disabled { color: #adb5c4; }
.create-button { min-height: 48px; width: 100%; margin-top: 14px; }
.recent { margin-top: 16px; }
.recent-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); font-weight: 650; }
.recent-row:hover { color: var(--blue); }
.recent-row span + span { color: var(--slate); font-size: .82rem; text-align: right; }

.room-banner { min-height: 154px; border-radius: var(--radius); background: linear-gradient(120deg, var(--navy), #293658); color: var(--white); padding: 25px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.room-banner .eyebrow, .projection-head .eyebrow { color: var(--lime); }
.room-banner p:last-child { color: #d8e0fb; }
.room-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.room-body { display: grid; grid-template-columns: minmax(0, 1.22fr) minmax(290px, .78fr); gap: 16px; margin-top: 16px; }
.room-heading { font-size: 1.23rem; margin: 3px 0 11px; }
.table-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.table-card { background: var(--white); border: 1px solid var(--line); border-radius: 13px; color: var(--ink); padding: 13px; min-width: 0; }
.table-card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 7px; }
.table-card h3 { font-size: 1rem; font-weight: 850; }
.tag { border-radius: 5px; background: #eef0f5; color: #46526a; padding: 5px 7px; font-size: .74rem; font-weight: 750; }
.tag.good { background: var(--green-light); color: var(--green); }
.table-links { margin-top: 9px; display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: .83rem; }
.table-links button { min-height: 30px; }
.room-plan .muted { margin-bottom: 11px; font-size: .92rem; }
.room-plan li { display: flex; justify-content: space-between; align-items: start; gap: 9px; padding: 10px 3px; border-top: 1px solid var(--line); font-size: .9rem; }
.room-plan li.current { background: #e8ecff; color: #27388a; font-weight: 750; }
.room-plan li span:last-child { white-space: nowrap; color: var(--slate); }
.clock { font-variant-numeric: tabular-nums; font-weight: 900; font-size: clamp(2.4rem, 5vw, 4.65rem); letter-spacing: -.065em; line-height: 1; white-space: nowrap; }
.clock.urgent { color: #b2263e; }
.room-banner .clock.urgent, .projector-page .clock.urgent { color: #ffc3ce; }
.results-card { margin-top: 16px; }
.table-wrap { overflow-x: auto; }
.ranking { width: 100%; border-collapse: collapse; text-align: left; font-variant-numeric: tabular-nums; }
.ranking th, .ranking td { padding: 9px 10px; border-bottom: 1px solid #e1e5ed; white-space: nowrap; }
.ranking thead th { color: var(--slate); font-size: .78rem; font-weight: 750; }
.ranking th:nth-last-child(-n + 2), .ranking td:nth-last-child(-n + 2) { text-align: right; }
.ranking .rank { display: inline-grid; height: 27px; min-width: 27px; padding: 0 4px; place-items: center; background: #eef1f9; border-radius: 8px; font-size: .85rem; font-weight: 850; }
.ranking .rank.first { background: var(--lime); color: #1e2c13; }
.ranking .points { font-weight: 870; }
.ranking .own-team { background: #eff1ff; }
.breakdown td, .breakdown th:not(:first-child) { text-align: right; }
.debrief { border-top: 1px solid var(--line); color: var(--slate); margin-top: 15px; padding-top: 13px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 13px; }
.gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 9px; }
.gallery figcaption { margin-top: 6px; color: var(--slate); font-size: .83rem; }
.solution { padding: 10px 0; border-top: 1px solid var(--line); }
.solution summary { font-weight: 720; }
.solution p { margin: 7px 0 4px; color: var(--slate); }

.projector-page { background: var(--navy); color: var(--white); min-height: 100svh; }
.projector-page .top { border-bottom: 1px solid #354057; }
.projector { width: min(calc(100% - 56px), 1380px); margin: 0 auto; padding: 20px 0 32px; }
.projection-head { text-align: center; padding: 5px 0 17px; }
.projection-head h1 { font-size: clamp(2rem, 4.8vw, 4rem); letter-spacing: -.05em; margin: 5px 0; }
.projection-head .clock { font-size: clamp(3.1rem, 7vw, 7rem); color: var(--lime); }
.projection-head p:last-child { color: #d7def6; margin-top: 4px; }
.projection-tables { display: grid; grid-template-columns: repeat(5, 1fr); gap: 9px; }
.projection-tables .table-card { padding: 15px; }
.projector-board { margin: auto; width: min(980px, 100%); background: var(--white); color: var(--ink); border-radius: 17px; padding: 8px 14px; }
.projector-board.split { width: min(1160px, 100%); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.projector-board.split > div + div { border-left: 1px solid var(--line); padding-left: 10px; }
.projector-board .ranking th, .projector-board .ranking td { padding-block: 5px; }

.player-page .top { position: sticky; z-index: 2; top: 0; }
.player-page .top-inner { width: min(calc(100% - 32px), 620px); min-height: 55px; }
.player-page .nav-label { text-align: right; }
.player-shell { padding: 14px 0 32px; }
.player-timer { position: sticky; top: 55px; z-index: 1; display: grid; grid-template-columns: 1fr max-content; align-items: end; gap: 8px 12px; padding: 10px 4px 9px; background: var(--paper); }
.player-timer .clock { font-size: 2.65rem; }
.timer-kind { font-size: .85rem; color: var(--slate); margin-top: 3px; }
progress { appearance: none; grid-column: 1 / -1; height: 6px; width: 100%; border: 0; border-radius: 6px; background: #dce1ef; overflow: hidden; }
progress::-webkit-progress-bar { background: #dce1ef; }
progress::-webkit-progress-value { background: #4b5cbe; }
progress::-moz-progress-bar { background: #4b5cbe; }
.task-card { margin-bottom: 12px; }
.task-card h1 { font-size: clamp(1.55rem, 5.1vw, 2.4rem); letter-spacing: -.04em; line-height: 1.13; }
.task-card .eyebrow { margin-bottom: 7px; }
.task-prompt { color: #28304a; margin-bottom: 15px; }
.entry, .waiting { margin-top: 15px; }
.entry .button, .waiting .team-note, .waiting p + p { margin-top: 17px; }
.waiting .clock { display: inline-block; padding-top: 14px; }
.team-note, .accepted { padding: 13px 14px; background: #eef1fa; border-radius: 10px; word-break: normal; color: #344261; }
.accepted { background: var(--green-light); color: #16472e; }
.accepted strong { font-weight: 850; }
.accepted p { margin-top: 3px; }
.clues { background: #edf0ff; border: 1px solid #dfe3ff; border-radius: 11px; padding: 12px; margin-bottom: 14px; }
.clues h2 { margin-bottom: 8px; font-size: 1rem; }
.clues p { display: flex; align-items: flex-start; gap: 8px; margin-top: 6px; }
.clue-number { display: inline-grid; flex: 0 0 23px; width: 23px; height: 23px; place-items: center; font-size: .8rem; font-weight: 850; color: #fff; background: #3c4da7; border-radius: 6px; }
.player-page fieldset { min-width: 0; border: 0; margin: 0; padding: 0; }
.player-page fieldset:disabled { opacity: .62; }
.choices, .matches { display: grid; gap: 8px; }
.choice { position: relative; display: flex; gap: 10px; align-items: center; min-height: 48px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: #f8f9fc; cursor: pointer; }
.choice:has(input:checked) { border-color: #7380d9; background: #ebefff; color: #1e2c76; }
.choice:has(input:focus-visible) { outline: 3px solid #5868ec; outline-offset: 2px; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice-letter { display: inline-grid; place-items: center; flex: 0 0 30px; height: 30px; border-radius: 8px; background: #edf0ff; color: #31429a; font-weight: 850; }
.choice:has(input:checked) .choice-letter { background: #3649ac; color: #fff; }
.answer-label { font-size: .91rem; color: var(--slate); margin-bottom: 8px; }
.order-list li { display: grid; grid-template-columns: 27px minmax(0, 1fr) 81px; gap: 7px; align-items: center; border: 1px solid var(--line); border-radius: 9px; padding: 6px 8px; margin-bottom: 6px; font-size: .91rem; }
.order-list li div { display: flex; gap: 5px; }
.order-list .icon { width: 38px; height: 39px; }
.answer-text input { font-size: 1rem; }
.submit-answer { width: 100%; min-height: 48px; margin-top: 14px; }
.route { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; width: min(100%, 390px); margin-inline: auto; touch-action: none; user-select: none; }
.route-cell { aspect-ratio: 1; padding: 0; min-width: 0; display: grid; align-content: center; justify-items: center; gap: 1px; border: 1px solid #d1d8e8; border-radius: 7px; background: #f1f3f9; color: #364260; }
.route-cell small { font-size: .57rem; }
.route-cell.terminal { border-color: #7182d9; background: #e7ebff; color: #25358b; }
.route-cell.trail { background: #293ea7; color: #fff; border-color: #213386; }
.route-tools, .photo-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.route-steps { margin: 8px 0 0; color: var(--slate); text-align: center; font-size: .88rem; font-weight: 700; }
.route-preview + .team-note, .puzzle-widget + .team-note { margin-top: 12px; }

.puzzle-preview { margin: 10px 0 15px; }
.preview-items { padding-left: 20px; color: var(--slate); }
.preview-items li { margin: 4px 0; }
.puzzle-grid {
  --columns: 3;
  display: grid;
  grid-template-columns: repeat(var(--columns), minmax(0, 1fr));
  gap: 4px;
}
.puzzle-grid[data-columns="1"] { --columns: 1; }
.puzzle-grid[data-columns="2"] { --columns: 2; }
.puzzle-grid[data-columns="4"] { --columns: 4; }
.puzzle-grid[data-columns="5"] { --columns: 5; }
.puzzle-grid[data-columns="6"] { --columns: 6; }
.symbol-grid, .packing-board { width: min(100%, 344px); margin: 0 auto; }
.symbol-grid[data-columns="3"] { max-width: 258px; }
.symbol-cell, .packing-cell {
  display: grid;
  align-items: center;
  justify-items: center;
  width: 100%;
  aspect-ratio: 1;
  min-width: 0;
  padding: 0;
  border: 1px solid #cbd4e5;
  border-radius: 7px;
  color: #253489;
  background: #f3f5fb;
  font-size: clamp(1.05rem, 5vw, 1.75rem);
  line-height: 1;
}
button.symbol-cell:hover, button.packing-cell:hover { border-color: #6b7bc9; }
.symbol-cell[aria-pressed="true"] { background: #3548aa; border-color: #2b3b8e; color: white; }
.puzzle-compare {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.puzzle-compare > div { min-width: 0; }
.puzzle-compare h3 { text-align: center; font-size: .86rem; color: var(--slate); margin: 0 0 5px; }
.puzzle-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 7px 10px;
  color: var(--slate);
  margin: 10px 0;
  font-size: .83rem;
  font-weight: 680;
}
.puzzle-toolbar:last-child { margin-bottom: 0; }
.puzzle-feedback:not(:empty) { margin-bottom: 0; }
.memory-study {
  padding: 13px 11px;
  border-radius: 11px;
  background: #edf0ff;
  color: #243388;
}
.memory-status { text-align: center; font-weight: 720; margin: 0 0 9px; }
.puzzle-palette {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  gap: 5px;
  margin: 0 0 12px;
}
.puzzle-palette .symbol-cell { width: 42px; }
.puzzle-palette .button[aria-pressed="true"] { background: #3548aa; border-color: #2b3b8e; color: white; }

.tile-grid {
  width: min(calc(100% - 25px), 328px);
  margin: 19px auto;
  gap: 5px;
}
.tile-grid[data-columns="2"] { max-width: 208px; }
.tile-slot { position: relative; }
.tile {
  width: 100%;
  aspect-ratio: 1;
  min-width: 0;
  display: block;
  position: relative;
  padding: 0;
  background: #ecefff;
  color: #27398f;
  border: 1px solid #aab6e1;
  border-radius: 8px;
}
button.tile:hover { background: #dadefa; }
.tile-edge, .tile-frame { display: grid; place-items: center; position: absolute; font-size: .92rem; line-height: 1; }
.tile-edge { min-width: 16px; min-height: 16px; }
.tile-edge.north, .tile-edge.south, .tile-frame.north, .tile-frame.south { left: 50%; transform: translateX(-50%); }
.tile-edge.east, .tile-edge.west, .tile-frame.east, .tile-frame.west { top: 50%; transform: translateY(-50%); }
.tile-edge.north { top: 2px; }
.tile-edge.east { right: 2px; }
.tile-edge.south { bottom: 2px; }
.tile-edge.west { left: 2px; }
.tile-frame { z-index: 1; color: #443677; pointer-events: none; }
.tile-frame.north { top: -14px; }
.tile-frame.east { right: -13px; }
.tile-frame.south { bottom: -14px; }
.tile-frame.west { left: -13px; }

.puzzle-scales, .puzzle-commands { display: grid; gap: 7px; margin: 8px auto 10px; }
.puzzle-scales { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.puzzle-scale {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 6px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f4f5ff;
  min-width: 0;
}
.puzzle-scale > span { color: #283782; font-size: .81rem; }
.puzzle-scale strong { font-size: 1.35rem; color: #27398f; }
.puzzle-scale small { grid-column: 1 / -1; color: var(--slate); font-size: .72rem; }
.puzzle-command {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 9px;
  width: 100%;
  min-height: 45px;
  padding: 6px 10px;
  border: 1px solid #cbd4ee;
  background: #f5f6fc;
  color: #253385;
  border-radius: 9px;
  text-align: left;
}
button.puzzle-command:hover { background: #ecefff; }
.puzzle-command:disabled { opacity: .55; }
.puzzle-command small { color: var(--slate); overflow-wrap: anywhere; }

.puzzle-pieces {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  max-width: 380px;
  margin: 0 auto 10px;
}
.puzzle-piece {
  min-height: 60px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 5px;
  border: 1px solid var(--line);
  background: #f7f8fc;
  border-radius: 9px;
  color: #2f3470;
  padding: 5px 2px;
  font-size: .84rem;
  font-weight: 750;
}
.puzzle-piece[aria-pressed="true"] { border-color: #4159c6; background: #e0e7ff; }
.mini-shape { width: max-content; grid-template-columns: repeat(var(--columns), 10px); gap: 1px; }
.mini-cell { width: 10px; height: 10px; position: relative; border-radius: 2px; }
.mini-cell[data-anchor]::before { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: currentColor; }
.packing-cell { font-size: .86rem; line-height: 1; font-weight: 800; }
.packing-cell.outside { background: #eceef3; border: 0; border-radius: 4px; opacity: .45; }
[data-piece="0"] { background: #c8d4ff; color: #263b91; }
[data-piece="1"] { background: #b9ebcf; color: #185137; }
[data-piece="2"] { background: #ffe29f; color: #6a460c; }
[data-piece="3"] { background: #f3c9e9; color: #66205a; }
[data-piece="4"] { background: #ccebf4; color: #15516a; }
[data-piece="5"] { background: #e5d5fc; color: #512584; }

@media (max-width: 590px) {
  .puzzle-compare { grid-template-columns: minmax(0, 1fr); gap: 7px; }
  .puzzle-compare .symbol-grid { max-width: 218px; }
}

.photo-actions { justify-content: flex-start; margin: 0 0 10px; }
.photo-input, .own-breakdown { margin-bottom: 14px; }
.photo-input:has(#camera:focus-visible) label[for="camera"], .photo-input:has(#gallery:focus-visible) label[for="gallery"] { outline: 3px solid #5868ec; outline-offset: 2px; }
#photo-preview { color: var(--slate); font-size: .9rem; }
#photo-preview img { max-height: 170px; border-radius: 9px; object-fit: contain; }
.own-breakdown li { display: flex; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); padding: 7px 1px; font-size: .9rem; }

dialog { width: min(calc(100% - 32px), 640px); max-height: calc(100svh - 40px); padding: 18px 21px; border: 1px solid var(--line); border-radius: 15px; color: var(--ink); background: var(--white); }
dialog::backdrop { background: #0b1327aa; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.dialog-head h2 { font-size: 1.25rem; letter-spacing: -.03em; }
dialog > p { margin-bottom: 9px; }
.bank-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#bank-found { margin-block: 8px; font-size: .86rem; }
.bank-list { max-height: 52svh; overflow-y: auto; padding-right: 5px; }
.bank-row { display: grid; grid-template-columns: 1fr max-content; align-items: center; gap: 4px 8px; padding: 9px 0; border-top: 1px solid var(--line); }
.bank-row p { color: var(--slate); font-size: .83rem; }
.bank-row details { grid-column: 1 / -1; }
.bank-row summary { color: var(--blue); font-size: .82rem; }
.qr-dialog { display: grid; justify-items: center; gap: 9px; text-align: center; }
.qr { width: min(215px, 100%); height: auto; }
.manage-form { display: grid; gap: 12px; }
.manage-actions { display: flex; flex-wrap: wrap; gap: 8px; }
#recover-link { display: grid; gap: 8px; }
#recover-link button { justify-self: start; }
#toast { display: none; position: fixed; z-index: 5; right: 16px; bottom: 16px; max-width: min(420px, calc(100% - 32px)); padding: 10px 14px; color: var(--white); background: #242e4e; border: 1px solid #656e97; border-radius: 10px; font-size: .91rem; }
#toast.visible { display: block; }
#print-sheet { display: none; }

@media (max-width: 900px) {
  .hero { min-height: 400px; }
  .hero-stats div { display: grid; gap: 4px; padding: 16px; }
  .workspace, .hero-wrap, .top-inner { width: min(calc(100% - 32px), 1240px); }
  .table-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .room-body { grid-template-columns: minmax(0, 1fr) minmax(250px, .85fr); }
}

@media (max-width: 690px) {
  .top-inner { min-height: 54px; gap: 10px; }
  .top-actions { gap: 9px; }
  .nav-label, .quiet-link { font-size: .8rem; }
  .hero-wrap { padding-top: 15px; }
  .hero { grid-template-columns: 1fr; border-radius: 18px; }
  .hero-content { padding: 23px 20px 22px; }
  .hero h1 { font-size: clamp(3.2rem, 13vw, 5.1rem); }
  .hero-visual { min-height: 224px; aspect-ratio: 16 / 10; }
  .hero-stats { margin-top: 12px; }
  .hero-stats div { padding: 9px 5px 12px; }
  .hero-stats strong { font-size: 1.35rem; }
  .hero-stats span { font-size: .74rem; }
  .login-row { gap: 6px; }
  .login-row .button { padding: 8px 9px; }
  .workspace { padding-top: 19px; }
  .builder, .room-body { grid-template-columns: 1fr; }
  .card { padding: 16px; border-radius: 14px; }
  .room-banner { min-height: 0; padding: 17px; flex-wrap: wrap; }
  .room-banner h1 { font-size: 2rem; }
  .room-actions { justify-content: flex-start; }
  .rounds-card .section-head .button { padding-inline: 8px; font-size: .86rem; }
  .projection-tables { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .projector { width: calc(100% - 24px); }
  .projector-board { padding-inline: 5px; }
  .projector-board.split { grid-template-columns: 1fr; gap: 0; }
  .projector-board.split > div + div { border-left: 0; padding-left: 0; }
}

@media (max-width: 385px) {
  .workspace, .hero-wrap, .top-inner, .narrow, .player-page .top-inner { width: calc(100% - 22px); }
  .brand { gap: 7px; font-size: 1.08rem; }
  .top-actions .button.small { font-size: .72rem; padding-inline: 6px; }
  .player-page .nav-label { max-width: 16ch; }
  .card { padding: 13px; }
  .ranking td, .ranking th { padding-inline: 5px; }
  .edit-list li { grid-template-columns: 23px minmax(0, 1fr) 62px max-content; gap: 5px; }
  .edit-list .icon { width: 25px; }
  .round-number { width: 23px; }
  .table-card { padding: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::after, *::before { transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  @page { margin: 11mm; }
  body { background: #fff; color: #000; }
  #app, #toast, dialog, noscript { display: none !important; }
  #print-sheet { display: grid; grid-template-columns: 1fr 1fr; gap: 4mm; }
  #print-sheet section { break-inside: avoid; text-align: center; padding: 4mm; border: 1px solid #bbb; }
  #print-sheet h2 { font-size: 20pt; }
  #print-sheet .qr { width: 48mm; height: 48mm; margin: 1mm auto; }
  #print-sheet p { font-size: 9pt; }
}
