:root {
    --cell-width: 4.75%;
    --clr-g-bkg: #003300;
    --clr-g-text: white;
    --clr-g-link: #cccc00;
    --clr-hex-border: #000000;
    --clr-p-a: #ffcc00;
    --clr-p-b: #0055d4;
    --clr-p-c: #444444;
    --clr-p-d: #cccccc;
    --clr-p-e: #aa00aa;

    --fx-hex-transparency: 20%;
    --fx-loc-transparency: 35%;
}

html{
    background-image: url("/assets/green-felt-3e609176.jpg");
    background-size: cover;
    background-color: var(--clr-g-bkg);
    color: var(--clr-g-text);
}

body.game-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

#game-area {
    display: grid;
    grid-template-areas:
        "main players-area game-log";
    grid-template-columns: 6fr 2fr 2fr;
    grid-template-rows: 1fr;
    flex: 1;
    min-height: 0;
}

main {
    grid-area: main;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#board-viewport {
    flex: 1;
    overflow: hidden;
    position: relative;
    cursor: grab;
    container-type: inline-size;
}

#board-viewport.grabbing {
    cursor: grabbing;
}

section#log-chat {
    grid-area: game-log;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#log-chat #log {
    flex: var(--log-flex, 1);
    overflow-y: auto;
    min-height: 0;
}

#log-chat .divider {
    flex: 0 0 auto;
    height: 6px;
    cursor: row-resize;
    background-color: oklch(from var(--clr-g-text) l c h / 15%);
}

#log-chat #chat {
    flex: var(--chat-flex, 1);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#log-chat #chat.minimized {
    flex: 0 0 auto;
}

#log-chat #chat.minimized #chat-messages,
#log-chat #chat.minimized .chat-composer {
    display: none;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 0 0 auto;
}

.chat-minimize-btn {
    position: relative;
}

.chat-badge {
    background-color: #e63946;
    border-radius: 1em;
    padding: 0 0.4em;
    font-size: 0.75em;
}

.chat-badge.hidden {
    display: none;
}

#chat-messages {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.chat-composer {
    flex: 0 0 auto;
}

.chat-composer form {
    display: flex;
}

.chat-composer input[type="text"] {
    flex: 1;
    min-width: 0;
}

.chat-closed-note {
    opacity: 0.7;
    font-style: italic;
}

#log .move,
.chat-message {
    margin: 1px;
    padding: 1px;
    &.a { background-color: oklch(from var(--clr-p-a) l c h / 30%); }
    &.b { background-color: oklch(from var(--clr-p-b) l c h / 30%); }
    &.c { background-color: oklch(from var(--clr-p-c) l c h / 30%); }
    &.d { background-color: oklch(from var(--clr-p-d) l c h / 30%); }
    &.e { background-color: oklch(from var(--clr-p-e) l c h / 30%); }
    &.system { background-color: oklch(from gray l c h / 30%); opacity: 0.7; font-style: italic; }
}

.chat-message .handle {
    font-weight: bold;
    margin-right: 0.3em;
}

.game-section {
    background-color: var(--clr-g-bkg);
    border: 0;
    margin: 2px;
    padding: 1px 2px;
    border-radius: 8px;
}

.mandatory-count {
    display: none;
}

#goals ul,#tasks ul {
    padding: inherit;
    margin: inherit;
}

#board {
    display: grid;
    grid-template-columns: 28fr 28fr 1fr;
    margin-left: 5px;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    transform-origin: 0 0;
    /* ponytail: no `will-change: transform` — it pins Chrome to a base-scale
       cached raster texture, so zooming in upscales that bitmap and pixellates
       every SVG (terrain icons, settlements). Repaint-on-zoom keeps them crisp.
       If pan ever janks on huge boards, toggle will-change only during drag. */
}

.quadrant {
    display: grid;
    grid-template-columns: repeat(21, 1fr);
    grid-template-rows: repeat(10, 3.927cqw);
    position: relative;
}

.quadrant.right {
    margin-left: -20px;
    margin-right: 20px;
}

.quadrant.bottom {
    margin-top: 5px;
}

.hex, .marker {
    grid-column: span 2;
    position: relative;
    align-self: start;
}

.hex {
    height: 5.236cqw;
    overflow: visible;
}

