body {
    margin: 0;
}

.game-shell {
    height: 100svh;
    background: #1f252b;
    color: #f3efe4;
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: 8px;
    box-sizing: border-box;
    font-family: "Segoe UI", system-ui, sans-serif;
    overflow: hidden;
}

.board-panel {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto auto;
    gap: 6px;
    align-content: center;
}

.board-panel-analysis {
    grid-template-columns: minmax(0, 1fr) 300px;
    grid-template-rows: auto auto minmax(0, 1fr);
    align-content: stretch;
}

.board-panel-analysis .board-toolbar,
.board-panel-analysis .opponents-row {
    grid-column: 1 / -1;
}

.board-panel-analysis .board-wrap {
    grid-column: 1;
    grid-row: 3;
}

.board-toolbar {
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.board-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.board-action.new-game-action {
    min-height: 44px;
    padding: 4px 12px;
}

.board-toolbar h1 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 650;
}

.board-action {
    min-width: 96px;
    min-height: 32px;
    border: 1px solid #a88955;
    border-radius: 6px;
    background: #efe0b8;
    color: #27303a;
    font: inherit;
    font-weight: 650;
    cursor: pointer;
}

.board-action:active {
    transform: translateY(1px);
}

.board-action:disabled {
    cursor: default;
    opacity: 0.62;
}

.board-action-selected {
    border-color: #f4d06f;
    background: #f5c85c;
}

.turn-decision-panel {
    max-height: 118px;
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 4px;
    padding: 8px 10px;
    border: 1px solid #3c4650;
    border-radius: 6px;
    background: #202832;
    color: #d8cfbd;
    box-sizing: border-box;
    font-size: 0.78rem;
}

.turn-decision-panel strong {
    color: #f3efe4;
    font-size: 0.82rem;
}

