/* ============================================================
   INFINITE REVERSI - Design System
   "Endless Othello on the Net" — est. 1998
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", "Arial", "Helvetica Neue", sans-serif;
  font-size: 12px;
  line-height: 1.4;
  background: #0a0a14;
  color: #d0d0d0;
  min-height: 100vh;
  overflow-x: hidden;
}

/* --- Star Field Background --- */
.star-field {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(1px 1px at 10% 20%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1px 1px at 30% 80%, rgba(255,255,255,0.4), transparent),
    radial-gradient(1px 1px at 50% 10%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 70% 60%, rgba(255,255,255,0.3), transparent),
    radial-gradient(1px 1px at 90% 40%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 15% 55%, rgba(200,220,255,0.4), transparent),
    radial-gradient(1px 1px at 45% 35%, rgba(255,255,255,0.35), transparent),
    radial-gradient(1px 1px at 65% 90%, rgba(200,230,255,0.3), transparent),
    radial-gradient(1px 1px at 85% 15%, rgba(255,255,255,0.45), transparent),
    radial-gradient(1px 1px at 25% 45%, rgba(180,200,255,0.3), transparent),
    radial-gradient(1.5px 1.5px at 5% 70%, rgba(255,255,255,0.7), transparent),
    radial-gradient(1.5px 1.5px at 55% 50%, rgba(200,220,255,0.5), transparent),
    radial-gradient(1.5px 1.5px at 75% 25%, rgba(255,255,255,0.55), transparent),
    radial-gradient(1.5px 1.5px at 95% 85%, rgba(180,200,255,0.4), transparent),
    radial-gradient(1.5px 1.5px at 35% 5%, rgba(255,255,255,0.5), transparent),
    radial-gradient(2px 2px at 40% 65%, rgba(100,180,255,0.3), transparent),
    radial-gradient(2px 2px at 80% 75%, rgba(100,200,255,0.25), transparent);
  background-color: #0a0a14;
}

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  position: relative;
  z-index: 10;
  background: linear-gradient(180deg, #1a1a2e 0%, #0d0d1a 100%);
  border-bottom: 2px solid #333355;
  padding: 0;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px 2px;
}

.header-logo {
  color: #00cc66;
  font-size: 16px;
}

.header-title {
  font-family: "Arial Black", "Impact", sans-serif;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 4px;
  background: linear-gradient(
    180deg,
    #8090a0 0%,
    #e0e8f0 18%,
    #ffffff 28%,
    #b0c0d0 40%,
    #506070 50%,
    #90a8c0 58%,
    #e8f0ff 68%,
    #ffffff 75%,
    #a0b0c8 85%,
    #607080 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 12px rgba(120, 160, 255, 0.4)) drop-shadow(2px 2px 0 #000);
}

.header-subtitle {
  padding: 0 18px 8px;
  font-size: 12px;
  font-weight: bold;
  color: #aaaacc;
  letter-spacing: 1px;
}

.header-nav {
  display: flex;
  gap: 0;
  padding: 0 18px;
  border-top: 1px solid #252540;
  border-bottom: 1px solid #252540;
  background: #12122a;
}

.nav-link {
  display: block;
  padding: 6px 16px;
  color: #ccccdd;
  text-decoration: none;
  font-size: 13px;
  font-weight: 900;
  border-right: 1px solid #1a1a35;
  transition: background 0.15s, color 0.15s;
}

.nav-link-button {
  background: transparent;
  border: 0;
  font: inherit;
  line-height: inherit;
  cursor: pointer;
}

.nav-link:hover {
  background: #1a1a40;
  color: #ffffff;
}

.nav-link.nav-active {
  background: #1e1e45;
  color: #ffffff;
  border-bottom: 2px solid #4488cc;
}

/* ============================================================
   TICKER BAR
   ============================================================ */
.ticker-bar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #101020;
  border-bottom: 1px solid #222244;
  padding: 3px 18px;
  font-size: 11px;
  overflow: hidden;
}

.ticker-label {
  color: #ffcc00;
  font-weight: 900;
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}

.ticker-scroll {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
}

