.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto 0 auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #1b6ec2;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

code {
    color: #c02d76;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}
/* Run and Build */
:root {
    --bg: #f6f4ee;
    --panel: #ffffff;
    --text: #1f2328;
    --muted: #6b6f76;
    --border: #d8d4c8;
    --accent: #1b6ec2;
    --ocean: #0b3b6e;
    --danger: #b3261e;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #16181c;
        --panel: #202329;
        --text: #e6e6e6;
        --muted: #9aa0a6;
        --border: #3a3e46;
        --accent: #5aa2f0;
        --ocean: #0a2442;
        --danger: #ff8a80;
    }
}

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 15px;
}

h1, h2, h3 { margin: 0.6em 0 0.3em; }
h3 { font-size: 1rem; }

button {
    font: inherit;
    padding: 0.3em 0.7em;
    margin: 0.15em;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--panel);
    color: var(--text);
    cursor: pointer;
}
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
button.link { border: none; background: none; color: var(--accent); padding: 0; }

input { font: inherit; padding: 0.2em 0.4em; }

.muted { color: var(--muted); }
.error { color: var(--danger); }
.row { display: flex; flex-wrap: wrap; align-items: center; margin: 0.2em 0; }

.chip {
    display: inline-block;
    min-width: 4.2em;
    padding: 0.1em 0.5em;
    border-radius: 999px;
    color: #fff;
    font-weight: 600;
    text-align: center;
}
.badge { font-size: 0.8em; padding: 0.1em 0.5em; border-radius: 4px; margin-left: 0.5em; }
.badge.warn { background: #ffcf8a; color: #5a3a00; }

.setup { max-width: 760px; margin: 2em auto; padding: 0 16px; }
.setup-table td { padding: 0.4em 0.6em 0.4em 0; vertical-align: middle; }
.seat { margin-right: 0.8em; white-space: nowrap; }
.scenarios { border: 1px solid var(--border); border-radius: 6px; margin: 0.8em 0; }
.scenario { display: block; margin: 0.4em 0; }
.scenario .muted { display: block; margin-left: 1.6em; font-size: 0.9em; }

/* The page fills the window and does not scroll. Only the log scrolls inside its panel. */
.layout {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(0, 2.4fr) minmax(320px, 1.4fr);
    grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas:
        "side status status"
        "side map actions"
        "side map item-panel";
    gap: 10px;
    padding: 10px;
    height: 100vh;
    box-sizing: border-box;
    overflow: hidden;
}
@media (max-width: 900px) {
    .layout {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto 60vh auto auto auto;
        grid-template-areas: "status" "map" "item-panel" "actions" "side";
        height: auto;
        overflow: visible;
    }
}

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 12px;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    box-sizing: border-box;
}
.card h3:first-child, .panel-head h3 { margin-top: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5em; }
.panel-head h3 { margin-bottom: 0.2em; }
.hint { margin: 0.4em 0; font-size: 0.85em; }

.status-bar { grid-area: status; display: flex; gap: 10px; align-items: stretch; overflow-x: auto; }
.round { display: flex; flex-direction: column; justify-content: center; gap: 0.2em; white-space: nowrap; }
.round .badge { margin-left: 0; }
.player-card {
    border: 1px solid var(--border);
    border-left: 5px solid;
    border-radius: 6px;
    padding: 4px 8px;
    display: grid;
    gap: 3px;
    min-width: 150px;
}
.player-card.current { background: rgba(127, 127, 127, 0.15); box-shadow: 0 0 0 2px var(--accent); }
.goals { border-left-color: var(--border); font-size: 0.8em; white-space: nowrap; align-content: center; grid-template-rows: repeat(4, auto); grid-auto-flow: column; column-gap: 12px; gap: 1px 12px; }
.chip.small { font-size: 0.8em; padding: 0 0.4em; }
.player-head { display: flex; gap: 0.6em; align-items: center; white-space: nowrap; }
.carried { letter-spacing: 1px; min-height: 1.2em; }