.turn-decision-title {
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.turn-decision-lines {
    min-height: 0;
    overflow: auto;
    font-family: Consolas, "Courier New", monospace;
    line-height: 1.35;
    white-space: pre-wrap;
}

.turn-decision-action {
    justify-self: end;
    min-width: 150px;
    min-height: 28px;
    font-size: 0.78rem;
}

.turn-decision-panel-paused {
    position: absolute;
    z-index: 180;
    width: min(460px, calc(100% - 32px));
    min-width: 300px;
    min-height: 150px;
    max-height: min(60svh, 520px);
    resize: both;
    overflow: auto;
    box-shadow: 0 12px 28px rgb(0 0 0 / 0.52);
}

.turn-status {
    min-height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    border: 1px solid #3c4650;
    border-radius: 6px;
    background: #202832;
    color: #f3efe4;
    font-weight: 700;
}

.player-name {
    font-weight: 900;
}

.player-name-red {
    color: #ff6459;
}

.player-name-blue {
    color: #70a0ff;
}

.player-name-white {
    color: #fffdf0;
    text-shadow: 0 1px 2px #111;
}

.player-name-orange {
    color: #ffab4a;
}

.board-wrap {
    position: relative;
    z-index: 2;
    min-height: 0;
    width: 100%;
    height: 100%;
    min-width: 0;
    box-sizing: border-box;
    max-width: 100%;
    justify-self: center;
    display: grid;
    justify-items: center;
    align-items: start;
    overflow: visible;
    border: 1px solid #3c4650;
    border-radius: 6px;
    background: #28323c;
    padding: 4px;
}

.board-message {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 110;
    min-width: 210px;
    max-width: min(78vw, 420px);
    padding: 12px 18px;
    border: 1px solid #a88955;
    border-radius: 6px;
    background: rgb(32 40 50 / 0.92);
    color: #f3efe4;
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
    box-shadow: 0 8px 20px rgb(0 0 0 / 0.45);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.game-over-message {
    width: min(100%, 720px);
    justify-self: center;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border: 1px solid #d3ae66;
    border-radius: 6px;
    background: #28323c;
    color: #f3efe4;
    text-align: center;
    box-sizing: border-box;
}

.game-over-message strong {
    font-size: 1.05rem;
}

.game-over-message span {
    line-height: 1.4;
}

.validation-failure-message {
    width: min(100%, 900px);
    max-height: 220px;
    justify-self: center;
    display: grid;
    grid-template-columns: minmax(180px, auto) minmax(0, 1fr) auto;
    align-items: start;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid #d8836f;
    border-radius: 6px;
    background: #3a2929;
    color: #fff4f0;
    box-sizing: border-box;
}

.validation-failure-message div {
    display: grid;
    gap: 4px;
}

.validation-failure-message ul {
    min-width: 0;
    max-height: 190px;
    margin: 0;
    padding-left: 22px;
    overflow: auto;
}

.validation-failure-message code {
    color: #ffd2c8;
}

.game-over-message .result-actions,
.validation-failure-message .result-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

@media (max-width: 700px) {
    .game-over-message {
        grid-template-columns: 1fr auto;
    }

    .game-over-message strong,
    .game-over-message span {
        text-align: left;
    }

    .game-over-message span {
        grid-column: 1 / -1;
        grid-row: 2;
    }
}

.catan-board {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(var(--board-scale, 1));
    transform-origin: center;
    flex: 0 0 auto;
}

.game-shell.fast-game *,
.game-shell.fast-game *::before,
.game-shell.fast-game *::after {
    animation: none !important;
    transition: none !important;
}

.board-tile {
    position: absolute;
    width: 104px;
    height: 91px;
    object-fit: fill;
    transform-origin: 50% 50%;
    user-select: none;
    -webkit-user-drag: none;
}

.land-tile {
    filter: drop-shadow(0 2px 2px rgb(0 0 0 / 0.35));
}

.water-tile,
.harbor-tile {
    filter: drop-shadow(0 1px 2px rgb(0 0 0 / 0.25));
}

.number-token {
    position: absolute;
    display: grid;
    place-items: center;
    box-sizing: border-box;
    border: 2px solid #111;
    border-radius: 50%;
    background: #f2dd9b;
    color: #111;
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1;
    pointer-events: none;
    user-select: none;
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.3);
}

.number-token-hot {
    color: #b51f1f;
}

.starting-value-label {
    position: absolute;
    z-index: 85;
    width: 30px;
    height: 22px;
    display: grid;
    place-items: center;
    border: 2px solid #f2dd9b;
    border-radius: 999px;
    background: rgb(32 40 50 / 0.9);
    color: #f3efe4;
    font-size: 0.72rem;
    font-family: inherit;
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 2px 5px rgb(0 0 0 / 0.45);
    padding: 0;
    cursor: pointer;
    transform: translate(-50%, -50%);
}

.starting-value-label:hover,
.starting-value-label:focus-visible {
    outline: 2px solid #f3efe4;
}

.starting-value-top {
    border-color: #111;
    background: #f5c85c;
    color: #111;
}

.starting-value-selected {
    z-index: 86;
    outline: 2px solid #f3efe4;
}

.game-piece {
    position: absolute;
    transform-origin: 50% 50%;
    pointer-events: none;
    user-select: none;
    filter: drop-shadow(0 1px 1px rgb(0 0 0 / 0.45));
}

.piece-svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.piece-svg rect,
.piece-svg polygon {
    fill: var(--piece-color);
    stroke: #161616;
    stroke-width: 2;
    stroke-linejoin: round;
}

.robber-body,
.robber-head {
    fill: #080808;
    stroke: #2a2a2a;
    stroke-width: 1.5;
    stroke-linejoin: round;
}

.robber-piece {
    filter: drop-shadow(0 2px 2px rgb(0 0 0 / 0.55));
}

.placement-target {
    position: absolute;
    z-index: 70;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    touch-action: manipulation;
    transform-origin: 50% 50%;
}

.settlement-placement-target::before {
    content: "";
    position: absolute;
    inset: 3px;
    box-sizing: border-box;
    border: 3px solid rgb(255 232 140 / 0.92);
    border-right-color: rgb(255 232 140 / 0.25);
    border-bottom-color: rgb(255 232 140 / 0.45);
    border-radius: 50%;
    box-shadow: 0 0 8px rgb(0 0 0 / 0.55);
    animation: placement-target-spin 2.4s linear infinite;
}

.settlement-placement-target::after {
    content: "";
    position: absolute;
    inset: 11px;
    border-radius: 50%;
    background: rgb(255 246 193 / 0.75);
}

.settlement-placement-target:hover::before,
.settlement-placement-target:focus-visible::before {
    border-color: #fff6c1;
    border-right-color: rgb(255 246 193 / 0.35);
}

.road-placement-target::before {
    content: "";
    position: absolute;
    left: 2px;
    right: 2px;
    top: 50%;
    height: 9px;
    border: 2px solid rgb(255 232 140 / 0.9);
    border-left-color: rgb(255 232 140 / 0.35);
    border-radius: 999px;
    background: rgb(255 246 193 / 0.42);
    box-shadow: 0 0 8px rgb(0 0 0 / 0.55);
    transform: translateY(-50%);
    animation: road-target-pulse 1.7s ease-in-out infinite;
}

.road-placement-target:hover::before,
.road-placement-target:focus-visible::before {
    background: rgb(255 246 193 / 0.7);
    border-color: #fff6c1;
}

.robber-placement-target {
    border-radius: 50%;
}

.robber-placement-target::before {
    content: "";
    position: absolute;
    inset: 3px;
    box-sizing: border-box;
    border: 3px solid rgb(245 80 70 / 0.95);
    border-left-color: rgb(245 80 70 / 0.32);
    border-bottom-color: rgb(245 80 70 / 0.52);
    border-radius: 50%;
    box-shadow: 0 0 10px rgb(0 0 0 / 0.6);
    animation: placement-target-spin 2.1s linear infinite;
}

.setup-selection-pulse {
    position: absolute;
    z-index: 72;
    pointer-events: none;
    transform-origin: 50% 50%;
}

.setup-selection-building {
    box-sizing: border-box;
    border: 3px solid rgb(255 232 140 / 0.95);
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgb(20 20 20 / 0.34), 0 0 12px rgb(255 232 140 / 0.7);
    animation: setup-selection-pulse 1s ease-in-out infinite;
}

.setup-selection-road::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 12px;
    border: 3px solid rgb(255 232 140 / 0.95);
    border-radius: 999px;
    box-shadow: 0 0 0 2px rgb(20 20 20 / 0.34), 0 0 12px rgb(255 232 140 / 0.7);
    transform: translateY(-50%);
    animation: setup-selection-road-pulse 1s ease-in-out infinite;
}