.hex-bg {
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    position: absolute;
    inset: 0;
    background-color: var(--hex-bg, transparent);
    pointer-events: none;
}

.hex > .hex-outline {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    pointer-events: none;
}

.hex > .hex-outline polygon {
    fill: none;
    stroke: oklch(from var(--hex-bg, transparent) calc(l * 0.55) c h);
    stroke-width: 8px;
}

svg {
    width: 100%;
    height: 102%;
}

ul li .hex:hover .hex-bg {
    background-color: #fd005f;
}

#board .selectable {
    cursor: pointer;
    width: 95%;
    margin: auto;
}

#board .selectable .hex-outline polygon {
    stroke: black;
    stroke-width: 4px;
    animation: selectable-pulse 2s linear infinite;
}

@keyframes selectable-pulse {
    0%, 100%  { stroke-opacity: 0.2; }
    50%       { stroke-opacity: 1; }
}

#board .selectable:hover .hex-bg {
    filter: drop-shadow(0 0 2px white);
}

#board .selected {
    transform: scale(1.25);
    z-index: 10;
    transition: transform 0.1s ease-out;
    filter: drop-shadow(0 0 3px #f0c040) drop-shadow(0 0 8px rgba(240, 192, 64, 0.8));
}

.hex.warrior-blocked {
    filter: drop-shadow(0 0 3px red) drop-shadow(0 0 8px rgba(255, 0, 0, 0.8));
}

@property --angle {
    syntax: "<angle>";
    inherits: false;
    initial-value: 0deg;
}

.selectable::after {
    --angle: 0deg;
    content: "";
    position: absolute;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    box-sizing: content-box;
    height: 100%;
    width: 100%;
    background-image: conic-gradient(from var(--angle), black, white, black, white, black);
    top: 50%;
    left: 50%;
    translate: -50% -50%;
    z-index: -1;
    padding: 3px;
    animation: 3s spin linear infinite;
}

@keyframes spin {
    from {
        --angle: 0deg;
    }
    to {
        --angle: 360deg;
    }
}

.tile {
    background-repeat: no-repeat;
    background-size: 300% 400%;
}

.tile-container {
    height: 100%;
    width: 100%;
    position: relative;
    background-repeat: no-repeat;
}

.hex .tile-container {
    position: absolute;
}

.tile-container .tile {
    height: 100%;
    width: 100%;
    position: absolute;
}

.tile-container div:nth-child(1) {
    z-index: 1;
}

.tile-container div:nth-child(2) {
    z-index: 2;
}

.tile-container div:nth-child(3) {
    left: -3px;
    top: -3px;
    z-index: 3;
}

.tile.location-barn {
    background-position: 15% 15%;
}

.tile.location-farm {
    background-position: 50% 0;
}

.tile.location-harbor {
    background-position: 15% 15%;
}

.tile.location-oasis {
    background-position: 0 66.667%;
}

.tile.location-oracle {
    background-position: 15% 15%;
}

.tile.location-paddock {
    background-position: 100% 33.333%;
}

.tile.location-tavern {
    background-position: 100% 0;
}

.tile.location-tower {
    background-position: 15% 15%;
}

.tile-counter {
    position: absolute;
    top: -5%;
    left: 50%;
    transform: translateX(-50%);
    width: 35%;
    aspect-ratio: 1;
    background: #cc1100;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.7rem;
    font-weight: 900;
    line-height: 1;
    z-index: 4;
    text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

#end-game-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
}

#end-game-modal .score-table .score-value {
    text-align: right;
}

.tile-tooltip {
    animation: goal-tooltip-in 0.12s ease-out;
    background: #0d1f0d;
    border: 1px solid var(--clr-g-link);
    border-radius: 6px;
    bottom: calc(100% + 6px);
    box-shadow: 0 0 12px rgba(204, 204, 0, 0.25), 0 4px 16px rgba(0,0,0,0.7);
    color: var(--clr-g-text);
    display: none;
    left: 50%;
    padding: 6px 10px;
    pointer-events: none;
    position: absolute;
    transform: translateX(-50%);
    width: 260px;
    will-change: transform, opacity;
    z-index: 200;
}

.hex:hover .tile-tooltip,
.player-tile:hover .tile-tooltip {
    display: block;
}

