body {
    min-height: 100vh;
    background: var(--cp-bg);
    color: var(--cp-text);
    font-family: "Segoe UI", Aptos, Calibri, -apple-system, BlinkMacSystemFont, sans-serif;
}

.game-container {
    max-width: 1440px;
}

.header,
.mode-selection,
.setup-screen,
.game-area {
    border: 1px solid var(--cp-border);
    background: var(--cp-surface);
    color: var(--cp-text);
}

.header {
    box-shadow: none;
}

.header h1,
.mode-selection h2,
.setup-screen h2,
.how-to-play-content h3,
.score-panel h2,
.found-panel h2 {
    color: var(--cp-text);
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--cp-accent);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.breadcrumb,
.breadcrumb-separator,
.opponent-name {
    color: var(--cp-text-muted);
}

.breadcrumb a {
    color: var(--cp-link);
}

.back-btn {
    border-color: var(--cp-border);
    background: var(--cp-surface);
    color: var(--cp-text);
}

.back-btn:hover {
    border-color: var(--cp-accent);
    background: var(--cp-accent-soft);
    color: var(--cp-accent);
}

button,
.btn {
    min-height: 44px;
    border-radius: 0.625rem;
    background: var(--cp-accent);
    color: var(--cp-accent-fg);
    box-shadow: none;
}

button:hover,
.btn:hover {
    background: var(--cp-accent-hover);
    box-shadow: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid var(--cp-link);
    outline-offset: 3px;
    box-shadow: none;
}

button:disabled {
    opacity: 0.58;
}

.btn-secondary {
    border: 1px solid var(--cp-border-strong);
    background: var(--cp-surface-soft);
    color: var(--cp-text);
}

.btn-secondary:hover {
    background: var(--cp-accent-soft);
    color: var(--cp-accent);
}

.mode-selection {
    max-width: 720px;
    margin: 36px auto;
    padding: 32px;
    border-radius: 16px;
    text-align: center;
}

.mode-intro {
    margin: -14px 0 24px;
    color: var(--cp-text-muted);
}

.mode-btn {
    width: 100%;
    margin: 8px 0;
    border: 1px solid var(--cp-border);
    background: var(--cp-surface-soft);
    color: var(--cp-text);
}

.mode-btn:hover {
    border-color: var(--cp-accent);
    background: var(--cp-accent-soft);
    color: var(--cp-text);
}

.mode-btn .desc {
    color: var(--cp-text-muted);
}

.how-to-play {
    margin-top: 24px;
    border: 1px solid var(--cp-border);
    border-radius: 0.625rem;
    background: var(--cp-bg-elevated);
    text-align: left;
}

.how-to-play summary {
    padding: 14px 16px;
    color: var(--cp-text);
    cursor: pointer;
    font-weight: 700;
}

.how-to-play-content {
    padding: 0 18px 18px;
    color: var(--cp-text-muted);
}

.how-to-play-content h3 {
    margin: 14px 0 4px;
    font-size: 1rem;
}

.setup-screen {
    max-width: 520px;
    border-radius: 16px;
    box-shadow: none;
}

.setup-screen .input-group label {
    color: var(--cp-text);
}

.setup-screen input,
.setup-screen select {
    border-color: var(--cp-border);
    background: var(--cp-bg-elevated);
    color: var(--cp-text);
}

.setup-screen input:focus,
.setup-screen select:focus {
    border-color: var(--cp-accent);
}

.setup-note {
    margin: 0 0 20px;
    color: var(--cp-text-muted);
}

#back-to-modes,
#back-to-modes-from-setup {
    margin-top: 12px;
}

.room-lobby,
.waiting-room {
    color: var(--cp-text);
}

.game-area {
    padding: 20px;
    border-radius: 16px;
}

.game-topbar {
    display: grid;
    gap: 10px;
}

.online-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.online-badge {
    padding: 4px 9px;
    border-radius: 0.625rem;
    background: var(--cp-accent);
    color: var(--cp-accent-fg);
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.connection-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px 14px;
    border: 1px solid var(--cp-warning);
    border-radius: 0.625rem;
    background: var(--cp-surface-soft);
    color: var(--cp-text);
}