.ticker-content {
  display: inline-block;
  color: #ccddee;
  font-size: 12px;
  font-weight: bold;
  font-family: "Consolas", "Courier New", monospace;
  animation: ticker-slide 30s linear infinite;
}

@keyframes ticker-slide {
  0% { transform: translateX(100%); }
  100% { transform: translateX(-100%); }
}

.ticker-users {
  color: #00cc88;
  font-weight: 900;
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.layout {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 220px;
  gap: 8px;
  padding: 8px;
  max-width: 1500px;
  margin: 0 auto;
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ============================================================
   PANEL SYSTEM (Win95-style)
   ============================================================ */
.panel {
  background: #c0c0c0;
  border: 2px outset #dfdfdf;
  box-shadow: 1px 1px 0 #808080;
  color: #000;
}

.panel-titlebar {
  background: linear-gradient(90deg, #000080, #0000a8);
  color: #ffffff;
  font-size: 11px;
  font-weight: bold;
  padding: 3px 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  user-select: none;
  letter-spacing: 0.5px;
}

.panel-titlebar-icon {
  font-size: 8px;
  opacity: 0.8;
}

.panel-body {
  background: #ffffff;
  border: 2px inset #c0c0c0;
  padding: 6px;
  font-size: 11px;
  margin: 4px;
}

.panel-actions {
  padding: 0 4px 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.panel-btn {
  background: #c0c0c0;
  border: 2px outset #dfdfdf;
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
  color: #000;
  text-align: center;
}

.panel-btn:hover {
  background: #d0d0d0;
}

.panel-btn:active {
  border: 2px inset #c0c0c0;
}

.panel-btn:disabled {
  color: #808080;
  cursor: not-allowed;
}

.panel-divider {
  height: 1px;
  background: #a0a0a0;
  margin: 4px 0;
}

/* --- Info rows --- */
.info-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 2px;
  font-size: 11px;
}

.info-label {
  color: #555;
  min-width: 48px;
}

.info-value {
  font-weight: bold;
  color: #000;
}

.info-sub {
  font-size: 10px;
  color: #555;
}

.point-highlight {
  color: #cc8800 !important;
  font-size: 13px;
}

/* --- Cooldown timer --- */
.cooldown-timer {
  font-weight: bold;
  color: #990000;
  font-size: 11px;
  margin-top: 2px;
}

/* --- Stat grid --- */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.stat-cell {
  background: #f0f0f0;
  border: 1px inset #d0d0d0;
  padding: 3px 5px;
  text-align: center;
}

.stat-label {
  display: block;
  font-size: 9px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  display: block;
  font-size: 14px;
  font-weight: bold;
  color: #000080;
}

/* --- Log body --- */
.log-body {
  max-height: 100px;
  overflow-y: auto;
  font-size: 10px;
  line-height: 1.5;
  font-family: "Consolas", "Courier New", monospace;
}

.log-entry {
  padding: 1px 0;
  border-bottom: 1px dotted #e0e0e0;
}

.log-entry:last-child {
  border-bottom: none;
}

.log-dim {
  color: #999;
  font-style: italic;
}

.log-coord {
  color: #000080;
  font-weight: bold;
}

.log-black {
  color: #333;
}

.log-white {
  color: #888;
}

.log-time {
  color: #aaa;
  font-size: 9px;
}

/* --- Retro link --- */
.retro-link {
  color: #0000cc;
  text-decoration: underline;
  font-size: 11px;
}

.retro-link:hover {
  color: #cc0000;
}

/* --- 88x31 banner --- */
.banner-88x31 {
  display: inline-block;
  width: 88px;
  height: 31px;
  background: linear-gradient(135deg, #001133, #003366);
  border: 1px solid #004488;
  color: #00ccaa;
  font-size: 8px;
  font-weight: bold;
  line-height: 1.2;
  text-align: center;
  padding-top: 4px;
  letter-spacing: 1px;
  box-shadow: 1px 1px 0 #000;
}

/* --- Panel footer info --- */
.panel-footer-info {
  border: 2px outset #dfdfdf;
}

.panel-footer-info .panel-body {
  margin: 0;
  border: none;
  background: #d8d8d8;
  padding: 6px;
}

/* ============================================================
   BOARD AREA
   ============================================================ */
.board-panel {
  min-width: 0;
}

.board-container {
  background: #0e0e1e;
  border: 2px outset #444466;
  padding: 0;
  box-shadow:
    0 0 30px rgba(0, 40, 80, 0.2),
    inset 0 0 0 1px rgba(0, 0, 0, 0.5);
}

.board-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 10px;
  background: linear-gradient(90deg, #0d0d20, #151530);
  border-bottom: 1px solid #333355;
  color: #ccddee;
  font-size: 13px;
  font-weight: 900;
}

.coord-display {
  display: flex;
  align-items: center;
  gap: 3px;
}

.coord-label {
  color: #aabbdd;
  font-size: 12px;
  font-weight: bold;
}

.coord-value {
  color: #00cccc;
  font-size: 14px;
  font-weight: 900;
  font-family: "Courier New", monospace;
  min-width: 36px;
  text-align: right;
}

.coord-sep {
  color: #8899aa;
  margin: 0 2px;
}

.board-wrapper {
  overflow: hidden;
  width: 100%;
  height: clamp(360px, 68vh, 720px);
  min-height: 360px;
  max-height: 720px;
  background: #1a5c1a;
  position: relative;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
  --cell-size: 24px;
  --stone-size: 20px;
  --dot-size: 4px;
  border-top: 1px solid #2a7a2a;
  border-bottom: 1px solid #2a7a2a;
  box-shadow:
    inset 0 0 40px rgba(0, 0, 0, 0.4),
    0 0 20px rgba(0, 80, 0, 0.15);
}

.board-wrapper:active {
  cursor: grabbing;
}

.board-grid {
  position: absolute;
  inset: 0;
  z-index: 1;
  background-color: #1a5c1a;
  background-image:
    linear-gradient(to right, rgba(0, 0, 0, 0.45) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.45) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: 0 0;
  image-rendering: pixelated;
  will-change: background-position, background-size;
}

.board-entities {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.board-entity {
  position: absolute;
  transform: translate(-50%, -50%);
}

/* --- Board overlay (minimap) --- */
.board-overlay {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 5;
  pointer-events: none;
}

.minimap-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  pointer-events: auto;
}

.minimap-label {
  font-size: 9px;
  letter-spacing: 1px;
  color: rgba(0, 255, 136, 0.85);
  font-weight: 900;
  text-shadow: 0 0 4px rgba(0, 255, 100, 0.4);
}

.minimap-container canvas {
  border: 1px solid #00aa44;
  background: #002200;
  display: block;
  box-shadow:
    0 0 6px rgba(0, 255, 100, 0.1),
    inset 0 0 10px rgba(0, 0, 0, 0.5);
}

.minimap-btn {
  background: rgba(0, 40, 0, 0.8);
  border: 1px solid #00aa44;
  padding: 1px 6px;
  font-size: 9px;
  cursor: pointer;
  font-family: inherit;
  color: #00cc66;
  pointer-events: auto;
}

.minimap-btn:hover {
  background: rgba(0, 60, 0, 0.9);
}

/* --- Board footer (timer bar) --- */
.board-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: linear-gradient(90deg, #0d0d20, #151530);
  border-top: 1px solid #333355;
}

.board-footer-timer {
  font-size: 12px;
  font-weight: bold;
  color: #ccddee;
}

.timer-value {
  font-size: 20px;
  font-weight: bold;
  color: #ffcc00;
  font-family: "Courier New", monospace;
  text-shadow: 0 0 8px rgba(255, 204, 0, 0.3);
  margin-left: 6px;
}

.board-footer-status {
  font-size: 11px;
  font-weight: bold;
  color: #aabbcc;
}

/* --- Bottom nav --- */
.bottom-nav {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}

.bottom-btn {
  flex: 1;
  background: #c0c0c0;
  border: 2px outset #dfdfdf;
  padding: 4px 6px;
  font-size: 10px;
  font-family: inherit;
  cursor: pointer;
  color: #000;
  text-align: center;
}

.bottom-btn:hover {
  background: #d0d0d0;
}

.bottom-btn:active {
  border: 2px inset #c0c0c0;
}

.bottom-btn:disabled {
  color: #808080;
  cursor: not-allowed;
}

/* ============================================================
   STONES & VALID MOVES
   ============================================================ */
.stone {
  width: var(--stone-size);
  height: var(--stone-size);
  border-radius: 50%;
  box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.6);
}

.stone.black {
  background: radial-gradient(circle at 35% 35%, #444, #111, #000);
  border: 1px solid #555;
}

.stone.white {
  background: radial-gradient(circle at 35% 35%, #fff, #e8e8e8, #ccc);
  border: 1px solid #aaa;
}

.stone-dot {
  width: var(--dot-size);
  height: var(--dot-size);
  border-radius: 50%;
}

.stone-dot.black-dot {
  background: #222;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.stone-dot.white-dot {
  background: #eee;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
}

.valid-move {
  width: var(--cell-size);
  height: var(--cell-size);
  background: rgba(0, 255, 100, 0.25);
  border: 1px solid rgba(0, 255, 100, 0.4);
  animation: pulse-move 1.2s ease-in-out infinite alternate;
}

@keyframes pulse-move {
  from { background: rgba(0, 255, 100, 0.15); }
  to { background: rgba(0, 255, 100, 0.35); border-color: rgba(0, 255, 100, 0.6); }
}

/* ============================================================
   LEADERBOARD
   ============================================================ */
.leaderboard-list {
  list-style: none;
  padding: 0;
  margin: 4px;
  font-size: 11px;
  background: #fff;
  border: 2px inset #c0c0c0;
}

.leaderboard-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 2px 5px;
  border-bottom: 1px solid #b0b0b0;
  background: #e0e0e0;
  margin: 0;
  font-size: 10px;
}

.leaderboard-list li:last-child {
  border-bottom: none;
}

.leaderboard-list li.rank-1 {
  background: #ffd060;
  font-weight: bold;
}

.leaderboard-list li.rank-2 {
  background: #d8d8e0;
}

.leaderboard-list li.rank-3 {
  background: #d4a860;
}

.leaderboard-empty {
  text-align: center;
  color: #666;
  padding: 8px;
  background: #f0f0f0;
  font-size: 11px;
}

.leaderboard-rank {
  width: 24px;
  font-weight: bold;
  color: #000080;
  font-size: 10px;
}

.leaderboard-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-score {
  width: 40px;
  text-align: right;
  font-weight: bold;
  color: #006600;
}

/* Mobile leaderboard */
.leaderboard-list.leaderboard-mobile {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
  padding: 0;
}

.leaderboard-list.leaderboard-mobile > li {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  display: block;
}

.leaderboard-list.leaderboard-mobile .leaderboard-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border: 2px inset #c0c0c0;
  background: #f0f0f0;
  color: #000080;
}

.lb-mobile-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 2px inset #c0c0c0;
  background: #fff;
}

.lb-mobile-col-left {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-right: 1px solid #a0a0a0;
}

.lb-mobile-col-right {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 2px 4px;
  font-size: 10px;
  overflow-y: auto;
  max-height: 120px;
}

.lb-mobile-card {
  padding: 3px 5px;
  border-bottom: 1px solid #b0b0b0;
}

.lb-mobile-card:last-child {
  border-bottom: none;
}

.lb-mobile-rank-1 { background: #ffd060; }
.lb-mobile-rank-2 { background: #d8d8e0; }
.lb-mobile-rank-3 { background: #d4a860; }

.lb-mobile-mini-rank {
  color: #000080;
  font-size: 11px;
  font-weight: bold;
}

.lb-mobile-mini-name {
  font-size: 11px;
  font-weight: bold;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-mobile-mini-points {
  color: #006600;
  font-size: 10px;
  font-weight: bold;
}

.lb-mobile-rest-empty {
  color: #999;
  font-style: italic;
  padding: 4px;
}

.lb-mobile-rest-line {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 10px;
  font-weight: bold;
  padding: 1px 0;
  border-bottom: 1px dotted #d0d0d0;
}

.lb-mobile-rest-line:last-child {
  border-bottom: none;
}

/* ============================================================
   HOTSPOTS
   ============================================================ */
.hotspot-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.hotspot-item { margin: 0; }

.hotspot-btn {
  width: 100%;
  text-align: left;
  font-family: inherit;
  background: #e8f0ff;
  border: 1px outset #c0c0c0;
  color: #000080;
  padding: 3px 5px;
  cursor: pointer;
  font-size: 10px;
}

.hotspot-btn:hover {
  background: #d0e0ff;
}

.hotspot-btn:active {
  border: 1px inset #c0c0c0;
}

.hotspot-empty {
  color: #666;
  font-size: 10px;
  font-style: italic;
}

/* ============================================================
   ROLE
   ============================================================ */
.role-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.role-name {
  font-size: 13px;
  color: #000080;
  font-weight: bold;
}

.role-desc {
  color: #333;
  font-size: 10px;
  line-height: 1.4;
}

/* ============================================================
   CONTROLS
   ============================================================ */
.controls-body {
  font-size: 10px;
  font-family: "Consolas", "Courier New", monospace;
}

.control-row {
  margin-bottom: 2px;
  display: flex;
  gap: 6px;
  align-items: baseline;
}

.control-row kbd {
  background: #e8e8e8;
  border: 1px solid #999;
  border-radius: 2px;
  padding: 0 3px;
  font-family: inherit;
  font-size: 9px;
  min-width: 44px;
  text-align: center;
  color: #333;
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  position: relative;
  z-index: 10;
  background: #101020;
  border-top: 2px solid #333355;
  padding: 8px 18px;
  margin-top: 8px;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1500px;
  margin: 0 auto;
  gap: 12px;
}

.footer-ad {
  max-width: 980px;
  margin: 0 auto 10px;
  padding: 8px;
  background: linear-gradient(180deg, rgba(20, 20, 38, 0.96), rgba(11, 11, 24, 0.96));
  border: 1px solid #2f2f4c;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 0 18px rgba(0, 0, 0, 0.18);
}

.footer-ad .adsbygoogle {
  min-height: 90px;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-logo {
  color: #00cc66;
  font-size: 14px;
}

.footer-brand {
  font-family: "Arial Black", "Impact", sans-serif;
  font-size: 14px;
  font-weight: 900;
  color: #aaaabb;
  letter-spacing: 2px;
}

.footer-tagline {
  font-size: 11px;
  font-weight: 900;
  color: #9999bb;
  letter-spacing: 1px;
  border: 1px solid #444466;
  padding: 1px 6px;
  background: #0a0a18;
}

.footer-center {
  text-align: center;
}

.footer-rule {
  background: #cc0000;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  padding: 3px 12px;
  letter-spacing: 1px;
}

.footer-right {
  font-size: 13px;
}

.footer-right .retro-link {
  color: #aaaacc;
  font-weight: 900;
}

.footer-right .retro-link:hover {
  color: #ddddee;
}

/* ============================================================
   MODALS
   ============================================================ */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.modal-window {
  width: 340px;
  background: #c0c0c0;
  border: 2px outset #dfdfdf;
  box-shadow: 3px 3px 0 #404040;
}

.modal-window.wide {
  width: 520px;
}

.modal-titlebar {
  background: linear-gradient(90deg, #000080, #0000a8);
  color: #fff;
  font-weight: bold;
  font-size: 12px;
  padding: 4px 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}

.modal-close-btn {
  margin-left: auto;
  background: #c0c0c0;
  border: 1px outset #dfdfdf;
  color: #000;
  font-size: 12px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  font-family: inherit;
}

.modal-close-btn:active {
  border: 1px inset #c0c0c0;
}

.modal-body {
  background: #fff;
  border: 2px inset #c0c0c0;
  padding: 8px;
  margin: 4px;
  font-size: 11px;
}

.modal-body label {
  display: block;
  margin-bottom: 2px;
  font-size: 11px;
  color: #333;
}

.modal-body input {
  width: 100%;
  padding: 3px 4px;
  border: 2px inset #c0c0c0;
  font-family: inherit;
  font-size: 12px;
  margin-bottom: 6px;
}

.modal-actions {
  padding: 4px;
  display: flex;
  gap: 6px;
  justify-content: center;
}

.modal-actions.stack {
  flex-direction: column;
  align-items: center;
}

.join-status {
  font-size: 11px;
  color: #000080;
  min-height: 14px;
}

/* --- Help modal --- */
.help-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.help-block {
  border: 1px inset #c0c0c0;
  padding: 5px;
  background: #f4f4f4;
}

.help-block h4 {
  margin: 0 0 4px 0;
  color: #000080;
  font-size: 11px;
}

.help-block p {
  margin: 2px 0;
  font-size: 10px;
}

/* --- Game Over modal --- */
.gameover-window {
  width: 400px;
  border: 3px outset #ffcc00;
  box-shadow:
    0 0 0 2px #000,
    0 0 20px rgba(255, 200, 0, 0.25);
  background: linear-gradient(180deg, #150030 0%, #0a0018 100%);
}

.gameover-titlebar {
  background: linear-gradient(90deg, #880000, #cc0000) !important;
  color: #ffcc00 !important;
  text-align: center;
  justify-content: center;
  letter-spacing: 2px;
  animation: title-blink 1s steps(2, end) infinite;
}

.gameover-body {
  position: relative;
  overflow: hidden;
  border-color: #ffcc00 !important;
  background: linear-gradient(180deg, rgba(30, 0, 60, 0.95), rgba(10, 0, 30, 0.95)) !important;
  color: #ffcc66;
}

.gameover-body::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.06) 0px,
    rgba(255, 255, 255, 0.06) 1px,
    transparent 1px,
    transparent 3px
  );
  opacity: 0.3;
}

.gameover-banner {
  position: relative;
  z-index: 1;
  margin: 0 auto 8px;
  width: fit-content;
  padding: 3px 10px;
  border: 1px outset #ffcc66;
  background: #000080;
  color: #ffcc00;
  font-weight: bold;
  font-size: 11px;
  letter-spacing: 1px;
}

.gameover-message {
  position: relative;
  z-index: 1;
  font-weight: bold;
  text-align: center;
  font-size: 18px;
  color: #fff;
  text-shadow: 1px 1px 0 #000, 0 0 8px rgba(255,255,255,0.3);
  margin-bottom: 6px;
}

.gameover-sub {
  position: relative;
  z-index: 1;
  text-align: center;
  font-size: 10px;
  color: #ccaa66;
}

@keyframes title-blink {
  from { color: #ffcc66; }
  to { color: #fff; }
}

/* ============================================================
   STATUS MESSAGE (toast)
   ============================================================ */
.status-message {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #ffcc00;
  color: #000;
  padding: 14px 24px;
  border: 2px outset #ffcc00;
  font-weight: bold;
  font-size: 14px;
  z-index: 3000;
  text-align: center;
  box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.5);
}

/* ============================================================
   MOBILE PANEL COLLAPSE
   ============================================================ */
.panel-collapsible-header {
  cursor: pointer;
}

.panel-toggle-indicator {
  display: none;
  margin-left: auto;
  font-size: 10px;
  color: #ccc;
  text-decoration: none;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1200px) {
  .layout {
    grid-template-columns: 1fr;
    padding: 6px;
    gap: 6px;
  }

  .side-panel {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }

  .panel {
    flex: 1 1 200px;
  }

  .header-title { font-size: 20px; }
}

@media (max-width: 768px) {
  .layout {
    grid-template-columns: 1fr;
    padding: 4px;
    gap: 4px;
  }

  .header-brand { padding: 6px 10px 2px; }
  .header-title { font-size: 18px; letter-spacing: 1px; }
  .header-subtitle { display: none; }

  .header-nav {
    overflow-x: auto;
    padding: 0 10px;
  }

  .nav-link {
    padding: 5px 12px;
    font-size: 12px;
  }

  .ticker-bar {
    padding: 2px 10px;
    font-size: 10px;
  }

  /* Mobile layout order: board first, then info */
  .board-panel {
    order: 1;
    grid-column: 1 / -1;
  }

  .right-panel {
    order: 2;
    grid-column: 1 / -1;
    gap: 4px;
  }

  .left-panel {
    order: 3;
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    align-items: start;
  }

  .left-panel #panel-controls,
  .left-panel #panel-recent,
  .left-panel .panel-footer-info {
    grid-column: 1 / -1;
  }

  .left-panel .panel {
    min-width: 0;
  }

  .side-panel {
    flex-direction: column;
    flex-wrap: nowrap;
  }

  .board-wrapper {
    height: clamp(280px, 50vh, 400px);
    min-height: 280px;
  }

  .board-overlay {
    top: 4px;
    right: 4px;
  }

  .minimap-container canvas {
    width: 70px;
    height: 70px;
  }

  .minimap-label { font-size: 7px; }
  .minimap-btn { font-size: 8px; padding: 2px 8px; }

  .panel {
    flex: initial;
  }

  .panel-titlebar {
    font-size: 11px;
    padding: 3px 6px;
  }

  .panel-body {
    padding: 4px;
    margin: 3px;
    font-size: 11px;
  }

  .panel-btn {
    padding: 4px 8px;
    font-size: 11px;
  }

  /* Bottom nav: 2 buttons side by side */
  .bottom-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px;
  }

  .bottom-btn {
    font-size: 10px;
    padding: 5px 4px;
  }

  .board-footer {
    padding: 4px 8px;
  }

  .timer-value {
    font-size: 16px;
  }

  .modal-window,
  .modal-window.wide {
    width: calc(100% - 16px);
  }

  .help-grid {
    grid-template-columns: 1fr;
  }

  .panel.mobile-collapsed > :not(.panel-titlebar) {
    display: none;
  }

  .panel.mobile-collapsed {
    min-height: 24px;
  }

  .panel-toggle-indicator {
    display: inline-block;
  }

  /* Hide secondary panels on mobile */
  .right-panel #panel-hotspots,
  .right-panel #panel-role,
  .right-panel #panel-worldlog,
  .right-panel #panel-controls,
  .right-panel .panel-links {
    display: none;
  }

  .left-panel #panel-observer,
  .left-panel #panel-recent,
  .left-panel .panel-footer-info {
    display: none;
  }

  /* Compact mobile leaderboard */
  .lb-mobile-col-right {
    max-height: 90px;
  }

  .site-footer {
    padding: 6px 10px;
  }

  .footer-ad {
    margin-bottom: 8px;
    padding: 6px;
  }

  .footer-inner {
    flex-direction: column;
    gap: 4px;
    text-align: center;
  }

  .footer-brand { font-size: 12px; }
  .footer-tagline { display: none; }
  .footer-center { display: none; }
}

@media (max-width: 480px) {
  .header-title { font-size: 16px; letter-spacing: 2px; }

  .nav-link {
    padding: 4px 10px;
    font-size: 11px;
  }

  .board-wrapper {
    height: clamp(250px, 45vh, 350px);
    min-height: 250px;
  }

  .coord-value { font-size: 12px; }
  .timer-value { font-size: 14px; }

  .lb-mobile-mini-rank { font-size: 10px; }
  .lb-mobile-mini-name { font-size: 10px; }
  .lb-mobile-mini-points { font-size: 9px; }
  .lb-mobile-rest-line { font-size: 9px; }
}

/* ============================================================
   HISTORY PAGE (legacy support)
   ============================================================ */
.history-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  color: #000;
  font-family: "Consolas", "Courier New", monospace;
}

.history-table th,
.history-table td {
  border: 1px solid #808080;
  padding: 4px 6px;
  font-size: 11px;
}

.history-table th {
  background: #d0d0d0;
  font-weight: bold;
}

.history-empty {
  padding: 12px;
  text-align: center;
  color: #666;
  font-weight: bold;
}

.main-container {
  position: relative;
  z-index: 5;
  display: flex;
  gap: 8px;
  padding: 8px;
  max-width: 1500px;
  margin: 0 auto;
}

.game-info {
  width: 220px;
  background: #c0c0c0;
  border: 2px outset #dfdfdf;
  padding: 0;
  color: #000;
}

.game-area {
  flex: 1;
  min-width: 0;
}

.player-info,
.controls {
  background: #fff;
  border: 2px inset #c0c0c0;
  padding: 6px;
  margin: 4px;
  font-size: 11px;
}

.player-info h3,
.controls h3 {
  margin: 0 0 4px 0;
  color: #000080;
  font-size: 12px;
}

.history-link {
  color: #0000cc;
  text-decoration: underline;
}

.history-link:hover {
  color: #cc0000;
}