.hex.left .tile-tooltip {
    left: 0;
    transform: none;
    animation: tile-tooltip-in-left 0.12s ease-out;
}

.hex.right .tile-tooltip {
    left: auto;
    right: 0;
    transform: none;
    animation: tile-tooltip-in-left 0.12s ease-out;
}

.hex.top-row .tile-tooltip {
    bottom: auto;
    top: calc(100% + 6px);
}

.player-tile .tile-tooltip {
    bottom: auto;
    top: calc(100% + 6px);
    width: 260px;
}

@keyframes tile-tooltip-in-left {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Terrains suitable for building */
/* canyon */
.hex.terrain-c {
    --hex-bg: color-mix(in srgb, #a52a2a, transparent var(--fx-hex-transparency));
}

/* desert */
.hex.terrain-d {
    --hex-bg: color-mix(in srgb, #ffd700, transparent var(--fx-hex-transparency));
}

/* flower field */
.hex.terrain-f {
    --hex-bg: color-mix(in srgb, darkorchid, transparent var(--fx-hex-transparency));
}

/* grassland */
.hex.terrain-g {
    --hex-bg: color-mix(in srgb, rgb(0,255,5), transparent var(--fx-hex-transparency));
}

/* timberland (forest) */
.hex.terrain-t {
    --hex-bg: color-mix(in srgb, forestgreen, transparent var(--fx-hex-transparency));
}

/* Terrains normally not suitable for building */
/* mountain */
.hex.terrain-m {
    --hex-bg: color-mix(in srgb, #444, transparent var(--fx-hex-transparency));
}

/* water */
.hex.terrain-w {
    --hex-bg: color-mix(in srgb, royalblue, transparent var(--fx-hex-transparency));
}

/* Terrain icons */
.hex .terrain-icon {
    position: absolute;
    inset: 0;
    background-repeat: no-repeat;
    background-size: 38%;
    background-position: center 85%;
    opacity: 0.65;
    pointer-events: none;
}
.hex.terrain-c .terrain-icon { background-image: url("/assets/terrain-icons/canyon-cb74adef.svg"); }
.hex.terrain-d .terrain-icon { background-image: url("/assets/terrain-icons/desert-2f29dfc9.svg"); }
.hex.terrain-f .terrain-icon { background-image: url("/assets/terrain-icons/flowers-35fdb311.svg"); }
.hex.terrain-g .terrain-icon { background-image: url("/assets/terrain-icons/grass-58a890ad.svg"); }
.hex.terrain-t .terrain-icon { background-image: url("/assets/terrain-icons/timberland-c2cded8c.svg"); }
.hex.terrain-m .terrain-icon { background-image: url("/assets/terrain-icons/mountain-1a862300.svg"); }
.hex.terrain-w .terrain-icon { background-image: url("/assets/terrain-icons/water-1f9c3bb5.svg"); }
.hex.terrain-b .terrain-icon { background-image: url("/assets/terrain-icons/marshland-d4a6fa4a.svg"); }
.hex.terrain-p .terrain-icon { background-image: url("/assets/terrain-icons/farmland-07c55e23.svg"); }

/* Special terrains */
.hex.terrain-l, .hex.terrain-s {
    width: 92%;
    height: 132%;
    margin: auto;
}

/* location (tiles, nomads) */
.hex.terrain-l {
    --hex-bg: color-mix(in srgb, goldenrod, transparent var(--fx-loc-transparency));
}

/* silver (castle, palace, etc) */
.hex.terrain-s {
    --hex-bg: color-mix(in srgb, silver, transparent var(--fx-loc-transparency));
}

.hex.terrain-s:before, .hex.terrain-l:before {
    content: "";
    position: absolute;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    box-sizing: content-box;
    height: 100%;
    width: 100%;
    background-image: conic-gradient(from var(--angle), black, white, black, white, black);
    top: 50%;
    left: 50%;
    translate: -50% -50%;
    padding: 3px;
    z-index: -1;
}

.hex .terrain-castlehex {
    position: absolute;
    inset: 0;
    background-image: url("/assets/silver/castle-5a03f4a7.svg");
    background-repeat: no-repeat;
    background-size: 80%;
    background-position: 5px 6px;
}

.hex .terrain-nomad {
    position: absolute;
    inset: 0;
    background-image: url("/assets/silver/nomad-050604bb.svg");
    background-size: 100%;
    background-position: 1px 3px;
}

.tile-container.barn {
    background-image: url("/assets/gold/barn-12f32ed5.svg");
    background-size: 80%;
    background-position: center 45%;
}

.tile-container.farm {
    background-image: url("/assets/gold/farm-43a1c958.svg");
    background-size: 70%;
    background-position: center;
}

.tile-container.harbor {
    background-image: url("/assets/gold/harbor-d8fe693f.svg");
    background-size: 88%;
    background-position: center 50%;
}

.tile-container.oasis {
    background-image: url("/assets/gold/oasis-9c1bd449.svg");
    background-size: 75%;
    background-position: center 50%;
}

.tile-container.oracle {
    background-image: url("/assets/gold/oracle-47226be7.svg");
    background-size: 70%;
    background-position: center 55%;
}

.tile-container.paddock {
    background-image: url("/assets/gold/paddock-12aa3b12.svg");
    background-size: 74%;
    background-position: center 48%;
}

.tile-container.tavern {
    background-image: url("/assets/gold/tavern-44f29f02.svg");
    background-size: 75%;
    background-position: center 50%;
}

.tile-container.tower {
    background-image: url("/assets/gold/tower-e5245793.svg");
    background-size: 80%;
    background-position: center 50%;
}

.tile-container.mandatory {
    background-image: url("/assets/permanent/mandatory-671b3366.svg");
    background-size: 80%;
    background-position: center 75%;
}

.tile-container.caravan {
    background-image: url("/assets/gold/caravan-efae6af4.svg");
    background-size: 80%;
    background-position: center 75%;
}

.tile-container.garden {
    background-image: url("/assets/gold/garden-98fbce4a.svg");
    background-size: 80%;
    background-position: center 75%;
}

.tile-container.quarry {
    background-image: url("/assets/gold/quarry-85e9e057.svg");
    background-size: 80%;
    background-position: center 75%;
}

.tile-container.village {
    background-image: url("/assets/gold/village-61129cf7.svg");
    background-size: 80%;
    background-position: center 75%;
}

.tile-container.barracks {
    background-image: url("/assets/gold/barracks-ca0d1224.svg");
    background-size: 70%;
    background-position: center 75%;
}

.tile-container.cityhall {
    background-image: url("/assets/gold/cityhall-9db5700d.svg");
    background-size: 70%;
    background-position: center 75%;
}

.tile-container.crossroads {
    background-image: url("/assets/gold/crossroads-475dfb44.svg");
    background-size: 70%;
    background-position: center 75%;
}

.tile-container.foresterslodge {
    background-image: url("/assets/gold/foresterslodge-975c3a83.svg");
    background-size: 70%;
    background-position: center 75%;
}

.tile-container.fort {
    background-image: url("/assets/gold/fort-9a1438ae.svg");
    background-size: 70%;
    background-position: center 75%;
}

.tile-container.lighthouse {
    background-image: url("/assets/gold/lighthouse-93098d76.svg");
    background-size: 70%;
    background-position: center 75%;
}

.tile-container.monastery {
    background-image: url("/assets/gold/monastery-98945127.svg");
    background-size: 70%;
    background-position: center 75%;
}

.tile-container.wagon {
    background-image: url("/assets/gold/wagon-e7641b30.svg");
    background-size: 70%;
    background-position: center 75%;
}


.tile-container.outpost,
.tile-container.resettlement,
.tile-container.sword,
.tile-container.treasure,
.tile-container.donationcanyon,
.tile-container.donationdesert,
.tile-container.donationflower,
.tile-container.donationgrass,
.tile-container.donationmountain,
.tile-container.donationtimber,
.tile-container.donationwater {
    background-size: 80%;
    background-position: center 75%;
}

.tile-container.outpost      { background-image: url("/assets/nomad/outpost-83f2c50d.svg"); }
.tile-container.resettlement { background-image: url("/assets/nomad/resettlement-16cd9bfa.svg"); }
.tile-container.sword        { background-image: url("/assets/nomad/sword-3d81425c.svg"); }
.tile-container.treasure     { background-image: url("/assets/nomad/treasure-1eac9776.svg"); }

.tile-container.donationcanyon   { background-image: url("/assets/nomad/donationcanyon-704f7b5d.svg"); }
.tile-container.donationdesert   { background-image: url("/assets/nomad/donationdesert-f90746fe.svg"); }
.tile-container.donationflower   { background-image: url("/assets/nomad/donationflower-b9d650d5.svg"); }
.tile-container.donationgrass    { background-image: url("/assets/nomad/donationgrass-adfbe89a.svg"); }
.tile-container.donationmountain { background-image: url("/assets/nomad/donationmountain-c62ee759.svg"); }
.tile-container.donationtimber   { background-image: url("/assets/nomad/donationtimber-3ec5662b.svg"); }
.tile-container.donationwater    { background-image: url("/assets/nomad/donationwater-adee8e02.svg"); }

.hex .tile-container.donationcanyon   { background-image: url("/assets/nomad/donationcanyon-704f7b5d.svg"); }
.hex .tile-container.donationdesert   { background-image: url("/assets/nomad/donationdesert-f90746fe.svg"); }
.hex .tile-container.donationflower   { background-image: url("/assets/nomad/donationflower-b9d650d5.svg"); }
.hex .tile-container.donationgrass    { background-image: url("/assets/nomad/donationgrass-adfbe89a.svg"); }
.hex .tile-container.donationmountain { background-image: url("/assets/nomad/donationmountain-c62ee759.svg"); }
.hex .tile-container.donationtimber   { background-image: url("/assets/nomad/donationtimber-3ec5662b.svg"); }
.hex .tile-container.donationwater    { background-image: url("/assets/nomad/donationwater-adee8e02.svg"); }
.hex .tile-container.outpost    { background-image: url("/assets/nomad/outpost-83f2c50d.svg"); }
.hex .tile-container.resettlement { background-image: url("/assets/nomad/resettlement-16cd9bfa.svg"); }

.hex-map-image {
    background-size: 300% 450%;
    content: "";
    display: block;
    height: 0;
    margin-top: 0;
}

.castle-hex {
    background-position: 0 0;
}

.tavern-hex {
    background-position: 0 25%;
}

.paddock-hex {
    background-position: 0 50%;
}

.oasis-hex {
    background-position: 50% 48%;
}

.farm-hex {
    background-position: 100% 0;
}

.map-cell-content.castle {
    background-position: 0 0;
}

.map-cell-content.tavern {
    background-position: 0 20%;
}

.map-cell-content.paddock {
    background-position: 0 40%;
}

.map-cell-content.oasis {
    background-position: 33.33% 40%;
}

.map-cell-content.farm {
    background-position: 66.67% 0;
}

.li {
    list-style: none;
}

.hex-settlement {
    position: absolute;
    top: 5%;
    left: 20%;
    width: 60%;
    height: 60%;
}

.city-hall-settlement {
    filter: drop-shadow(0 0 5px gold) drop-shadow(0 0 2px #b8860b);
}

.city-hall-bg {
    position: absolute;
    inset: 0;
    opacity: 0.18;
    pointer-events: none;
}

.hex.city-hall-preview::after {
    --angle: 0deg;
    content: "";
    position: absolute;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    box-sizing: content-box;
    height: 100%;
    width: 100%;
    background-image: conic-gradient(from var(--angle), #5a3a00, gold, #ffd700, gold, #5a3a00);
    top: 50%;
    left: 50%;
    translate: -50% -50%;
    z-index: -1;
    padding: 3px;
    animation: 3s spin linear infinite;
}

.hex-wall {
    background-image: url("/assets/wall-32589393.svg");
    background-repeat: no-repeat;
    background-size: 100%;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.hex-mystery {
    background-image: url("/assets/mystery-56c087b5.svg");
    background-repeat: no-repeat;
    background-size: 100%;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}


#scoring {
    background-color: black;
    position: relative;
}

#scoring ul {
    list-style-type: none;
    padding: 0;
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.goals-label {
    font-size: 0.7rem;
    text-transform: uppercase;
}

.goal-item {
    position: relative;
    cursor: default;
}

.goal-name {
    font-size: 0.85rem;
    font-weight: 700;
    transition: color 0.15s;
}

.goal-signifier {
    font-size: 0.75rem;
}

.goal-item:hover .goal-name {
    color: var(--clr-g-link);
}

.goal-tooltip {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    background: #0d1f0d;
    border: 1px solid var(--clr-g-link);
    box-shadow: 0 0 12px rgba(204, 204, 0, 0.25), 0 4px 16px rgba(0,0,0,0.7);
    border-radius: 6px;
    padding: 8px 12px;
    color: var(--clr-g-text);
    width: 200px;
    z-index: 100;
    pointer-events: none;
    animation: goal-tooltip-in 0.12s ease-out;
}

.goal-item:hover .goal-tooltip {
    display: block;
}

@keyframes goal-tooltip-in {
    from { opacity: 0; transform: translateX(-50%) translateY(-4px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

#turn-state-bar {
    background-color: black;
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    align-items: center;
    height: 2.5rem;
    position: relative;
    z-index: 2;
}

#dashboard-link-area {
    padding-left: 0;
    position: relative;
}

#sound-controls {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding-left: 1.25rem;
}

#audio-unlock-prompt {
    font-size: 0.75rem;
    color: #aaa;
    white-space: nowrap;
    border: 1px solid #555;
    border-radius: 3px;
    padding: 0.1em 0.35em;
    animation: sound-prompt-pulse 1.5s ease-in-out infinite;
}

@keyframes sound-prompt-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.35; }
}

#mute-btn {
    background: none;
    border: 1px solid #555;
    border-radius: 3px;
    color: inherit;
    cursor: pointer;
    font-size: 1em;
    line-height: 1;
    padding: 0.1em 0.3em;
}

#mute-btn.muted {
    background: rgba(220, 60, 60, 0.35);
    border-color: #cc4444;
    color: #ff9090;
}

#volume-slider {
    width: 5em;
}

