:root {
  color-scheme: dark;
  font: 15px/1.45 system-ui, sans-serif;
  background: #171e22;
  color: #ede5d3;
}
body { margin: 0; }
main {
  box-sizing: border-box;
  width: 100%;
  height: 100dvh;
  max-width: 1460px;
  margin: auto;
  padding: clamp(12px, 2.5vw, 30px);
  display: flex;
  flex-direction: column;
}
header { display: grid; gap: 10px; margin-bottom: 12px; }
.identity, .actions, .options-row { display: flex; align-items: center; gap: 8px; }
.identity { gap: 16px; min-width: 0; min-height: 38px; }
header a { color: #bcb3a0; font-size: 0.88rem; text-decoration: none; white-space: nowrap; }
header a:hover { text-decoration: underline; }
h1 { margin: 0; font: 600 1.4rem/1.2 Georgia, serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.actions { flex-wrap: wrap; min-height: 40px; }
.actions label, .options-row label { color: #c0baab; white-space: nowrap; }
.options-row { flex-wrap: wrap; clear: both; }
#room { width: 11em; }
.character { max-width: 10em; }
button, select {
  padding: 7px 11px;
  background: #293437;
  color: #f4ebd5;
  border: 1px solid #566065;
  border-radius: 5px;
  font: inherit;
}
button { cursor: pointer; }
button:hover { background: #39494b; }
.stage { position: relative; flex: 1; min-height: 240px; overflow: hidden; border: 1px solid #617070; border-radius: 10px; }
#yard { position: absolute; inset: 0; display: block; width: 100%; height: 100%; background: #354a4a; outline-offset: -2px; }
#yard:focus-visible { outline: 2px solid #b8a476; }
.caption, .outcome {
  pointer-events: none;
  padding: 6px 12px;
  border-radius: 5px;
  background: #202625eb;
  color: #f4ead4;
}
.guidance { position: absolute; inset: auto 12px 12px; pointer-events: none; display: grid; gap: 6px; }
.hints, .control-prompts { display: flex; align-items: end; gap: 8px; }
.hints:not(:has(.caption:not(:empty))), .control-prompts:not(:has(.control-prompt:not([hidden]))) { display: none; }
.caption { border-left: 2px solid #8eae99; }
.caption[data-tone="caution"] { border-left-color: #dba16e; }
#hint-two { margin-left: auto; }
.outcome { position: absolute; right: 12px; top: 12px; text-align: right; }
.outcome:has(#state-label:empty):has(#advance[hidden]), .caption:empty { display: none; }
#advance { pointer-events: auto; margin-top: 7px; }
dialog {
  width: min(680px, calc(100% - 48px)); max-height: 76vh; box-sizing: border-box;
  padding: 22px; border: 1px solid #77776a; border-radius: 10px; background: #202b2e; color: inherit;
}
dialog::backdrop { background: #11181cd6; }
dialog form { float: right; }
dialog h2, dialog h3 { margin: 0 0 0.45em; }
#districts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 20px; clear: both; }
#districts section { display: grid; align-content: start; gap: 6px; }
#districts button { text-align: left; }
#districts button[disabled] { opacity: 0.5; cursor: default; }
#districts button[aria-current] { outline: 1px solid #d7b071; outline-offset: -2px; }
#districts small { display: block; color: #ddc696; }
[data-player="1"] { --player: #e3a66b; }
[data-player="2"] { --player: #7fc3c2; }
.control-prompt { border-left: 3px solid var(--player); transition: opacity .4s; }
.control-prompt[data-player="2"] { margin-left: auto; }
.control-prompt[data-fading="true"] { opacity: 0; }
.control-dots { display: inline-flex; gap: 4px; margin-left: 8px; vertical-align: middle; }
.control-dots i { box-sizing: border-box; width: 7px; height: 7px; border: 1px solid var(--player); border-radius: 50%; }
.control-dots .done { background: var(--player); }
#play-options { width: min(800px, calc(100% - 32px)); padding-top: 0; }
.control-heading { position: sticky; top: 0; z-index: 1; background: #202b2e; padding-top: 18px; padding-bottom: 8px; }
.control-players { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 12px; }
.control-players div { color: var(--player); }
.control-row {
  display: grid; grid-template-columns: 96px minmax(0, 1fr) 125px 125px;
  align-items: center; gap: 12px; padding: 7px 9px; border-radius: 6px;
}
#control-card[data-players="1"] .control-row { grid-template-columns: 96px minmax(0, 1fr) 125px; }
#control-card[data-players="1"] [data-player="2"] { display: none; }
.control-row:nth-child(odd) { background: #ffffff06; }
.control-row h3 { margin: 0 0 3px; font-size: 1rem; }
.control-row p { margin: 0; font-size: .88rem; color: #cfc5b1; }
.control-picture { display: block; width: 96px; height: 72px; background: #192326; border: 1px solid #394447; border-radius: 6px; }
.control-keys { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; font-size: .78rem; color: #c9c0ac; }
.control-keys kbd, .control-prompt kbd { border-color: color-mix(in srgb, var(--player) 66%, #455357); border-bottom-width: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.touch { display: none; }
main:has(#yard[data-state="finale"]) .touch { display: none; }
kbd {
  display: inline-block;
  padding: 0 5px;
  background: #242d31;
  border: 1px solid #4b575c;
  border-radius: 4px;
  color: #ede5d3;
}
@media (max-width: 640px) {
  main { padding: 10px; }
  .identity { gap: 10px; min-height: 30px; }
  h1 { font-size: 1.15rem; }
  #room { width: 9em; }
  .hints, .control-prompts { align-items: start; flex-direction: column; }
  .caption { font-size: 0.85rem; }
  #hint-two { margin-left: 0; }
  #control-card .control-row { grid-template-columns: 96px minmax(0, 1fr); gap: 5px 12px; }
  .control-keys { grid-column: 2; }
  .control-keys .sr-only { position: static; width: auto; height: auto; margin: 0; clip-path: none; color: var(--player); padding-right: 4px; }
}
@media (prefers-reduced-motion: reduce) { .control-prompt { transition: none; } }
@media (pointer: coarse) {
  .touch { display: flex; flex-wrap: wrap; gap: 7px; padding-top: 10px; }
  .touch button { flex: 1; min-width: 42px; min-height: 42px; padding-inline: 5px; touch-action: none; user-select: none; }
  main:has(#players option[value="1"]:checked) .second-touch { display: none; }
}