.side { grid-area: side; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.events { flex: 1.2 1 0; overflow-y: auto; }
.message { margin: 0.2em 0; font-weight: 600; font-size: 0.9em; }
.tile-info { display: flex; flex-wrap: wrap; gap: 0 0.8em; font-size: 0.9em; }
.disaster { font-size: 0.9em; }
.disaster ul { margin: 0 0 0.3em; padding-left: 1.2em; }
.shore-line { stroke-width: 3.5; stroke-linecap: round; }
.canoe-icon { font-size: 9px; text-anchor: middle; }
.chicken-mark { stroke: #fff; stroke-width: 0.8; pointer-events: none; }
.chicken-icon { font-size: 6px; text-anchor: middle; pointer-events: none; }
.disaster h4 { margin: 0.5em 0 0.1em; font-size: 1em; }
.toggle button { font-size: 0.8em; padding: 0.15em 0.6em; margin: 0; }
.toggle button:first-child { border-radius: 6px 0 0 6px; }
.toggle button:last-child { border-radius: 0 6px 6px 0; border-left: none; }
.toggle button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.turn-log { flex: 1 1 0; display: flex; flex-direction: column; }
.turn-actions { margin: 0 0 0.4em; padding-left: 1.6em; font-size: 0.9em; }
.turn-actions .undone { color: var(--muted); text-decoration: line-through; }
.turn-log .log { flex: 1 1 0; max-height: none; min-height: 0; }

.map-area { grid-area: map; padding: 0; }
.map { position: relative; width: 100%; height: 100%; touch-action: none; user-select: none; }
.board {
    width: 100%;
    height: 100%;
    background: var(--ocean);
    display: block;
}
.zoom { position: absolute; right: 8px; top: 8px; display: flex; flex-direction: column; }
.zoom button { width: 2em; padding: 0.2em 0; margin: 2px 0; opacity: 0.9; }

.actions { grid-area: actions; padding: 6px 10px; }
.actions .row { margin: 0; }
.actions button { font-size: 0.8em; padding: 0.2em 0.45em; margin: 0.1em; }
.actions .end-turn button { font-size: 0.95em; padding: 0.3em 1.2em; }
.actions .end-turn .hint { margin: 0 0 0 0.6em; }

.item-panel { grid-area: item-panel; display: flex; flex-direction: column; overflow-y: auto; }

.hex { cursor: default; }
.hex.can-move { cursor: pointer; }
.tile { stroke: #333; stroke-width: 1.2; }
.highlight { fill: transparent; stroke: none; pointer-events: all; }
.highlight.here { stroke: #ffeb3b; stroke-width: 3.5; }
.hex.can-move:hover .highlight { fill: rgba(255, 255, 255, 0.25); }
.fire { fill: rgba(255, 80, 0, 0.35); stroke: #ff5a00; stroke-width: 2.5; pointer-events: none; }
.terrain-icon { font-size: 11px; text-anchor: middle; pointer-events: none; }
.coord { font-size: 8px; fill: #333; text-anchor: middle; pointer-events: none; opacity: 0.7; }
.tree-count { font-size: 7.5px; text-anchor: middle; pointer-events: none; }
.tile-items { font-size: 8.5px; text-anchor: middle; pointer-events: none; }
.hut-hp { font-size: 8px; font-weight: 700; fill: #fff; text-anchor: middle; pointer-events: none; }
.fire-icon, .pirate-icon { font-size: 14px; text-anchor: middle; pointer-events: none; }
.token { stroke: #fff; stroke-width: 1.5; pointer-events: none; }
.token.current { stroke: #ffeb3b; stroke-width: 2.5; }

.hunger .step {
    display: inline-block;
    width: 1.3em;
    font-size: 0.8em;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 4px;
    margin-right: 2px;
}
.hunger .step.on { background: var(--accent); color: #fff; border-color: var(--accent); }


.zones { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin: 0.4em 0; }
.zone {
    border: 1px dashed var(--border);
    border-radius: 8px;
    padding: 6px 8px;
    min-width: 0;
}
.zone-head { display: flex; gap: 0.5em; align-items: baseline; margin-bottom: 4px; }
.zone.source { border-style: solid; border-color: var(--accent); }
.zone.can-drop { border-style: solid; border-color: #26b050; background: rgba(38, 176, 80, 0.1); cursor: copy; }
.zone.no-drop { opacity: 0.6; cursor: not-allowed; }
.zone.urgent { border: 2px solid #e08a00; background: rgba(255, 170, 0, 0.12); }
.item.locked { cursor: not-allowed; opacity: 0.45; }
.placing-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6em;
    padding: 4px 8px;
    border-radius: 8px;
    background: rgba(255, 170, 0, 0.15);
    font-size: 0.9em;
}
.zone-reason { font-size: 0.8em; color: var(--danger); margin-top: 2px; }
.slots { display: flex; flex-wrap: wrap; gap: 4px; min-height: 2.2em; align-items: center; }
.slots.grid { display: grid; grid-template-columns: repeat(3, max-content); }
.item {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.7em;
    height: 1.7em;
    font-size: 1.7em;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    cursor: grab;
    user-select: none;
}
.item:hover { border-color: var(--accent); }
.item.held { outline: 2px solid var(--accent); }
.item.empty { border-style: dashed; background: none; cursor: default; }
.item sub { position: absolute; right: 2px; bottom: 0; font-size: 0.6em; font-weight: 700; }
.empty-text { font-size: 0.85em; }
.standings li { margin: 0.4em 0; }

.log { font-size: 0.85em; max-height: 240px; overflow-y: auto; padding-left: 2.2em; margin: 0; }
.log li { margin: 0.1em 0; }

h1:focus { outline: none; }

.notice { position: fixed; z-index: 10; top: 10px; left: 50%; transform: translateX(-50%); margin: 0; padding: 0.5em 0.8em; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); }

/* The tornado path on the map. */
.layer-paths { pointer-events: none; }
.tornado-path { stroke: #7b5ea7; stroke-width: 4; stroke-dasharray: 7 4; stroke-linecap: round; opacity: 0.85; }
.tornado-arrow { fill: #7b5ea7; }
.tornado-icon { font-size: 18px; text-anchor: middle; dominant-baseline: middle; }
.slide-path { stroke: #8b5a2b; stroke-width: 5; stroke-linecap: round; opacity: 0.9; }
.slide-arrow { fill: #8b5a2b; }