#turn-state {
    text-align: center;
}

#end-turn-area {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 0.5rem;
    height: 100%;
}

#end-turn-area button, #end-turn-area [type="submit"] {
    font-size: 0.85rem;
    padding: 0.2rem 0.75rem;
}

#players-area {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    font-family: monospace;
    font-weight: 600;
    margin: 8px;
    height: calc(100vh - 2.5rem - 16px);
}


.player-area {
    background-color: #4a7a4a;
    color: #111;
    padding: 4px;
    flex: 1 0 auto;
    border-left: 3px solid transparent;
}

.player-area:has(.player-spinner) {
    background-color: #5a8f5a;
    border-left-color: var(--clr-g-link);
}

.player-info-zone {
    padding: 2px 2px 4px;
}

.player-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.player-header form {
    display: contents;
}

.player-stats {
    display: flex;
    align-items: center;
    gap: 8px;
}

.supply-display {
    display: flex;
    align-items: center;
    gap: 4px;
}

.supply-settlements {
    border: 2px solid #0008;
    border-radius: 8px;
    padding: 2px 6px;
}

.player-action-zone {
    border-top: 1px solid rgba(0, 0, 0, 0.2);
    padding-top: 4px;
    margin-top: 2px;
}

.undo-button-wrapper {
    display: inline-flex;
    position: relative;
}