.connection-banner button {
    min-height: 36px;
    padding: 6px 12px;
}

.status {
    min-height: 1.8em;
    margin: 0;
    color: var(--cp-accent);
    font-size: 1.08rem;
    font-weight: 800;
    text-align: center;
}

.puzzle-dashboard {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(250px, 0.7fr);
    gap: 14px;
    margin: 14px 0;
}

.score-panel,
.found-panel {
    padding: 16px;
    border: 1px solid var(--cp-border);
    border-radius: 16px;
    background: var(--cp-bg-elevated);
}

.score-heading-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.score-panel h2,
.found-panel h2 {
    margin: 0;
    font-size: 1.08rem;
}

#remaining-count {
    color: var(--cp-accent);
}

.overall-progress {
    display: grid;
    grid-template-columns: minmax(130px, 1fr) auto;
    gap: 10px;
    align-items: center;
    margin: 12px 0;
    color: var(--cp-text-muted);
    font-size: 0.9rem;
}

.progress-bar {
    height: 12px;
    overflow: hidden;
    border: 1px solid var(--cp-border);
    border-radius: 0.625rem;
    background: var(--cp-surface-soft);
}

#progress-fill {
    display: block;
    width: 0;
    height: 100%;
    background: var(--cp-accent);
    transition: width 220ms ease;
}

.scoreboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
}

.score-card {
    --player-color: var(--cp-accent);
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 9px 10px;
    border: 1px solid var(--cp-border);
    border-left: 5px solid var(--player-color);
    border-radius: 0.625rem;
    background: var(--cp-surface);
}

.score-card.player-1 {
    --player-color: var(--cp-accent);
}

.score-card.player-2 {
    --player-color: var(--cp-link);
}

.score-card.player-3 {
    --player-color: var(--cp-success);
}

.score-card.player-4 {
    --player-color: var(--cp-warning);
}

.score-card.is-me {
    background: var(--cp-accent-soft);
}

.score-avatar {
    color: var(--player-color);
    font-size: 1.05rem;
}

.score-name {
    overflow: hidden;
    color: var(--cp-text);
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.score-value {
    color: var(--player-color);
    font-size: 1.15rem;
}

.round-stats {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    color: var(--cp-text-muted);
}

#lockout-status.locked {
    color: var(--cp-danger);
    font-weight: 800;
}

.found-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 18px;
    margin: 10px 0 0 22px;
    color: var(--cp-text-muted);
}

.found-list li.found {
    color: var(--cp-text);
    font-weight: 700;
}

.found-list li.found::marker {
    color: var(--cp-success);
}

.scene-description {
    grid-column: 1 / -1;
    margin: 0;
    padding: 10px 14px;
    border-left: 4px solid var(--cp-accent);
    background: var(--cp-accent-soft);
    color: var(--cp-text-muted);
}

