:root {
  color-scheme: dark;
  --ink: #f2efe5;
  --muted: #bdb4a3;
  --line: rgba(255, 255, 255, 0.14);
  --gold: #d6a84f;
  --red: #a64032;
  --green: #4d7f69;
  --blue: #456e9e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background: #111;
}

body.dragging-map-piece {
  cursor: grabbing;
  user-select: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: #312a22;
  border-radius: 6px;
  padding: 10px 14px;
  cursor: pointer;
}

button:hover {
  border-color: rgba(214, 168, 79, 0.7);
}

button:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.app {
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

[hidden] {
  display: none !important;
}

.auth-screen,
.room-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(560px, 1.15fr);
  gap: 42px;
  align-items: center;
  padding: 5vw;
  background:
    linear-gradient(90deg, rgba(17, 17, 17, 0.82), rgba(17, 17, 17, 0.48)),
    url("./素材/地图.png") center / cover;
}

.auth-screen {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: #17130f;
}

.auth-screen::before {
  content: "";
  position: absolute;
  inset: -5%;
  z-index: -2;
  background: url("./covers/登录注册壁纸.webp") center / cover no-repeat;
  filter: blur(3px);
  transform: scale(1.03);
}

.auth-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(90deg, rgba(15, 13, 11, 0.76), rgba(15, 13, 11, 0.42));
}

.auth-screen .brand h1 {
  max-width: 720px;
  color: #fff;
  font-size: clamp(38px, 5vw, 68px);
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.52);
}

.auth-screen .brand .eyebrow,
.auth-screen .brand > p:last-child {
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.62);
}

.game-hub-screen {
  min-height: 100vh;
  color: #1f2a2e;
  padding: 48px clamp(24px, 5vw, 80px) 64px;
  background: #edf2f1;
}

.hub-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  max-width: 1440px;
  margin: 0 auto 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid #cbd5d4;
}

.hub-header h1 {
  margin: 0;
  font-size: clamp(38px, 5vw, 68px);
  line-height: 1;
}

.hub-header > div > p:last-child {
  margin: 14px 0 0;
  color: #627074;
}

.hub-account {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
  color: #627074;
}

.hub-account strong {
  color: #1f2a2e;
}

.hub-account button {
  color: #263237;
  background: #fff;
  border-color: #bdc9c7;
}

.game-library {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  max-width: 1440px;
  margin: 0 auto;
}