.die-face {
    position: absolute;
    left: 0;
    top: 0;
    width: 34px;
    height: 34px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    padding: 5px;
    box-sizing: border-box;
    border: 2px solid #111;
    border-radius: 7px;
    background: #f7f7f2;
    box-shadow: 0 3px 6px rgb(0 0 0 / 0.4);
    z-index: 60;
    pointer-events: none;
    animation: dice-roll 1.08s cubic-bezier(0.18, 0.8, 0.26, 1) both;
}

.resource-animation {
    position: absolute;
    left: 0;
    top: 0;
    width: 64px;
    height: 64px;
    z-index: 80;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
    filter: drop-shadow(0 2px 3px rgb(0 0 0 / 0.45));
    animation: resource-collect 2.4s cubic-bezier(0.18, 0.78, 0.24, 1) both;
}

.die-pip {
    width: 6px;
    height: 6px;
    place-self: center;
    border-radius: 50%;
    background: #111;
}

.pip-top-left {
    grid-column: 1;
    grid-row: 1;
}

.pip-top-right {
    grid-column: 3;
    grid-row: 1;
}

.pip-middle-left {
    grid-column: 1;
    grid-row: 2;
}

.pip-center {
    grid-column: 2;
    grid-row: 2;
}

.pip-middle-right {
    grid-column: 3;
    grid-row: 2;
}

.pip-bottom-left {
    grid-column: 1;
    grid-row: 3;
}

.pip-bottom-right {
    grid-column: 3;
    grid-row: 3;
}

@keyframes dice-roll {
    0% {
        transform: translate(var(--start-x), var(--start-y)) rotate(0deg) scale(0.92);
    }

    100% {
        transform: translate(var(--end-x), var(--end-y)) rotate(var(--spin)) scale(1);
    }
}

