* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #1a1a2e;
  color: #eee;
  min-height: 100vh;
}

.hidden { display: none !important; }

/* ========== Join overlay ========== */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: #1a1a2e;
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.overlay.active { display: flex; }

.join-box {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 300px;
}

.join-box h1 {
  font-size: 2.8em;
  margin-bottom: 20px;
  letter-spacing: 4px;
  text-transform: uppercase;
  background: linear-gradient(135deg, #e74c3c, #3498db);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.join-box input {
  padding: 12px 16px;
  border: 2px solid #333;
  border-radius: 8px;
  background: #16213e;
  color: #eee;
  font-size: 16px;
  text-align: center;
}
.join-box input:focus { outline: none; border-color: #3498db; }

.join-box button {
  padding: 12px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
#btn-create { background: #27ae60; color: #fff; }
#btn-join { background: #3498db; color: #fff; }
.divider { color: #666; font-size: 14px; }
.error { color: #e74c3c; font-size: 14px; }
.mode-select,
.theme-select,
.theme-select-game {
  padding: 12px 16px;
  border: 2px solid #333;
  border-radius: 8px;
  background: #16213e;
  color: #eee;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
}
.mode-select:focus,
.theme-select:focus,
.theme-select-game:focus { outline: none; border-color: #3498db; }
.theme-select-game {
  width: auto;
  padding: 5px 8px;
  font-size: 12px;
  border-width: 1px;
}

.game-mode-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.gm-codenames { background: rgba(52,152,219,0.2); color: #3498db; }
.gm-alias { background: rgba(230,126,34,0.2); color: #e67e22; }
.gm-spyfall { background: rgba(155,89,182,0.2); color: #9b59b6; }
.gm-crocodile { background: rgba(46,204,113,0.2); color: #2ecc71; }
.gm-whoami { background: rgba(241,196,15,0.2); color: #f1c40f; }

.version {
  position: fixed;
  bottom: 12px;
  right: 16px;
  font-size: 11px;
  color: #444;
  letter-spacing: 1px;
}

#room-code-input {
  text-transform: uppercase;
  letter-spacing: 4px;
  font-weight: 700;
}

/* ========== Game screen ========== */
.game-screen {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 16px;
}

/* -- Top bar -- */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #2a2a4a;
  flex-wrap: wrap;
}

.top-left { display: flex; align-items: center; gap: 6px; }

.room-label { font-size: 13px; color: #888; }
.room-code {
  font-family: monospace;
  font-size: 1.1em;
  letter-spacing: 3px;
  background: #16213e;
  padding: 3px 10px;
  border-radius: 6px;
  user-select: all;
  cursor: pointer;
  font-weight: 700;
}

.top-center { flex: 1; display: flex; justify-content: center; }

.scores-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.score-badge {
  padding: 5px 14px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.9em;
  text-align: center;
  min-width: 90px;
  transition: outline 0.2s;
}
.score-badge .s-label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  margin-bottom: 1px;
}

.btn-leave {
  background: rgba(231,76,60,0.15);
  border: none;
  color: #e74c3c;
  font-size: 14px;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-leave:hover { background: rgba(231,76,60,0.3); }

.name-editor {
  display: flex;
  gap: 4px;
}
.name-editor input {
  padding: 5px 10px;
  border: 1px solid #444;
  border-radius: 6px;
  background: #16213e;
  color: #eee;
  font-size: 13px;
  width: 120px;
}
.name-editor input:focus { outline: none; border-color: #3498db; }
.name-editor button {
  padding: 5px 10px;
  border: none;
  border-radius: 6px;
  background: #27ae60;
  color: #fff;
  cursor: pointer;
  font-size: 13px;
}

/* -- Info bar -- */
.info-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 8px 0;
  flex-wrap: wrap;
}

.turn-indicator {
  font-weight: 700;
  font-size: 1.05em;
}

.timer-display {
  font-family: monospace;
  font-size: 1.4em;
  font-weight: 700;
  min-width: 50px;
  text-align: center;
  padding: 2px 10px;
  border-radius: 6px;
  background: rgba(255,255,255,0.05);
}
.timer-display.timer-warn {
  color: #e74c3c;
  animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.clue-display {
  font-size: 1.2em;
  font-weight: 700;
}

.action-buttons {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.btn-action {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  background: rgba(255,255,255,0.1);
  color: #ccc;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-action:hover { background: rgba(255,255,255,0.2); }

/* Settings dropdown */
.settings-wrap { position: relative; }

.settings-dropdown {
  position: absolute;
  top: 36px;
  right: 0;
  background: #16213e;
  border: 2px solid #333;
  border-radius: 10px;
  padding: 14px;
  z-index: 50;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.settings-dropdown label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.settings-dropdown select {
  padding: 4px 8px;
  border: 1px solid #444;
  border-radius: 6px;
  background: #1a1a2e;
  color: #eee;
  font-size: 13px;
}
.settings-dropdown button {
  padding: 8px;
  border: none;
  border-radius: 6px;
  background: #27ae60;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
}

/* ========== Game body ========== */
.game-body {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 8px;
}

/* -- Clue sidebars -- */
.clue-sidebar {
  width: 150px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.clue-team-history {
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
}
.clue-team-history h4 {
  font-size: 11px;
  text-transform: uppercase;
  margin-bottom: 5px;
  letter-spacing: 0.5px;
}
.clue-entry {
  padding: 2px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.clue-entry:last-child { border-bottom: none; }
.clue-word { font-weight: 600; text-transform: uppercase; }
.clue-count { opacity: 0.7; margin-left: 4px; }

/* -- Board -- */
.board-area { flex: 1; min-width: 0; }

.board {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.card {
  position: relative;
  aspect-ratio: 1.6;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 12px;
  font-weight: 700;
  font-size: clamp(9px, 1.8vw, 15px);
  text-align: center;
  cursor: default;
  transition: transform 0.15s, box-shadow 0.15s;
  word-break: break-word;
  line-height: 1.2;
  user-select: none;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: none;
  overflow: hidden;
}

/* Unrevealed (plain players see this) */
.card.unrevealed {
  background: #2a2a3e;
  color: #ccc;
}

.card.clickable { cursor: pointer; }
.card.clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  outline: 2px solid rgba(255,255,255,0.4);
}

/* Revealed cards — solid fills */
.card.type-red { background: #c0392b; color: #fff; }
.card.type-blue { background: #2980b9; color: #fff; }
.card.type-green { background: #27ae60; color: #fff; }
.card.type-orange { background: #d35400; color: #fff; }
.card.type-purple { background: #8e44ad; color: #fff; }
.card.type-neutral { background: #636e72; color: #dfe6e9; }
.card.type-assassin {
  background: #111;
  color: #fff;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.8);
}

/* Spymaster unrevealed — semi-transparent fills */
.card.spy-red { background: rgba(192, 57, 43, 0.35); color: #f1c0bb; }
.card.spy-blue { background: rgba(41, 128, 185, 0.35); color: #b8d8f0; }
.card.spy-green { background: rgba(39, 174, 96, 0.35); color: #b4e6cb; }
.card.spy-orange { background: rgba(211, 84, 0, 0.35); color: #f0cbb0; }
.card.spy-purple { background: rgba(142, 68, 173, 0.35); color: #d5b8e2; }
.card.spy-neutral { background: rgba(99, 110, 114, 0.25); color: #aab2b5; }
.card.spy-assassin { background: rgba(0, 0, 0, 0.7); color: #ff6b6b; }

/* ========== Controls ========== */
.clue-form {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  margin-bottom: 8px;
}
.clue-form input[type="text"] {
  padding: 9px 12px;
  border: 2px solid #444;
  border-radius: 8px;
  background: #16213e;
  color: #eee;
  font-size: 15px;
  width: 170px;
}
.clue-form input[type="number"] {
  padding: 9px;
  border: 2px solid #444;
  border-radius: 8px;
  background: #16213e;
  color: #eee;
  font-size: 15px;
  width: 55px;
  text-align: center;
}
.clue-form input:focus { outline: none; border-color: #3498db; }

#btn-give-clue {
  padding: 9px 16px;
  border: none;
  border-radius: 8px;
  background: #27ae60;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn-end-turn {
  display: block;
  margin: 0 auto;
  padding: 9px 24px;
  border: none;
  border-radius: 8px;
  background: #e67e22;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* ========== Player panel ========== */
.player-panel {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #2a2a4a;
  flex-wrap: wrap;
  justify-content: center;
}

.player-team-block {
  border-radius: 10px;
  padding: 10px 12px;
  min-width: 150px;
  flex: 1;
  max-width: 220px;
}
.player-team-block h4 {
  font-size: 11px;
  text-transform: uppercase;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.spymaster-slot {
  background: rgba(0,0,0,0.2);
  border-radius: 6px;
  padding: 6px 8px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
}
.spymaster-slot .slot-label {
  font-size: 10px;
  text-transform: uppercase;
  color: #888;
  white-space: nowrap;
}
.spymaster-slot .slot-name {
  font-weight: 700;
  font-size: 13px;
}

.operative-list {
  font-size: 13px;
  min-height: 20px;
}
.operative-entry {
  padding: 2px 0;
}

.team-actions {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.team-actions button {
  padding: 4px 10px;
  border: none;
  border-radius: 5px;
  background: rgba(255,255,255,0.1);
  color: #ccc;
  cursor: pointer;
  font-size: 11px;
  white-space: nowrap;
}
.team-actions button:hover { background: rgba(255,255,255,0.2); }

/* Spectators block */
.spectators-block {
  border-radius: 10px;
  padding: 10px 12px;
  min-width: 150px;
  background: rgba(255,255,255,0.04);
  border-left: 3px solid #666;
}
.spectators-block h4 {
  font-size: 11px;
  text-transform: uppercase;
  color: #888;
  margin-bottom: 6px;
}
.spectator-entry {
  font-size: 13px;
  padding: 2px 0;
  color: #aaa;
}
.spectators-block .btn-spectate {
  margin-top: 6px;
  padding: 4px 10px;
  border: none;
  border-radius: 5px;
  background: rgba(255,255,255,0.1);
  color: #ccc;
  cursor: pointer;
  font-size: 11px;
}
.spectators-block .btn-spectate:hover { background: rgba(255,255,255,0.2); }
.player-draggable { cursor: grab; }
.player-draggable:active { cursor: grabbing; }
.player-dropzone.is-drag-over {
  outline: 2px dashed currentColor;
  outline-offset: 3px;
}

/* ========== Pause overlay ========== */
.pause-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 90;
}
.pause-content { text-align: center; }
.pause-text {
  font-size: 3em;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 8px;
  margin-bottom: 20px;
  color: #f39c12;
}
.btn-unpause {
  padding: 12px 36px;
  border: none;
  border-radius: 10px;
  background: #27ae60;
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
}

/* Host settings inside pause */
.pause-settings {
  margin-top: 24px;
  background: rgba(255,255,255,0.05);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 260px;
  margin-left: auto;
  margin-right: auto;
}
.pause-settings label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.pause-settings select {
  padding: 4px 8px;
  border: 1px solid #444;
  border-radius: 6px;
  background: #1a1a2e;
  color: #eee;
  font-size: 13px;
}
.pause-settings button {
  padding: 8px;
  border: none;
  border-radius: 6px;
  background: #e67e22;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
}

/* ========== Winner overlay (banner, board visible behind) ========== */
.winner-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 100;
  padding: 24px 20px;
  flex-wrap: wrap;
  box-shadow: 0 4px 30px rgba(0,0,0,0.6);
}
.winner-text {
  font-size: 2em;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 3px;
}
.winner-overlay button {
  padding: 10px 24px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin: 4px;
  background: #27ae60;
  color: #fff;
}

/* ========== Vote / confirmation ========== */
.card.has-votes::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.2);
  border-radius: 12px;
  pointer-events: none;
}

.card.my-vote {
  outline: 2px solid rgba(255,255,255,0.6);
  outline-offset: -2px;
}

.card.confirming::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0;
  background: rgba(0,0,0,0.4);
  border-radius: 0 0 12px 12px;
  pointer-events: none;
  animation: fill-up 1s linear forwards;
}

@keyframes fill-up {
  from { height: 0; }
  to { height: 100%; border-radius: 12px; }
}

.vote-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
  pointer-events: none;
  z-index: 2;
  line-height: 1.4;
}

/* ========== Alias-specific ========== */
.alias-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  gap: 16px;
  padding: 20px 0;
}

.alias-word-card {
  background: #2a2a3e;
  border-radius: 16px;
  padding: 40px 60px;
  font-size: 2.2em;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-align: center;
  word-break: break-word;
  min-width: 280px;
  max-width: 90vw;
}

.alias-waiting-card {
  background: rgba(255,255,255,0.04);
  border-radius: 16px;
  padding: 30px 40px;
  font-size: 1.3em;
  color: #888;
  text-align: center;
}

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

.alias-btn {
  padding: 16px 40px;
  border: none;
  border-radius: 12px;
  font-size: 1.1em;
  font-weight: 700;
  cursor: pointer;
  min-width: 140px;
  transition: transform 0.1s;
}
.alias-btn:active { transform: scale(0.96); }
.alias-btn-correct { background: #27ae60; color: #fff; }
.alias-btn-skip { background: #e67e22; color: #fff; }
.alias-btn-start { background: #3498db; color: #fff; font-size: 1.2em; padding: 18px 50px; }

.alias-turn-score {
  font-size: 1.4em;
  font-weight: 700;
  margin-top: 8px;
}

.alias-review {
  width: 100%;
  max-width: 400px;
}

.alias-review-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 4px;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.15s;
}
.alias-review-item:hover { opacity: 0.85; }
.alias-review-correct {
  background: rgba(39, 174, 96, 0.2);
  color: #2ecc71;
}
.alias-review-skipped {
  background: rgba(231, 76, 60, 0.2);
  color: #e74c3c;
}
.alias-review-word {
  text-transform: uppercase;
  font-weight: 600;
}
.alias-review-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
}

.alias-confirm-btn {
  margin-top: 16px;
  padding: 12px 36px;
  border: none;
  border-radius: 10px;
  background: #27ae60;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.alias-explainer-label {
  font-size: 14px;
  color: #888;
  margin-bottom: 4px;
}
.alias-explainer-name {
  font-size: 1.1em;
  font-weight: 700;
}

.alias-difficulty-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  font-weight: 700;
  margin-left: 8px;
}
.alias-difficulty-normal { background: rgba(39,174,96,0.2); color: #2ecc71; }
.alias-difficulty-hard { background: rgba(231,76,60,0.2); color: #e74c3c; }

/* ========== Spyfall ========== */
.spyfall-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 20px 0;
}

.spyfall-role-card {
  border-radius: 16px;
  padding: 30px 50px;
  text-align: center;
  min-width: 260px;
  max-width: 90vw;
}
.spyfall-role-card .sf-location {
  font-size: 1.6em;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 8px;
}
.spyfall-role-card .sf-role {
  font-size: 1.1em;
  color: #aaa;
}
.spyfall-role-card.sf-player {
  background: rgba(46, 204, 113, 0.15);
  border: 2px solid rgba(46, 204, 113, 0.4);
}
.spyfall-role-card.sf-spy {
  background: rgba(231, 76, 60, 0.15);
  border: 2px solid rgba(231, 76, 60, 0.5);
}
.spyfall-role-card.sf-spy .sf-location {
  color: #e74c3c;
}

.sf-ask-label {
  font-size: 14px;
  color: #888;
}
.sf-ask-name {
  font-weight: 700;
  font-size: 1.1em;
}

.sf-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.sf-actions button {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.sf-btn-next { background: #3498db; color: #fff; }
.sf-btn-accuse { background: #e74c3c; color: #fff; }
.sf-btn-start { background: #27ae60; color: #fff; font-size: 1.2em; padding: 16px 50px; border-radius: 12px; }

.sf-accuse-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  max-width: 600px;
}
.sf-accuse-list button {
  padding: 8px 14px;
  border: 1px solid #444;
  border-radius: 6px;
  background: #16213e;
  color: #ccc;
  cursor: pointer;
  font-size: 13px;
}
.sf-accuse-list button:hover {
  background: #2a2a4a;
  border-color: #888;
}

.sf-location-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
  width: 100%;
  max-width: 760px;
  margin: 16px auto 0;
  padding: 0;
}
.sf-location-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background: #16213e;
  border: 1px solid #2a3a5a;
  border-radius: 8px;
  overflow: hidden;
  padding: 0;
  color: #ddd;
  font-size: 12px;
  cursor: default;
  transition: border-color 0.15s, transform 0.15s;
}
button.sf-location-card {
  cursor: pointer;
  font-family: inherit;
}
button.sf-location-card:hover {
  border-color: #9b59b6;
  transform: translateY(-1px);
}
.sf-location-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: #0d1524;
}
.sf-location-label {
  padding: 6px 8px;
  text-align: center;
  line-height: 1.2;
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sf-location-active {
  border-color: #27ae60;
  box-shadow: 0 0 0 2px #27ae60;
  background: #1a3a2a;
}
.sf-location-active .sf-location-label {
  color: #fff;
  font-weight: 600;
}

.sf-vote-panel {
  text-align: center;
}
.sf-vote-panel .sf-vote-question {
  font-size: 1.1em;
  margin-bottom: 12px;
}
.sf-vote-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.sf-vote-buttons button {
  padding: 12px 30px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.sf-vote-yes { background: #27ae60; color: #fff; }
.sf-vote-no { background: #e74c3c; color: #fff; }
.sf-vote-status {
  font-size: 13px;
  color: #888;
  margin-top: 8px;
}

.sf-lobby-msg {
  font-size: 1.2em;
  color: #888;
  text-align: center;
  padding: 30px;
}

.sf-result-section {
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  padding: 16px;
  max-width: 400px;
  width: 100%;
}
.sf-result-section h4 {
  font-size: 12px;
  text-transform: uppercase;
  color: #888;
  margin-bottom: 8px;
}
.sf-result-entry {
  padding: 4px 0;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
}
.sf-result-spy { color: #e74c3c; font-weight: 700; }

/* ========== Whoami ========== */
.whoami-center {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 10px 0;
}

.wm-players-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.wm-player-card {
  background: #16213e;
  border: 2px solid #333;
  border-radius: 12px;
  padding: 14px;
  min-width: 180px;
  max-width: 240px;
  flex: 1;
  text-align: center;
}

.wm-player-name {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 8px;
}

.wm-word-tablet {
  background: #2a2a3e;
  border-radius: 8px;
  padding: 10px;
  min-height: 40px;
  font-size: 1.2em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #f1c40f;
  display: flex;
  align-items: center;
  justify-content: center;
  word-break: break-word;
}

.wm-word-tablet.wm-hidden {
  color: #555;
  font-style: italic;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.9em;
}

.wm-word-tablet.wm-you {
  background: rgba(241,196,15,0.1);
  border: 1px dashed #f1c40f;
  color: #888;
  font-weight: 400;
  text-transform: none;
  font-size: 0.9em;
}

.wm-assign-form {
  display: flex;
  gap: 4px;
  margin-top: 8px;
}

.wm-assign-input {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid #444;
  border-radius: 6px;
  background: #1a1a2e;
  color: #eee;
  font-size: 13px;
}
.wm-assign-input:focus { outline: none; border-color: #f1c40f; }

.wm-assign-btn {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  background: #f1c40f;
  color: #1a1a2e;
  font-weight: 700;
  cursor: pointer;
  font-size: 12px;
}

.wm-notebook {
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
}

.wm-notebook h4 {
  font-size: 12px;
  text-transform: uppercase;
  color: #888;
  margin-bottom: 6px;
}

.wm-notebook textarea {
  width: 100%;
  min-height: 80px;
  padding: 10px;
  border: 1px solid #444;
  border-radius: 8px;
  background: #16213e;
  color: #eee;
  font-size: 14px;
  resize: vertical;
  font-family: inherit;
}
.wm-notebook textarea:focus { outline: none; border-color: #f1c40f; }

.wm-guess-form {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
}

.wm-guess-input {
  padding: 10px 14px;
  border: 2px solid #444;
  border-radius: 8px;
  background: #16213e;
  color: #eee;
  font-size: 15px;
  width: 200px;
}
.wm-guess-input:focus { outline: none; border-color: #f1c40f; }

.wm-guess-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  background: #f1c40f;
  color: #1a1a2e;
  font-weight: 700;
  cursor: pointer;
  font-size: 14px;
}

.wm-skip-btn {
  padding: 8px 18px;
  border: none;
  border-radius: 8px;
  background: #e67e22;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
}

.wm-turn-indicator {
  text-align: center;
  font-size: 1.1em;
  padding: 8px;
  border-radius: 8px;
  background: rgba(241,196,15,0.1);
}

.wm-finished-badge {
  display: inline-block;
  background: rgba(46,204,113,0.2);
  color: #2ecc71;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 6px;
}

.wm-status-msg {
  text-align: center;
  color: #888;
  font-size: 14px;
  padding: 10px;
}

/* ========== Crocodile ========== */
.croc-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}

.croc-word-display {
  font-size: 1.8em;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #2ecc71;
  padding: 10px 30px;
  background: rgba(46,204,113,0.1);
  border-radius: 10px;
}

.croc-canvas-wrap {
  width: 100%;
  max-width: 600px;
  aspect-ratio: 4/3;
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  border: 2px solid #444;
}
.croc-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
  touch-action: none;
}
.croc-canvas.readonly {
  cursor: default;
  pointer-events: none;
}

.croc-toolbar {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}
.croc-color {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s;
}
.croc-color.active { border-color: #fff; }
.croc-color:hover { border-color: rgba(255,255,255,0.5); }

.croc-size-slider {
  width: 80px;
  accent-color: #2ecc71;
}

.croc-tool-btn {
  padding: 5px 12px;
  border: 1px solid #444;
  border-radius: 6px;
  background: #16213e;
  color: #ccc;
  cursor: pointer;
  font-size: 12px;
}
.croc-tool-btn.active { background: #2ecc71; color: #fff; border-color: #2ecc71; }
.croc-tool-btn:hover { border-color: #888; }

.croc-guess-area {
  width: 100%;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.croc-guess-form {
  display: flex;
  gap: 6px;
}
.croc-guess-input {
  flex: 1;
  padding: 10px 14px;
  border: 2px solid #444;
  border-radius: 8px;
  background: #16213e;
  color: #eee;
  font-size: 15px;
}
.croc-guess-input:focus { outline: none; border-color: #2ecc71; }
.croc-guess-send {
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  background: #2ecc71;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
}
.croc-guess-log {
  max-height: 150px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.croc-guess-item {
  font-size: 13px;
  padding: 3px 8px;
  border-radius: 4px;
}
.croc-guess-item.correct {
  background: rgba(46,204,113,0.2);
  color: #2ecc71;
  font-weight: 700;
}
.croc-guess-item .guess-name {
  color: #888;
  margin-right: 6px;
}

.croc-skip-btn {
  padding: 8px 20px;
  border: none;
  border-radius: 8px;
  background: #e67e22;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
}

.croc-waiting-card {
  background: rgba(255,255,255,0.04);
  border-radius: 16px;
  padding: 30px 40px;
  font-size: 1.3em;
  color: #888;
  text-align: center;
}

/* ========== Local paper theme (non-Monopoly games) ========== */
body.theme-paper {
  background: #ebe4d4;
  color: #2a2418;
}
body.theme-paper .overlay {
  background: #ebe4d4;
  color: #2a2418;
}
body.theme-paper .join-box h1 {
  background: none;
  -webkit-text-fill-color: #2a2418;
  color: #2a2418;
  font-family: "Instrument Serif", ui-serif, Georgia, serif;
  font-style: italic;
  letter-spacing: -1px;
  text-transform: none;
}
body.theme-paper .join-box input,
body.theme-paper .mode-select,
body.theme-paper .theme-select,
body.theme-paper .theme-select-game {
  background: #fbf6e8;
  color: #2a2418;
  border-color: rgba(42, 36, 24, 0.22);
  box-shadow: 0 2px 8px rgba(42, 36, 24, 0.04);
}
body.theme-paper .join-box input:focus,
body.theme-paper .mode-select:focus,
body.theme-paper .theme-select:focus,
body.theme-paper .theme-select-game:focus {
  border-color: #b85c3e;
}
body.theme-paper .divider,
body.theme-paper .version {
  color: #8a7f65;
}
body.theme-paper #btn-create {
  background: #2a2418;
  color: #fbf6e8;
}
body.theme-paper #btn-join {
  background: #b85c3e;
  color: #fbf6e8;
}

body.theme-paper:not(.gm-monopoly) .game-screen {
  color: #2a2418;
}
body.theme-paper:not(.gm-monopoly) .top-bar {
  border-bottom-color: rgba(42, 36, 24, 0.18);
}
body.theme-paper:not(.gm-monopoly) .room-label,
body.theme-paper:not(.gm-monopoly) .alias-explainer-label,
body.theme-paper:not(.gm-monopoly) .sf-ask-label,
body.theme-paper:not(.gm-monopoly) .sf-vote-status,
body.theme-paper:not(.gm-monopoly) .sf-lobby-msg,
body.theme-paper:not(.gm-monopoly) .wm-notebook h4,
body.theme-paper:not(.gm-monopoly) .croc-guess-item .guess-name {
  color: #8a7f65;
}
body.theme-paper:not(.gm-monopoly) .room-code,
body.theme-paper:not(.gm-monopoly) .timer-display,
body.theme-paper:not(.gm-monopoly) .settings-dropdown,
body.theme-paper:not(.gm-monopoly) .alias-word-card,
body.theme-paper:not(.gm-monopoly) .alias-waiting-card,
body.theme-paper:not(.gm-monopoly) .sf-result-section,
body.theme-paper:not(.gm-monopoly) .wm-player-card,
body.theme-paper:not(.gm-monopoly) .croc-waiting-card {
  background: #fbf6e8;
  color: #2a2418;
  border: 0.5px solid rgba(42, 36, 24, 0.18);
  box-shadow: 0 4px 14px rgba(42, 36, 24, 0.05);
}
body.theme-paper:not(.gm-monopoly) .settings-dropdown {
  border-width: 0.5px;
}
body.theme-paper:not(.gm-monopoly) .settings-dropdown select,
body.theme-paper:not(.gm-monopoly) .name-editor input,
body.theme-paper:not(.gm-monopoly) .clue-form input,
body.theme-paper:not(.gm-monopoly) .wm-assign-input,
body.theme-paper:not(.gm-monopoly) .wm-guess-input,
body.theme-paper:not(.gm-monopoly) .wm-notebook textarea,
body.theme-paper:not(.gm-monopoly) .croc-guess-input {
  background: #fffaf1;
  color: #2a2418;
  border-color: rgba(42, 36, 24, 0.22);
}
body.theme-paper:not(.gm-monopoly) .btn-action,
body.theme-paper:not(.gm-monopoly) .team-actions button,
body.theme-paper:not(.gm-monopoly) .spectators-block .btn-spectate,
body.theme-paper:not(.gm-monopoly) .croc-tool-btn,
body.theme-paper:not(.gm-monopoly) .sf-accuse-list button {
  background: #fbf6e8;
  color: #2a2418;
  border: 0.5px solid rgba(42, 36, 24, 0.22);
}
body.theme-paper:not(.gm-monopoly) .btn-action:hover,
body.theme-paper:not(.gm-monopoly) .team-actions button:hover,
body.theme-paper:not(.gm-monopoly) .spectators-block .btn-spectate:hover,
body.theme-paper:not(.gm-monopoly) .croc-tool-btn:hover,
body.theme-paper:not(.gm-monopoly) .sf-accuse-list button:hover {
  background: #fff;
}
body.theme-paper:not(.gm-monopoly) .player-panel {
  border-top-color: rgba(42, 36, 24, 0.18);
}
body.theme-paper:not(.gm-monopoly) .player-team-block,
body.theme-paper:not(.gm-monopoly) .spectators-block {
  background: rgba(251, 246, 232, 0.72);
  border-color: rgba(42, 36, 24, 0.18);
}
body.theme-paper:not(.gm-monopoly) .spectator-entry {
  color: #5b523f;
}
body.theme-paper:not(.gm-monopoly) .card.unrevealed {
  background: #fbf6e8;
  color: #2a2418;
  border: 0.5px solid rgba(42, 36, 24, 0.22);
  box-shadow: 0 3px 10px rgba(42, 36, 24, 0.05);
}
body.theme-paper:not(.gm-monopoly) .card.clickable:hover {
  box-shadow: 0 5px 16px rgba(42, 36, 24, 0.16);
  outline-color: rgba(184, 92, 62, 0.45);
}
body.theme-paper:not(.gm-monopoly) .card.spy-red { color: #8b2d24; background: rgba(192, 57, 43, 0.16); }
body.theme-paper:not(.gm-monopoly) .card.spy-blue { color: #235d85; background: rgba(41, 128, 185, 0.16); }
body.theme-paper:not(.gm-monopoly) .card.spy-green { color: #226f43; background: rgba(39, 174, 96, 0.16); }
body.theme-paper:not(.gm-monopoly) .card.spy-orange { color: #8b4d13; background: rgba(211, 84, 0, 0.16); }
body.theme-paper:not(.gm-monopoly) .card.spy-purple { color: #67347d; background: rgba(142, 68, 173, 0.16); }
body.theme-paper:not(.gm-monopoly) .card.spy-neutral { color: #5f686b; background: rgba(99, 110, 114, 0.14); }
body.theme-paper:not(.gm-monopoly) .clue-entry {
  border-bottom-color: rgba(42, 36, 24, 0.08);
}
body.theme-paper:not(.gm-monopoly) .alias-review-correct {
  background: rgba(39, 174, 96, 0.12);
  color: #1f7a45;
}
body.theme-paper:not(.gm-monopoly) .alias-review-skipped {
  background: rgba(231, 76, 60, 0.12);
  color: #a93b2e;
}
body.theme-paper:not(.gm-monopoly) .spyfall-role-card.sf-player,
body.theme-paper:not(.gm-monopoly) .spyfall-role-card.sf-spy {
  background: #fbf6e8;
  box-shadow: 0 4px 14px rgba(42, 36, 24, 0.05);
}
body.theme-paper:not(.gm-monopoly) .spyfall-role-card .sf-role,
body.theme-paper:not(.gm-monopoly) .wm-word-tablet.wm-hidden,
body.theme-paper:not(.gm-monopoly) .wm-word-tablet.wm-you {
  color: #8a7f65;
}
body.theme-paper:not(.gm-monopoly) .sf-location-card {
  background: #fbf6e8;
  border-color: rgba(42, 36, 24, 0.18);
  color: #2a2418;
}
body.theme-paper:not(.gm-monopoly) .sf-location-card img {
  background: #f4eede;
}
body.theme-paper:not(.gm-monopoly) .sf-location-active {
  background: rgba(39, 174, 96, 0.12);
}
body.theme-paper:not(.gm-monopoly) .wm-word-tablet {
  background: #fffaf1;
  color: #8a5b00;
}
body.theme-paper:not(.gm-monopoly) .croc-canvas-wrap {
  border-color: rgba(42, 36, 24, 0.22);
  box-shadow: 0 4px 14px rgba(42, 36, 24, 0.06);
}
body.theme-paper:not(.gm-monopoly) .croc-color.active {
  border-color: #2a2418;
}
body.theme-paper:not(.gm-monopoly) .croc-color:hover {
  border-color: rgba(42, 36, 24, 0.45);
}
body.theme-paper:not(.gm-monopoly) .pause-overlay {
  background: rgba(235, 228, 212, 0.92);
  color: #2a2418;
}
body.theme-paper:not(.gm-monopoly) .pause-text {
  color: #b85c3e;
  font-family: "Instrument Serif", ui-serif, Georgia, serif;
}
body.theme-paper:not(.gm-monopoly) .winner-overlay {
  background: rgba(235, 228, 212, 0.95);
  box-shadow: 0 4px 30px rgba(42, 36, 24, 0.2);
}

/* ========== Responsive ========== */
@media (max-width: 800px) {
  .clue-sidebar { display: none; }
  .game-body { flex-direction: column; }
  .board-area { width: 100%; }
  .card { font-size: clamp(8px, 3vw, 13px); }
  .top-bar { flex-direction: column; align-items: stretch; gap: 6px; }
  .info-bar { flex-direction: column; gap: 6px; }
  .clue-form { flex-wrap: wrap; }
  .clue-form input[type="text"] { width: 100%; }
}

/* Codenames keeps the full desktop-style table on phones. */
@media (max-width: 800px) {
  body.game-codenames .game-screen {
    max-width: 1200px;
    min-width: 760px;
    padding: 10px 16px;
  }
  body.game-codenames .top-bar {
    flex-direction: row;
    align-items: center;
  }
  body.game-codenames .info-bar {
    flex-direction: row;
    gap: 14px;
  }
  body.game-codenames .game-body {
    flex-direction: row;
    align-items: flex-start;
  }
  body.game-codenames .clue-sidebar {
    display: flex;
  }
  body.game-codenames .board-area {
    width: auto;
  }
  body.game-codenames .card {
    font-size: clamp(9px, 1.8vw, 15px);
  }
}

/* ============================================================
   MONOPOLY (v2 — warm paper, tile = card with price tab)
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

/* When monopoly mode is active, theme the entire shell */
body.gm-monopoly {
  background: #ebe4d4;
  color: #2a2418;
}
body.gm-monopoly .game-screen { background: #ebe4d4; max-width: none; padding: 0; }
body.gm-monopoly .top-bar {
  background: #f4eede;
  color: #2a2418;
  border-bottom: 0.5px solid rgba(42, 36, 24, 0.18);
  padding: 12px 18px;
}
body.gm-monopoly .top-bar .room-label,
body.gm-monopoly .top-bar .room-code,
body.gm-monopoly .top-bar .game-mode-badge {
  font-family: "Instrument Serif", serif;
  background: transparent;
  color: #2a2418;
  letter-spacing: -0.3px;
  font-weight: 500;
}
body.gm-monopoly .top-bar .game-mode-badge {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: 2px;
  color: #8a7f65;
  text-transform: uppercase;
  border: 0;
  padding: 0;
}
body.gm-monopoly .top-bar .room-code { font-size: 18px; }
body.gm-monopoly .top-bar .btn-leave {
  background: transparent;
  color: #8a7f65;
  border: 0.5px solid rgba(42, 36, 24, 0.2);
}
body.gm-monopoly .name-editor input,
body.gm-monopoly .name-editor button {
  background: #fbf6e8;
  color: #2a2418;
  border: 0.5px solid rgba(42, 36, 24, 0.2);
  font-family: "Inter", sans-serif;
}
body.gm-monopoly #scores-bar { display: none; }
body.gm-monopoly .info-bar {
  background: #f4eede;
  color: #2a2418;
  border-bottom: 0.5px solid rgba(42, 36, 24, 0.18);
  padding: 8px 18px;
}
body.gm-monopoly .turn-indicator { color: #2a2418; font-family: "Instrument Serif", serif; }
body.gm-monopoly .btn-action {
  background: #fbf6e8;
  color: #2a2418;
  border: 0.5px solid rgba(42, 36, 24, 0.2);
  font-family: "Inter", sans-serif;
}
body.gm-monopoly .btn-action:hover { background: #fff; }
body.gm-monopoly .settings-dropdown {
  background: #fbf6e8;
  color: #2a2418;
  border: 0.5px solid rgba(42, 36, 24, 0.2);
}
body.gm-monopoly .settings-dropdown label,
body.gm-monopoly .settings-dropdown select {
  color: #2a2418;
  background: #fff;
  border-color: rgba(42, 36, 24, 0.2);
}
body.gm-monopoly #player-panel { display: none; }
body.gm-monopoly .pause-overlay { background: rgba(235, 228, 212, 0.92); color: #2a2418; }
body.gm-monopoly .pause-overlay .pause-text { color: #2a2418; font-family: "Instrument Serif", serif; }
body.gm-monopoly .winner-overlay { background: rgba(235, 228, 212, 0.95); color: #2a2418; }
body.gm-monopoly .winner-text { color: #2a2418; font-family: "Instrument Serif", serif; }

/* Warm-paper palette (applies within the monopoly view) */
#monopoly-area {
  --mp-surface-bg: #ebe4d4;
  --mp-panel-bg:   #f4eede;
  --mp-board-bg:   #f4eede;
  --mp-tile-bg:    #fbf6e8;
  --mp-ink:        #2a2418;
  --mp-muted-ink:  #8a7f65;
  --mp-hairline:   rgba(42, 36, 24, 0.18);
  --mp-accent:     #b85c3e;
  --mp-accent-ink: #fbf6e8;
  --mp-active-row: rgba(184, 92, 62, 0.08);
  --mp-serif:  "Instrument Serif", ui-serif, Georgia, serif;
  --mp-ui:     "Inter", ui-sans-serif, system-ui, sans-serif;
  --mp-mono:   "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
  color: var(--mp-ink);
  font-family: var(--mp-ui);
}

.monopoly-center {
  width: 100%;
  padding: 0;
  box-sizing: border-box;
  background: var(--mp-surface-bg);
  min-height: calc(100vh - 110px);
}

.mp-lobby-msg {
  text-align: center;
  font-family: var(--mp-serif);
  font-size: 1.4em;
  color: var(--mp-ink);
  margin: 40px 0 20px;
  letter-spacing: -0.5px;
}
.mp-btn-start {
  display: block;
  margin: 0 auto;
  padding: 14px 40px;
  background: var(--mp-accent);
  color: var(--mp-accent-ink);
  border: none;
  border-radius: 10px;
  font-size: 1em;
  font-family: var(--mp-ui);
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
}
.mp-btn-start:hover { filter: brightness(1.08); }

/* Layout: board + sidebar */
.mp-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  align-items: start;
  max-width: 1280px;
  margin: 0 auto;
}

/* Board grid sizing */
.mp-board-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  min-width: 0;
  container-type: inline-size;
  container-name: brd;
}
.mp-board {
  --mp-board-size: min(94vmin, 1400px, 100cqw);
  --mp-corner-size: calc(var(--mp-board-size) * 0.13);
  --mp-cell-size: calc((var(--mp-board-size) - var(--mp-corner-size) * 2) / 9);
  --mp-tab-h: 20px;
  width: var(--mp-board-size);
  height: var(--mp-board-size);
  display: grid;
  grid-template-columns: var(--mp-corner-size) repeat(9, var(--mp-cell-size)) var(--mp-corner-size);
  grid-template-rows: var(--mp-corner-size) repeat(9, var(--mp-cell-size)) var(--mp-corner-size);
  background: var(--mp-board-bg);
  position: relative;
  box-sizing: content-box;
}

/* Tile cell */
.mp-tile {
  position: relative;
  cursor: pointer;
  min-width: 0;
  min-height: 0;
}

/* Inner wrapper absorbs rotation so upright design works on all edges */
.mp-tile-inner {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100%;
  height: 100%;
  transform: translate(-50%, -50%);
  transform-origin: center;
}
.mp-tile-bottom .mp-tile-inner { transform: translate(-50%, -50%) rotate(0deg); }
/* Top edge: flip layout (tab on TOP, body BELOW) but keep all text upright. */
.mp-tile-top    .mp-tile-inner { transform: translate(-50%, -50%) rotate(0deg); }
.mp-tile-top .mp-tile-card { top: var(--mp-tab-h); height: calc(100% - var(--mp-tab-h)); }
.mp-tile-top .mp-tile-tab { top: 0; bottom: auto; border-radius: 4px 4px 0 0; }
.mp-tile-top .mp-tile-name { top: auto; bottom: 0; padding: 6px 3px 4px;
  background: linear-gradient(to top, var(--mp-tile-bg) 58%, rgba(251, 246, 232, 0) 100%);
  transform: translateY(4px);
}
.mp-tile-top:hover .mp-tile-name { transform: translateY(0); }
.mp-tile-top:hover .mp-tile-glyph { transform: scale(0.78) translateY(-14%); }
.mp-tile-top .mp-tile-houses { top: auto; bottom: 4px; }

.mp-tile-left   .mp-tile-inner {
  width: var(--mp-cell-size);
  height: var(--mp-corner-size);
  transform: translate(-50%, -50%) rotate(90deg);
}
.mp-tile-right  .mp-tile-inner {
  width: var(--mp-cell-size);
  height: var(--mp-corner-size);
  transform: translate(-50%, -50%) rotate(-90deg);
}

/* Card body (top portion of upright frame) */
.mp-tile-card {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: calc(100% - var(--mp-tab-h));
  background: var(--mp-tile-bg);
  border: 0.5px solid var(--mp-ink);
  box-sizing: border-box;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mp-tile-card::before {
  /* Owner frame — 5px ring at the outer edge, painted on top of the logo.
     Transparent by default; coloured at 55% opacity when owned. */
  content: '';
  position: absolute;
  inset: 0;
  border: 5px solid transparent;
  box-sizing: border-box;
  pointer-events: none;
  opacity: 0.45;
  transition: border-color 240ms ease;
}
.mp-tile[data-owner-color] .mp-tile-card::before {
  border-color: var(--mp-owner-color);
}
.mp-tile.is-mortgaged .mp-tile-card {
  filter: grayscale(0.7);
}
.mp-tile.is-mortgaged .mp-tile-glyph {
  opacity: 0.42;
}
.mp-tile-mortgage {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(-12deg);
  padding: 2px 5px;
  border: 1px solid var(--mp-accent);
  color: var(--mp-accent);
  background: rgba(251, 246, 232, 0.86);
  font-family: var(--mp-mono);
  font-size: 8px;
  letter-spacing: 1px;
  font-weight: 700;
  pointer-events: none;
}

/* Glyph / logo inside the card */
.mp-tile-glyph {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 55%;
  height: 55%;
  transition: transform 220ms cubic-bezier(.2,.7,.2,1);
}
/* When a real logo image is present, the image takes the entire card body
   (edge-to-edge, ignoring the owner frame which paints over the corners). */
.mp-tile-glyph-image {
  width: 100%;
  height: 100%;
  padding: 0;
}
.mp-tile-glyph-image img {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: fill;
}
.mp-tile-glyph img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.mp-tile-glyph svg { max-width: 100%; max-height: 100%; }

/* Name band — hidden by default, reveals on hover from the inner edge */
.mp-tile-name {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  padding: 4px 3px 6px;
  background: linear-gradient(to bottom, var(--mp-tile-bg) 58%, rgba(251, 246, 232, 0) 100%);
  font-family: var(--mp-serif);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.2px;
  color: var(--mp-ink);
  text-align: center;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 180ms ease, transform 180ms cubic-bezier(.2,.7,.2,1);
  pointer-events: none;
  word-break: break-word;
}
.mp-tile:hover .mp-tile-name { opacity: 1; transform: translateY(0); }
.mp-tile:hover .mp-tile-glyph { transform: scale(0.78) translateY(14%); }

/* Price tab (bottom strip, 86% wide, outer edge) */
.mp-tile-tab {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 86%;
  height: var(--mp-tab-h);
  background: var(--mp-tile-bg);
  border: 0.5px solid var(--mp-ink);
  border-radius: 0 0 4px 4px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-family: var(--mp-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--mp-ink);
  line-height: 1;
}
.mp-tile-tab[data-group] {
  background: var(--mp-tab-color);
  color: #fff;
  border-color: var(--mp-tab-color);
}
.mp-tile-tab .mp-tab-cur {
  font-size: 10px;
  position: relative;
  top: -0.5px;
  opacity: 0.75;
}
.mp-tile-tab[data-group] .mp-tab-cur { color: rgba(255,255,255,0.75); }

/* Influence markers (stars away from the name band) */
.mp-tile-houses {
  position: absolute;
  left: 4px;
  right: auto;
  bottom: 4px;
  display: flex;
  justify-content: center;
  gap: 1px;
  pointer-events: none;
  z-index: 3;
}
.mp-tile-house {
  color: #1f6feb;
  font-size: 9px;
  line-height: 1;
  text-shadow: 0 0.5px 1px rgba(0,0,0,0.25);
}
.mp-tile-hotel {
  color: #f1c40f;
  font-size: 18px;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0,0,0,0.35);
}
.mp-tile-top .mp-tile-houses { top: 4px; bottom: auto; }

/* Corner tiles — card body inset by TAB_HEIGHT on two outer sides */
.mp-tile-corner .mp-corner-body {
  position: absolute;
  background: var(--mp-tile-bg);
  border: 0.5px solid var(--mp-ink);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px;
  gap: 4px;
}
.mp-corner-title {
  font-family: var(--mp-serif);
  font-weight: 500;
  font-size: 13px;
  color: var(--mp-ink);
  letter-spacing: -0.2px;
  line-height: 1.05;
  text-transform: uppercase;
}
.mp-corner-sub {
  font-family: var(--mp-mono);
  font-size: 8px;
  color: var(--mp-muted-ink);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.mp-corner-glyph {
  flex: 1 1 auto;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}
.mp-corner-glyph img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
/* Corner insets by quadrant */
.mp-tile-corner-br .mp-corner-body { top: 0; left: 0; right: var(--mp-tab-h); bottom: var(--mp-tab-h); }
.mp-tile-corner-bl .mp-corner-body { top: 0; right: 0; left: var(--mp-tab-h); bottom: var(--mp-tab-h); }
.mp-tile-corner-tl .mp-corner-body { bottom: 0; right: 0; left: var(--mp-tab-h); top: var(--mp-tab-h); }
.mp-tile-corner-tr .mp-corner-body { bottom: 0; left: 0; right: var(--mp-tab-h); top: var(--mp-tab-h); }

/* Center content (dice/actions/log + title) */
.mp-board-center {
  position: absolute;
  left: var(--mp-corner-size);
  top: var(--mp-corner-size);
  width: calc(var(--mp-cell-size) * 9);
  height: calc(var(--mp-cell-size) * 9);
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 20px;
  box-sizing: border-box;
}
.mp-board-center > * { pointer-events: auto; }
.mp-brand {
  font-family: var(--mp-serif);
  font-style: italic;
  font-size: clamp(32px, 6vw, 56px);
  color: var(--mp-ink);
  letter-spacing: -1.5px;
  line-height: 1;
  text-align: center;
}
.mp-brand-sub {
  font-family: var(--mp-mono);
  font-size: 9.5px;
  color: var(--mp-muted-ink);
  text-transform: uppercase;
  letter-spacing: 3px;
  margin-top: 8px;
  text-align: center;
}
.mp-dice-throw-layer {
  position: absolute;
  left: var(--mp-corner-size);
  top: var(--mp-corner-size);
  width: calc(var(--mp-cell-size) * 9);
  height: calc(var(--mp-cell-size) * 9);
  pointer-events: none;
  z-index: 18;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 720px;
}

/* Dice */
.mp-dice {
  display: flex;
  gap: 12px;
  align-items: center;
}
.mp-die {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: var(--mp-ink);
  font-family: var(--mp-mono);
  font-size: 22px;
  font-weight: 500;
  border: 0.5px solid var(--mp-ink);
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(42, 36, 24, 0.15);
}
.mp-die-empty { background: transparent; color: var(--mp-muted-ink); border-style: dashed; }
.mp-dice-label {
  font-family: var(--mp-serif);
  font-style: italic;
  color: var(--mp-accent);
  font-weight: 600;
  font-size: 16px;
}

.mp-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.mp-btn {
  padding: 10px 22px;
  border: 0.5px solid var(--mp-ink);
  border-radius: 8px;
  font-size: 13px;
  font-family: var(--mp-ui);
  font-weight: 500;
  letter-spacing: 0.3px;
  cursor: pointer;
  background: var(--mp-tile-bg);
  color: var(--mp-ink);
  transition: background 120ms ease;
}
.mp-btn:hover:not(:disabled) { background: #fff; }
.mp-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.mp-btn-roll, .mp-btn-end, .mp-btn-buy {
  background: var(--mp-accent);
  color: var(--mp-accent-ink);
  border-color: var(--mp-accent);
}
.mp-btn-roll:hover:not(:disabled), .mp-btn-end:hover:not(:disabled), .mp-btn-buy:hover:not(:disabled) {
  background: var(--mp-accent);
  filter: brightness(1.08);
}

.mp-log {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-family: var(--mp-mono);
  font-size: 10.5px;
  color: var(--mp-muted-ink);
  max-height: 140px;
  overflow-y: auto;
}
.mp-log-line {
  padding: 3px 4px;
  border-bottom: 0.5px solid var(--mp-hairline);
  line-height: 1.35;
}

/* Player tokens — absolute-layer over the board, animated */
.mp-tokens-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.mp-token {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  color: #fff;
  font-family: var(--mp-serif);
  font-weight: 600;
  font-size: 11px;
  box-shadow: 0 2px 5px rgba(0,0,0,.28), 0 0 0 2px var(--mp-board-bg);
  transition: left 170ms cubic-bezier(.5,1.6,.5,1), top 170ms cubic-bezier(.5,1.6,.5,1);
  z-index: 10;
  transform: translate(-50%, -50%);
  will-change: left, top;
}
.mp-token-active {
  box-shadow: 0 2px 5px rgba(0,0,0,.28), 0 0 0 2px var(--mp-board-bg), 0 0 0 4px rgba(184, 92, 62, 0.5);
}
.mp-token-bankrupt {
  display: none;
}

/* Sidebar */
.mp-sidebar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 84vh;
  overflow-y: auto;
}
.mp-player-card {
  background: var(--mp-panel-bg);
  border: 0.5px solid var(--mp-hairline);
  border-left: 3px solid var(--mp-player-color, var(--mp-muted-ink));
  border-radius: 6px;
  padding: 10px 12px;
  font-family: var(--mp-ui);
}
.mp-player-active { background: var(--mp-active-row); border-color: var(--mp-accent); }
.mp-player-bankrupt { opacity: 0.4; }
.mp-player-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.mp-player-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 0.5px solid var(--mp-ink);
}
.mp-player-name {
  font-family: var(--mp-serif);
  font-size: 15px;
  font-weight: 500;
  color: var(--mp-ink);
  letter-spacing: -0.2px;
}
.mp-player-money {
  color: var(--mp-ink);
  font-family: var(--mp-mono);
  font-size: 18px;
  font-weight: 500;
  margin-top: 4px;
  letter-spacing: -0.5px;
}
.mp-player-money .mp-cur {
  font-size: 12px;
  color: var(--mp-muted-ink);
  margin-right: 2px;
}
.mp-player-props {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}
.mp-prop-chip {
  font-family: var(--mp-mono);
  font-size: 9.5px;
  background: rgba(0, 0, 0, 0.04);
  padding: 2px 6px;
  border-radius: 3px;
  border-top: 2px solid var(--mp-chip-color, var(--mp-muted-ink));
  color: var(--mp-ink);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .mp-page-grid { grid-template-columns: 1fr !important; }
  .mp-aside-left, .mp-aside-right { max-height: none !important; }
}
@media (max-width: 640px) {
  .mp-board { --mp-board-size: 95vmin; }
  .mp-brand { font-size: 26px; }
}

/* ─── 3-column layout — full-bleed ──────────────────────── */
.mp-page-grid {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 240px;
  gap: 0;
  align-items: stretch;
  max-width: none;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  min-height: calc(100vh - 110px);
}
@media (min-width: 1700px) {
  .mp-page-grid { grid-template-columns: 300px minmax(0, 1fr) 280px; }
}
.mp-aside-left, .mp-aside-right {
  background: var(--mp-panel-bg);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-y: auto;
  overflow-x: hidden;
  font-family: var(--mp-ui);
  min-width: 0;
}
.mp-aside-left { border-right: 0.5px solid var(--mp-hairline); }
.mp-aside-right { border-left: 0.5px solid var(--mp-hairline); }
.mp-board-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 16px 12px;
  min-width: 0;
  overflow: visible; /* dice throw above action bar */
}

.mp-aside-h {
  font-family: var(--mp-mono);
  font-size: 10px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--mp-muted-ink);
  margin-bottom: 10px;
}
.mp-aside-counter {
  font-family: var(--mp-serif);
  font-size: 28px;
  font-weight: 400;
  letter-spacing: -1px;
  color: var(--mp-ink);
  line-height: 1;
  margin-bottom: 14px;
}

/* Player rows in left aside */
.mp-player-rows { display: flex; flex-direction: column; }
.mp-player-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 8px;
  border-radius: 4px;
  margin: 0;
  transition: background 120ms ease;
  min-width: 0;
}
.mp-player-row.is-active { background: var(--mp-active-row); }
.mp-player-row.is-bankrupt { opacity: 0.4; }
.mp-player-row.is-offline .mp-prow-name { color: var(--mp-muted-ink); }
.mp-player-row.is-offline .mp-prow-dot { opacity: 0.4; }
.mp-prow-tag-offline { color: var(--mp-accent) !important; }
.mp-prow-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.mp-prow-main { flex: 1; min-width: 0; }
.mp-prow-name-row { display: flex; align-items: baseline; gap: 6px; }
.mp-prow-name {
  font-family: var(--mp-serif);
  font-size: 16px;
  font-weight: 500;
  color: var(--mp-ink);
  letter-spacing: -0.3px;
}
.mp-prow-tag {
  font-family: var(--mp-mono);
  font-size: 9px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--mp-muted-ink);
}
.mp-prow-stats {
  font-family: var(--mp-mono);
  font-size: 11px;
  color: var(--mp-muted-ink);
  margin-top: 2px;
  letter-spacing: 0.2px;
}
.mp-prow-stats .mp-cur { color: var(--mp-ink); }
.mp-prow-stats .mp-money { color: var(--mp-ink); margin-right: 6px; }

/* Empty slot styling */
.mp-player-row.is-empty-slot {
  border: 0.5px dashed var(--mp-hairline);
  background: transparent;
  margin: 4px 0;
  padding: 8px 10px;
  border-radius: 6px;
  min-width: 0;
}
.mp-empty-main { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-width: 0; flex: 1; }
.mp-slot-label {
  font-family: var(--mp-mono);
  font-size: 10px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--mp-muted-ink);
  flex-shrink: 0;
}
.mp-slot-empty-note {
  font-family: var(--mp-mono);
  font-size: 10px;
  color: var(--mp-muted-ink);
  opacity: 0.6;
}
.mp-slot-join {
  font-family: var(--mp-ui);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  background: var(--mp-ink);
  color: var(--mp-accent-ink);
  border: 0;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
}
.mp-slot-join:hover { filter: brightness(1.15); }
.mp-slot-leave {
  background: transparent;
  border: 0.5px solid var(--mp-hairline);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  color: var(--mp-muted-ink);
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
  margin-left: auto;
}
.mp-slot-leave:hover { background: var(--mp-hairline); color: var(--mp-ink); }

/* Spectators */
.mp-spec-counter {
  font-family: var(--mp-serif);
  font-size: 22px;
  letter-spacing: -0.5px;
  color: var(--mp-ink);
  margin-bottom: 8px;
  line-height: 1;
}
.mp-spec-empty {
  font-family: var(--mp-mono);
  font-size: 11px;
  color: var(--mp-muted-ink);
  opacity: 0.6;
}
.mp-spec-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mp-spec-row {
  font-family: var(--mp-ui);
  font-size: 13px;
  color: var(--mp-ink);
  padding: 4px 0;
  border-bottom: 0.5px solid var(--mp-hairline);
}
.mp-spec-row:last-child { border-bottom: 0; }

/* Activity log */
.mp-activity {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-family: var(--mp-mono);
  font-size: 11px;
  color: var(--mp-muted-ink);
  line-height: 1.4;
}
.mp-act-line { display: flex; gap: 10px; }
.mp-act-time { color: var(--mp-muted-ink); flex-shrink: 0; opacity: 0.7; }
.mp-act-text { color: var(--mp-ink); }

/* DEED (right aside) */
.mp-deed-strip {
  height: 4px;
  width: 100%;
  background: var(--mp-deed-color, var(--mp-muted-ink));
  margin-bottom: 16px;
}
.mp-deed-group {
  font-family: var(--mp-mono);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--mp-muted-ink);
  margin-bottom: 8px;
}
.mp-deed-title {
  font-family: var(--mp-serif);
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.8px;
  color: var(--mp-ink);
  margin-bottom: 22px;
}
.mp-deed-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0.5px solid var(--mp-hairline);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  margin: -8px 0 18px;
}
.mp-deed-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.mp-deed-rows { display: flex; flex-direction: column; gap: 14px; margin-bottom: 22px; }
.mp-deed-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--mp-ui);
  font-size: 13px;
}
.mp-deed-row-label { color: var(--mp-muted-ink); }
.mp-deed-row-val { color: var(--mp-ink); font-family: var(--mp-mono); }
.mp-deed-row-val .mp-cur { color: var(--mp-muted-ink); margin-right: 1px; }

.mp-rent-table { display: flex; flex-direction: column; gap: 8px; }
.mp-rent-row {
  display: flex;
  justify-content: space-between;
  font-family: var(--mp-mono);
  font-size: 12px;
  padding: 4px 0;
  border-bottom: 0.5px solid var(--mp-hairline);
}
.mp-rent-row:last-child { border-bottom: 0; }
.mp-rent-row.is-current { color: var(--mp-ink); font-weight: 500; background: rgba(201, 90, 46, 0.08); margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: 3px; border-bottom-color: transparent; }
.mp-rent-row.is-current .mp-rent-label { font-weight: 600; }
.mp-rent-label { color: var(--mp-muted-ink); }
.mp-rent-val { color: var(--mp-ink); display: inline-flex; align-items: baseline; gap: 4px; }
.mp-rent-note { font-size: 9px; color: var(--mp-accent); letter-spacing: 0.5px; }

.mp-deed-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 0.5px solid var(--mp-hairline);
}
.mp-deed-actions .mp-cta {
  flex: 1;
  padding: 9px 10px;
  font-size: 11px;
  letter-spacing: 1px;
}

/* Bottom action bar */
.mp-action-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 14px 22px;
  background: var(--mp-tile-bg);
  border: 0.5px solid var(--mp-hairline);
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(42, 36, 24, 0.06);
  font-family: var(--mp-ui);
  margin: 8px auto 0;
  max-width: 600px;
  width: 100%;
  box-sizing: border-box;
  overflow: visible; /* dice throw arc may extend above the bar */
}
.mp-action-status {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  padding-right: 8px;
  border-right: 0.5px solid var(--mp-hairline);
  margin-right: 4px;
}
.mp-action-status-label {
  font-family: var(--mp-mono);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--mp-muted-ink);
}
.mp-action-status-name {
  font-family: var(--mp-serif);
  font-size: 18px;
  color: var(--mp-ink);
  letter-spacing: -0.3px;
  line-height: 1.1;
}
.mp-action-dice {
  display: flex;
  gap: 8px;
  align-items: center;
  overflow: visible;
  min-height: 52px;
}
.mp-dice-pair {
  display: flex;
  gap: 8px;
  align-items: center;
  transform-origin: 50% 100%;
  will-change: transform;
}
/* Dice are thrown onto the board; the action bar only updates after settle. */
@keyframes mp-dice-pair-table-throw {
  0% {
    transform: translate3d(18vmin, 25vmin, 0) rotateZ(-28deg) scale(0.62);
    opacity: 0;
  }
  26% {
    transform: translate3d(-3vmin, -4vmin, 0) rotateZ(13deg) scale(1.12);
    opacity: 1;
  }
  48% {
    transform: translate3d(2.4vmin, 1.8vmin, 0) rotateZ(-7deg) scale(0.98);
  }
  72% {
    transform: translate3d(-0.8vmin, 0.7vmin, 0) rotateZ(3deg) scale(1.02);
  }
  100% {
    transform: translate3d(0, 0, 0) rotateZ(0deg) scale(1);
    opacity: 1;
  }
}
.mp-dice-throw-layer .mp-dice-pair {
  filter: drop-shadow(0 14px 18px rgba(42, 36, 24, 0.24));
}
.mp-dice-pair.mp-dice-pair--table-throw {
  animation: mp-dice-pair-table-throw 1.24s cubic-bezier(0.2, 0.9, 0.18, 1) forwards;
}
.mp-dice-pair.mp-dice-pair--table-tumble {
  animation: mp-dice-pair-table-tumble 1.05s cubic-bezier(0.2, 0.8, 0.24, 1) forwards;
}
.mp-dice-pair.mp-dice-pair--table-final {
  animation: mp-dice-table-final 360ms ease-out both;
}
@keyframes mp-dice-pair-table-tumble {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  35% { transform: translate3d(-1.8vmin, 1.1vmin, 0) scale(1.04); }
  68% { transform: translate3d(1vmin, 0.4vmin, 0) scale(0.98); }
  100% { transform: translate3d(0, 0, 0) scale(1); }
}
@keyframes mp-dice-table-final {
  0% { transform: translateY(-4px) scale(1.05); }
  100% { transform: translateY(0) scale(1); }
}
.mp-dice-pair--table {
  gap: clamp(10px, 1.8vmin, 18px);
  transform-style: preserve-3d;
}
.mp-die-cube {
  --mp-die-cube-size: clamp(44px, 6.4vmin, 66px);
  width: var(--mp-die-cube-size);
  height: var(--mp-die-cube-size);
  position: relative;
  transform-style: preserve-3d;
}
.mp-die-cube-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transform: rotateX(-14deg) rotateY(18deg) rotateZ(0deg);
}
.mp-die-cube-face {
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, #fffaf1, #f5ead7);
  border: 1px solid rgba(42, 36, 24, 0.32);
  border-radius: 14%;
  box-shadow: inset -5px -6px 12px rgba(42, 36, 24, 0.12), inset 4px 4px 10px rgba(255, 255, 255, 0.85);
  backface-visibility: hidden;
}
.mp-die-cube-face-front { transform: translateZ(calc(var(--mp-die-cube-size) / 2)); }
.mp-die-cube-face-back { transform: rotateY(180deg) translateZ(calc(var(--mp-die-cube-size) / 2)); }
.mp-die-cube-face-right { transform: rotateY(90deg) translateZ(calc(var(--mp-die-cube-size) / 2)); }
.mp-die-cube-face-left { transform: rotateY(-90deg) translateZ(calc(var(--mp-die-cube-size) / 2)); }
.mp-die-cube-face-top { transform: rotateX(90deg) translateZ(calc(var(--mp-die-cube-size) / 2)); }
.mp-die-cube-face-bottom { transform: rotateX(-90deg) translateZ(calc(var(--mp-die-cube-size) / 2)); }
.mp-die-cube-dot {
  position: absolute;
  width: 12%;
  height: 12%;
  border-radius: 999px;
  background: var(--mp-ink);
  transform: translate(-50%, -50%);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.18);
}
.mp-dice-pair--table-throw .mp-die-cube-a .mp-die-cube-inner {
  animation: mp-die-cube-roll-a 1.24s cubic-bezier(0.2, 0.9, 0.18, 1) both;
}
.mp-dice-pair--table-throw .mp-die-cube-b .mp-die-cube-inner {
  animation: mp-die-cube-roll-b 1.24s cubic-bezier(0.2, 0.9, 0.18, 1) both;
}
.mp-dice-pair--table-tumble .mp-die-cube-a .mp-die-cube-inner {
  animation: mp-die-cube-tumble-a 1.05s cubic-bezier(0.2, 0.8, 0.24, 1) both;
}
.mp-dice-pair--table-tumble .mp-die-cube-b .mp-die-cube-inner {
  animation: mp-die-cube-tumble-b 1.05s cubic-bezier(0.2, 0.8, 0.24, 1) both;
}
@keyframes mp-die-cube-roll-a {
  0% { transform: rotateX(720deg) rotateY(-520deg) rotateZ(28deg); }
  100% { transform: rotateX(-14deg) rotateY(18deg) rotateZ(0deg); }
}
@keyframes mp-die-cube-roll-b {
  0% { transform: rotateX(-650deg) rotateY(700deg) rotateZ(-34deg); }
  100% { transform: rotateX(-14deg) rotateY(18deg) rotateZ(0deg); }
}
@keyframes mp-die-cube-tumble-a {
  0% { transform: rotateX(620deg) rotateY(-430deg) rotateZ(20deg); }
  100% { transform: rotateX(-14deg) rotateY(18deg) rotateZ(0deg); }
}
@keyframes mp-die-cube-tumble-b {
  0% { transform: rotateX(-560deg) rotateY(520deg) rotateZ(-18deg); }
  100% { transform: rotateX(-14deg) rotateY(18deg) rotateZ(0deg); }
}
.mp-action-btns { display: flex; gap: 8px; }
.mp-debug-dice {
  display: flex;
  gap: 4px;
  align-items: center;
}
.mp-debug-dice select {
  width: 44px;
  padding: 8px 6px;
  border: 0.5px solid var(--mp-hairline);
  border-radius: 6px;
  background: #fff;
  color: var(--mp-ink);
  font-family: var(--mp-mono);
}

/* Dot dice */
.mp-die-svg {
  width: 44px;
  height: 44px;
  background: #fff;
  border: 0.5px solid var(--mp-ink);
  border-radius: 6px;
  padding: 5px;
  box-sizing: border-box;
  box-shadow: 0 2px 5px rgba(42, 36, 24, 0.1);
}
.mp-die-svg.is-empty { background: transparent; border-style: dashed; opacity: 0.5; }
.mp-die-svg circle { fill: var(--mp-ink); }

@keyframes mp-die-jitter-a { 0% { transform: rotate(-8deg) translateY(-1px); } 50% { transform: rotate(6deg) translateY(1px); } 100% { transform: rotate(-4deg) translateY(0); } }
@keyframes mp-die-jitter-b { 0% { transform: rotate(7deg) translateY(1px); } 50% { transform: rotate(-5deg) translateY(-1px); } 100% { transform: rotate(3deg) translateY(0); } }
.mp-action-dice.is-rolling .mp-dice-pair > .mp-die-svg:nth-child(1) {
  animation: mp-die-jitter-a 200ms ease-in-out infinite;
}
.mp-action-dice.is-rolling .mp-dice-pair > .mp-die-svg:nth-child(2) {
  animation: mp-die-jitter-b 240ms ease-in-out infinite;
}

/* CTA buttons in action bar */
.mp-cta {
  padding: 11px 22px;
  border: 0;
  border-radius: 6px;
  font-family: var(--mp-ui);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 120ms ease;
}
.mp-cta-primary {
  background: var(--mp-ink);
  color: var(--mp-accent-ink);
}
.mp-cta-primary:hover:not(:disabled) { background: #1a1814; }
.mp-cta-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.mp-cta-secondary {
  background: transparent;
  color: var(--mp-ink);
  border: 0.5px solid var(--mp-ink);
}
.mp-cta-secondary:hover:not(:disabled) { background: rgba(42, 36, 24, 0.04); }
.mp-cta-danger {
  background: var(--mp-accent);
  color: var(--mp-accent-ink);
}
.mp-cta-danger:hover:not(:disabled) { filter: brightness(1.08); }

/* Casino bet controls (replaces single CTA when on casino square) */
.mp-casino-controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
  min-width: 180px;
}
.mp-casino-label {
  font-family: var(--mp-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--mp-muted-ink);
  text-align: center;
}
.mp-casino-input {
  width: 100%;
  font-family: var(--mp-mono);
  font-size: 14px;
  padding: 6px 8px;
  border: 1px solid var(--mp-hairline);
  background: var(--mp-tile-bg);
  color: var(--mp-ink);
  text-align: center;
  border-radius: 4px;
  box-sizing: border-box;
}
.mp-casino-btnrow {
  display: flex;
  gap: 6px;
}
.mp-casino-btnrow .mp-cta { flex: 1; }
.mp-casino-red {
  background: #c53030;
  color: #fff;
  border-color: #c53030;
}
.mp-casino-red:hover:not(:disabled) { background: #a82525; }
.mp-casino-black {
  background: #171717;
  color: #fff;
  border: 1px solid #171717;
}
.mp-casino-black:hover:not(:disabled) { background: #000; }

/* Tile selection ring */
.mp-tile.is-selected .mp-tile-card { box-shadow: 0 0 0 2px var(--mp-accent); }
.mp-tile.is-selected .mp-corner-body { box-shadow: 0 0 0 2px var(--mp-accent); }

@media (max-width: 1280px) {
  .mp-page-grid { grid-template-columns: 220px minmax(0, 1fr) 260px; }
}
@media (max-width: 1100px) {
  .mp-page-grid { grid-template-columns: 1fr; }
  .mp-aside-left, .mp-aside-right { max-height: none; }
}

/* ─── Trade modal ────────────────────────────────────────── */
.mp-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(42, 36, 24, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 24px;
  box-sizing: border-box;
}
.mp-modal {
  background: var(--mp-tile-bg);
  border: 0.5px solid var(--mp-hairline);
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(42, 36, 24, 0.25);
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  font-family: var(--mp-ui);
}
.mp-trade-modal { max-width: 760px; }
.mp-modal-head {
  padding: 20px 24px 16px;
  border-bottom: 0.5px solid var(--mp-hairline);
}
.mp-modal-title {
  font-family: var(--mp-serif);
  font-size: 28px;
  letter-spacing: -0.6px;
  color: var(--mp-ink);
  line-height: 1.1;
}
.mp-modal-sub {
  font-family: var(--mp-mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--mp-muted-ink);
  margin-top: 6px;
}
.mp-modal-empty {
  padding: 24px;
  text-align: center;
  color: var(--mp-muted-ink);
  font-size: 13px;
}
.mp-modal-error {
  margin: 0 24px 12px;
  padding: 10px 14px;
  background: rgba(201, 90, 46, 0.12);
  border: 0.5px solid var(--mp-accent);
  color: var(--mp-accent);
  border-radius: 6px;
  font-size: 12px;
}
.mp-modal-foot {
  padding: 14px 24px;
  border-top: 0.5px solid var(--mp-hairline);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.mp-trade-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 24px;
  border-bottom: 0.5px solid var(--mp-hairline);
}
.mp-trade-chip {
  font-family: var(--mp-ui);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.3px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 0.5px solid var(--mp-hairline);
  background: var(--mp-panel-bg);
  color: var(--mp-ink);
  cursor: pointer;
  position: relative;
  padding-left: 22px;
  transition: border-color 120ms ease, background 120ms ease;
}
.mp-trade-chip::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mp-chip-color, var(--mp-muted-ink));
  transform: translateY(-50%);
}
.mp-trade-chip:hover { border-color: var(--mp-ink); }
.mp-trade-chip.is-active {
  background: var(--mp-ink);
  color: var(--mp-accent-ink);
  border-color: var(--mp-ink);
}

.mp-trade-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--mp-hairline);
}
.mp-trade-col {
  background: var(--mp-tile-bg);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.mp-trade-col-title {
  font-family: var(--mp-mono);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--mp-muted-ink);
}
.mp-trade-money {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mp-trade-money-label {
  font-family: var(--mp-mono);
  font-size: 10px;
  color: var(--mp-muted-ink);
  letter-spacing: 0.5px;
}
.mp-trade-money input {
  width: 100%;
  padding: 8px 10px;
  background: var(--mp-panel-bg);
  border: 0.5px solid var(--mp-hairline);
  border-radius: 4px;
  font-family: var(--mp-mono);
  font-size: 14px;
  color: var(--mp-ink);
  box-sizing: border-box;
}
.mp-trade-money input:focus {
  outline: none;
  border-color: var(--mp-ink);
}

.mp-trade-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 280px;
  overflow-y: auto;
}
.mp-trade-empty {
  font-family: var(--mp-mono);
  font-size: 11px;
  color: var(--mp-muted-ink);
  opacity: 0.6;
  padding: 8px 0;
}
.mp-trade-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 4px;
  border: 0.5px solid transparent;
  cursor: pointer;
  font-size: 13px;
  color: var(--mp-ink);
}
.mp-trade-item:hover:not(.is-blocked) { background: var(--mp-active-row); }
.mp-trade-item.is-selected { border-color: var(--mp-ink); background: var(--mp-active-row); }
.mp-trade-item.is-blocked { opacity: 0.4; cursor: not-allowed; }
.mp-trade-item.is-summary { cursor: default; padding-left: 4px; }
.mp-trade-item input[type="checkbox"] { margin: 0; }
.mp-trade-item-strip {
  width: 4px;
  height: 18px;
  border-radius: 1px;
  flex-shrink: 0;
}
.mp-trade-item-name { flex: 1; }

.mp-trade-summary-money {
  font-family: var(--mp-mono);
  font-size: 18px;
  font-weight: 500;
  color: var(--mp-ink);
}
.mp-trade-summary-money .mp-cur { color: var(--mp-muted-ink); margin-right: 2px; font-size: 14px; }

/* Pending banner for the proposer */
.mp-trade-pending-banner {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--mp-tile-bg);
  border: 0.5px solid var(--mp-hairline);
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(42, 36, 24, 0.18);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--mp-ui);
  font-size: 13px;
  color: var(--mp-ink);
  z-index: 180;
}

.mp-cta-trade {
  margin-left: 6px;
}

/* ─── Card draw banner ──────────────────────────────────── */
@keyframes mp-card-fade {
  0%   { opacity: 0; transform: translate(-50%, -54%) scale(0.92); }
  10%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  90%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -48%) scale(0.98); }
}
.mp-card-banner {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 250;
  cursor: pointer;
  animation: mp-card-fade 4000ms ease-in-out forwards;
}
.mp-card-banner-inner {
  background: var(--mp-tile-bg);
  border: 0.5px solid var(--mp-ink);
  border-radius: 14px;
  box-shadow: 0 16px 48px rgba(42, 36, 24, 0.35);
  padding: 28px 36px;
  min-width: 320px;
  max-width: 460px;
  text-align: center;
  font-family: var(--mp-ui);
}
.mp-card-banner-label {
  font-family: var(--mp-mono);
  font-size: 11px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--mp-muted-ink);
  margin-bottom: 14px;
}
.mp-card-banner-text {
  font-family: var(--mp-serif);
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: -0.3px;
  color: var(--mp-ink);
}
.mp-card-banner-sub {
  font-family: var(--mp-mono);
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--mp-muted-ink);
  margin-top: 14px;
}
.mp-card-banner-chance .mp-card-banner-label { color: var(--mp-accent); }
.mp-card-banner-chest  .mp-card-banner-label { color: #3a7d2e; }
.mp-card-banner-chance .mp-card-banner-inner { border-color: var(--mp-accent); }
.mp-card-banner-chest  .mp-card-banner-inner { border-color: #3a7d2e; }

/* ─── Casino result banner ────────────────────────────────── */
@keyframes mp-casino-pop {
  0% { opacity: 0; transform: translate(-50%, -48%) scale(0.9); }
  12% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  86% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -52%) scale(0.98); }
}
@keyframes mp-casino-wheel-spin-red {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(1440deg); }
}
@keyframes mp-casino-wheel-spin-black {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(1620deg); }
}
.mp-casino-banner {
  position: fixed;
  left: 50%;
  top: 48%;
  transform: translate(-50%, -50%);
  z-index: 245;
  cursor: pointer;
  animation: mp-casino-pop 3600ms ease-in-out forwards;
}
.mp-casino-banner-inner {
  min-width: min(340px, 88vw);
  background: var(--mp-tile-bg);
  border: 0.5px solid var(--mp-ink);
  border-radius: 18px;
  padding: 22px 26px 20px;
  box-shadow: 0 24px 60px rgba(42, 36, 24, 0.28);
  text-align: center;
  font-family: var(--mp-ui);
}
.mp-casino-banner-label {
  font-family: var(--mp-mono);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--mp-accent);
  margin-bottom: 14px;
}
.mp-casino-wheel {
  width: 112px;
  height: 112px;
  margin: 0 auto 16px;
  border: 4px solid var(--mp-ink);
  border-radius: 50%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.35), 0 8px 20px rgba(42, 36, 24, 0.18);
}
.mp-casino-wheel.outcome-red {
  animation: mp-casino-wheel-spin-red 1500ms cubic-bezier(0.14, 0.72, 0.22, 1) both;
}
.mp-casino-wheel.outcome-black {
  animation: mp-casino-wheel-spin-black 1500ms cubic-bezier(0.14, 0.72, 0.22, 1) both;
}
.mp-casino-wheel-half {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mp-mono);
  font-size: 22px;
  font-weight: 700;
}
.mp-casino-wheel-red {
  background: #c53030;
  color: #fff;
}
.mp-casino-wheel-black {
  background: #111;
  color: #fff;
}
.mp-casino-banner-result {
  font-family: var(--mp-serif);
  font-size: 28px;
  color: var(--mp-ink);
  line-height: 1;
  margin-bottom: 10px;
}
.mp-casino-banner-sub {
  font-family: var(--mp-mono);
  font-size: 11px;
  color: var(--mp-muted-ink);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.mp-casino-banner.is-win .mp-casino-banner-sub { color: #2e7d32; }
.mp-casino-banner.is-lose .mp-casino-banner-sub { color: #a33a2d; }

@media (max-width: 700px) {
  .mp-trade-grid { grid-template-columns: 1fr; }
  .mp-modal { max-height: 96vh; }
}

/* ─── Monopoly mobile layout ─────────────────────────────── */
@media (max-width: 700px) {
  body.gm-monopoly { overflow-x: hidden; }
  body.gm-monopoly .game-screen { min-height: 100svh; }
  body.gm-monopoly .top-bar {
    position: sticky;
    top: 0;
    z-index: 80;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: max(8px, env(safe-area-inset-top)) 10px 8px;
  }
  body.gm-monopoly .top-center { display: none; }
  body.gm-monopoly .top-left { min-width: 0; flex-wrap: wrap; }
  body.gm-monopoly .top-right { justify-self: end; }
  body.gm-monopoly .name-editor input { width: 84px; padding: 4px 7px; font-size: 12px; }
  body.gm-monopoly .name-editor button { padding: 4px 8px; }
  body.gm-monopoly .info-bar {
    position: sticky;
    top: 48px;
    z-index: 75;
    justify-content: space-between;
    gap: 8px;
    padding: 7px 10px;
  }
  body.gm-monopoly .turn-indicator { font-size: 18px; line-height: 1; }
  body.gm-monopoly .action-buttons { margin-left: auto; }

  .monopoly-center { min-height: auto; }
  .mp-page-grid { display: flex; flex-direction: column; min-height: auto; }

  .mp-aside-left {
    order: 1;
    padding: 8px 10px 9px;
    border-right: 0;
    border-bottom: 0.5px solid var(--mp-hairline);
    gap: 8px;
    overflow: hidden;
  }
  .mp-aside-left .mp-aside-h,
  .mp-aside-left .mp-aside-counter { display: none; }
  .mp-player-rows {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0;
  }
  .mp-player-row {
    width: 100%;
    min-width: 0;
    background: rgba(251, 246, 232, 0.72);
    border: 0.5px solid var(--mp-hairline);
    padding: 7px 8px;
    border-radius: 8px;
  }
  .mp-player-row.is-empty-slot { margin: 0; }
  .mp-prow-name {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 54vw;
  }
  .mp-prow-stats { font-size: 10px; white-space: nowrap; }
  .mp-aside-left > div:nth-child(2) { display: none; }

  .mp-board-col {
    order: 2;
    justify-content: flex-start;
    gap: 8px;
    padding: 10px 6px 120px;
    min-height: auto;
  }
  .mp-board-wrap { width: 100%; overflow: visible; }
  .mp-board {
    --mp-board-size: min(96vw, 58svh);
    --mp-tab-h: 13px;
  }
  .mp-brand { font-size: clamp(24px, 9vw, 38px); letter-spacing: -0.8px; }
  .mp-brand-sub { display: none; }
  .mp-tile-name { font-size: 8px; }
  .mp-tile-tab { font-size: 8px; gap: 1px; }
  .mp-tile-tab .mp-tab-cur { font-size: 7px; }
  .mp-tile-mortgage { font-size: 6px; padding: 1px 3px; letter-spacing: 0.5px; }
  .mp-tile-house { font-size: 7px; }
  .mp-tile-hotel { font-size: 13px; }
  .mp-token { width: 14px; height: 14px; font-size: 7px; border-width: 1px; }
  .mp-tile-corner .mp-corner-title,
  .mp-tile-corner .mp-corner-sub {
    display: none;
  }
  .mp-corner-glyph {
    width: 100%;
    height: 100%;
  }
  .mp-corner-glyph img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  .mp-action-bar {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 95;
    width: auto;
    max-width: none;
    margin: 0;
    padding: 10px;
    justify-content: space-between;
    gap: 8px;
    border-radius: 12px;
    box-shadow: 0 10px 34px rgba(42, 36, 24, 0.22);
  }
  .mp-action-status { min-width: 86px; padding-right: 8px; margin-right: 0; }
  .mp-action-status-label { font-size: 8px; letter-spacing: 1.2px; }
  .mp-action-status-name { font-size: 15px; }
  .mp-action-dice { min-height: 36px; }
  .mp-die-svg { width: 34px; height: 34px; padding: 4px; }
  .mp-action-btns { gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
  .mp-cta { min-height: 42px; padding: 10px 12px; font-size: 11px; letter-spacing: 1px; }
  .mp-debug-dice select { width: 38px; padding: 8px 4px; }
  .mp-casino-controls { min-width: min(210px, 52vw); }

  .mp-aside-right {
    order: 3;
    border-left: 0;
    border-top: 0.5px solid var(--mp-hairline);
    padding: 12px 12px 130px;
    gap: 16px;
  }
  .mp-deed-title { font-size: 24px; margin-bottom: 14px; }
  .mp-deed-image { margin: -4px 0 14px; }
  .mp-deed-rows { gap: 9px; margin-bottom: 14px; }
  .mp-rent-table { gap: 5px; }
  .mp-deed-actions { flex-direction: column; }
  .mp-spec-counter,
  .mp-spec-list,
  .mp-spec-empty { display: none; }

  .mp-modal-overlay { padding: 8px; align-items: flex-end; }
  .mp-modal { max-height: 92svh; border-radius: 14px 14px 8px 8px; }
  .mp-modal-head,
  .mp-modal-foot { padding-left: 16px; padding-right: 16px; }
  .mp-casino-banner,
  .mp-card-banner { width: calc(100vw - 28px); }
  .mp-casino-banner-inner,
  .mp-card-banner-inner { min-width: 0; width: 100%; box-sizing: border-box; }
}

/* ============================================================
   ADMIN PANEL (monopoly editor) — warm-paper theme
   ============================================================ */
.btn-admin-open {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 500;
  background: var(--mp-ink, #2a2418);
  color: #fbf6e8;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(42, 36, 24, 0.25);
}
.btn-admin-open:hover { filter: brightness(1.15); }

.admin-overlay {
  --mp-surface-bg: #ebe4d4;
  --mp-panel-bg:   #f4eede;
  --mp-board-bg:   #f4eede;
  --mp-tile-bg:    #fbf6e8;
  --mp-ink:        #2a2418;
  --mp-muted-ink:  #8a7f65;
  --mp-hairline:   rgba(42, 36, 24, 0.18);
  --mp-accent:     #b85c3e;
  --mp-accent-ink: #fbf6e8;
  --mp-active-row: rgba(184, 92, 62, 0.08);
  --mp-serif:  "Instrument Serif", ui-serif, Georgia, serif;
  --mp-ui:     "Inter", ui-sans-serif, system-ui, sans-serif;
  --mp-mono:   "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;

  position: fixed;
  inset: 0;
  background: var(--mp-surface-bg);
  z-index: 1000;
  display: flex;
  align-items: stretch;
  justify-content: center;
  overflow-y: auto;
  color: var(--mp-ink);
  font-family: var(--mp-ui);
}
.admin-panel {
  background: var(--mp-surface-bg);
  width: 100%;
  max-width: 1280px;
  display: flex;
  flex-direction: column;
}
.admin-header {
  display: flex;
  align-items: center;
  padding: 16px 24px;
  background: var(--mp-panel-bg);
  border-bottom: 0.5px solid var(--mp-hairline);
  gap: 16px;
}
.admin-header h2 {
  margin: 0;
  font-family: var(--mp-serif);
  font-weight: 400;
  font-size: 26px;
  letter-spacing: -0.6px;
  color: var(--mp-ink);
}
.admin-tabs { display: flex; gap: 4px; flex: 1; justify-content: center; }
.admin-tab-btn {
  background: transparent;
  color: var(--mp-muted-ink);
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 6px 16px 8px;
  cursor: pointer;
  font-family: var(--mp-mono);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
}
.admin-tab-btn.active { color: var(--mp-ink); border-bottom-color: var(--mp-accent); }
.btn-admin-close {
  background: transparent;
  color: var(--mp-muted-ink);
  border: 0.5px solid var(--mp-hairline);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}
.btn-admin-close:hover { color: var(--mp-ink); background: var(--mp-tile-bg); }

.admin-tab-body { padding: 24px; min-height: 200px; }

.admin-toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--mp-ink);
  color: var(--mp-accent-ink);
  padding: 10px 22px;
  border-radius: 6px;
  font-family: var(--mp-mono);
  font-size: 12px;
  letter-spacing: 0.5px;
  z-index: 2500;
  box-shadow: 0 4px 16px rgba(42, 36, 24, 0.35);
}
.admin-toast.success { background: #3a7d2e; }
.admin-toast.error   { background: var(--mp-accent); }

.admin-section-label {
  font-family: var(--mp-mono);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--mp-muted-ink);
  margin-bottom: 6px;
}

/* Buttons */
.admin-btn-primary {
  background: var(--mp-ink);
  color: var(--mp-accent-ink);
  border: 0;
  padding: 10px 22px;
  border-radius: 6px;
  font-family: var(--mp-ui);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
}
.admin-btn-primary:hover { filter: brightness(1.15); }
.admin-btn-ghost {
  background: transparent;
  border: 0;
  color: var(--mp-muted-ink);
  font-family: var(--mp-mono);
  font-size: 11px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  cursor: pointer;
  padding: 4px 8px;
}
.admin-btn-ghost:hover { color: var(--mp-ink); }
.admin-btn-danger {
  background: transparent !important;
  color: var(--mp-accent) !important;
  border: 0.5px solid var(--mp-accent) !important;
  padding: 6px 12px !important;
  border-radius: 4px !important;
  cursor: pointer !important;
  font-family: var(--mp-ui) !important;
  font-size: 11px !important;
  letter-spacing: 0.5px !important;
}
.admin-btn-danger:hover { background: var(--mp-accent) !important; color: var(--mp-accent-ink) !important; }

/* Deck list */
.admin-deck-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.admin-deck-card {
  background: var(--mp-tile-bg);
  border: 0.5px solid var(--mp-hairline);
  border-radius: 8px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.admin-deck-card-new {
  cursor: pointer;
  align-items: center;
  justify-content: center;
  color: var(--mp-muted-ink);
  border-style: dashed;
  min-height: 110px;
  font-family: var(--mp-mono);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
}
.admin-deck-card-new:hover { color: var(--mp-ink); border-color: var(--mp-ink); }
.admin-deck-title {
  font-family: var(--mp-serif);
  font-size: 22px;
  letter-spacing: -0.4px;
  color: var(--mp-ink);
  line-height: 1.1;
}
.admin-deck-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.admin-deck-actions button {
  background: transparent;
  color: var(--mp-ink);
  border: 0.5px solid var(--mp-hairline);
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--mp-ui);
  font-size: 11px;
  letter-spacing: 0.5px;
}
.admin-deck-actions button:hover { background: var(--mp-active-row); border-color: var(--mp-ink); }

/* Deck editor */
.admin-editor-header {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.admin-deck-name-wrap { flex: 1; min-width: 240px; }
.admin-deck-name-input {
  width: 100%;
  background: var(--mp-tile-bg);
  border: 0.5px solid var(--mp-hairline);
  color: var(--mp-ink);
  padding: 8px 12px;
  border-radius: 6px;
  font-family: var(--mp-serif);
  font-size: 22px;
  letter-spacing: -0.3px;
}
.admin-deck-name-input:focus { outline: none; border-color: var(--mp-ink); }
.admin-deck-name-input:disabled { background: transparent; }
.admin-note {
  color: var(--mp-muted-ink);
  font-family: var(--mp-mono);
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

/* Board */
.admin-board-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 22px;
  container-type: inline-size;
}
.admin-board-minigrid {
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  grid-template-rows: repeat(11, 1fr);
  aspect-ratio: 1/1;
  width: min(640px, 100cqw);
  background: var(--mp-board-bg);
  border: 0.5px solid var(--mp-hairline);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}
.admin-cell {
  background: var(--mp-tile-bg);
  color: var(--mp-ink);
  font-family: var(--mp-ui);
  font-size: 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3px 2px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
  border: 0.5px solid var(--mp-hairline);
  transition: outline 120ms ease;
}
.admin-cell:hover { outline: 1px solid var(--mp-muted-ink); outline-offset: -1px; }
.admin-cell-selected { outline: 2px solid var(--mp-accent); outline-offset: -2px; }
.admin-cell-strip { height: 6px; flex-shrink: 0; margin: -3px -2px 3px; position: relative; z-index: 1; }
.admin-cell-label { font-size: 8px; line-height: 1.1; text-align: center; word-break: break-word; position: relative; z-index: 1; }
.admin-cell-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
  box-sizing: border-box;
  pointer-events: none;
  z-index: 0;
}
/* When a logo is present, the image is the visual ID — drop the text label. */
.admin-cell:has(> .admin-cell-img) .admin-cell-label { display: none; }
.admin-cell-idx {
  position: absolute;
  top: 2px;
  left: 3px;
  color: var(--mp-muted-ink);
  font-family: var(--mp-mono);
  font-size: 7px;
  opacity: 0.5;
}
.admin-cell-go, .admin-cell-jail, .admin-cell-go_to_jail, .admin-cell-parking, .admin-cell-casino {
  background: var(--mp-panel-bg);
  font-weight: 600;
  align-items: center;
}
.admin-cell-casino { background: rgba(184, 92, 62, 0.18); }
.admin-cell-tax    { background: rgba(184, 92, 62, 0.08); }
.admin-cell-chance { background: rgba(184, 92, 62, 0.12); }
.admin-cell-chest  { background: rgba(58, 125, 46, 0.10); }

/* Cell editor */
.admin-cell-editor {
  background: var(--mp-tile-bg);
  border: 0.5px solid var(--mp-hairline);
  border-radius: 8px;
  padding: 22px 26px;
  margin-bottom: 18px;
}
.admin-cell-editor h3 {
  margin: 0 0 18px;
  font-family: var(--mp-serif);
  font-weight: 400;
  font-size: 24px;
  letter-spacing: -0.4px;
  color: var(--mp-ink);
}
.admin-cell-editor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px 22px;
  align-items: start;
}
.admin-cell-empty {
  color: var(--mp-muted-ink);
  text-align: center;
  padding: 50px 0;
  font-family: var(--mp-mono);
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.admin-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 0;
  font-family: var(--mp-mono);
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--mp-muted-ink);
}
.admin-field input,
.admin-field select {
  background: #fff;
  border: 0.5px solid var(--mp-hairline);
  color: var(--mp-ink);
  padding: 7px 10px;
  border-radius: 5px;
  font-family: var(--mp-ui);
  font-size: 14px;
  letter-spacing: 0;
  text-transform: none;
}
.admin-field input:focus,
.admin-field select:focus { outline: none; border-color: var(--mp-ink); }
.admin-field input:disabled,
.admin-field select:disabled { background: var(--mp-active-row); cursor: not-allowed; }
.admin-subtitle {
  font-family: var(--mp-mono);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--mp-muted-ink);
  margin: 6px 0 8px;
  grid-column: 1 / -1;
}
.admin-rent-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  grid-column: 1 / -1;
}

.admin-logo-field {
  border-top: 0.5px solid var(--mp-hairline);
  padding-top: 14px;
  margin-top: 6px;
  grid-column: 1 / -1;
}
.admin-logo-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 0.5px solid var(--mp-hairline);
  border-radius: 6px;
  padding: 10px 12px;
  min-height: 64px;
  margin-top: 4px;
  font-family: var(--mp-ui);
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--mp-ink);
}
.admin-logo-preview img {
  max-width: 56px;
  max-height: 56px;
  object-fit: contain;
}
.admin-logo-btns {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.admin-logo-btns button {
  background: var(--mp-ink);
  color: var(--mp-accent-ink);
  border: 0;
  padding: 7px 14px;
  border-radius: 5px;
  cursor: pointer;
  font-family: var(--mp-ui);
  font-size: 11px;
  letter-spacing: 0.5px;
}
.admin-logo-btns button:hover { filter: brightness(1.15); }

/* Groups editor */
.admin-groups-box {
  background: var(--mp-tile-bg);
  border: 0.5px solid var(--mp-hairline);
  border-radius: 8px;
  padding: 14px 22px;
  margin-bottom: 14px;
}
.admin-groups-box summary {
  cursor: pointer;
  color: var(--mp-muted-ink);
  font-family: var(--mp-mono);
  font-size: 11px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
}
.admin-groups-box[open] summary { color: var(--mp-ink); }
.admin-groups-list {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.admin-group-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.admin-group-row input[type="text"] {
  flex: 1;
  background: #fff;
  border: 0.5px solid var(--mp-hairline);
  color: var(--mp-ink);
  padding: 6px 10px;
  border-radius: 4px;
  font-family: var(--mp-ui);
  font-size: 14px;
}
.admin-group-row input[type="color"] {
  width: 36px;
  height: 32px;
  border: 0.5px solid var(--mp-hairline);
  background: none;
  cursor: pointer;
  border-radius: 4px;
  padding: 0;
}
.admin-group-id {
  color: var(--mp-muted-ink);
  font-family: var(--mp-mono);
  font-size: 11px;
}
.admin-group-row button {
  background: transparent;
  color: var(--mp-muted-ink);
  border: 0.5px solid var(--mp-hairline);
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--mp-mono);
  font-size: 11px;
}
.admin-group-row button:hover { color: var(--mp-ink); }

/* Cards editor */
.admin-cards-section {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.admin-card-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px minmax(160px, 220px) auto;
  gap: 8px;
  align-items: start;
  padding: 10px;
  border: 0.5px solid var(--mp-hairline);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.35);
}
.admin-card-row textarea,
.admin-card-row select,
.admin-card-row input {
  width: 100%;
  background: #fff;
  border: 0.5px solid var(--mp-hairline);
  color: var(--mp-ink);
  padding: 7px 9px;
  border-radius: 4px;
  font-family: var(--mp-ui);
  font-size: 13px;
}
.admin-card-row textarea {
  min-height: 64px;
  resize: vertical;
}
.admin-card-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.admin-card-actions button {
  border: 0.5px solid var(--mp-hairline);
  background: transparent;
  color: var(--mp-ink);
  border-radius: 4px;
  padding: 6px 8px;
  cursor: pointer;
}

/* Logos tab */
.admin-upload-form {
  background: var(--mp-tile-bg);
  border: 0.5px solid var(--mp-hairline);
  border-radius: 8px;
  padding: 18px 22px;
  display: grid;
  grid-template-columns: 1fr 1fr auto auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
}
.admin-upload-form h3 {
  grid-column: 1 / -1;
  margin: 0;
  font-family: var(--mp-serif);
  font-weight: 400;
  font-size: 22px;
  color: var(--mp-ink);
}
.admin-upload-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-family: var(--mp-mono);
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--mp-muted-ink);
}
.admin-upload-form input {
  background: #fff;
  border: 0.5px solid var(--mp-hairline);
  color: var(--mp-ink);
  padding: 8px 12px;
  border-radius: 5px;
  font-family: var(--mp-ui);
  font-size: 14px;
  letter-spacing: 0;
  text-transform: none;
}
.admin-upload-form button {
  background: var(--mp-ink);
  color: var(--mp-accent-ink);
  border: 0;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  font-family: var(--mp-ui);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.admin-logo-filter {
  display: block;
  width: 100%;
  max-width: 460px;
  margin-bottom: 14px;
  padding: 8px 14px;
  background: var(--mp-tile-bg);
  border: 0.5px solid var(--mp-hairline);
  color: var(--mp-ink);
  border-radius: 6px;
  font-family: var(--mp-ui);
  font-size: 14px;
}
.admin-logo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
.admin-logo-tile {
  background: var(--mp-tile-bg);
  border: 0.5px solid var(--mp-hairline);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--mp-ink);
  font-family: var(--mp-ui);
  font-size: 12px;
  text-align: center;
  cursor: pointer;
}
.admin-logo-tile img {
  width: 100%;
  height: 90px;
  object-fit: contain;
  background: #fff;
  border-radius: 4px;
  border: 0.5px solid var(--mp-hairline);
}
.admin-logo-tile:hover { border-color: var(--mp-accent); }
.admin-logo-del {
  width: 100%;
}

/* Logo picker modal */
.admin-modal {
  position: fixed;
  inset: 0;
  background: rgba(42, 36, 24, 0.55);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.admin-modal-box {
  background: var(--mp-surface-bg);
  border-radius: 12px;
  padding: 22px 26px;
  max-width: 880px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 16px 48px rgba(42, 36, 24, 0.35);
  font-family: var(--mp-ui);
}
.admin-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.admin-modal-header h3 {
  margin: 0;
  flex: 1;
  font-family: var(--mp-serif);
  font-weight: 400;
  font-size: 24px;
  color: var(--mp-ink);
}
.admin-modal-header button {
  background: transparent;
  color: var(--mp-muted-ink);
  border: 0;
  font-size: 22px;
  cursor: pointer;
  padding: 4px 10px;
}
.admin-modal-header button:hover { color: var(--mp-ink); }

@media (max-width: 900px) {
  .admin-cell-editor-grid { grid-template-columns: 1fr; }
  .admin-upload-form { grid-template-columns: 1fr; }
}
