.directory {
  width: min(100%, 56rem);
  margin: 0 auto;
}
.directory-rooms {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}
.directory-rooms button {
  width: 100%;
  min-height: 3.5rem;
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}
.directory-rooms button[aria-pressed="true"] {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}
.directory-rooms span {
  font-size: 0.875rem;
}
:root {
  --bg: #dddbdf;
  --grid: #cfccd2;
  --ink: #222;
  --muted: #666;
  --slot0: #4d63d8;
  --slot1: #0d0d0d;
  --slot2: #a83232;
  --slot3: #c97df0;
  --mono: "Courier New", Courier, monospace;
  --title: Impact, Haettenschweiler, "Arial Narrow Bold", "Arial Black", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--mono);
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid) 2px, transparent 2px),
    linear-gradient(90deg, var(--grid) 2px, transparent 2px);
  background-size: 384px 384px;
  background-position: 93px 140px;
}

#app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  justify-items: center;
}

header { text-align: center; }

h1, h2 {
  margin: 0;
  font-family: var(--title);
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
h1 { font-size: 2.6rem; color: #fff; text-shadow: 2px 2px 0 var(--muted); }
h2 { font-size: 1.6rem; margin-bottom: 8px; }

#notice {
  min-height: 1.5em;
  margin: 4px 0 0;
  color: var(--muted);
}

section[hidden], [hidden] { display: none !important; }

.menu, .dialog {
  background: #fff;
  padding: 24px;
}

.menu {
  width: min(400px, 100%);
  display: grid;
  justify-items: center;
  gap: 12px;
}

#join-panel {
  margin-inline: auto;
}

.dialog { width: min(1000px, 100%); }

#logo {
  width: 96px;
  height: 136px;
  image-rendering: pixelated;
}

.version {
  position: fixed;
  right: 8px;
  bottom: 6px;
  z-index: 1;
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
  pointer-events: none;
}

label { font-size: 0.9rem; color: var(--muted); }

input, button {
  font: inherit;
  font-size: 1.2rem;
  color: var(--ink);
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 0;
  padding: 6px 16px;
}

input { width: min(270px, 100%); text-align: center; }

button { cursor: pointer; }

input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, [role="radio"]:focus-visible, [tabindex="0"]:focus-visible {
  /*outline: 3px solid var(--slot0);
  outline-offset: 3px;
  box-shadow: 0 0 0 1px #fff;*/
  outline: none; box-shadow: none;
}
#view:focus-visible { outline: none; box-shadow: none; }
button:hover:not(:disabled), button:focus-visible { background: var(--ink); color: #fff; }
.menu button { width: min(270px, 100%); font-size: 1.6rem; }
.main-menu .menu-actions { display: grid; gap: 12px; justify-items: center; width: 100%; margin-top: 8px; }
.main-menu .menu-actions button { width: min(320px, 100%); }
button:disabled { opacity: 0.4; cursor: not-allowed; }

.buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; justify-content: center; }

.hint { color: var(--muted); font-size: 0.85rem; text-align: center; }

.cards {
  list-style: none;
  padding: 0;
  margin: 16px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
  justify-content: center;
}

.editor {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 24px;
  align-items: start;
  width: min(560px, 100%);
}