@keyframes placement-target-spin {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes resource-collect {
    0% {
        opacity: 0;
        transform: translate(var(--start-x), var(--start-y)) scale(0.72);
    }

    10% {
        opacity: 1;
        transform: translate(var(--start-x), var(--start-y)) scale(1.18);
    }

    26% {
        opacity: 1;
        transform: translate(var(--start-x), var(--start-y)) scale(0.94);
    }

    42% {
        opacity: 1;
        transform: translate(var(--start-x), var(--start-y)) scale(1.12);
    }

    50% {
        opacity: 1;
        transform: translate(var(--start-x), var(--start-y)) scale(1);
    }

    100% {
        opacity: 0.15;
        transform: translate(var(--end-x), var(--end-y)) scale(0.58);
    }
}

@keyframes road-target-pulse {
    50% {
        opacity: 0.55;
        transform: translateY(-50%) scaleX(0.92);
    }
}

@keyframes setup-selection-pulse {
    50% {
        opacity: 0.55;
        transform: scale(1.18);
    }
}

@keyframes setup-selection-road-pulse {
    50% {
        opacity: 0.55;
        transform: translateY(-50%) scaleX(1.08);
    }
}

.player-red {
    --piece-color: #c83a32;
}

.player-blue {
    --piece-color: #2f63c7;
}

.player-white {
    --piece-color: #f2f0e6;
}

.player-orange {
    --piece-color: #d98224;
}

.opponents-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(136px, 1fr));
    gap: 8px;
}

.opponent-panel {
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 8px;
    border: 1px solid #3c4650;
    border-radius: 6px;
    background: #202832;
    box-sizing: border-box;
}

.opponent-name {
    font-size: 0.86rem;
    font-weight: 800;
    white-space: nowrap;
}

.player-summary {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.player-summary-hand {
    align-self: center;
    flex: 0 0 auto;
}

.score-label {
    color: #f2dd9b;
    font-size: 0.76rem;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.award-badges {
    display: flex;
    align-items: center;
    gap: 3px;
    min-height: 0;
}

.award-badges:empty {
    display: none;
}

.award-card-button {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
}

.award-card-button:hover {
    background: rgb(255 255 255 / 0.12);
}

.award-card-button:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.award-card-button img {
    width: 22px;
    height: 33px;
    border-radius: 3px;
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.45);
}

.opponent-decks {
    display: flex;
    align-items: center;
    gap: 6px;
}

.hidden-card-stack {
    position: relative;
    width: 34px;
    height: 46px;
    flex: 0 0 auto;
}

.hidden-card-stack::before,
.hidden-card-stack::after {
    content: "";
    position: absolute;
    width: 28px;
    height: 42px;
    border: 1px solid rgb(0 0 0 / 0.5);
    border-radius: 4px;
    background: #2a3340;
}

.hidden-card-stack::before {
    left: 5px;
    top: 3px;
}

.hidden-card-stack::after {
    left: 2px;
    top: 1px;
}

.hidden-card-stack img {
    position: absolute;
    left: 0;
    top: 0;
    width: 28px;
    height: 42px;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.42);
    z-index: 1;
}

.hidden-card-stack span {
    position: absolute;
    right: -5px;
    bottom: -4px;
    min-width: 18px;
    height: 18px;
    display: grid;
    place-items: center;
    border: 1px solid #111;
    border-radius: 50%;
    background: #f2dd9b;
    color: #111;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
    z-index: 2;
}

.hand-row {
    position: relative;
    z-index: 1;
    height: 112px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(420px, auto);
    gap: 6px;
}

.player-hand,
.development-panel {
    display: flex;
    align-items: flex-start;
    border: 1px solid #3c4650;
    border-radius: 6px;
    background: #202832;
    box-sizing: border-box;
}

.player-hand {
    justify-content: center;
    gap: 8px;
    padding: 4px 8px 8px;
    overflow-x: auto;
    overflow-y: hidden;
}

.hand-player-label {
    padding: 0 4px;
    font-size: 0.92rem;
}

.development-panel {
    gap: 6px;
    min-width: 420px;
    max-width: 560px;
    padding: 4px 8px 8px;
    overflow: visible;
}

.turn-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(62px, 1fr));
    gap: 4px;
    flex: 0 0 364px;
    align-content: start;
}

.turn-action {
    min-width: 0;
    min-height: 27px;
    padding: 2px 5px;
    font-size: 0.7rem;
    line-height: 1.05;
    white-space: normal;
    overflow-wrap: anywhere;
}

.piece-buy-action {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 22px 18px minmax(0, 1fr);
    grid-template-rows: 18px auto;
    grid-template-areas:
        ". piece count ."
        "label label label label";
    align-items: center;
    justify-content: center;
    gap: 1px 4px;
    text-align: center;
}