.hub-disclaimer {
  max-width: 1440px;
  margin: 24px auto 0;
  color: #7b8789;
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

.game-tile {
  min-width: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid #cbd5d4;
  border-top: 4px solid var(--game-accent);
  border-radius: 8px;
  box-shadow: 0 22px 55px rgba(0, 0, 0, 0.3);
}

.game-tile-camel {
  --game-accent: #e7b338;
}

.game-tile-royal {
  --game-accent: #d6573e;
}

.game-tile-detective {
  --game-accent: #5f90b7;
}

.game-tile-edo {
  --game-accent: #d04b3e;
}

.game-tile-tragic {
  --game-accent: #8c4f9e;
}

.game-cover-stage {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  padding: 0;
  overflow: hidden;
  background: #dfe7e5;
  border-bottom: 1px solid #cbd5d4;
}

.game-cover-stage img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.game-tile-body {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 22px;
  min-height: 250px;
  padding: 22px;
}

.game-type {
  margin: 0 0 6px;
  color: var(--game-accent);
  font-size: 13px;
}

.game-tile h2 {
  margin: 0 0 10px;
  font-size: 27px;
}

.game-tile-body > div > p:last-child {
  margin: 0;
  color: #627074;
  line-height: 1.7;
  white-space: pre-line;
}

.game-enter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  width: 100%;
  padding: 10px 16px;
  color: #101112;
  background: var(--game-accent);
  border: 1px solid color-mix(in srgb, var(--game-accent) 70%, white);
  border-radius: 6px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.game-enter:hover {
  filter: brightness(1.08);
}

.game-enter-pending,
.game-enter-pending:hover {
  color: #667074;
  background: #d8dddc;
  border-color: #c4cdcb;
  filter: none;
  cursor: not-allowed;
  opacity: 1;
}

.external-password {
  display: inline-block;
  margin-top: 8px;
  color: #7d3040;
}

.new-player-warning {
  margin: -2px 0 0;
  color: #ff8c7d;
  font-weight: 700;
}

.lobby-actions .danger {
  color: #fff;
  background: #a64032;
  border-color: #c95f50;
}

.auth-screen {
  grid-template-columns: minmax(300px, 1fr) minmax(320px, 440px);
  color: #1f2a2e;
  background: #edf2f1;
}

.auth-screen .brand p { color: #fff; }

.auth-screen .auth-panel {
  color: #1f2a2e;
  background: #fff;
  border-color: #cbd5d4;
  box-shadow: 0 24px 60px rgba(35, 55, 58, 0.14);
}

.auth-screen .auth-panel label,
.auth-screen .auth-hint {
  color: #627074;
}

.auth-screen .auth-panel input,
.auth-screen .auth-tabs {
  color: #1f2a2e;
  background: #f5f8f7;
  border-color: #bdc9c7;
}

.auth-screen .auth-tabs button {
  color: #435156;
}

.room-screen {
  align-items: start;
}

.auth-screen > *,
.room-screen > * {
  min-width: 0;
}

.auth-panel {
  display: grid;
  gap: 16px;
  padding: 28px;
  background: rgba(28, 25, 21, 0.96);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
}

.auth-panel label {
  display: grid;
  gap: 7px;
  color: var(--muted);
}

.auth-panel input,
.create-room-row input {
  width: 100%;
  min-width: 0;
  padding: 11px 12px;
  color: var(--ink);
  background: #14120f;
  border: 1px solid #4b453c;
  border-radius: 6px;
}

.auth-panel input:focus,
.create-room-row input:focus {
  border-color: var(--gold);
  outline: 2px solid rgba(214, 168, 79, 0.2);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: #14120f;
  border-radius: 6px;
}

.auth-tabs button {
  background: transparent;
  border-color: transparent;
}

.auth-tabs button.active {
  color: #17120a;
  background: var(--gold);
}

.auth-hint,
.auth-message {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.auth-message.error {
  color: #ff9284;
}

.auth-submit {
  min-height: 48px;
}

.account-bar {
  position: absolute;
  top: 18px;
  right: 5vw;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px 8px 14px;
  color: var(--muted);
  background: rgba(20, 18, 15, 0.9);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.account-bar strong {
  color: var(--ink);
}

.brand h1 {
  margin: 0 0 16px;
  font-size: clamp(42px, 7vw, 84px);
  line-height: 1.03;
  overflow-wrap: anywhere;
}

.brand p {
  max-width: 680px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.8;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: 13px;
}

.room-panel,
.side-panel,
.case-panel {
  background: rgba(28, 25, 21, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.36);
}

.room-panel {
  display: grid;
  gap: 18px;
  padding: 24px;
}

.room-panel > *,
.room-fields > *,
.room-choice > * {
  min-width: 0;
  max-width: 100%;
}

.room-fields {
  display: grid;
  grid-template-columns: 1fr 140px;
  gap: 14px;
}

.lobby-fields {
  grid-template-columns: minmax(180px, 0.7fr) minmax(420px, 1.3fr);
}

.seat-choice {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.seat-choice-buttons {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.seat-choice-buttons button {
  min-height: 42px;
  padding: 6px;
  color: var(--muted);
  background: #14120f;
  border-color: #454039;
  font-size: 13px;
}

.seat-choice-buttons button.active {
  color: #17120a;
  background: var(--seat-color, var(--gold));
  border-color: rgba(255, 255, 255, 0.65);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--seat-color, var(--gold)) 24%, transparent);
}

.room-choice {
  display: grid;
  gap: 10px;
}

.room-choice h2 {
  margin: 0;
  font-size: 20px;
}

.room-directory-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.room-directory-head p,
.room-empty {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.create-room-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.room-choice-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.room-choice-buttons button {
  min-height: 48px;
  padding: 8px 10px;
  color: var(--muted);
  background: #14120f;
  border-color: #454039;
}

.room-choice-buttons .room-entry {
  display: grid;
  gap: 5px;
  min-height: 76px;
  text-align: left;
}

.room-entry strong,
.room-entry span,
.room-entry small {
  display: block;
}

.room-entry strong {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.room-entry span,
.room-entry small {
  color: var(--muted);
  font-size: 12px;
}

.room-entry.started {
  border-color: rgba(77, 127, 105, 0.75);
}

.room-choice-buttons button.active {
  color: #17120a;
  background: var(--gold);
  border-color: #f1c76e;
  box-shadow: 0 0 0 2px rgba(214, 168, 79, 0.2);
}

.room-choice-buttons button:disabled {
  opacity: 0.68;
}

.lobby-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.lobby-actions .primary {
  flex: 1 1 180px;
}

.lobby-entry-status {
  min-height: 24px;
  color: var(--muted);
  text-align: center;
}

.test-entry-button {
  min-height: 50px;
  color: #17120a;
  background: var(--gold);
  border-color: #f1c76e;
  font-weight: 800;
}

.test-entry-button:hover {
  background: #e2b85f;
}

.test-seat-switcher {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px;
  background: #15130f;
  border: 1px solid rgba(214, 168, 79, 0.46);
  border-radius: 6px;
}

.test-seat-switcher span {
  padding: 0 5px;
  color: var(--gold);
  font-size: 12px;
  white-space: nowrap;
}

.test-seat-switcher button {
  min-width: 34px;
  min-height: 32px;
  padding: 5px 8px;
  font-size: 12px;
}

.test-seat-switcher button.active {
  color: #17120a;
  background: var(--seat-color, var(--gold));
  border-color: rgba(255, 255, 255, 0.7);
}

.lobby-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
  background: #11100d;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.lobby-panel h3,
.lobby-panel p {
  margin: 0;
}

.lobby-panel p {
  margin-top: 4px;
  color: var(--muted);
}

.lobby-roster {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 8px;
}

.lobby-player {
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 2px 9px;
  align-items: center;
  min-width: 0;
  padding: 10px;
  background: #1c1915;
  border: 1px solid #454039;
  border-radius: 5px;
}

.lobby-player i {
  grid-row: 1 / 3;
  width: 10px;
  height: 10px;
  background: var(--player-color);
  border-radius: 50%;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--player-color) 22%, transparent);
}

.lobby-player strong,
.lobby-player span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lobby-player span {
  color: var(--muted);
  font-size: 12px;
}

.case-picker.locked {
  pointer-events: none;
  opacity: 0.62;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  color: var(--ink);
  background: #141312;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
}

textarea {
  min-height: 150px;
  resize: vertical;
}

.case-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: end;
}

.case-header h2 {
  margin: 0 0 4px;
}

.case-header p {
  margin: 0;
  color: var(--muted);
}

.current-case-card {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-width: 0;
  padding: 12px;
  background: #11100d;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.current-case-card > img {
  display: block;
  width: 132px;
  height: 99px;
  min-width: 132px;
  max-width: 132px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid rgba(214, 168, 79, 0.28);
  border-radius: 6px;
}

.current-case-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.current-case-copy > span {
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
}

.current-case-copy h2,
.current-case-copy p,
.current-case-copy small { margin: 0; }
.current-case-copy h2 { display: none; }
.current-case-copy p { color: var(--ink); font-size: 20px; font-weight: 900; }
.current-case-copy small { color: var(--muted); line-height: 1.65; }

.case-picker {
  display: grid;
  grid-template-columns: minmax(280px, 420px);
  gap: 12px;
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

.case-card {
  position: relative;
  display: grid;
  gap: 8px;
  color: var(--muted);
  background: #151414;
  border: 1px solid rgba(214, 168, 79, 0.24);
  border-radius: 8px;
  padding: 10px;
}

.case-card.selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(214, 168, 79, 0.18);
}

.case-card.locked-case {
  opacity: 0.54;
}

.case-card.locked-case::after {
  content: "待补素材";
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 7px;
  color: #16120d;
  background: var(--gold);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.case-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.case-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
  background: #333;
}

.case-card strong {
  color: var(--ink);
  font-size: 20px;
}

.case-card small {
  min-height: 42px;
  line-height: 1.45;
}

.primary {
  color: #16120d;
  background: var(--gold);
  border-color: var(--gold);
  font-weight: 700;
}

.table-screen {
  min-height: 100vh;
  background: #141414;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(180px, auto) minmax(360px, 1fr) auto;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 20px;
  background: rgba(20, 20, 20, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.case-heading { min-width: 0; }

.turn-summary {
  justify-self: center;
  display: grid;
  grid-template-columns: minmax(140px, auto);
  align-items: stretch;
  gap: 1px;
  overflow: hidden;
  background: var(--line);
  border: 1px solid rgba(214, 168, 79, 0.5);
  border-radius: 7px;
}

.turn-summary-item {
  display: grid;
  align-content: center;
  gap: 3px;
  min-height: 54px;
  padding: 8px 16px;
  background: #11100d;
}

.turn-summary-item span {
  color: var(--muted);
  font-size: 12px;
}

.turn-summary-item strong {
  color: var(--text);
  font-size: 17px;
  white-space: nowrap;
}

.turn-summary-item b { color: var(--gold); }


.topbar h2 {
  margin: 0;
  font-size: 28px;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.bgm-controls {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 5px 7px 5px 10px;
  background: rgba(18, 16, 13, 0.82);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.bgm-controls span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.bgm-controls input[type="range"] {
  appearance: none;
  width: 120px;
  height: 18px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

.bgm-controls input[type="range"]::-webkit-slider-runnable-track {
  height: 5px;
  background: linear-gradient(90deg, var(--gold) 0 var(--bgm-level, 35%), #777 0 100%);
  border-radius: 2px;
}

.bgm-controls input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -5.5px;
  background: var(--gold);
  border: 1px solid #f3d28f;
  border-radius: 50%;
}

.bgm-controls small,
.bgm-controls output {
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.bgm-controls output {
  width: 34px;
  color: var(--text);
  text-align: right;
}

.bgm-controls button {
  min-height: 28px;
  padding: 3px 8px;
  font-size: 12px;
}

.network-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: rgba(18, 16, 13, 0.82);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.network-box label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.network-box input {
  width: 92px;
  height: 32px;
  padding: 4px 8px;
  color: var(--text);
  background: #11100d;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 14px;
  font-weight: 800;
}

.network-box button {
  min-height: 32px;
  padding: 4px 10px;
}

#networkStatus,
#tableNetworkStatus {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

#networkStatus[data-tone="online"],
#tableNetworkStatus[data-tone="online"] {
  color: #8bd49c;
}

#networkStatus[data-tone="error"],
#tableNetworkStatus[data-tone="error"] {
  color: #ff9b8f;
}

.player-display-name {
  display: block;
  padding: 6px 8px 0;
  overflow: hidden;
  color: #f4ead3;
  font-size: 14px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remote-cursor-layer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  overflow: hidden;
  pointer-events: none;
}

.remote-cursor {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 1;
  transform: translate(-2px, -2px);
  transition: left 55ms linear, top 55ms linear, opacity 180ms ease;
}

.remote-cursor.idle {
  opacity: 0.28;
}

.remote-cursor i {
  display: block;
  width: 0;
  height: 0;
  border-top: 18px solid var(--cursor-color);
  border-right: 11px solid transparent;
  filter: drop-shadow(0 1px 1px #000);
  transform: rotate(-12deg);
}

.remote-cursor span {
  position: absolute;
  top: 14px;
  left: 12px;
  padding: 3px 6px;
  color: #111;
  background: var(--cursor-color);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.focus-wave {
  position: absolute;
  width: 34px;
  aspect-ratio: 1;
  pointer-events: none;
  transform: translate(-50%, -50%);
  border: 4px solid rgba(255, 220, 118, 0.98);
  border-radius: 50%;
  box-shadow: 0 0 18px rgba(255, 201, 74, 0.95), inset 0 0 10px rgba(255, 245, 191, 0.75);
  animation: focus-wave-expand 1.25s ease-out forwards;
}

.focus-wave::after {
  content: "";
  position: absolute;
  inset: 50%;
  border: 2px solid rgba(255, 247, 211, 0.88);
  border-radius: 50%;
  animation: focus-wave-expand-inner 0.85s 0.08s ease-out forwards;
}

@keyframes focus-wave-expand {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.25); }
  16% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(5.5); }
}

@keyframes focus-wave-expand-inner {
  from { inset: 50%; opacity: 1; }
  to { inset: -80%; opacity: 0; }
}

.role-pill {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  color: var(--gold);
  background: rgba(214, 168, 79, 0.12);
  border: 1px solid rgba(214, 168, 79, 0.36);
  border-radius: 999px;
  font-size: 14px;
}

.table-layout {
  display: grid;
  grid-template-columns: 250px minmax(560px, 1fr) 340px;
  gap: 14px;
  padding: 14px;
}

.side-panel,
.case-panel,
.status-panel {
  align-self: start;
  display: grid;
  gap: 18px;
  padding: 16px;
  max-height: calc(100vh - 92px);
  overflow: auto;
}

.status-panel {
  grid-column: 3;
  align-self: end;
  background: rgba(28, 25, 21, 0.96);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: none;
}

h3 {
  margin: 0 0 12px;
  color: var(--gold);
  font-size: 18px;
}

.brief-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.brief-heading-row h3 {
  margin: 0;
}

.case-audio-toggle {
  padding: 6px 10px;
  color: var(--gold);
  border-color: rgba(214, 168, 79, 0.5);
  font-size: 12px;
  font-weight: 800;
}

.case-audio-toggle[hidden],
.case-audio-panel[hidden],
.case-audio-body[hidden] {
  display: none;
}

.case-audio-panel {
  margin-top: 10px;
  padding: 10px;
  background: rgba(214, 168, 79, 0.08);
  border: 1px solid rgba(214, 168, 79, 0.35);
  border-radius: 8px;
}

.case-audio-body {
  display: grid;
  gap: 9px;
}

.case-audio-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.case-audio-buttons {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
}

.case-audio-buttons button {
  width: 100%;
  border-color: rgba(214, 168, 79, 0.55);
  font-weight: 800;
}

.case-audio-buttons .case-audio-stop {
  color: #ffd4d4;
  background: rgba(126, 34, 34, 0.42);
  border-color: rgba(248, 113, 113, 0.58);
}

.status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.status-readout {
  display: grid;
  gap: 8px;
  padding: 12px;
  color: var(--muted);
  background: #11100d;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 14px;
}

.status-readout strong {
  color: var(--text);
  font-size: 22px;
  line-height: 1.1;
}

.next-day-button {
  width: 100%;
  margin-top: 10px;
  background: var(--gold);
  color: #151009;
  border-color: rgba(255, 226, 149, 0.7);
  font-weight: 900;
}

.next-day-button[hidden] {
  display: none;
}

.table-message {
  min-height: 44px;
  margin: 12px 0 0;
  padding: 10px 12px;
  color: var(--gold);
  line-height: 1.45;
  background: rgba(214, 168, 79, 0.1);
  border: 1px solid rgba(214, 168, 79, 0.25);
  border-radius: 6px;
}

.panel-hint {
  margin: -4px 0 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.hat-chip-tray {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: rgba(28, 25, 21, 0.96);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.hat-chip-tray h3 {
  margin-bottom: 0;
}

.hat-chip-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.hat-chip-spawn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 7px 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
}

.hat-chip-spawn b {
  font-size: 14px;
}

.hat-chip-preview {
  width: 22px;
  height: 22px;
  aspect-ratio: 1;
  border-radius: 999px;
  object-fit: cover;
}

.notes {
  margin-top: 12px;
}

.player-notes textarea {
  min-height: 170px;
}

.map-stage .player-notes {
  margin: 12px;
}

.final-deduction {
  display: grid;
  gap: 12px;
}

.final-deduction h3 {
  margin: 0;
}

.final-deduction-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.compact-reference-button {
  min-height: 34px;
  padding: 6px 12px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 800;
}

#finalDeductionForm {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: #11100d;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.board-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.board-tabs button {
  height: 36px;
  padding: 0;
}

.board-tabs .active {
  outline: 2px solid var(--gold);
}

.board-blue {
  background: var(--blue);
}

.board-red {
  background: var(--red);
}

.board-green {
  background: var(--green);
}

.board-yellow {
  background: var(--gold);
  color: #1b160f;
}

.player-board {
  width: 100%;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.map-stage {
  position: relative;
  z-index: 1;
  min-height: calc(100vh - 92px);
  background: #0f0e0d;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden auto;
  isolation: isolate;
}

.map-toolbar {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: #1b1815;
}

.map-toolbar button {
  min-width: 44px;
  padding: 8px 10px;
}

.map-scroll {
  position: relative;
  height: calc(100vh - 146px);
  min-height: 430px;
  overflow: auto;
  display: grid;
  place-items: start;
  overscroll-behavior: contain;
  contain: paint;
  isolation: isolate;
}

.player-board-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.player-board-panel {
  position: relative;
  min-width: 0;
  padding: 0;
  background: #100f0c;
  border: 3px solid var(--board-color, var(--line));
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--board-color, white) 28%, transparent), 0 8px 18px rgba(0, 0, 0, 0.28);
}

.player-board-panel.board-blue { --board-color: #3b82f6; }
.player-board-panel.board-red { --board-color: #ef4444; }
.player-board-panel.board-green { --board-color: #65a30d; }
.player-board-panel.board-yellow { --board-color: #facc15; }

.player-board-panel .player-display-name {
  padding: 7px 8px;
  color: #fff;
  background: color-mix(in srgb, var(--board-color) 68%, #12100d 32%);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
  font-weight: 900;
}

.player-board-panel.active {
  border-color: rgba(223, 174, 77, 0.86);
  box-shadow: 0 0 0 2px rgba(223, 174, 77, 0.2);
}

.player-board-panel.viewing {
  border-color: var(--board-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--board-color) 42%, transparent), 0 0 18px color-mix(in srgb, var(--board-color) 32%, transparent);
}

.player-board-button {
  display: block;
  width: 100%;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.player-board-button:disabled {
  cursor: default;
  opacity: 1;
}

body.mystery-role .player-board-button { cursor: pointer; }

.player-board-button img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.money-control {
  position: absolute;
  right: 5.5%;
  bottom: 8%;
  display: flex;
  align-items: center;
  gap: 6px;
  width: min(42%, 120px);
  padding: 5px 7px;
  color: #21170d;
  background: rgba(243, 210, 116, 0.9);
  border: 1px solid rgba(91, 57, 24, 0.58);
  border-radius: 4px;
  font-size: 13px;
  font-weight: 900;
}

.player-token-controls {
  position: absolute;
  left: 5.5%;
  bottom: 8%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  width: min(48%, 136px);
}

.player-token-controls button {
  min-height: 26px;
  padding: 2px 4px;
  color: #1a1209;
  background: rgba(255, 250, 231, 0.9);
  border: 1px solid rgba(92, 58, 25, 0.52);
  border-radius: 3px;
  font-size: 12px;
  font-weight: 900;
}

.map-number-overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.money-control input {
  width: 100%;
  min-width: 0;
  height: 26px;
  padding: 2px 5px;
  color: #1a1209;
  background: rgba(255, 250, 231, 0.92);
  border: 1px solid rgba(92, 58, 25, 0.52);
  border-radius: 3px;
  font-weight: 900;
}

.map-board {
  position: relative;
  width: calc(1100px * var(--zoom, 1));
  max-width: none;
  overflow: hidden;
  isolation: isolate;
}

#cityMap {
  width: 100%;
  display: block;
}

.map-case-zone {
  position: absolute;
  top: 1.72%;
  left: 1.42%;
  right: 1.42%;
  height: 15.92%;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.32%;
  overflow: visible;
  pointer-events: none;
}

.suspect-token-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.crime-scene-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.player-token-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hat-chip-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.reveal-marker-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.day-marker-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.day-marker-hit {
  position: absolute;
  z-index: 9;
  left: 93.6%;
  width: 4.2%;
  min-width: 36px;
  height: 3.1%;
  min-height: 24px;
  transform: translate(-50%, -50%);
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 999px;
  box-shadow: none;
  pointer-events: auto;
}

.day-marker-hit.current::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 54%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 4px solid rgba(210, 32, 22, 0.92);
  border-radius: 999px;
  box-shadow: 0 0 0 1px rgba(255, 230, 210, 0.35), 0 2px 5px rgba(0, 0, 0, 0.35);
}

.day-marker-hit:disabled {
  cursor: default;
}

.map-case-card {
  position: relative;
  display: grid;
  width: 100%;
  height: 100%;
  padding: 0;
  background: rgba(20, 18, 16, 0.06);
  border-color: transparent;
  pointer-events: auto;
}

.map-case-card.taken-card {
  opacity: 0.56;
}

.map-case-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
  background: #2b2721;
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.28);
}

.map-case-card span {
  display: none;
}

.map-case-card b {
  position: absolute;
  left: 50%;
  bottom: 8%;
  transform: translateX(-50%);
  min-width: max-content;
  padding: 3px 6px;
  color: #17110a;
  background: var(--gold);
  border-radius: 999px;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.map-case-card b:empty {
  display: none;
}

.case-knowledge-markers {
  position: absolute;
  left: 50%;
  bottom: -9.5%;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  pointer-events: none;
}

.case-knowledge-markers:empty {
  display: none;
}

.case-knowledge-markers i {
  display: grid;
  width: 18px;
  aspect-ratio: 1;
  place-items: center;
  color: #140f0a;
  border: 1px solid rgba(45, 30, 15, 0.72);
  border-radius: 2px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
  line-height: 1;
}

.map-case-card.facedown::after {
  content: none;
}

body:not(.mystery-role) .map-case-card {
  cursor: not-allowed;
}

.reveal-marker {
  position: absolute;
  z-index: 10;
  width: 2.05%;
  min-width: 24px;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  padding: 0;
  color: #1a1009;
  background: #f1d47a;
  border: 2px solid rgba(75, 45, 18, 0.62);
  border-radius: 999px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.38);
  font-size: 13px;
  font-weight: 900;
  pointer-events: auto;
}

.suspect-token {
  position: absolute;
  z-index: 4;
  width: 4.2%;
  min-width: 38px;
  max-width: 66px;
  aspect-ratio: 1;
  padding: 0;
  overflow: hidden;
  transform: translate(-50%, -50%);
  background: rgba(18, 16, 13, 0.85);
  border: 2px solid rgba(214, 168, 79, 0.75);
  border-radius: 10px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.38);
  cursor: grab;
  pointer-events: auto;
  touch-action: none;
  will-change: left, top;
}

.suspect-token.dragging {
  z-index: 6;
  border-color: #f3d486;
  cursor: grabbing;
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.5);
}

.suspect-token img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  pointer-events: none;
}

.crime-scene-token {
  position: absolute;
  z-index: 4;
  width: 5.4%;
  min-width: 46px;
  max-width: 82px;
  aspect-ratio: 1;
  padding: 0;
  transform: translate(-50%, -50%);
  background: transparent;
  border: 0;
  cursor: grab;
  pointer-events: auto;
  touch-action: none;
  will-change: left, top;
}

.crime-scene-token.dragging { z-index: 7; cursor: grabbing; }
.crime-scene-token img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }

.crime-scene-spawn {
  display: grid;
  grid-template-columns: 48px 1fr;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
}

.crime-scene-spawn img { width: 48px; height: 48px; object-fit: contain; }

.placement-tools {
  display: grid;
  gap: 12px;
  padding: 12px;
  background: #14120f;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.placement-tools-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.placement-tools-head h3 { margin: 0; }
.placement-tools-head button { padding: 6px 10px; font-size: 12px; }

.placement-tools-body {
  display: grid;
  gap: 22px;
}

.placement-tools-body[hidden] { display: none; }

.player-token {
  position: absolute;
  z-index: 5;
  width: 3.2%;
  min-width: 34px;
  max-width: 54px;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 999px;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.42);
  cursor: grab;
  pointer-events: auto;
  touch-action: none;
  will-change: left, top;
}

.player-token.active {
  outline: 3px solid rgba(214, 168, 79, 0.74);
  outline-offset: 2px;
}

.player-token.dragging {
  z-index: 7;
  cursor: grabbing;
}

.player-token img { width: 100%; height: 100%; object-fit: cover; border-radius: 999px; pointer-events: none; }

.hat-chip {
  position: absolute;
  z-index: 6;
  width: 2.55%;
  min-width: 28px;
  max-width: 42px;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 999px;
  box-shadow: 0 5px 0 color-mix(in srgb, var(--player-color) 66%, #000 34%), 0 10px 16px rgba(0, 0, 0, 0.38);
  cursor: grab;
  pointer-events: auto;
  touch-action: none;
  will-change: left, top;
}

.hat-chip.dragging {
  z-index: 7;
  cursor: grabbing;
}

.hat-chip img { width: 100%; height: 100%; object-fit: cover; border-radius: 999px; pointer-events: none; }

.empty-slot {
  display: grid;
  place-items: end center;
  padding-bottom: 4px;
  color: rgba(46, 40, 30, 0.5);
  font-weight: 800;
  pointer-events: none;
}

.brief-card {
  display: grid;
  align-content: start;
  gap: 8px;
  width: 100%;
  padding: 8px;
  text-align: left;
  background: #121111;
}

.brief-card span {
  color: var(--gold);
  font-size: 13px;
}

.brief-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 4px;
}

.suspect-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.suspect-grid .asset-card img {
  aspect-ratio: 1;
  object-fit: cover;
}

.suspect-tray-card {
  position: relative;
}

.suspect-tray-card::after {
  content: "放置";
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 3px 6px;
  color: #17110a;
  background: var(--gold);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.asset-strip {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.asset-strip.compact {
  grid-template-columns: repeat(3, 1fr);
}

.asset-card {
  display: grid;
  gap: 7px;
  padding: 8px;
  text-align: left;
  background: #171511;
}

.asset-card img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 4px;
  background: #2e2a24;
}

.asset-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.player-card-log {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.player-card-log-item {
  width: 100%;
  padding: 8px 10px;
  background: #171511;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}

.player-card-log-item:hover {
  border-color: rgba(223, 174, 77, 0.65);
  color: var(--text);
}

.action-panel {
  display: grid;
  gap: 12px;
}

.action-head,
.mystery-action-row,
.action-buttons,
.interrogation-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.action-head,
.mystery-action-row {
  justify-content: space-between;
}

.action-head h3 {
  margin: 0;
}

.action-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.action-title-row button {
  padding: 6px 9px;
  color: var(--gold);
  font-size: 12px;
}

.action-head span {
  min-width: 52px;
  padding: 6px 8px;
  color: #17110a;
  background: var(--gold);
  border-radius: 4px;
  text-align: center;
  font-weight: 900;
}

.action-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.interrogate-box {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: #11100d;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.interrogate-box h4 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
}

.interrogate-box label {
  gap: 6px;
  font-size: 14px;
}

.interrogate-box textarea {
  min-height: 78px;
}

.interrogation-list {
  display: grid;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.interrogation-item {
  display: grid;
  gap: 8px;
  padding: 10px;
  background: #171511;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.interrogation-item p,
.interrogation-item strong,
.interrogation-item em {
  margin: 0;
}

.interrogation-item strong {
  color: var(--gold);
  font-size: 13px;
}

.interrogation-item em {
  justify-self: start;
  padding: 4px 7px;
  color: #17110a;
  background: rgba(214, 168, 79, 0.88);
  border-radius: 4px;
  font-size: 13px;
  font-style: normal;
  font-weight: 900;
}

.interrogation-item.answered {
  border-color: rgba(93, 145, 93, 0.48);
}

.interrogation-item.blocked {
  border-color: rgba(191, 74, 63, 0.68);
}

.interrogation-item.decision-launcher {
  cursor: pointer;
  border-color: rgba(214, 168, 79, 0.58);
}

.interrogation-item.decision-launcher:hover {
  background: #201c15;
}

.interrogation-answer {
  padding: 8px;
  color: var(--text);
  background: rgba(214, 168, 79, 0.08);
  border-radius: 4px;
}

.interrogation-actions {
  justify-content: flex-end;
}

.interrogation-actions.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.interrogation-actions .danger-action {
  border-color: rgba(191, 74, 63, 0.75);
  color: #f1b0a9;
}

.interrogation-muted {
  color: #81796a;
  font-style: italic;
}

.information-history {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.information-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.information-history-head h3 { margin: 0; font-size: 17px; }
.information-history-head span { color: var(--gold); font-size: 13px; font-weight: 800; }

.information-history-list {
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.information-history-list article {
  display: grid;
  gap: 5px;
  padding: 10px 12px;
  background: #15130f;
  border-left: 3px solid rgba(214, 168, 79, 0.68);
}

.information-history-list article strong { color: var(--text); }
.information-history-list article span { font-size: 12px; }
.information-history-list article p { margin: 0; color: #d4cbb9; white-space: pre-wrap; }

.information-pending {
  width: 100%;
  border-color: rgba(214, 168, 79, 0.64);
  color: var(--gold);
  text-align: left;
}

.decision-dialog {
  position: fixed;
  width: min(620px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 32px));
  padding: 30px;
  color: var(--text);
  background: #181611;
  border: 1px solid rgba(214, 168, 79, 0.58);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.68);
}

.decision-dialog::backdrop { background: rgba(5, 5, 4, 0.78); }

.decision-dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 38px;
  height: 38px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

.decision-dialog-kicker { margin-bottom: 8px; color: var(--gold); font-size: 13px; font-weight: 900; }
.decision-dialog h2 { margin: 0 48px 18px 0; font-size: 25px; }
.decision-dialog-body { display: grid; gap: 12px; color: #d5cdbc; line-height: 1.65; }
.decision-dialog-body p { margin: 0; }
.decision-dialog-body blockquote {
  margin: 0;
  padding: 16px;
  color: var(--text);
  background: rgba(214, 168, 79, 0.1);
  border-left: 3px solid var(--gold);
  white-space: pre-wrap;
}
.decision-dialog-body textarea { min-height: 150px; resize: vertical; }
.decision-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.decision-dialog-actions .danger-action { border-color: #a94f44; color: #f1b0a9; }

.action-reference-dialog {
  position: fixed;
  width: min(720px, calc(100vw - 32px));
  max-height: min(820px, calc(100vh - 32px));
  padding: 30px;
  color: var(--text);
  background: #181611;
  border: 1px solid rgba(214, 168, 79, 0.58);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.68);
}

.action-reference-dialog::backdrop { background: rgba(5, 5, 4, 0.78); }
.action-reference-dialog h2 { margin: 0 48px 18px 0; font-size: 25px; }

.motive-reference-dialog {
  position: fixed;
  width: min(560px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 32px));
  padding: 30px;
  color: var(--text);
  background: #181611;
  border: 1px solid rgba(214, 168, 79, 0.58);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.68);
}

.motive-reference-dialog::backdrop { background: rgba(5, 5, 4, 0.78); }
.motive-reference-dialog h2 { margin: 0 48px 18px 0; font-size: 25px; }

.motive-reference-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.motive-reference-grid span {
  padding: 12px 16px;
  color: #eee7d8;
  background: #11100d;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: center;
}

.motive-reference-grid span:nth-child(2n) { border-right: 0; }
.motive-reference-grid span:nth-last-child(-n + 2) { border-bottom: 0; }

.motive-reference-note {
  margin: 16px 0 0;
  padding: 12px 14px;
  color: var(--gold);
  background: rgba(214, 168, 79, 0.09);
  border-left: 3px solid var(--gold);
  line-height: 1.55;
}

.search-reference-dialog {
  position: fixed;
  width: min(920px, calc(100vw - 32px));
  max-height: min(860px, calc(100vh - 32px));
  padding: 30px;
  color: var(--text);
  background: #181611;
  border: 1px solid rgba(214, 168, 79, 0.58);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.68);
}

.search-reference-dialog::backdrop { background: rgba(5, 5, 4, 0.78); }
.search-reference-dialog h2 { margin: 0 48px 18px 0; font-size: 25px; }
.search-reference-content { display: grid; gap: 22px; overflow: auto; }
.search-reference-content h3 { margin: 0 0 10px; color: var(--gold); }
.search-reference-list { display: grid; gap: 6px; }
.search-reference-list article {
  display: grid;
  grid-template-columns: minmax(100px, 150px) 1fr;
  gap: 14px;
  padding: 11px 13px;
  background: #11100d;
  border: 1px solid var(--line);
  border-radius: 5px;
}
.search-reference-list strong { color: #f0e8d7; }
.search-reference-list p { margin: 0; color: #cfc5b1; line-height: 1.55; }

.answer-text-dialog {
  position: fixed;
  width: min(1500px, calc(100vw - 32px));
  max-height: min(880px, calc(100vh - 32px));
  padding: 30px;
  color: var(--text);
  background: #181611;
  border: 1px solid rgba(214, 168, 79, 0.58);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.68);
}
.answer-text-dialog::backdrop { background: rgba(5, 5, 4, 0.78); }
.answer-text-dialog h2 { margin: 0 48px 12px 0; font-size: 25px; }
.answer-text-note { margin: 0 0 12px; color: var(--gold); line-height: 1.55; }
.answer-text-dialog > button:not(.decision-dialog-close) { margin-bottom: 12px; }
.answer-text-content {
  max-height: min(660px, calc(100vh - 250px));
  margin: 0;
  padding: 10px;
  overflow: auto;
  background: #0e0d0b;
  border: 1px solid var(--line);
  border-radius: 6px;
  user-select: text;
}
.answer-matrix {
  display: grid;
  grid-template-columns: 132px repeat(var(--answer-columns), minmax(210px, 230px));
  width: max-content;
  min-width: 100%;
  gap: 1px;
  background: #2e2921;
}
.answer-matrix-corner,
.answer-matrix-column,
.answer-matrix-row {
  z-index: 2;
  display: grid;
  place-items: center;
  min-height: 54px;
  padding: 10px;
  color: var(--gold);
  background: #171510;
  font-weight: 900;
  text-align: center;
}
.answer-matrix-corner,
.answer-matrix-column { position: sticky; top: 0; z-index: 3; }
.answer-matrix-corner { left: 0; z-index: 4; }
.answer-matrix-row { position: sticky; left: 0; align-content: start; padding-top: 18px; }
.answer-matrix-cell {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 150px;
  padding: 6px;
  background: #0e0d0b;
}
.answer-matrix-cell.is-empty::after {
  content: "—";
  margin: auto;
  color: #655d50;
}
.answer-text-content article {
  min-width: 0;
  padding: 10px;
  background: #171510;
  border: 1px solid #40392d;
  border-radius: 6px;
}
.answer-text-content article > div {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 9px;
  border-bottom: 1px solid #332e25;
}
.answer-text-content strong { color: var(--gold); line-height: 1.45; }
.answer-text-content article button {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 5px 9px;
  font-size: 12px;
}
.answer-text-content p {
  margin: 10px 0 0;
  color: #e8e0d0;
  font: 14px/1.75 "Microsoft YaHei", sans-serif;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.answer-text-content article.optimal-answer {
  border-color: rgba(214, 168, 79, 0.7);
  background: #191711;
}
.answer-text-content article.nonoptimal-answer > p:not(.answer-reveal) { color: #ef7569; }
.optimal-answer-badge {
  flex: 0 0 auto;
  padding: 3px 6px;
  color: #17130c;
  background: var(--gold);
  border-radius: 3px;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}
.nonoptimal-answer .optimal-answer-badge {
  color: #ffd8d2;
  background: #7e3029;
}
.answer-text-content .answer-reveal {
  margin-top: 8px;
  color: #ef6b58;
  font-weight: 900;
}

.action-reference-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  overflow: auto;
}

.action-reference-list article {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 12px;
  background: #11100d;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.action-reference-list article > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.action-reference-list strong { color: var(--text); font-size: 16px; }
.action-reference-list span { color: var(--gold); font-size: 12px; font-weight: 800; white-space: nowrap; }
.action-reference-list p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }

@media (max-width: 640px) {
  .decision-dialog { padding: 24px 18px 20px; }
  .decision-dialog-actions { display: grid; grid-template-columns: 1fr; }
  .action-reference-dialog { padding: 24px 18px 20px; }
  .action-reference-list { grid-template-columns: 1fr; }
  .motive-reference-dialog { padding: 24px 18px 20px; }
  .search-reference-dialog { padding: 24px 18px 20px; }
  .answer-text-dialog { padding: 24px 18px 20px; }
  .answer-text-content { grid-template-columns: 1fr; }
  .search-reference-list article { grid-template-columns: 1fr; gap: 6px; }
}

@media (max-width: 1180px) {
  .topbar { grid-template-columns: 1fr auto; }
  .turn-summary { grid-column: 1 / -1; grid-row: 2; width: 100%; }
  .turn-summary-item { min-width: 0; }
}

.truth-box {
  display: grid;
  gap: 10px;
}

.truth-box p {
  margin: 0;
  color: var(--muted);
}

.truth-box img {
  width: 100%;
  border-radius: 6px;
  border: 1px solid var(--line);
  cursor: zoom-in;
}

.truth-box.locked img {
  display: none;
}

.truth-box:not(.locked) button {
  display: none;
}

dialog {
  width: min(92vw, 880px);
  max-height: 92vh;
  padding: 16px;
  color: var(--ink);
  background: #171511;
  border: 1px solid var(--line);
  border-radius: 8px;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.74);
}

.dialog-close {
  float: right;
  width: 38px;
  height: 38px;
  padding: 0;
}

.dialog-help {
  color: var(--muted);
  line-height: 1.6;
}

.dialog-help code {
  color: var(--gold);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.case-picker-dialog {
  width: min(94vw, 1040px);
}

.case-picker-dialog .case-picker {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  max-height: 62vh;
  overflow: auto;
  padding: 2px 4px 2px 2px;
}

.admin-home-customize {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 45;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.bug-report-dialog {
  width: min(92vw, 760px);
}

.bug-report-form {
  display: grid;
  gap: 14px;
}

.bug-report-form textarea {
  min-height: 160px;
}

.bug-report-message {
  min-height: 22px;
  margin: 0;
  color: var(--green);
  font-weight: 700;
}

.bug-report-message.error { color: #ff8c7d; }

.bug-admin-section {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.bug-admin-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.bug-admin-heading h3 { margin: 0; }

.bug-report-list {
  display: grid;
  gap: 10px;
  max-height: 42vh;
  overflow: auto;
}

.bug-report-item {
  display: grid;
  gap: 7px;
  padding: 12px;
  background: #11100d;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.bug-report-item header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.bug-report-item p {
  margin: 0;
  color: var(--ink);
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.bug-report-item small { color: var(--muted); }

.hub-editor-dialog { width: min(96vw, 1120px); }

.hub-editor-list {
  display: grid;
  gap: 14px;
  max-height: 66vh;
  overflow: auto;
  padding-right: 4px;
}

.hub-editor-row {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: #11100d;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.hub-editor-row h3 { margin: 0; color: var(--gold); }

.hub-editor-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.hub-editor-fields label:nth-child(3),
.hub-editor-fields label:nth-child(4) { grid-column: 1 / -1; }
.hub-editor-fields textarea { min-height: 110px; }

.hub-editor-fields label:has(input[type="checkbox"]) {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hub-editor-fields input[type="checkbox"] { width: 18px; height: 18px; }

.customize-list {
  display: grid;
  gap: 12px;
  max-height: 58vh;
  overflow: auto;
  padding-right: 4px;
}

.customize-row {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 12px;
  align-items: start;
  padding: 10px;
  background: #111;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.customize-row img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
  background: #333;
}

.customize-fields {
  display: grid;
  gap: 10px;
}

.preview-tools {
  display: grid;
  grid-template-columns: 42px minmax(160px, 1fr) 42px 72px;
  gap: 8px;
  align-items: center;
  margin: 4px 46px 12px 0;
}

.preview-tools button {
  height: 34px;
  padding: 0 8px;
}

.preview-scroll {
  width: 100%;
  height: min(74vh, 760px);
  overflow: auto;
  background: #0d0c0b;
  border: 1px solid var(--line);
  border-radius: 6px;
}

#previewImage {
  display: block;
  width: auto;
  height: auto;
  max-width: none;
  margin: 0 auto;
  object-fit: contain;
}

#previewLabel {
  margin: 10px 0 0;
  color: var(--muted);
}

.card-menu {
  position: fixed;
  z-index: 50;
  width: 230px;
  max-height: min(70vh, 620px);
  overflow: auto;
  padding: 8px;
  background: rgba(22, 19, 16, 0.98);
  border: 1px solid rgba(214, 168, 79, 0.42);
  border-radius: 8px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.card-menu-title {
  padding: 8px 9px 10px;
  color: var(--gold);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
}

.card-menu-divider {
  margin: 6px 0 4px;
  padding: 6px 9px 3px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.card-menu button {
  width: 100%;
  margin: 2px 0;
  padding: 8px 9px;
  text-align: left;
  background: transparent;
  border-color: transparent;
}

.card-menu button:hover {
  background: rgba(214, 168, 79, 0.12);
  border-color: rgba(214, 168, 79, 0.22);
}

@media (max-width: 1100px) {
  .auth-screen,
  .room-screen,
  .table-layout {
    grid-template-columns: 1fr;
  }

  .side-panel,
  .case-panel {
    max-height: none;
  }

  .map-scroll {
    height: 70vh;
  }

  .game-library {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .hub-editor-fields { grid-template-columns: 1fr; }
  .hub-editor-fields label:nth-child(3),
  .hub-editor-fields label:nth-child(4) { grid-column: auto; }
  .auth-screen,
  .room-screen {
    padding: 20px;
  }

  .account-bar {
    position: static;
    grid-column: 1;
    justify-self: stretch;
    justify-content: space-between;
    flex-wrap: wrap;
    max-width: 100%;
  }

  .account-bar span {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .game-hub-screen {
    padding: 26px 18px 40px;
  }

  .admin-home-customize {
    left: 12px;
    bottom: 12px;
  }

  .hub-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 20px;
  }

  .hub-account {
    width: 100%;
    justify-content: space-between;
  }

  .game-library {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .game-tile-body {
    min-height: 0;
    gap: 14px;
    padding: 14px;
  }

  .game-type { font-size: 11px; }
  .game-tile h2 { margin-bottom: 7px; font-size: 19px; }
  .game-tile-body > div > p:last-child { font-size: 12px; line-height: 1.55; }
  .game-enter { min-height: 38px; padding: 8px 6px; font-size: 12px; }

  .room-fields,
  .room-choice-buttons,
  .create-room-row,
  .case-picker,
  .customize-row {
    grid-template-columns: 1fr;
  }

  .seat-choice-buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar,
  .case-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .current-case-card {
    grid-template-columns: 92px minmax(0, 1fr);
  }

  .current-case-card > img {
    width: 92px;
    height: 69px;
    min-width: 92px;
    max-width: 92px;
  }
  .current-case-card > button { grid-column: 1 / -1; width: 100%; }

  .status-grid,
  .asset-strip,
  .asset-strip.compact {
    grid-template-columns: 1fr 1fr;
  }
}
.room-panel.in-room > .room-choice, .room-panel.in-room > .test-entry-button { display: none; }
.room-panel.in-room .lobby-fields > label { display: none; }
.room-panel.in-room .lobby-fields { grid-template-columns: minmax(0, 1fr); }
.room-quick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.room-screen .brand h1 { margin-bottom: 8px; font-size: 34px; line-height: 1.18; }
.room-screen .brand p { font-size: 15px; line-height: 1.5; }
.room-quick-form { display: grid; gap: 10px; align-content: start; min-width: 0; }
.room-quick-form + .room-quick-form { padding-left: 20px; border-left: 1px solid var(--line); }
.room-quick-form h3, .room-list-title { margin: 0; font-size: 16px; }
.room-quick-form h3 span { margin-right: 8px; color: var(--gold); font-size: 12px; }
.room-quick-form p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.room-quick-form .new-player-warning { color: #ff9a86; }
.room-quick-form .create-room-row { grid-template-columns: minmax(0, 1fr) 108px; }
.room-quick-form .create-room-row button { min-width: 0; white-space: nowrap; }
.room-list-title { margin-top: 8px; }
.room-list-title small { margin-left: 6px; color: var(--muted); font-size: 12px; }
.room-choice-buttons { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.room-choice-buttons .room-entry { min-height: 82px; }
.room-choice-buttons .room-entry:disabled { cursor: not-allowed; }
@media (max-width: 760px) {
  .room-screen .brand h1 { font-size: 28px; }
  .room-quick-actions { grid-template-columns: 1fr; gap: 18px; }
  .room-quick-form + .room-quick-form { padding: 18px 0 0; border-left: 0; border-top: 1px solid var(--line); }
  .room-choice-buttons { grid-template-columns: 1fr; }
}
@media (max-width: 390px) {
  .room-quick-form .create-room-row { grid-template-columns: 1fr; }
  .room-quick-form .create-room-row button { width: 100%; }
}