.scene-pair {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.scene-card {
    min-width: 0;
    margin: 0;
    padding: 10px;
    border: 1px solid var(--cp-border);
    border-radius: 16px;
    background: var(--cp-surface-soft);
}

.scene-card figcaption {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    color: var(--cp-text);
}

.scene-card figcaption span {
    color: var(--cp-text-muted);
    font-size: 0.85rem;
}

.scene-frame {
    position: relative;
    overflow: hidden;
    border: 2px solid var(--cp-border-strong);
    border-radius: 0.625rem;
    background: var(--cp-bg-elevated);
    touch-action: manipulation;
}

.scene-frame.locked {
    cursor: wait;
}

.scene-svg {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 8 / 5;
}

.scene-sky {
    fill: var(--cp-bg-elevated);
}

.scene-sun,
.flowers circle {
    fill: var(--cp-warning);
}

.sun-rays,
.shore {
    fill: none;
    stroke: var(--cp-warning);
    stroke-linecap: round;
    stroke-width: 9;
}

.scene-cloud,
.snow-cap {
    fill: var(--cp-surface);
    stroke: var(--cp-border-strong);
    stroke-width: 2;
}

.mountain-back {
    fill: var(--cp-border);
    stroke: var(--cp-text-muted);
    stroke-width: 4;
}

.mountain-front {
    fill: var(--cp-border-strong);
    stroke: var(--cp-text);
    stroke-width: 4;
}

.grass-back,
.tree-crown {
    fill: var(--cp-success);
}

.lake {
    fill: var(--cp-link);
    opacity: 0.58;
}

.shore {
    stroke: var(--cp-surface);
    stroke-width: 8;
}

.tree-trunk,
.bench-piece,
.bench-frame,
.basket-body,
.basket-lines,
.basket-handle {
    fill: var(--cp-accent);
    stroke: var(--cp-text);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 5;
}

.apple {
    fill: var(--cp-warning);
    stroke: var(--cp-text);
    stroke-width: 3;
}

.bird-body,
.bird-head,
.cat-body,
.cat-head,
.cat-ears {
    fill: var(--cp-accent);
    stroke: var(--cp-text);
    stroke-linejoin: round;
    stroke-width: 4;
}

.bird-wing,
.bird-leg,
.cat-tail {
    fill: none;
    stroke: var(--cp-text);
    stroke-linecap: round;
    stroke-width: 5;
}

.bird-beak {
    fill: var(--cp-warning);
    stroke: var(--cp-text);
    stroke-width: 3;
}

.cat-eye {
    fill: var(--cp-text);
}

.hotspot-layer,
.marker-layer {
    position: absolute;
    inset: 0;
}

.marker-layer {
    pointer-events: none;
}

.hotspot {
    position: absolute;
    left: var(--x);
    top: var(--y);
    width: max(var(--w), 44px);
    height: max(var(--h), 44px);
    min-height: 44px;
    padding: 0;
    border: 3px solid var(--cp-link);
    border-radius: 50%;
    background: var(--cp-sheen);
    box-shadow: none;
    opacity: 0;
    transform: translate(-50%, -50%);
}

.hotspot:hover {
    background: var(--cp-sheen);
    box-shadow: none;
    opacity: 0.14;
    transform: translate(-50%, -50%);
}

.hotspot:focus-visible {
    outline: 4px solid var(--cp-warning);
    outline-offset: 2px;
    box-shadow: none;
    opacity: 0.32;
    transform: translate(-50%, -50%);
}

.hotspot:disabled {
    pointer-events: none;
    opacity: 0;
}

.hotspot span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.difference-marker {
    --marker-color: var(--cp-accent);
    position: absolute;
    left: var(--x);
    top: var(--y);
    display: grid;
    place-items: center;
    width: clamp(30px, 7%, 44px);
    aspect-ratio: 1;
    border: 4px solid var(--marker-color);
    border-radius: 50%;
    background: var(--cp-panel-strong);
    color: var(--marker-color);
    font-weight: 900;
    transform: translate(-50%, -50%);
    animation: marker-pop 320ms ease-out;
}

.difference-marker.player-1 {
    --marker-color: var(--cp-accent);
}

.difference-marker.player-2 {
    --marker-color: var(--cp-link);
}

.difference-marker.player-3 {
    --marker-color: var(--cp-success);
}

.difference-marker.player-4 {
    --marker-color: var(--cp-warning);
}

.game-buttons {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

@keyframes marker-pop {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.65);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@media (max-width: 980px) {
    .puzzle-dashboard {
        grid-template-columns: 1fr;
    }

    .found-list {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .game-area {
        padding: 12px;
    }

    .scene-pair {
        grid-template-columns: 1fr;
    }

    .scene-card {
        padding: 8px;
    }

    .found-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    .game-container {
        padding: 10px;
    }

    .header {
        align-items: flex-start;
        padding: 14px;
    }

    .header h1 {
        font-size: 1.35rem;
    }

    .mode-selection,
    .setup-screen {
        margin: 16px auto;
        padding: 18px;
    }

    .score-heading-row,
    .scene-card figcaption,
    .overall-progress {
        align-items: flex-start;
        grid-template-columns: 1fr;
    }

    .score-heading-row,
    .scene-card figcaption {
        flex-direction: column;
    }

    .scoreboard {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (prefers-reduced-motion: reduce) {
    #progress-fill,
    .difference-marker,
    button,
    .btn {
        animation: none;
        transition: none;
    }
}