.undo-button-wrapper .undo-form {
    display: contents;
}

.undo-btn {
    font-size: 1rem;
    padding: 3px 9px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 0, 0, 0.6);
    border-radius: 4px 0 0 4px;
    color: #ddd;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: background 0.15s, color 0.15s;
}

.undo-btn.undo-main {
    flex: 1;
}

.undo-btn:not([disabled]):hover {
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
}

.undo-btn[disabled] {
    opacity: 0.4;
    cursor: default;
}

.undo-dropdown-btn {
    font-size: 1rem;
    padding: 3px 6px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 0, 0, 0.6);
    border-left: 1px solid rgba(0, 0, 0, 0.8);
    border-radius: 0 4px 4px 0;
    color: #ddd;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: background 0.15s, color 0.15s;
    min-width: 24px;
    text-align: center;
}

.undo-dropdown-btn:not([disabled]):hover {
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
}

.undo-dropdown-btn[disabled] {
    opacity: 0.4;
    cursor: default;
}

.undo-dropdown-menu {
    position: absolute;
    top: calc(100% + 2px);
    right: 0;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.8);
    border-radius: 4px;
    min-width: 120px;
    z-index: 100;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
}

.undo-dropdown-menu form {
    display: contents;
}

.undo-max-btn {
    display: block;
    width: 100%;
    padding: 6px 12px;
    background: transparent;
    border: none;
    color: #ddd;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    text-align: left;
    font-size: 0.95rem;
    transition: background 0.15s, color 0.15s;
}