.piece-buy-action .game-piece {
    grid-area: piece;
    justify-self: center;
    filter: drop-shadow(0 1px 1px rgb(0 0 0 / 0.55));
}

.piece-buy-action > span {
    grid-area: label;
    min-width: 0;
    font-size: 0.66rem;
}

.piece-inventory-count {
    grid-area: count;
    min-width: 17px;
    height: 17px;
    display: grid;
    place-items: center;
    border: 1px solid #756b5a;
    border-radius: 50%;
    background: #efe0b8;
    color: #27303a;
    font-size: 0.66rem;
    line-height: 1;
}

.piece-inventory-empty {
    border-color: #9e4b45;
    background: #713c39;
    color: #fff1e8;
}

.cancel-placement-action {
    border-color: #b98a5c;
}

.development-hand {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 0;
    min-width: 0;
    flex: 1 1 auto;
    overflow-x: auto;
    overflow-y: hidden;
}

.development-card-stack {
    position: relative;
    flex: 0 0 auto;
    width: 48px;
    height: 60px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.development-hand-card {
    display: block;
    width: 40px;
    height: 60px;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.45);
    user-select: none;
    -webkit-user-drag: none;
}

.development-card-stack + .development-card-stack {
    margin-left: -20px;
}

.development-card-stack:hover .development-hand-card,
.development-card-stack:focus-visible .development-hand-card {
    transform: translateY(-3px);
}

.development-count {
    position: absolute;
    right: -2px;
    bottom: -3px;
    min-width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    border: 1px solid #111;
    border-radius: 50%;
    background: #f2dd9b;
    color: #111;
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1;
    z-index: 2;
}

.development-preview-backdrop {
    position: absolute;
    inset: 0;
    z-index: 120;
    display: grid;
    place-items: center;
    padding: 10px;
    border: 0;
    background: rgb(10 14 18 / 0.58);
}

.development-preview-surface {
    position: relative;
    display: grid;
    justify-items: center;
    gap: 10px;
}

.development-preview-close {
    position: absolute;
    top: 4px;
    right: 4px;
    z-index: 2;
    width: 30px;
    height: 30px;
    border: 1px solid #756b5a;
    border-radius: 4px;
    background: rgb(21 27 33 / 0.92);
    color: #f3efe4;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.development-preview-card {
    width: min(58vw, 280px);
    max-height: calc(100svh - 42px);
    aspect-ratio: 2 / 3;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgb(0 0 0 / 0.65);
}

.award-preview {
    padding: 10px;
    border: 0;
    max-width: calc(100vw - 20px);
    max-height: calc(100svh - 20px);
    background: transparent;
}

.award-preview::backdrop {
    background: rgb(10 14 18 / 0.58);
}

.award-preview .development-preview-card {
    width: min(420px, calc(100vw - 60px), calc((100svh - 60px) * 2 / 3));
}

.award-preview .award-preview-close {
    width: 44px;
    height: 44px;
}

.development-play-action {
    width: 100%;
}

.development-resource-picker {
    width: min(92vw, 430px);
    display: grid;
    gap: 9px;
    padding: 10px;
    border: 1px solid #a88955;
    border-radius: 6px;
    background: #202832;
    color: #f3efe4;
}

.development-resource-options {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 7px;
}

.development-resource-choice {
    position: relative;
    min-width: 0;
    display: grid;
    justify-items: center;
    gap: 3px;
}

.development-resource-choice > button:first-child {
    width: 54px;
    height: 54px;
    padding: 3px;
    border: 1px solid #756b5a;
    border-radius: 5px;
    background: #151b21;
    cursor: pointer;
}

.development-resource-choice img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.development-resource-choice span {
    min-height: 18px;
    font-weight: 800;
}

.development-resource-remove {
    width: 28px;
    height: 24px;
    border: 1px solid #756b5a;
    border-radius: 4px;
    background: #151b21;
    color: #f3efe4;
    cursor: pointer;
}

.trade-panel {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 125;
    width: min(94vw, 720px);
    max-height: min(88svh, 620px);
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid #a88955;
    border-radius: 6px;
    background: rgb(32 40 50 / 0.97);
    box-shadow: 0 12px 30px rgb(0 0 0 / 0.58);
    transform: translate(-50%, -50%);
    overflow: auto;
}