.preview { width: 160px; height: 226px; background: #e8e6e9; image-rendering: pixelated; display: block; }

.pickers { display: grid; gap: 8px; justify-items: start; }
.pickers h2 { margin-bottom: 4px; }
.pickers select { width: 100%; font: inherit; font-size: 1rem; padding: 4px 8px; border: 3px solid var(--ink); background: #fff; color: var(--ink); border-radius: 0; }
.pickers .buttons { margin-top: 8px; justify-content: flex-start; }

.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch { width: 28px; height: 28px; padding: 0; border: 3px solid var(--ink); border-radius: 0; }
.swatch.selected { outline: 3px solid var(--ink); outline-offset: 2px; }
.swatch:hover:not(:disabled) { background-color: inherit; }

.slot { display: grid; justify-items: center; gap: 8px; }

.card {
  position: relative;
  width: 170px;
  height: 300px;
  border-radius: 14px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  display: grid;
  grid-template-rows: 1fr 62px;
  background: #222;
}
.card.slot-0 { background: #232323; --banner: var(--slot0); }
.card.slot-1 { background: #050505; --banner: var(--slot1); }
.card.slot-2 { background: #b23a3a; --banner: var(--slot2); }
.card.slot-3 { background: #e6bdfc; --banner: var(--slot3); }
.card.empty { background: #e8e6e9; --banner: #bdbbc0; }

.portrait { width: 100%; height: 100%; display: block; }

.marks { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; flex-wrap: wrap; gap: 4px; }
.mark {
  font-size: 0.7rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
}
.mark-owner { background: #f2c230; }
.mark-ready { background: #5fbf6a; color: #fff; }
.mark-you { background: #fff; }

.banner {
  display: grid;
  place-items: center;
  background: var(--banner);
  color: #fff;
  font-family: var(--title);
  font-size: 1.9rem;
  letter-spacing: 0.02em;
}

.caption { font-size: 0.95rem; color: var(--muted); max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.slots { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: center; }
.slots li { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; }
.slots li.dead { opacity: 0.5; text-decoration: line-through; }

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: #fff;
  font-family: var(--title);
}
.slot-0.chip { background: var(--slot0); }
.slot-1.chip { background: var(--slot1); }
.slot-2.chip { background: var(--slot2); }
.slot-3.chip { background: var(--slot3); }

#game-panel { width: 100%; display: grid; gap: 4px; justify-items: center; }

#timer {
  min-height: 1.2em;
  font-family: var(--title);
  font-size: 2rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

#view {
  width: 100%;
  height: min(64vh, 760px);
  display: block;
  background: transparent;
}

.controls-panel {
  position: fixed;
  top: 64px;
  right: 12px;
  z-index: 3;
  display: grid;
  gap: 10px;
  width: min(440px, calc(100vw - 24px));
  max-height: calc(100vh - 76px);
  overflow: auto;
  padding: 18px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.24);
}
.menu-hub {
  position: fixed;
  inset: 50% auto auto 50%;
  z-index: 4;
  display: grid;
  gap: 10px;
  width: min(340px, calc(100vw - 24px));
  transform: translate(-50%, -50%);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
}
.menu-hub button { width: 100%; }

.results {
  position: fixed;
  inset: 50% auto auto 50%;
  z-index: 10;
  display: grid;
  gap: 12px;
  width: min(820px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  overflow: auto;
  transform: translate(-50%, -50%);
  padding: 20px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
  background: white;
}
.results h2 { text-align: center; }
.results h3 { margin: 0; font-size: 1rem; text-align: center; }
.results-table-wrap { max-width: 100%; overflow: auto; }
.results-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.results-table th, .results-table td { border: 2px solid var(--ink); padding: 6px 8px; text-align: left; }
.results-table th { background: var(--ink); color: #fff; }
#return-to-lobby { justify-self: center; min-height: 48px; }
.osk {
  position: fixed;
  inset: 50% auto auto 50%;
  z-index: 5;
  display: grid;
  gap: 10px;
  width: min(760px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow: auto;
  transform: translate(-50%, -50%);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
}
#osk-preview { min-height: 2.2em; overflow-wrap: anywhere; border: 2px solid #d5d3d8; padding: 6px 10px; }
.osk-keys { display: grid; gap: 5px; }
.osk-row { display: flex; gap: 5px; }
.osk-key { flex: 1 1 0; min-width: 0; min-height: 44px; padding: 5px; font-size: 1rem; }
.osk-key[data-osk-type="space"], .osk-key[data-osk-type="confirm"], .osk-key[data-osk-type="cancel"] { flex-grow: 2; }
.control-bindings { display: grid; gap: 6px; }
.control-binding {
  display: grid;
  grid-template-columns: minmax(88px, 1fr) minmax(0, 1.5fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding-bottom: 6px;
  border-bottom: 1px solid #d5d3d8;
  color: var(--muted);
  font-size: 0.9rem;
}
.control-binding button {
  min-width: 0;
  overflow-wrap: anywhere;
  padding: 5px 8px;
  font-size: 0.88rem;
}
.controls-panel .hint { min-height: 1.2em; margin: 0; }
.controls-panel .buttons { margin-top: 2px; }
.controller-settings {
  display: grid;
  gap: 6px;
  padding-top: 10px;
  border-top: 2px solid #d5d3d8;
}
.controller-settings h3 {
  margin: 0;
  font-family: var(--title);
  font-size: 1.05rem;
  font-weight: 400;
  text-transform: uppercase;
}
.controller-settings select {
  width: 100%;
  min-width: 0;
  padding: 5px 8px;
  border: 3px solid var(--ink);
  border-radius: 0;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-size: 0.9rem;
}
.controller-settings select:disabled { opacity: 0.6; }
.controller-settings #controller-mapping { color: var(--ink); }
.sound { display: grid; gap: 8px; width: min(360px, 100%); justify-items: stretch; }
.sound input[type="range"] { width: 100%; }
.sound .check { display: flex; align-items: center; justify-content: flex-start; justify-self: stretch; width: 100%; gap: 8px; color: var(--ink); }

.dev { display: grid; gap: 8px; border: 4px dashed #c0392b; }
.dev.navigation-layer {
  position: fixed;
  inset: 50% auto auto 50%;
  z-index: 4;
  width: min(680px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow: auto;
  transform: translate(-50%, -50%);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
}
.dev-marker { margin: 0; font-family: var(--title); font-size: 1.4rem; color: #c0392b; letter-spacing: 0.08em; }
.dev-sliders { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.dev-sliders li { display: grid; grid-template-columns: 110px 1fr 48px; gap: 8px; align-items: center; }
.dev-sliders output { text-align: right; }

.room select, .room-controls select {
  font: inherit;
  font-size: 1rem;
  padding: 4px 8px;
  border: 3px solid var(--ink);
  background: #fff;
  color: var(--ink);
  border-radius: 0;
  width: min(270px, 100%);
}

.pattern-banner {
  margin: 8px auto;
  padding: 6px 16px;
  width: fit-content;
  background: #a52c2c;
  color: #fff;
  font-weight: bold;
  text-transform: uppercase;
}

.role-banner {
  position: fixed;
  inset: 50% auto auto 50%;
  z-index: 3;
  transform: translate(-50%, -50%);
  margin: 0;
  padding: 12px 28px;
  background: #a52c2c;
  color: #fff;
  font-family: var(--title);
  font-size: 2rem;
  text-align: center;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
  pointer-events: none;
}

.mode-cards { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.mode-cards button { width: auto; font-size: 1.1rem; padding: 6px 14px; }
.mode-cards button[aria-checked="true"] { background: var(--ink); color: #fff; }

.room-summary { text-align: center; font-weight: bold; margin: 8px 0; }
.room-controls { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: center; }
.room-controls input { width: min(200px, 100%); font-size: 1rem; }
.room-controls select { width: auto; }
.room-password-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin-top: 8px; }
.room-password-controls p { width: 100%; margin: 0; }
.room-password-controls input { width: min(220px, 100%); font-size: 1rem; }
.room-password-controls button { font-size: 0.9rem; padding: 5px 8px; }
.check input { width: auto; }

.card.team-A { box-shadow: 0 0 0 5px #3373f2; }
.card.team-B { box-shadow: 0 0 0 5px #f28c1a; }
.mark-team-A { background: #3373f2; color: #fff; }
.mark-team-B { background: #f28c1a; color: #fff; }
#hud li.team-A .chip { outline: 3px solid #3373f2; }
#hud li.team-B .chip { outline: 3px solid #f28c1a; }

#hud li.role-chaser { font-weight: bold; }

@media (max-width: 480px) {
  header { padding-top: 48px; }
  .editor { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .pickers { min-width: 0; width: 100%; justify-items: center; }
  .controls-panel { left: 12px; right: 12px; width: auto; padding: 16px; }
  .control-binding { grid-template-columns: minmax(76px, 0.8fr) minmax(0, 1.2fr); }
  .controls-panel .buttons button { font-size: 0.95rem; }
}

@media (orientation: landscape) and (max-height: 500px) {
  #app { max-width: none; min-height: 100dvh; padding: 6px 12px; gap: 6px; align-content: start; }
  header { display: flex; align-items: center; justify-content: center; gap: 12px; }
  h1 { font-size: 1.6rem; line-height: 1; }
  #notice { min-height: 0; margin: 0; }

  .room {
    width: min(820px, 100%);
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    gap: 4px 10px;
    padding: 8px 12px;
    align-items: center;
  }
  .room > h2, .room > .mode-cards, .room > #room-mode-hint,
  .room > #room-ff-label, .room > #room-create { grid-column: 1 / -1; }
  .room > label { justify-self: end; font-size: 0.8rem; }
  .room input, .room select { width: 100%; min-width: 0; font-size: 0.9rem; padding: 4px 8px; }
  .room > #room-mode-hint { margin: 0; }
  .mode-cards { gap: 4px; }
  .mode-cards button { min-height: 36px; padding: 4px 10px; font-size: 0.85rem; }
  .room > button { min-height: 44px; }

  #join-panel {
    width: min(620px, 100%);
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr);
    gap: 6px 10px;
    padding: 8px 12px;
  }
  #join-panel > #logo, #join-panel > #join-room, #join-panel > button { grid-column: 1 / -1; }
  #join-panel > #logo { width: 32px; height: 32px; }
  #join-panel > label { justify-self: end; }
  #join-panel > input { width: 100%; min-width: 0; }
  #join-panel > button { min-height: 44px; }

  #lobby-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    gap: 4px 10px;
    max-height: calc(100dvh - 56px);
    overflow: auto;
    align-content: start;
    padding: 10px;
  }
  #lobby-panel > h2, #lobby-panel > #room-summary, #lobby-panel > #room-note,
  #lobby-panel > .buttons, #lobby-panel > .hint { grid-column: 1 / -1; }
  #lobby-panel > h2 { font-size: 1.3rem; margin: 0; }
  #room-summary, #room-note { margin: 0; }
  #room-controls { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px; min-width: 0; }
  #lobby-password-controls { display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; min-width: 0; }
  #room-controls label { font-size: 0.75rem; }
  #room-controls input, #room-controls select { width: 100%; min-width: 0; padding: 3px 4px; font-size: 0.8rem; }
  #slots { gap: 4px; margin: 0; justify-content: space-between; }
  #slots > li { flex: 1 1 22%; min-width: 0; }
  #slots .card { width: 100%; height: 104px; grid-template-rows: 1fr 28px; }
  #slots .caption { max-width: 100%; font-size: 0.7rem; }
  #lobby-panel > .buttons { gap: 4px; margin-top: 2px; }
  #lobby-panel > .buttons button { min-height: 40px; padding: 4px 8px; font-size: 0.85rem; }
  #lobby-panel > .hint { display: none; }

  #game-panel {
    position: fixed;
    inset: 0;
    z-index: 5;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    padding: max(4px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(4px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    overflow: hidden;
    background: var(--bg);
  }
  #view { position: absolute; inset: 0; width: 100%; height: 100%; }
  #timer { position: absolute; z-index: 2; top: max(4px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); font-size: 1.3rem; }
  #hud { position: absolute; z-index: 2; top: max(28px, calc(env(safe-area-inset-top) + 22px)); left: 50%; transform: translateX(-50%); gap: 4px 10px; margin: 0; font-size: 0.75rem; }
  #hud li { gap: 4px; font-size: inherit; }
  #hud .chip { width: 18px; height: 18px; }
  .touch-controls { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
  .touch-controls button {
    position: absolute;
    display: grid;
    place-items: center;
    min-width: 64px;
    min-height: 64px;
    padding: 8px;
    border: 3px solid var(--ink);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.86);
    color: var(--ink);
    font-size: 0.95rem;
    font-weight: bold;
    pointer-events: auto;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
  }
  #touch-joystick {
    left: max(14px, env(safe-area-inset-left));
    bottom: max(14px, env(safe-area-inset-bottom));
    width: min(30vw, 128px);
    height: min(30vw, 128px);
    min-width: 96px;
    min-height: 96px;
    border-radius: 50%;
    background: rgba(34, 34, 34, 0.18);
  }
  .touch-joystick-knob {
    width: 42%;
    height: 42%;
    border: 3px solid var(--ink);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    transform: translate(var(--stick-x, 0px), var(--stick-y, 0px));
    pointer-events: none;
  }
  .touch-actions { position: absolute; right: max(14px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); width: min(30vw, 160px); height: 140px; pointer-events: none; }
  #touch-bomb { right: 0; bottom: 0; width: 76px; height: 76px; background: rgba(232, 188, 54, 0.94); }
  #touch-punch { right: 82px; bottom: 38px; width: 68px; height: 68px; background: rgba(218, 91, 61, 0.94); font-size: 0.78rem; }
  .touch-controls button:active, .touch-controls button.is-active { background: var(--ink); color: #fff; }
}

@media (orientation: portrait) and (max-width: 600px) {
  .touch-device #game-panel {
    position: fixed;
    inset: 0;
    z-index: 5;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    padding: max(4px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(4px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    overflow: hidden;
    background: var(--bg);
  }
  .touch-device #view { position: absolute; inset: 0; width: 100%; height: 100%; }
  .touch-device #timer { position: absolute; z-index: 2; top: max(4px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); font-size: 1.3rem; }
  .touch-device #hud { position: absolute; z-index: 2; top: max(28px, calc(env(safe-area-inset-top) + 22px)); left: 50%; transform: translateX(-50%); gap: 4px 10px; margin: 0; font-size: 0.75rem; }
  .touch-device #hud li { gap: 4px; font-size: inherit; }
  .touch-device #hud .chip { width: 18px; height: 18px; }
  .touch-device .touch-controls { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
  .touch-device .touch-controls button {
    position: absolute;
    display: grid;
    place-items: center;
    min-width: 64px;
    min-height: 64px;
    padding: 8px;
    border: 3px solid var(--ink);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.86);
    color: var(--ink);
    font-size: 0.95rem;
    font-weight: bold;
    pointer-events: auto;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
  }
  .touch-device #touch-joystick {
    left: max(14px, env(safe-area-inset-left));
    bottom: max(14px, env(safe-area-inset-bottom));
    width: min(30vw, 140px);
    height: min(30vw, 140px);
    min-width: 104px;
    min-height: 104px;
    background: rgba(34, 34, 34, 0.18);
  }
  .touch-device .touch-joystick-knob {
    width: 42%;
    height: 42%;
    border: 3px solid var(--ink);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    transform: translate(var(--stick-x, 0px), var(--stick-y, 0px));
    pointer-events: none;
  }
  .touch-device .touch-actions { position: absolute; right: max(14px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); width: min(32vw, 160px); height: 140px; pointer-events: none; }
  .touch-device #touch-bomb { right: 0; bottom: 0; width: 76px; height: 76px; background: rgba(232, 188, 54, 0.94); }
  .touch-device #touch-punch { right: 82px; bottom: 38px; width: 68px; height: 68px; background: rgba(218, 91, 61, 0.94); font-size: 0.78rem; }
  .touch-device .touch-controls button:active, .touch-device .touch-controls button.is-active { background: var(--ink); color: #fff; }
}

/* ---- 011: lobby header icons, seat controls, configuration panel ---- */
.lobby-header {
  display: grid;
  grid-template-columns: 1fr auto auto;
  grid-template-areas: "title config leave" "summary summary summary";
  align-items: center;
  gap: 4px 8px;
}
.lobby-header h2 { grid-area: title; margin: 0; }
.lobby-header .room-summary { grid-area: summary; margin: 0; }
.lobby-header #room-config-open { grid-area: config; }
.lobby-header #leave-room { grid-area: leave; }
.icon-button {
  width: 44px;
  height: 44px;
  padding: 0;
  font-size: 1.4rem;
  line-height: 1;
  display: inline-grid;
  place-items: center;
}
.icon-button svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
}
.seat-control {
  position: absolute;
  z-index: 1;
  padding: 0;
  display: grid;
  place-items: center;
  line-height: 1;
}
.seat-remove {
  top: 6px;
  right: 6px;
  width: 30px;
  height: 30px;
  font-size: 1.2rem;
}
.seat-add {
  top: 50%;
  left: 50%;
  width: 64px;
  height: 64px;
  margin: -52px 0 0 -32px;
  font-size: 2.4rem;
}
.card.closed { opacity: 0.45; }
.lobby-actions button { min-width: 140px; }
.lobby-actions #ready[aria-pressed="true"] { background: var(--ink); color: #fff; }
.room-config {
  position: fixed;
  inset: 50% auto auto 50%;
  z-index: 4;
  transform: translate(-50%, -50%);
  width: min(520px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow: auto;
  display: grid;
  gap: 12px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
}
.room-config .room-controls, .room-config .room-password-controls { display: grid; gap: 6px; justify-items: start; }
.room-config select { font: inherit; font-size: 1rem; padding: 4px 8px; border: 3px solid var(--ink); background: #fff; color: var(--ink); border-radius: 0; }

select:focus-visible { background: var(--ink); color: #fff; }


/* ---- 011: the tabbed Options screen ---- */
.options {
  position: fixed;
  inset: 50% auto auto 50%;
  z-index: 4;
  transform: translate(-50%, -50%);
  width: min(600px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow: auto;
  display: grid;
  gap: 12px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
}
.options-tabs { display: flex; gap: 0; border-bottom: 3px solid var(--ink); }
.options-tabs [role="tab"] {
  flex: 1;
  border-bottom: 0;
  font-size: 1.05rem;
  padding: 6px 10px;
}
.options-tabs [role="tab"] + [role="tab"] { border-left: 0; }
.options-tabs [role="tab"][aria-selected="true"] { background: var(--ink); color: #fff; }
.options .options-tab { width: 100%; }
.options .options-tab h2 { display: none; }
.options .controls-panel {
  position: static;
  width: 100%;
  max-height: none;
  overflow: visible;
  padding: 0;
  box-shadow: none;
}
.options .sound { width: 100%; }

/* ---- 011: the Customize tab and the randomize icon on the preview ---- */
.options .editor { width: 100%; }
.preview-wrap { position: relative; width: 160px; height: 226px; }
.randomize-icon {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 1.3rem;
  line-height: 1;
  display: grid;
  place-items: center;
}
/* Material Icons "autorenew" (Apache 2.0), inlined so the page loads nothing external */
.randomize-icon svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}