.undo-max-btn:not([disabled]):hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.undo-max-btn[disabled] {
    opacity: 0.4;
    cursor: default;
}

.player-tiles {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.player-tile-popup {
    position: relative;
    display: inline-block;
    color: var(--clr-g-text);
}

.player-tile {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    background-color: #1c1508;
    border: 3px solid transparent;
    position: relative;
    transition: opacity 0.2s, filter 0.2s, box-shadow 0.2s;
}

.player-tile.category-permanent {
    background-color: silver;
    border-color: black;
}

.player-tile.category-location {
    background-color: goldenrod;
    border-color: gold;
}

.player-tile.category-nomad {
    background-color: silver;
    border-color: silver;
}

.player-tile.tile-inactive.category-permanent {
    background-color: color-mix(in srgb, silver, #333 20%);
    border-color: color-mix(in srgb, black, #333 20%);
}

.player-tile.tile-inactive.category-location {
    background-color: color-mix(in srgb, goldenrod, #333 20%);
    border-color: color-mix(in srgb, gold, #333 20%);
}

.player-tile.tile-inactive.category-nomad {
    background-color: color-mix(in srgb, silver, #333 20%);
    border-color: color-mix(in srgb, silver, #333 20%);
}

.player-tile::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: conic-gradient(from var(--angle), #00000040, #ffffff40, #00000040, #ffffff40, #00000040);
    height: 100%;
    width: 100%;
}

.player-tiles form {
    display: contents;
}

.player-tiles button {
    all: unset;
    display: block;
}

.tile-activatable {
    cursor: pointer;
}

.tile-activatable .tile-container {
    opacity: 1;
}

.tile-activatable:hover {
    box-shadow: 0 0 8px 2px rgba(255, 255, 255, 0.5);
}

.tile-used,
.tile-inactive .tile-container{
    opacity: 0.5;
}

.tile-active {
    box-shadow: 0 0 0 2px #f0c040, 0 0 10px rgba(240, 192, 64, 0.7);
}

.player-spinner {
    /* background-image: url("/assets/tape-reel-0f078491.svg"); */
    animation: playspin 3s infinite linear;
    display: inline-block;
    width: 40px;
    transform-origin: 20px 20px;
}

@keyframes playspin {
    to {
        transform: rotate(-360deg);
    }
}

.handle {
    font-size: 1.5rem;
}

.rating-badge {
    font-size: 0.8rem;
}

.first-player-marker {
    margin-left: 0.3rem;
    vertical-align: middle;
}

.first-player-marker img {
    width: 40px;
}

.player-clock {
    margin-left: 0.5rem;
    padding: 1px 8px;
    border-radius: 4px;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.4);
    color: #ddd;
}

.player-clock.clock-low {
    color: #f0c040;
}

.player-clock.clock-flagged {
    color: #e05a5a;
}

.claim-victory-btn {
    font-size: 1rem;
    padding: 3px 9px;
    background: #a52a2a;
    border: 1px solid rgba(0, 0, 0, 0.6);
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
}

.speed-badge {
    font-size: 0.8rem;
    margin-left: 0.4rem;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.15);
}

.player-order {
    display: none;
}

.settlement-icon {
    display: inline-block;
    width: 36px;
    height: 38px;
}

.warrior-icon {
    display: inline-block;
    width: 36px;
    height: 38px;
}

.settlement-count {
    display: inline-block;
    font-size: 2rem;
    font-weight: 700;
    min-width: 2ch;
    line-height: 1;
}

.score-container {
    position: relative;
    display: inline-block;
    cursor: default;
}

.player-score {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.score-unit {
    font-size: 1.5rem;
    font-weight: 400;
    opacity: 0.7;
    letter-spacing: 0;
}

.score-breakdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    background: #0d1f0d;
    border: 1px solid var(--clr-g-link);
    box-shadow: 0 0 12px rgba(204, 204, 0, 0.25), 0 4px 16px rgba(0,0,0,0.7);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.8rem;
    color: #ddd;
    min-width: 160px;
    z-index: 100;
    pointer-events: none;
    animation: score-breakdown-in 0.12s ease-out;
}

@keyframes score-breakdown-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.score-container:hover .score-breakdown {
    display: block;
}

.score-row {
    display: flex;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 2px 0;
}

.score-row-total {
    border-top: 1px solid #444;
    margin-top: 4px;
    padding-top: 4px;
    color: var(--clr-g-link);
    font-weight: 600;
}

.score-goal-value {
    text-align: right;
}

.player-card {
    background-size: 100%;
    width: 52px;
    height: 52px;
    color: transparent;
    display: inline-block;
    flex-shrink: 0;
    border-radius: 6px;
    /* border: 2px solid rgba(0, 0, 0, 0.35); */
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255,255,255,0.08);
}

.player-card.card-Z {
    background-image: url("/assets/silver/castle-5a03f4a7.svg");
}

.player-card.card-G {
    background-image: url("/assets/cards/grass-card-57153908.svg");
    background-position: 20%;
}

.player-card.card-C {
    background-image: url("/assets/cards/canyon-card-f5126c29.svg");
}

.player-card.card-D {
    background-image: url("/assets/cards/desert-card-0a7e0cad.svg");
}

.player-card.card-F {
    background-image: url("/assets/cards/flowers-card-69e9c908.svg");
}

.player-card.card-T {
    background-image: url("/assets/cards/timberland-card-e71299bd.svg");
}

.player-card.card-shunned {
    opacity: 0.35;
    filter: grayscale(60%);
    position: relative;
}

.fort-drawn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    margin-left: 6px;
}

.fort-drawn-label {
    font-size: 9px;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: gold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.fort-drawn .player-card {
    transform-origin: center;
    /* deal-in flip, then a settling golden pulse */
    animation:
        fort-card-deal 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.25) both,
        fort-card-glow 1.8s ease-in-out 0.55s infinite;
}

@keyframes fort-card-deal {
    0%   { opacity: 0; transform: perspective(500px) translateY(-34px) rotateY(90deg) scale(0.75); }
    55%  { opacity: 1; transform: perspective(500px) translateY(4px) rotateY(-12deg) scale(1.08); }
    100% { opacity: 1; transform: perspective(500px) translateY(0) rotateY(0) scale(1); }
}

@keyframes fort-card-glow {
    0%, 100% { box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5), 0 0 4px 1px rgba(255, 215, 0, 0.45); }
    50%      { box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5), 0 0 11px 3px rgba(255, 215, 0, 0.9); }
}

.meeple-popup {
    position: absolute;
    z-index: 100;
    background: #222;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
}

.meeple-popup.hidden {
    display: none;
}

.popup-btn {
    background: #444;
    color: #eee;
    border: none;
    border-radius: 3px;
    padding: 3px 8px;
    cursor: pointer;
    font-size: 1rem;
    width: 100%;
}

.popup-btn:hover {
    background: #666;
}

.popup-btn-cancel {
    background: #333;
    color: #aaa;
}

.popup-warning {
    color: #f90;
    font-size: 1rem;
    padding: 2px 4px;
    display: block;
    text-align: center;
}

/* Hamburger menu */

.hamburger-btn {
    background: none;
    border: 1px solid #555;
    border-radius: 3px;
    color: inherit;
    cursor: pointer;
    font-size: 1.1em;
    line-height: 1;
    padding: 0.15em 0.5em;
    margin-left: 0.75rem;
}

.hamburger-btn:hover { border-color: #888; }

.hamburger-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: #111;
    border: 1px solid #444;
    list-style: none;
    margin: 0;
    padding: 0;
    min-width: 200px;
    z-index: 100;
}

.hamburger-menu.hidden { display: none; }

.hamburger-menu li { border-bottom: 1px solid #333; }
.hamburger-menu li:last-child { border-bottom: none; }

.hamburger-menu a,
.hamburger-menu button {
    display: block;
    width: 100%;
    padding: 0.6em 1em;
    color: var(--clr-ds-text);
    text-decoration: none;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 0.9em;
    box-sizing: border-box;
}

.hamburger-menu a:hover,
.hamburger-menu button:hover {
    background: #222;
    color: var(--clr-ds-text);
}