.trade-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.trade-header h2,
.trade-section h3 {
    margin: 0;
}

.trade-close {
    width: 30px;
    height: 30px;
    border: 1px solid #756b5a;
    border-radius: 4px;
    background: #151b21;
    color: #f3efe4;
    cursor: pointer;
}

.trade-mode-tabs {
    display: flex;
    gap: 8px;
}

.trade-mode {
    min-height: 32px;
    padding: 4px 12px;
    border: 1px solid #756b5a;
    border-radius: 4px;
    background: #151b21;
    color: #f3efe4;
    font: inherit;
    cursor: pointer;
}

.trade-mode-selected {
    border-color: #f4d06f;
    background: #f5c85c;
    color: #27303a;
}

.trade-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.trade-section {
    display: grid;
    gap: 7px;
    min-width: 0;
}

.trade-resource-row {
    display: grid;
    grid-template-columns: 38px minmax(58px, 1fr) auto 28px 24px 28px;
    align-items: center;
    gap: 6px;
    min-height: 50px;
}

.trade-resource-row img {
    width: 34px;
    height: 50px;
    border-radius: 4px;
    object-fit: cover;
}

.trade-resource-row button {
    width: 28px;
    height: 28px;
    border: 1px solid #756b5a;
    border-radius: 4px;
    background: #efe0b8;
    color: #27303a;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.trade-resource-row button:disabled {
    cursor: default;
    opacity: 0.45;
}

.trade-resource-row small {
    color: #f2dd9b;
    font-weight: 800;
}

.trade-status {
    min-height: 24px;
    color: #f2dd9b;
    font-weight: 700;
}

.trade-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.computer-trade-panel {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 145;
    width: min(90vw, 430px);
    display: grid;
    gap: 14px;
    padding: 16px;
    border: 1px solid #a88955;
    border-radius: 6px;
    background: rgb(32 40 50 / 0.98);
    color: #f3efe4;
    box-shadow: 0 12px 30px rgb(0 0 0 / 0.58);
    transform: translate(-50%, -50%);
}

.computer-trade-panel h2 {
    margin: 0;
    font-size: 1.15rem;
    text-align: center;
}

.computer-trade-exchange {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 10px;
}

.computer-trade-resource {
    min-width: 0;
    display: grid;
    justify-items: center;
    gap: 5px;
    text-align: center;
}

.computer-trade-resource img {
    width: 70px;
    height: 104px;
    object-fit: contain;
}

.computer-trade-resource span {
    color: #d8cfbd;
    font-size: 0.85rem;
}

.computer-trade-resource strong {
    font-size: 0.9rem;
}

.computer-trade-arrow {
    font-size: 1.8rem;
    color: #f2dd9b;
}

.computer-trade-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.startup-panel {
    position: absolute;
    inset: 0;
    z-index: 130;
    display: grid;
    place-items: center;
    padding: 16px;
    background: rgb(31 37 43 / 0.9);
}

.startup-card {
    width: min(92vw, 420px);
    max-height: calc(100svh - 100px);
    overflow-y: auto;
    display: grid;
    gap: 16px;
    padding: 18px;
    border: 1px solid #a88955;
    border-radius: 6px;
    background: #202832;
    box-shadow: 0 10px 30px rgb(0 0 0 / 0.5);
}

.startup-card h2 {
    margin: 0;
    font-size: 1.45rem;
}

.startup-load-action,
.startup-start-action {
    width: 100%;
}

.startup-opponents,
.startup-players,
.startup-seed,
.startup-rules {
    display: grid;
    gap: 8px;
}

.startup-opponents span,
.startup-players > span,
.startup-seed > label,
.startup-rules span {
    color: #d8cfbd;
    font-size: 0.9rem;
    font-weight: 650;
}

.startup-seed > div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.startup-seed input {
    min-width: 0;
    padding: 7px 9px;
    border: 1px solid #756b5a;
    border-radius: 5px;
    background: #151b21;
    color: #f3efe4;
    font: inherit;
}

.player-slot-list {
    display: grid;
    gap: 7px;
}

.player-slot {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
}

.player-slot-color {
    display: flex;
    align-items: center;
    gap: 7px;
    color: #f3efe4;
    font-size: 0.88rem;
    font-weight: 750;
}

