:root {
  color-scheme: dark;
  --bg: #101419;
  --panel: #191f26;
  --line: #303a44;
  --text: #eef3ee;
  --muted: #96a6af;
  --lime: #d1ef79;
  --coral: #ff7769;
  --amber: #ffc76b;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    15px/1.5 system-ui,
    sans-serif;
}
header {
  max-width: 1240px;
  margin: auto;
  padding: 24px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
.brand {
  font-weight: 900;
  letter-spacing: 3px;
  color: var(--text);
  text-decoration: none;
}
.brand span {
  font: 10px monospace;
  color: var(--muted);
  margin-left: 18px;
}
.badge,
.eyebrow,
.panel-title > span {
  font: 11px monospace;
  letter-spacing: 1.5px;
  color: var(--lime);
}
main {
  max-width: 1240px;
  margin: auto;
  padding: 32px;
}
.intro {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 26px;
}
.eyebrow {
  margin: 0 0 6px;
}
h1 {
  font-size: clamp(32px, 5vw, 58px);
  letter-spacing: -2px;
  line-height: 1.1;
  margin: 0;
}
h1 span {
  color: var(--coral);
}
.intro p:last-child {
  color: var(--muted);
  margin: 12px 0 0;
}
.session {
  display: flex;
  align-items: end;
  gap: 12px;
}
label {
  font-size: 12px;
  color: var(--muted);
}
select,
button {
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #252d35;
  color: var(--text);
  padding: 10px 12px;
}
select {
  display: block;
  margin-top: 5px;
  max-width: 100%;
}
button {
  cursor: pointer;
}
button:hover {
  border-color: var(--lime);
}
button:focus-visible,
select:focus-visible,
canvas:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 3px;
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
.game-shell {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #111b25;
}
.game-top,
.game-bottom {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 18px;
  font: 11px monospace;
  letter-spacing: 1px;
  background: #1b232c;
}
.game-top #role {
  color: var(--lime);
}
.game-bottom {
  color: var(--muted);
  letter-spacing: 0;
}
.viewport {
  position: relative;
}
canvas {
  display: block;
  width: 100%;
  aspect-ratio: 16/9;
  touch-action: none;
}
#announcement {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: 5px;
  background: #0a1017dc;
  max-width: 85%;
  text-align: center;
  pointer-events: none;
  color: var(--lime);
  font-weight: 650;
}
#announcement:empty {
  display: none;
}
.touch {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 15px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}
.touch div {
  display: flex;
  gap: 10px;
}
.touch button {
  pointer-events: auto;
  width: 58px;
  height: 50px;
  background: #dae8f020;
  border-color: #dae8f040;
  color: #fff;
  font-size: 22px;
  touch-action: none;
  user-select: none;
}
.dashboard {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 20px 0;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
}
.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
h2 {
  margin: 0;
  font-size: 16px;
}
.panel-title > span {
  color: var(--muted);
  font-size: 10px;
}
.room-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  margin: 6px 0;
  padding: 10px;
  background: transparent;
}
.room-card.active {
  border-color: var(--lime);
  background: #d1ef7908;
}
.room-card b {
  font: 18px monospace;
  color: var(--lime);
}
.room-card span {
  flex: 1;
}
.room-card small {
  display: block;
  color: var(--muted);
  font: 10px monospace;
  margin-top: 3px;
}
.room-card em {
  font: 10px monospace;
  color: var(--muted);
  font-style: normal;
}
.fine {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}
.debug-toggle {
  display: block;
  margin-top: 18px;
}
input {
  accent-color: var(--lime);
}
.trap-card {
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.trap-card:last-child {
  border: 0;
}
.trap-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.trap-label span {
  font: 10px monospace;
  color: var(--amber);
}
.trap-card small {
  font: 10px monospace;
  color: var(--muted);
}
.trap-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.trap-actions button {
  padding: 7px 10px;
  font-size: 12px;
}
.trap-actions .chosen {
  color: var(--lime);
  border-color: var(--lime);
}
.trap-actions .fire {
  margin-left: auto;
  background: var(--coral);
  color: #15191f;
  border: 0;
  font-weight: 700;
}
.diagnostics {
  padding: 14px 20px;
  margin: 20px 0;
}
summary {
  cursor: pointer;
  font-size: 12px;
}
summary span {
  float: right;
  color: var(--muted);
  font: 10px monospace;
}
pre {
  font: 12px/1.8 monospace;
  color: var(--muted);
  white-space: pre-wrap;
  margin: 12px 0 0;
}
.test-actions {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 15px;
}
.test-actions label:first-child {
  align-self: center;
}
#test-status {
  font-size: 12px;
  color: var(--lime);
}
#pool {
  font: 11px/1.8 monospace;
  color: var(--muted);
}
footer {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-top: 25px;
}
@media (max-width: 760px) {
  header {
    padding: 15px;
  }
  .brand span {
    display: none;
  }
  main {
    padding: 16px;
  }
  .intro {
    gap: 20px;
    align-items: start;
  }
  .session {
    flex-direction: column;
    align-items: stretch;
    max-width: 48%;
  }
  .session select {
    font-size: 11px;
  }
  .dashboard {
    grid-template-columns: 1fr;
  }
  .panel {
    padding: 15px;
  }
  .game-top,
  .game-bottom {
    font-size: 9px;
    padding: 9px;
  }
  .game-bottom #message {
    max-width: 48%;
    text-align: right;
  }
  .touch button {
    width: 46px;
    height: 40px;
  }
  .touch {
    bottom: 8px;
    left: 8px;
    right: 8px;
  }
  footer {
    gap: 15px;
  }
  .badge {
    font-size: 8px;
  }
}
@media (orientation: landscape) and (max-height: 600px) {
  header {
    padding: 8px 16px;
  }
  main {
    padding: 12px;
  }
  .intro {
    margin-bottom: 12px;
  }
  h1 {
    font-size: 28px;
  }
  .intro p:last-child {
    display: none;
  }
  .session {
    flex-direction: row;
    align-items: end;
    max-width: 65%;
  }
  .session select {
    max-width: 260px;
  }
  .game-shell {
    max-width: 850px;
    margin: auto;
  }
  .viewport {
    max-height: 70vh;
    display: flex;
    justify-content: center;
  }
  canvas {
    width: auto;
    max-width: 100%;
    height: 70vh;
  }
  .dashboard {
    grid-template-columns: 1fr 1fr;
  }
  .touch {
    left: calc(50% - min(44vw, 58vh));
    right: calc(50% - min(44vw, 58vh));
  }
}
/* Landscape keeps the whole canvas and touch buttons in the initial viewport. */
@media (orientation: landscape) and (max-height: 600px) {
  header {
    display: none;
  }
  .intro {
    margin-bottom: 8px;
  }
  .intro .eyebrow {
    font-size: 9px;
  }
  main {
    padding: 8px 12px;
  }
  .viewport {
    max-height: none;
  }
  canvas {
    height: 56vh;
    width: auto;
    max-width: 100%;
  }
  .touch {
    width: min(calc(100% - 16px), calc(99.56vh - 16px));
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    bottom: 8px;
  }
  .touch button {
    height: 36px;
    width: 46px;
  }
  .game-top,
  .game-bottom {
    padding: 8px;
    font-size: 9px;
  }
  .session select {
    padding: 6px;
    font-size: 11px;
  }
  .session button {
    padding: 8px;
    font-size: 12px;
  }
}
.quick-controls:not([hidden]) {
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
  padding: 7px 12px;
  background: #18232e;
  border-top: 1px solid var(--line);
}
.quick-controls > div {
  display: flex;
  gap: 7px;
  align-items: center;
}
.quick-controls span {
  font: 10px monospace;
  color: var(--muted);
}
.quick-controls button {
  padding: 6px 10px;
  font-size: 11px;
  background: #34424b;
}
@media (orientation: landscape) and (max-height: 600px) {
  .quick-controls:not([hidden]) {
    gap: 12px;
    padding: 4px 8px;
  }
  .quick-controls button {
    padding: 5px 8px;
    font-size: 10px;
  }
}
.session {
  flex-wrap: wrap;
  max-width: 55%;
}
.session select {
  font-size: 12px;
}
.session #player-count {
  min-width: 55px;
}
input:not([type="checkbox"]):not([type="file"]) {
  display: block;
  margin-top: 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #252d35;
  color: var(--text);
  padding: 9px;
  max-width: 100%;
  font: inherit;
}
#network-panel {
  margin-bottom: 18px;
}
#roster {
  padding: 8px 0;
  font: 11px/1.7 monospace;
  color: var(--lime);
}
.import-button {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 10px;
  cursor: pointer;
}
.test-actions select {
  max-width: 240px;
}
.test-actions input {
  max-width: 230px;
}
#library-results {
  max-height: 100px;
  overflow: auto;
  margin: 8px 0;
}
.quick-controls > div > div {
  display: flex;
  gap: 6px;
}
.quick-controls button {
  background: #34424b;
}
.game-shell.focus-play {
  position: fixed;
  inset: 0;
  z-index: 1000;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  max-width: none;
  width: 100%;
  height: 100dvh;
}
.game-shell.focus-play .viewport {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.game-shell.focus-play canvas {
  height: 100%;
  max-height: 100%;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}
.game-shell.focus-play .touch {
  width: calc(100% - 40px);
  left: 50%;
  right: auto;
  transform: translateX(-50%);
}
#exit-focus {
  display: none;
  font-size: 11px;
  padding: 4px 8px;
}
.game-shell.focus-play #exit-focus {
  display: block;
}
#pool {
  overflow-wrap: anywhere;
}
#review-notes {
  min-width: 230px;
}
@media (orientation: landscape) and (max-height: 600px) {
  .session {
    max-width: 68%;
    gap: 5px;
  }
  .session select {
    max-width: 210px;
  }
  .session button {
    font-size: 10px;
    padding: 6px;
  }
  h1 {
    font-size: 25px;
  }
  .game-shell.focus-play canvas {
    height: 100%;
  }
  .game-shell.focus-play .touch button {
    width: 58px;
    height: 44px;
  }
}
@media (max-width: 580px) {
  .intro {
    flex-direction: column;
  }
  .session {
    max-width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .test-actions label {
    max-width: 100%;
  }
}
