:root { --night: #07090b; --paper: #11151a; --sand: #263039; --ink: #eef1eb; --muted: #a8b2b9; --line: #37434d; }
body { background: #050607; color: var(--ink); }
select, select option { color: #000; }
.topbar { background: #090c0f; border-color: #29323a; }
.topbar { position: sticky; top: 0; z-index: 20; min-height: 150px; }
.topbar nav { display: grid; justify-items: end; gap: 5px; }
.active-turn-banner { position: absolute; left: 50%; transform: translateX(-50%); display: grid; justify-items: center; gap: 8px; color: #fff; font: 500 15px 'DM Mono', monospace; letter-spacing: .04em; line-height: 1.2; text-align: center; white-space: nowrap; }
.game-status-line { display: flex; align-items: center; gap: 18px; }
.active-turn-banner b { color: var(--gold); font-size: 19px; }
.global-status-tables { display: flex; align-items: stretch; gap: 8px; }
.game-stats-table { border-collapse: collapse; color: #cbd3d5; font: 500 11px 'DM Mono', monospace; letter-spacing: .02em; background: #ffffff08; border: 1px solid #ffffff1f; }
.game-stats-table th, .game-stats-table td { padding: 3px 9px; border-right: 1px solid #ffffff16; text-align: left; }
.game-stats-table th { color: #fff; font-weight: 700; background: #ffffff09; }
.game-stats-table td { color: var(--gold); }
.game-stats-table td:last-child { border-right: 0; }
.global-player-summaries { display: flex; gap: 8px; }
.global-player-summary { display: grid; grid-template-columns: auto auto; gap: 5px 8px; min-width: 180px; padding: 5px 7px; border: 2px solid #ffffff1f; background: #ffffff08; color: #cbd3d5; font: 500 10px 'DM Mono', monospace; letter-spacing: .02em; }
.global-player-summary.active-global-player { border-color: #fff; }
.global-player-summary header { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 12px; color: #fff; }
.global-player-summary header span { color: var(--gold); overflow: hidden; text-overflow: ellipsis; }
.global-building-minis { display: flex; align-items: center; gap: 6px; }
.global-building-mini { display: grid; justify-items: center; gap: 2px; margin: 0; color: var(--gold); font: 500 9px 'DM Mono', monospace; }
.global-building-mini > .building-cube-display { display: flex; align-items: center; gap: 2px; }
.global-building-mini > .building-cube-display > .building-artwork { width: 47px; }
.global-building-mini .building-artwork > img { width: 100%; height: 66px; object-fit: contain; }
.global-building-mini figcaption { white-space: nowrap; }
.cube-icons { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }
.cube-icons img { display: block; width: 13px; height: 13px; object-fit: contain; }
.blue-cubes img { filter: brightness(0) saturate(100%) invert(29%) sepia(97%) saturate(1918%) hue-rotate(184deg) brightness(96%) contrast(102%); }
.building-artwork { position: relative; display: block; flex: 0 0 auto; width: 34%; }
.building-cube-display { display: flex; align-items: center; gap: 4px; }
.building > .building-cube-display { display: flex; width: 100%; }
.building-artwork > img { display: block; width: 100%; height: auto; margin: 0; object-fit: contain; }
.building-artwork > .building-resource-cubes { position: absolute; top: 50%; left: 50%; right: auto; width: 90%; max-height: 85%; display: flex; align-content: center; justify-content: center; gap: 1px; padding: 2px; transform: translate(-50%, -50%); }
.building .building-artwork > img { display: block; width: 100%; height: auto; margin: 0; object-fit: contain; }
.building .building-artwork > .building-resource-cubes img { width: 32px; height: 32px; }
.spent-cubes-outside .cube-icons img { width: 32px; height: 32px; }
.spent-cubes-outside { display: flex !important; align-items: center; color: var(--muted) !important; font-weight: 400 !important; }
.global-building-mini .building-artwork { width: 47px; }
.global-building-mini .building-artwork > img { height: 66px; }
.global-building-mini .building-resource-cubes img { width: 16px; height: 16px; }
.global-building-mini .spent-cubes-outside .cube-icons img { width: 16px; height: 16px; }
.global-building-mini .spent-cubes-outside { justify-content: flex-start; }
.unit-artwork { position: relative; grid-column: 1; width: 126px; height: 226px; isolation: isolate; }
.unit-artwork .unit-card-image { position: absolute; top: 0; left: 0; z-index: 2; display: block; width: 126px; height: 174px; object-fit: contain; }
.unit-tapped-marker { position: absolute; top: 68px; left: 8px; z-index: 4; display: grid; justify-items: center; gap: 2px; width: 110px; padding: 6px 3px; border: 1px solid #e2a84a; border-radius: 4px; background: #101416ef; color: #fff; font-size: 10px; line-height: 1.2; text-align: center; text-shadow: 0 1px 2px #000; }
.unit-tapped-marker strong { color: #ffd27a; font-size: 13px; letter-spacing: .08em; }
.unit-attachments { position: absolute; top: 52px; left: 0; z-index: 1; width: 126px; height: 174px; pointer-events: none; }
.unit-artwork .unit-attachments img { position: absolute; top: 0; display: block; width: 126px; height: 174px; object-fit: contain; }
.unit-artwork > .cube-icons { position: absolute; top: 3px; bottom: 3px; flex-wrap: nowrap; flex-direction: column; overflow-y: auto; padding: 2px; border-radius: 3px; background: #050607b8; }
.unit-artwork > .black-cubes { left: 2px; }
.unit-artwork > .blue-cubes { right: 2px; }
.unit-artwork > .cube-icons { bottom: 55px; z-index: 3; }
.unit-artwork > .cube-icons img { width: 13px; height: 13px; }
.global-pile-counts { display: grid; grid-template-columns: repeat(3, auto); align-content: center; gap: 4px 7px; margin: 0; }
.global-pile-counts div { display: grid; justify-items: center; gap: 1px; }
.global-pile-counts dt { color: #aeb8be; font-size: 8px; text-transform: uppercase; }
.global-pile-counts dd { margin: 0; color: #fff; font-size: 12px; }
.global-concede { border: 1px solid #ffffff36; background: transparent; color: #cbd3d5; padding: 3px 7px; cursor: pointer; font: 600 10px Manrope, sans-serif; }
.hero { background-image: linear-gradient(90deg, #050607e8 0%, #050607a6 52%, #05060752 100%), url('/rulebook-art/factions-hero.png'); background-position: center; background-size: cover; }
.lobby { min-height: calc(100vh - 72px); background-image: linear-gradient(90deg, #050607e8 0%, #050607a6 55%, #05060780 100%), url('/rulebook-art/setup-illustration.png'); background-position: center; background-size: cover; }
.hero-art, .lobby-art { position: relative; isolation: isolate; overflow: hidden; }
.hero-artwork, .lobby-artwork { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; object-fit: cover; opacity: .38; filter: grayscale(.25) brightness(.55); }
.hero-art::after, .lobby-art::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, #050607e8 0%, #050607a6 52%, #05060752 100%); }
.hero-content, .lobby-content { position: relative; }
.feature-grid { box-shadow: 0 20px 55px #0009; }
.feature-grid article, .setup-card, .auth-card, .player { background: #12171c; color: var(--ink); border-color: #2f3a43; }
.player { border-top: 5px solid #53606b; }
.player.active-player { border-top-color: #fff; }
.feature-grid article p, .section-heading p, .player header p, .pile-count, .unit-info span, .unit-info small { color: #aeb8be; }
.lobby, .lobby-art { min-height: calc(100vh - 72px); padding: 70px clamp(24px, 9vw, 150px); }
.lobby-content { max-width: 1120px; }
.setup-card input, .setup-card select { background: #080b0e; color: var(--ink); border-color: #3a4650; }
.controls, .hand-panel { background: #0b1014; }
.opening-building-choices { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; }
.opening-building-choice, .refill-building-choice { display: grid; grid-template-columns: 92px minmax(0, 1fr); align-items: center; gap: 10px; min-width: 240px; padding: 8px; border: 2px solid #5f7771; background: #161d23; color: var(--ink); cursor: pointer; text-align: left; }
.opening-building-choice:hover, .opening-building-choice:focus-visible, .refill-building-choice:hover, .refill-building-choice:focus-visible { border-color: var(--gold); background: #202a32; outline: none; }
.opening-building-choice > .building-artwork, .refill-building-choice > .building-artwork { width: 92px; }
.opening-building-choice .building-artwork > img, .refill-building-choice .building-artwork > img { width: 92px; height: 128px; object-fit: contain; }
.opening-building-choice > .building-details, .refill-building-choice > .building-details { display: grid; gap: 4px; }
.opening-building-choice b, .refill-building-choice b { font: 700 14px Fraunces, serif; }
.opening-building-choice small, .refill-building-choice small { color: var(--gold); font: 500 11px 'DM Mono', monospace; }
.opening-building-choice .spent-cubes-outside .cube-icons img, .refill-building-choice .spent-cubes-outside .cube-icons img { width: 10px; height: 10px; }
.worker-resource-choices { margin: 14px 0; padding: 12px; border: 1px solid #5f7771; background: #161d23; }
.worker-resource-choices p { margin: 0 0 10px; }
.worker-building-choices { display: flex; flex-wrap: wrap; gap: 10px; }
.worker-building-choice { display: grid; grid-template-columns: 58px minmax(0, 1fr); align-items: center; gap: 8px; min-width: 210px; padding: 6px; border: 2px solid #5f7771; background: #202a32; color: var(--ink); cursor: pointer; text-align: left; }
.worker-building-choice:hover:not(:disabled), .worker-building-choice:focus-visible { border-color: var(--gold); outline: none; }
.worker-building-choice:disabled { cursor: not-allowed; opacity: .45; }
.worker-building-choice img { width: 58px; height: 80px; object-fit: contain; }
.worker-building-choice span { display: grid; gap: 3px; }
.worker-building-choice b { font: 700 12px Fraunces, serif; }
.worker-building-choice small, .borrowed-resources { color: var(--gold) !important; font: 500 11px 'DM Mono', monospace; }
.selection-limit { display: block; margin-top: 10px; }
.unit-actions { display: grid; gap: 3px; align-self: stretch; }
.unit-actions button { height: 24px; min-height: 24px; padding: 2px 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 18px; }
.card.pending { width: 249px; flex-basis: 249px; }
.card.pending img { height: 310px; }
.main-hand .card { width: 249px; flex-basis: 249px; }
.main-hand .card img { height: 310px; }
.unit { display: grid; grid-template-columns: 126px minmax(0, 1fr); align-items: stretch; }
.unit img { grid-row: 1 / span 2; }
.unit-info { grid-column: 2; }
.unit-info .unit-counters { color: var(--ink); font-size: 120%; font-weight: 700; }
.unit-info .unit-capacities { font-size: 100%; }
.unit-actions { grid-column: 2; align-self: end; margin-left: 0; width: 100%; }
.unit-actions button, .attachment-targets button { width: 100%; height: 19px; min-height: 19px; padding: 1px 5px; font-size: 12px; line-height: 15px; }
.attachment-targets { display: grid; gap: 4px; }
.attachment-targets fieldset { display: flex; gap: 7px; margin: 0; padding: 0; border: 0; }
.attachment-targets legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.attachment-targets label { font-size: 10px; white-space: nowrap; }
.attachment-targets select { width: 100%; min-width: 0; color: #111; font-size: 10px; }
.attachment-targets select option { color: #111; }

.lane { background: #202a32; }
.unit, .building, .card, .log { background: #161d23; color: var(--ink); border-color: #36424c; }
.building span, .card small, .log p { color: #aeb8be; }
.buildings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); flex-wrap: unset; }
.buildings h3 { grid-column: 1 / -1; width: auto; }
.building { display: flex; align-items: center; gap: 8px; min-width: 0; width: 100%; }
.building .building-details { display: grid; flex: 1; gap: 3px; min-width: 0; }
.hero h1 { letter-spacing: normal; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.rules-button { background: #9b6b3d; }
.rules-button:hover { background: #b47b45; }
.hand-heading { display: flex; justify-content: space-between; align-items: start; gap: 20px; }
.phase-guide { max-width: 560px; margin: 0; padding: 10px 12px; border-left: 2px solid var(--gold); background: #161d23; color: #cdd4d3; font-size: 11px; line-height: 1.45; }
.phase-guide b { color: var(--gold); }
@media (max-width: 850px) { .lobby-art { padding: 36px 18px; } .hand-heading { display: block; } .phase-guide { margin-top: 12px; } .topbar { min-height: 128px; } .active-turn-banner { gap: 6px; font-size: 10px; } .game-status-line { gap: 8px; } .active-turn-banner b { font-size: 13px; } .game-stats-table { font-size: 9px; } .game-stats-table th, .game-stats-table td { padding: 2px 4px; } .global-status-tables, .global-player-summaries { gap: 4px; } .global-player-summary { min-width: 130px; padding: 3px; gap: 3px; font-size: 8px; } .global-building-minis { gap: 2px; } .global-building-mini img { width: 35px; height: 50px; } .global-building-mini { font-size: 7px; } .global-pile-counts { gap: 2px 4px; } .global-pile-counts dt { font-size: 6px; } .global-pile-counts dd { font-size: 9px; } .card.pending, .main-hand .card { width: 192px; flex-basis: 192px; } .card.pending img, .main-hand .card img { height: 240px; } }
.player-storage { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, .7fr); gap: 10px; margin-top: 18px; }
.player-storage > section { min-width: 0; padding: 10px; border: 1px solid #36424c; background: #0d1216; }
.player-storage .buildings { display: grid; grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); align-content: start; gap: 8px; margin-top: 0; }
.player-storage .buildings h3 { grid-column: 1 / -1; width: auto; }
.player-storage .building { display: grid; justify-items: center; align-content: start; gap: 6px; min-width: 0; width: 100%; padding: 8px; }
.player-storage .building > .building-cube-display { justify-content: center; width: auto; }
.player-storage .building .building-artwork { width: 100px; }
.player-storage .building .building-details { display: grid; justify-items: center; width: 100%; text-align: center; }
.player-piles h3 { margin: 0 0 7px; font: 600 11px 'DM Mono', monospace; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.player-pile-list { display: flex; justify-content: space-evenly; align-items: flex-start; gap: 8px; }
.player-pile { display: grid; justify-items: center; gap: 5px; min-width: 0; margin: 0; color: var(--ink); font: 600 10px 'DM Mono', monospace; text-align: center; }
.player-pile-card { position: relative; width: clamp(56px, 7vw, 96px); aspect-ratio: 822 / 1122; }
.player-pile-card img { display: block; width: 100%; height: 100%; object-fit: contain; }
.player-pile-card span { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font: 800 clamp(20px, 2.2vw, 30px)/1 'DM Mono', monospace; text-shadow: -1px -1px 0 #ffffffa8, 1px 1px 0 #414141, 2px 3px 3px #000, 0 0 5px #000; }
.player-pile figcaption { color: var(--muted); text-transform: uppercase; }
.player-hand-box { min-width: 0; margin-top: 10px; padding: 10px; border: 1px solid #36424c; background: #0d1216; }
.player-hand-box h3 { margin: 0 0 7px; color: var(--muted); font: 600 11px 'DM Mono', monospace; text-transform: uppercase; letter-spacing: .08em; }
.player-hand-box h3 span { color: var(--ink); }
.player-hand-cards { display: flex; align-items: flex-start; gap: 8px; min-height: 28px; overflow-x: auto; padding-bottom: 4px; }
.player-hand-card { display: grid; flex: 0 0 82px; gap: 4px; margin: 0; color: var(--ink); font: 500 9px 'DM Mono', monospace; text-align: center; }
.player-hand-card img, .player-hand-back img { display: block; width: 100%; aspect-ratio: 822 / 1122; object-fit: contain; }
.player-hand-card figcaption { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-hand-back { flex: 0 0 48px; }
.player-hand-box .empty { margin: 0; color: var(--muted); font-size: 11px; }
@media (max-width: 600px) {
  .player-storage { grid-template-columns: minmax(0, 1fr); }
  .player-storage .buildings { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .player-storage .building .building-artwork { width: min(100%, 100px); }
  .player-pile-card { width: 72px; }
  .player-hand-card { flex-basis: 72px; }
  .player-hand-back { flex-basis: 44px; }
}