.player-slot-color::before {
    width: 15px;
    height: 15px;
    flex: 0 0 15px;
    border: 1px solid rgb(255 255 255 / 0.55);
    border-radius: 50%;
    background: var(--player-slot-color);
    content: "";
}

.player-slot-color-red {
    --player-slot-color: #c83f3f;
}

.player-slot-color-blue {
    --player-slot-color: #3976c5;
}

.player-slot-color-white {
    --player-slot-color: #e8e4d8;
}

.player-slot-color-orange {
    --player-slot-color: #db812d;
}

.player-slot-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

.player-control-option {
    min-width: 0;
    min-height: 34px;
    padding: 5px 6px;
    border: 1px solid #756b5a;
    border-radius: 5px;
    background: #151b21;
    color: #f3efe4;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 750;
    cursor: pointer;
}

.player-control-option-selected {
    border-color: #f4d06f;
    background: #f5c85c;
    color: #27303a;
}

.startup-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #d8cfbd;
    font-size: 0.9rem;
    font-weight: 650;
}

.startup-toggle input {
    width: 18px;
    height: 18px;
    accent-color: #d3a84c;
}

.startup-slider {
    display: grid;
    gap: 7px;
    color: #d8cfbd;
    font-size: 0.9rem;
    font-weight: 650;
}

