:root {
  color-scheme: light;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #233a31;
  background: #f9f6ec;
  --paper: #fffdf7;
  --forest: #233a31;
  --muted: #5d685e;
  --line: #e5decf;
  --green: #305c49;
  --rust: #a34733;
  --serif: Georgia, "Times New Roman", serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible { outline: 3px solid #155b9b; outline-offset: 4px; }
[hidden] { display: none !important; }
.topbar { border-bottom: 1px solid var(--line); background: var(--paper); }
.topbar-inner {
  max-width: 1300px; min-height: 77px; margin-inline: auto; padding: 12px 42px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.brand { display: flex; gap: 11px; align-items: center; border: 0; background: none; padding: 0; text-align: left; }
.brand > span:nth-child(2) { font-family: var(--serif); font-size: 24px; font-weight: bold; letter-spacing: .025em; line-height: 1; }
.brand > span:nth-child(2) span { color: var(--rust); }
.brand small { font: 750 9px/1.2 "Segoe UI", system-ui, sans-serif; letter-spacing: .17em; color: var(--muted); display: block; margin-top: 5px; }
.brand-icon { display: grid; place-items: center; width: 43px; height: 43px; background: #e8eee2; border: 1px solid #d9e5d5; border-radius: 13px; }
.brand-icon svg { width: 29px; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.icon-button, .menu-button, .hint { background: var(--paper); border: 1px solid var(--line); border-radius: 11px; min-height: 42px; }
.icon-button { display: inline-grid; place-items: center; width: 43px; padding: 0; }
.menu-button { display: flex; gap: 8px; align-items: center; padding: 0 13px; font-size: 13px; font-weight: 700; }
.icon-button svg, .menu-button svg { width: 21px; height: 21px; }
.icon-button:hover, .menu-button:hover, .hint:hover { background: #f0f2e8; }
.shell { width: min(1160px, calc(100% - 64px)); margin-inline: auto; }
.game-heading { padding: 31px 0 24px; }
.subject { color: var(--rust); font-weight: 800; font-size: 11px; letter-spacing: .18em; }
.subject span { margin-right: 4px; }
.game-heading h1 {
  font: 500 clamp(2.35rem, 5.4vw, 4.15rem)/1.05 var(--serif);
  letter-spacing: -.065em; margin: 9px 0 8px;
}
.game-heading h1 em { color: var(--rust); font-weight: inherit; letter-spacing: -.075em; }
.game-heading p, .map-head p { color: var(--muted); margin: 0; }
.game-heading p { font-size: 15px; }
.game-layout { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 20px; align-items: start; }
.sidebar, .game-card { background: var(--paper); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 4px 14px #6951320b; }
.sidebar { grid-area: 1 / 1; padding: 18px 13px 15px; }
.map-head { padding: 0 6px 13px; }
.map-head h2 { font: 600 23px/1.1 var(--serif); margin: 0 0 4px; letter-spacing: -.025em; }
.map-head p { font-size: 12px; }
#room-map { display: grid; gap: 6px; }
.room-button {
  background: #fcfaf4; border: 1px solid #ebe6da; border-radius: 11px;
  display: flex; align-items: center; gap: 9px; text-align: left;
  padding: 5px 8px 5px 5px; width: 100%; min-width: 0; min-height: 53px;
}
.room-button:hover:not(:disabled) { background: #e9f1e4; }
.room-button[aria-current="step"] { border-color: #9db49a; background: #e9f1e4; }
.room-button:disabled { cursor: default; color: #556258; }
.room-button:disabled img { opacity: .68; }
.room-button img { width: 51px; height: 39px; object-fit: cover; border-radius: 7px; flex: 0 0 auto; }
.room-button span { font-size: 13px; font-weight: 680; line-height: 1.15; }
.room-button .room-status { margin-left: auto; display: inline-grid; place-items: center; color: #466450; }
.room-status svg { width: 15px; height: 15px; }
.map-progress { margin: 14px 5px 0; padding-top: 13px; border-top: 1px solid #ece6d9; }
.map-progress > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; font-size: 12px; color: var(--muted); }
.map-progress strong { color: var(--green); }
progress { display: block; appearance: none; width: 100%; height: 7px; border: 0; border-radius: 999px; background: #ece7d9; overflow: hidden; }
progress::-webkit-progress-bar { background: #ece7d9; }
progress::-webkit-progress-value { background: #648561; border-radius: 999px; }
progress::-moz-progress-bar { background: #648561; border-radius: 999px; }
.game-card { grid-area: 1 / 2; min-width: 0; padding: 14px; }
.prompt-bar { position: relative; padding: 4px 57px 13px 6px; }
.prompt-meta { display: flex; align-items: center; gap: 11px; }
#room-name { color: var(--green); text-transform: uppercase; font-size: 10px; font-weight: 800; letter-spacing: .14em; }
.round-dots { display: inline-flex; gap: 4px; }
.round-dots i { width: 7px; height: 7px; background: #e4ddcf; border-radius: 50%; }
.round-dots i[data-active] { background: #709571; }
#sentence { margin: 5px 0 0; font: 500 clamp(1.4rem, 3vw, 2.05rem)/1.24 var(--serif); letter-spacing: -.028em; }
#sentence strong { font-weight: 600; color: var(--rust); background: #f9e6d7; border-radius: 6px; padding: 0 .17em .065em; white-space: nowrap; }
.listen { position: absolute; right: 2px; top: 8px; background: #ecf1e7; border-color: #dce6d8; }
.scene-frame { border: 1px solid #ded2bb; border-radius: 13px; overflow: hidden; background: #e6caa3; }
.scene { position: relative; isolation: isolate; aspect-ratio: 768/340; }
.room-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; user-select: none; pointer-events: none; }
.spot, .placed, .sparkles { position: absolute; left: var(--x); top: var(--y); }
.spot {
  width: clamp(42px, 6vw, 62px); aspect-ratio: 1; transform: translate(-50%, -50%);
  border: 0; background: transparent; border-radius: 50%; padding: 0; display: grid; place-items: center;
}
.spot::before {
  content: ""; width: 57%; aspect-ratio: 1; border: 2px dashed #fffcdf; border-radius: 50%;
  background: #223a31a3; box-shadow: 0 0 0 1px #243a31cc, 0 2px 6px #2a25165e;
  transition: background .16s, scale .16s;
}
.spot:hover::before, .spot.over::before { scale: 1.18; background: #396955; border-style: solid; }
.spot:focus-visible { outline-color: #fffbe4; outline-offset: -4px; }
.scene[data-selected] .spot::before { background: #305c49; }
.spot.wrong::before { background: #a02f2c; border-style: solid; animation: shake .35s ease both; color: white; content: "×"; display: grid; place-items: center; }
.spot.clue::before { background: #305c49; border-style: solid; animation: pulse .7s 3 alternate; }
.placed { transform: translate(-50%, -50%); width: var(--size); max-height: 29%; object-fit: contain; pointer-events: none; filter: drop-shadow(0 3px 2px #31251853); animation: place .35s ease both; }
.sparkles { color: #fff8b5; font-size: clamp(1.15rem, 4vw, 2.7rem); line-height: 1; pointer-events: none; text-shadow: 0 1px 4px #69401d; animation: sparkle .7s ease both; }
.tray { display: flex; min-height: 81px; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 1px 2px; }
.tray-item { display: flex; align-items: center; gap: 11px; min-width: 0; }
.item {
  display: grid; width: 67px; height: 65px; place-items: center; flex: 0 0 auto;
  touch-action: none; background: #fbf0de; border: 1px dashed #d1ad7b; border-radius: 11px; padding: 6px;
  cursor: grab; user-select: none;
}
.item:not(:disabled):hover, .item[aria-pressed="true"] { background: #f6e3bc; border-color: #936632; }
.item.dragging { opacity: .4; }
.item:disabled { opacity: .48; cursor: default; }
.item img { max-width: 100%; max-height: 51px; object-fit: contain; pointer-events: none; }
.tray-label { display: block; color: var(--rust); font-size: 9px; font-weight: 800; letter-spacing: .12em; }
#item-name { display: block; margin-top: 3px; font-size: 15px; line-height: 1.1; }
.tray-controls { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.hint { padding: 0 12px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.hint span { color: var(--rust); font-size: 17px; margin-right: 3px; }
.primary { background: var(--green); border: 1px solid var(--green); color: white; border-radius: 11px; min-height: 42px; padding: 8px 14px; font-weight: 750; white-space: nowrap; }
.primary:hover { background: #224b3a; }
.primary span { margin-left: 3px; }
.feedback { min-height: 1.4em; margin: 0 1px 1px; font-size: 13px; color: var(--muted); }
.feedback[data-kind="correct"] { color: #286044; font-weight: 700; }
.feedback[data-kind="wrong"] { color: #982f2f; font-weight: 700; }
.drag-proxy { pointer-events: none; position: fixed; z-index: 10; width: clamp(48px, 7vw, 77px); height: clamp(48px, 7vw, 77px); object-fit: contain; transform: translate(-50%, -50%) rotate(-7deg); filter: drop-shadow(0 6px 6px #221d1559); }
footer { margin: 14px 0 16px; color: #647065; font-size: 10px; font-weight: 700; letter-spacing: .085em; }
footer > span:first-child { color: var(--rust); margin-right: 3px; }
.footer-dot { margin: 0 3px; }
dialog { padding: 0; border: 1px solid var(--line); width: min(440px, calc(100% - 36px)); border-radius: 20px; color: var(--forest); background: var(--paper); box-shadow: 0 15px 90px #242d2755; max-height: calc(100% - 36px); }
dialog::backdrop { background: #233a3177; }
.dialog-inner { padding: 14px 14px 20px; text-align: center; position: relative; }
.dialog-close { position: absolute; z-index: 1; top: 22px; right: 22px; font-size: 22px; }
.dialog-art { display: block; width: 100%; border-radius: 11px; }
.dialog-inner .subject { margin: 17px 0 6px; }
.dialog-inner h2 { font: 500 35px/1.05 var(--serif); margin: 0 9px; letter-spacing: -.05em; }
#dialog-description { margin: 10px auto 16px; max-width: 33ch; color: var(--muted); font-size: 14px; }
.game-switch { display: inline-flex; align-items: center; color: inherit; text-decoration: none; }
.game-switch:focus-visible { outline: 3px solid #155b9b; outline-offset: 4px; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
@keyframes shake { 25% { translate: -4px; } 75% { translate: 4px; } }
@keyframes pulse { to { scale: 1.28; box-shadow: 0 0 0 5px #fdf1b9a1; } }
@keyframes place { from { scale: .65; } 60% { scale: 1.12; } }
@keyframes sparkle { 0% { opacity: 0; scale: .3; } 30% { opacity: 1; scale: 1.15; } 100% { opacity: 0; translate: 6px -35px; } }
@media (max-width: 850px) {
  .shell { width: calc(100% - 34px); }
  .topbar-inner { padding-inline: 17px; }
  .game-layout { grid-template-columns: 175px minmax(0, 1fr); gap: 12px; }
  .sidebar { padding-inline: 9px; }
  .room-button img { width: 37px; }
}
@media (max-width: 650px) {
  .topbar-inner { min-height: 62px; }
  .brand-icon { width: 36px; height: 36px; border-radius: 10px; }
  .brand-icon svg { width: 24px; }
  .brand { gap: 7px; }
  .brand > span:nth-child(2) { font-size: 19px; }
  .brand small { font-size: 7px; }
  .menu-button { font-size: 12px; padding: 0 8px; }
  .header-actions { gap: 5px; }
  .game-heading { padding: 23px 0 16px; }
  .game-heading p { font-size: 13px; }
  .game-layout { display: flex; flex-direction: column; gap: 12px; }
  .sidebar, .game-card { width: 100%; border-radius: 15px; }
  .game-card { padding: 9px; }
  .prompt-bar { padding-left: 3px; padding-bottom: 10px; }
  .listen { top: 3px; right: 0; }
  .scene-frame { border-radius: 9px; }
  .tray { min-height: 70px; }
  .item { width: 52px; height: 53px; }
  .item img { max-height: 39px; }
  .sidebar { padding: 12px 9px; }
  .map-head { padding-bottom: 8px; }
  .map-head h2 { font-size: 18px; }
  .map-head p { display: none; }
  #room-map { grid-template-columns: repeat(5, minmax(0,1fr)); gap: 4px; }
  .room-button { min-height: 67px; display: grid; align-content: start; gap: 3px; position: relative; padding: 3px; text-align: center; }
  .room-button img { width: 100%; height: 29px; }
  .room-button span { font-size: 9px; }
  .room-button .room-status { position: absolute; top: 4px; right: 4px; background: var(--paper); border-radius: 4px; }
  .room-status svg { width: 12px; height: 12px; }
  .map-progress { margin-top: 8px; padding-top: 8px; }
}
@media (max-width: 359px) {
  .topbar-inner { padding-inline: 12px; gap: 8px; }
  .brand > span:nth-child(2) { font-size: 17px; }
  .brand-icon { width: 31px; height: 34px; }
  .menu-button { width: 43px; justify-content: center; padding: 0; }
  .menu-button span { display: none; }
  .spot::before { width: 42%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .spot.clue::before { box-shadow: 0 0 0 4px #fdf1b9; }
}
a.brand { color: inherit; text-decoration: none; }
a.brand:focus-visible { outline: 3px solid #155b9b; outline-offset: 4px; }
.home-link { gap: 4px; }
.home-link span { margin: 0; }
@media (max-width: 520px) {
  .topbar-inner:has(.home-link) { flex-wrap: wrap; gap: 7px; }
  .topbar-inner:has(.home-link) .header-actions { flex-wrap: wrap; }
  .topbar-inner:has(.home-link) .home-link { padding-inline: 7px; }
  .topbar-inner:has(.home-link) .menu-button { width: 43px; justify-content: center; padding: 0; }
  .topbar-inner:has(.home-link) .menu-button span { display: none; }
}
