    :root { color-scheme: dark; }
    * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

    html, body {
      margin: 0;
      padding: 0;
      width: 100%;
      height: 100%;
      overflow: hidden;
      background: #05080f;
      font-family: 'Inter', system-ui, -apple-system, sans-serif;
      color: #f8fafc;
      user-select: none;
    }

    #canvas-container {
      position: fixed;
      inset: 0;
      width: 100%;
      height: 100%;
      z-index: 1;
      cursor: grab;
    }
    #canvas-container:active { cursor: grabbing; }

    .glass {
      background: rgba(10, 15, 26, 0.80);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      border: 1px solid rgba(255, 255, 255, 0.10);
      box-shadow: 0 14px 36px rgba(0, 0, 0, 0.5);
    }

    .glass-gold {
      background: linear-gradient(145deg, rgba(20, 26, 40, 0.94), rgba(10, 14, 24, 0.97));
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
      border: 1px solid rgba(234, 179, 8, 0.38);
      box-shadow: 0 24px 56px rgba(0, 0, 0, 0.72), 0 0 28px rgba(234, 179, 8, 0.14);
    }

    .font-display { font-family: 'Playfair Display', Georgia, serif; }

    ::-webkit-scrollbar { width: 6px; height: 6px; }
    ::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.03); }
    ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.18); border-radius: 999px; }

    @keyframes floatUp {
      0% { opacity: 0; transform: translate(-50%, 10px) scale(0.92); }
      15% { opacity: 1; transform: translate(-50%, 0px) scale(1); }
      85% { opacity: 1; transform: translate(-50%, -26px) scale(1); }
      100% { opacity: 0; transform: translate(-50%, -42px) scale(0.95); }
    }
    .toast-float { animation: floatUp 2.5s cubic-bezier(0.22, 1, 0.36, 1) forwards; }

    @keyframes pulseRing {
      0%, 100% { box-shadow: 0 0 0 0 rgba(250, 204, 21, 0.55); }
      50% { box-shadow: 0 0 0 8px rgba(250, 204, 21, 0); }
    }
    .active-turn-ring { animation: pulseRing 2s infinite; }

    @keyframes cardFlipIn {
      0% { transform: perspective(900px) rotateY(70deg) scale(0.92); opacity: 0; }
      100% { transform: perspective(900px) rotateY(0deg) scale(1); opacity: 1; }
    }
    .card-flip-in { animation: cardFlipIn 0.42s cubic-bezier(0.22, 1, 0.36, 1) forwards; }

    /* Subtle cinematic letterbox bars during closeups */
    .cine-bar {
      position: fixed;
      left: 0; right: 0;
      height: 0px;
      background: rgba(3, 5, 10, 0.85);
      z-index: 15;
      pointer-events: none;
      transition: height 0.45s cubic-bezier(0.22, 1, 0.36, 1);
    }
    .cine-bar.top { top: 0; }
    .cine-bar.bottom { bottom: 0; }
    body.cine-active .cine-bar { height: 26px; }

html { color-scheme: dark; }
body { min-height: 100dvh; }
#canvas-container { touch-action: none; }
[hidden] { display: none !important; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible {
  outline: 2px solid #fcd68a;
  outline-offset: 2px;
}
button:disabled { cursor: not-allowed; opacity: 0.5; }
#game-header > div:last-child { flex-wrap: wrap; }
#game-brand { flex-shrink: 0; }
#modal-content { max-height: min(90dvh, 48rem); }
#modal-content:focus { outline: none; }
#setup-players-list input { min-width: 0; }
#tile-inspector { max-height: 45dvh; overflow-y: auto; }
.game-table { width: 100%; border-collapse: collapse; text-align: left; }
.game-table th, .game-table td { padding: 5px 6px; vertical-align: top; }
.game-table th { font-weight: 600; }
.game-table tbody tr + tr { border-top: 1px solid #ffffff15; }
#activity-log td:first-child { color: #9aa9bb; width: 25px; }
.setup-presets { display: flex; gap: 8px; }
.setup-presets button {
  padding: 8px 14px;
  border: 1px solid #71809666;
  border-radius: 9px;
  flex: 1;
  font-weight: 650;
  font-size: .875rem;
}
.setup-presets button[aria-pressed="true"] { color: #fde4a4; background: #facc1522; border-color: #facc1575; }
.setup-error { color: #fecaca; font-size: .875rem; margin: 0 0 12px; }
.game-error {
  position: fixed;
  z-index: 80;
  inset: auto 16px 16px;
  background: #252016;
  padding: 18px;
  border-radius: 12px;
  text-align: center;
}
.game-error a { text-decoration: underline; }

.flat-mode #canvas-container {
  display: grid;
  place-items: center;
  padding: 88px 14px 91px;
  cursor: auto;
  overflow: auto;
  touch-action: pan-x pan-y;
  background: radial-gradient(ellipse at center, #102b30, #05080f 72%);
}
.flat-board {
  display: grid;
  grid-template: repeat(11, minmax(0, 1fr)) / repeat(11, minmax(0, 1fr));
  gap: 2px;
  width: min(84vw, calc(100dvh - 180px), 740px);
  min-width: 445px;
  aspect-ratio: 1;
  padding: 7px;
  background: #1e272b;
  border: 1px solid #ab8c52;
  border-radius: 9px;
  box-shadow: 0 18px 48px #0008;
}
.flat-center {
  grid-area: 2 / 2 / 11 / 11;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  border: 1px solid #a287513f;
  color: #f2db9e;
  background: radial-gradient(ellipse at center, #183e38, #0b2629);
}
.flat-center span { font: clamp(2rem, 6vw, 5rem) Georgia, serif; }
.flat-center small { color: #c5cfbf; }
.flat-tile {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2px;
  text-align: center;
  color: #f5f3ed;
  background: #111a22;
  border: 1px solid #ffffff12;
  border-top: 4px solid var(--sector);
  overflow: hidden;
}
.flat-tile:hover, .flat-highlight { background: #244448; }
.flat-owned { border-bottom: 3px solid var(--owner); }
.flat-tile-name { overflow-wrap: anywhere; line-height: 1.05; font-size: clamp(.55rem, 1.08dvh, .82rem); }
.flat-occupants { font-size: clamp(.55rem, 1.4dvh, 1rem); line-height: 1; overflow: hidden; }
@media (max-width: 1100px) {
  .flat-mode #canvas-container { padding-top: 154px; }
  .flat-board { width: min(90vw, calc(100dvh - 245px)); }
}
@media (max-width: 760px) {
  #game-header { flex-wrap: wrap; justify-content: flex-start; }
  #game-header > div:last-child { max-width: 100%; }
  #players-panel { top: 118px; }
  #toast-layer { top: 180px; width: 92vw; text-align: center; }
  #tile-inspector { bottom: 116px; }
  .flat-mode #canvas-container { place-items: center start; padding-top: 186px; padding-bottom: 120px; }
  #game-header button { padding-inline: 7px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}