.startup-slider span {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.startup-slider input {
    width: 100%;
    accent-color: #d3a84c;
}

.analysis-panel {
    min-height: 118px;
    display: grid;
    grid-template-columns: auto minmax(360px, 1fr) minmax(280px, 0.8fr) auto;
    align-items: stretch;
    gap: 12px;
    padding: 6px 10px;
    border: 1px solid #3c4650;
    border-radius: 6px;
    background: #202832;
    box-sizing: border-box;
    color: #d8cfbd;
    font-size: 0.86rem;
}

.board-panel-analysis .analysis-panel {
    grid-column: 2;
    grid-row: 3;
    min-height: 0;
    height: 100%;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(0, 0.8fr) minmax(0, 1fr) auto;
    align-items: start;
}

.board-panel-analysis .analysis-summary {
    display: grid;
    gap: 4px;
}

.board-panel-analysis .analysis-breakdown {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.board-panel-analysis .analysis-strategies {
    align-content: start;
}

.board-panel-analysis .analysis-panel .board-action {
    align-self: end;
}

.analysis-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.analysis-panel strong {
    color: #f3efe4;
}

.analysis-breakdown {
    display: grid;
    grid-template-columns: repeat(6, minmax(70px, auto));
    gap: 4px 10px;
    align-content: center;
    min-width: 0;
}

.analysis-breakdown span {
    white-space: nowrap;
}

.analysis-strategies {
    display: grid;
    gap: 4px;
    align-content: center;
    min-width: 0;
}

.analysis-strategy {
    display: grid;
    gap: 1px;
    min-width: 0;
}

.analysis-strategy span,
.analysis-strategy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.analysis-strategy small {
    color: #aeb7c1;
    font-size: 0.72rem;
}

.analysis-decision {
    min-height: 0;
    display: grid;
    gap: 3px;
    align-content: start;
    overflow: auto;
    padding-top: 4px;
    border-top: 1px solid #3c4650;
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.72rem;
    line-height: 1.35;
}

.analysis-decision span {
    white-space: pre-wrap;
}

.opponent-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.opponent-option {
    min-height: 38px;
    border: 1px solid #756b5a;
    border-radius: 6px;
    background: #151b21;
    color: #f3efe4;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.opponent-option-selected {
    border-color: #f4d06f;
    background: #f5c85c;
    color: #27303a;
}

.rule-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.rule-option {
    min-height: 42px;
    padding: 6px 8px;
    border: 1px solid #756b5a;
    border-radius: 6px;
    background: #151b21;
    color: #f3efe4;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 750;
    cursor: pointer;
}

.rule-option-selected {
    border-color: #f4d06f;
    background: #f5c85c;
    color: #27303a;
}

.robber-discard-panel,
.robber-move-panel {
    position: absolute;
    left: 50%;
    bottom: 92px;
    z-index: 95;
    transform: translateX(-50%);
    max-width: min(94vw, 900px);
    border: 1px solid #a88955;
    border-radius: 6px;
    background: rgb(32 40 50 / 0.94);
    box-shadow: 0 8px 18px rgb(0 0 0 / 0.45);
    color: #f3efe4;
}

.robber-discard-panel {
    display: grid;
    grid-template-columns: auto 1fr auto 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
}

.robber-discard-status {
    display: grid;
    gap: 3px;
    min-width: 118px;
}

.robber-discard-status strong {
    font-size: 0.95rem;
}

.robber-discard-status span {
    color: #d8cfbd;
    font-size: 0.78rem;
}

.discard-zone {
    display: flex;
    align-items: center;
    gap: 7px;
}

.discard-divider {
    width: 1px;
    align-self: stretch;
    background: #5f6872;
}

.discard-card-button {
    position: relative;
    width: 66px;
    height: 99px;
    padding: 0;
    border: 1px solid #756b5a;
    border-radius: 5px;
    background: #151b21;
    cursor: pointer;
}

.discard-card-button:disabled {
    cursor: default;
    opacity: 0.36;
}

.discard-card-button img {
    display: block;
    width: 60px;
    height: 89px;
    margin: 2px auto 0;
    border-radius: 4px;
}

.discard-card-button span {
    position: absolute;
    right: -7px;
    bottom: -7px;
    min-width: 19px;
    height: 19px;
    display: grid;
    place-items: center;
    border: 1px solid #111;
    border-radius: 50%;
    background: #f2dd9b;
    color: #111;
    font-size: 0.75rem;
    font-weight: 800;
}

.discard-selected .discard-card-button {
    border-color: #c94c3e;
}

.discard-confirm {
    min-width: 86px;
}

.robber-move-panel {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 14px;
    font-weight: 650;
}

.resource-stack {
    position: relative;
    flex: 0 0 auto;
}

.resource-card {
    position: absolute;
    width: 56px;
    height: 84px;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.45);
    user-select: none;
    -webkit-user-drag: none;
}

.resource-count {
    position: absolute;
    right: -9px;
    bottom: -9px;
    min-width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    border: 1px solid #111;
    border-radius: 50%;
    background: #f2dd9b;
    color: #111;
    font-size: 0.8rem;
    font-weight: 800;
    line-height: 1;
    z-index: 10;
}

@media (max-width: 700px) {
    .game-shell {
        padding: 6px;
    }

    .board-panel {
        gap: 5px;
    }

    .board-wrap {
        padding: 6px;
    }

    .hand-row {
        height: 104px;
        grid-template-columns: minmax(0, 1fr) minmax(320px, auto);
        gap: 6px;
    }

    .player-hand,
    .development-panel {
        height: 104px;
    }

    .player-hand {
        gap: 9px;
        padding: 4px 8px 12px;
    }

    .development-panel {
        min-width: 320px;
        max-width: 390px;
        padding: 4px 6px 8px;
        gap: 5px;
    }

    .turn-actions {
        grid-template-columns: repeat(3, minmax(55px, 1fr));
        gap: 3px;
        flex-basis: 178px;
    }

    .turn-action {
        min-height: 25px;
        padding: 2px 3px;
        font-size: 0.62rem;
    }

    .piece-buy-action {
        grid-template-columns: minmax(0, 1fr) 18px 15px minmax(0, 1fr);
        grid-template-rows: 16px auto;
        gap: 1px 3px;
    }

    .piece-buy-action > span {
        font-size: 0.58rem;
    }

    .piece-inventory-count {
        min-width: 15px;
        height: 15px;
        font-size: 0.58rem;
    }

    .development-card-stack {
        width: 43px;
        height: 60px;
    }

    .development-hand-card {
        width: 38px;
        height: 57px;
    }

    .development-card-stack + .development-card-stack {
        margin-left: -19px;
    }

    .development-preview-card {
        width: min(72vw, 260px);
    }

    .robber-discard-panel {
        grid-template-columns: auto 1fr auto;
        gap: 8px;
        padding: 8px;
    }

    .discard-divider {
        display: none;
    }

    .discard-zone {
        gap: 5px;
    }

    .discard-card-button {
        width: 50px;
        height: 75px;
    }

    .discard-card-button img {
        width: 45px;
        height: 67px;
    }
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    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: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem 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;
}
