:root {
    --game-primary: #c90c0f;
    --game-secondary: #2a9d8f;
}

body.pd-page {
    margin: 0;
    min-height: 100vh;
    font-family: "Rockwell", "Rockwell Nova", "Roboto Slab", serif;
    color: #eef6f3;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 12% 8%, rgba(42, 157, 143, 0.22), transparent 42%),
        radial-gradient(circle at 88% 10%, rgba(201, 12, 15, 0.18), transparent 46%),
        linear-gradient(180deg, #12343c 0%, #1b4a52 48%, #0e2428 100%);
}

body.pd-page.game-menu-active {
    overflow-y: auto;
    overflow-x: hidden;
}

body.pd-page.game-menu-active #game-header {
    display: none !important;
}

.pd-page .game-screen {
    display: none;
    min-height: 100vh;
}

.pd-page .game-screen.active {
    display: block;
}

body.pd-page.with-game-header .pd-shell {
    padding-top: 5.5rem;
}

.pd-shell {
    max-width: min(980px, 96vw);
    margin: 0 auto;
    padding: 1.1rem 0.75rem 2.5rem;
}

.pd-hud {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin: 0 auto 0.85rem;
    padding: 0.55rem 0.7rem;
    background: linear-gradient(180deg, #24545c, #12343c);
    border: 3px solid #0a1f24;
    border-radius: 12px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 10px 24px rgba(0, 0, 0, 0.35);
}

.pd-lcd {
    min-width: 4.6rem;
    padding: 0.2rem 0.45rem;
    background: #071416;
    color: #7de3c8;
    font-family: "Courier New", ui-monospace, monospace;
    font-size: 1.05rem;
    font-weight: 700;
    text-align: center;
    border-radius: 6px;
    box-shadow: inset 0 0 0 2px #7f1d1d, inset 0 8px 16px rgba(0, 0, 0, 0.45);
}

.pd-lcd span {
    display: block;
    font-size: 0.62rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #7de3c8;
}

.pd-chip {
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: #c90c0f;
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
}

.pd-panel {
    background: #f4f1e8;
    color: #1b140c;
    border-radius: 14px;
    padding: 1rem 1rem 1.2rem;
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.35), inset 0 0 0 2px rgba(201, 12, 15, 0.12);
}

.pd-prompt {
    margin: 0 0 0.4rem;
    font-size: 1.28rem;
    line-height: 1.4;
    color: #1b140c;
}

.pd-kind {
    display: inline-block;
    margin-bottom: 0.45rem;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: #fff;
    color: #c90c0f;
    border: 2px solid #c90c0f;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.pd-hint {
    margin: 0 0 0.7rem;
    color: #4a5a58;
    font-size: 0.95rem;
}

.pd-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.pd-steps {
    display: flex;
    gap: 0.45rem;
    list-style: none;
    margin: 0 0 0.85rem;
    padding: 0;
}

.pd-steps li {
    flex: 1;
    text-align: center;
    padding: 0.4rem 0.3rem;
    border-radius: 999px;
    border: 2px solid #c90c0f;
    background: #fff;
    color: #c90c0f;
    font-size: 0.82rem;
    font-weight: 800;
}

.pd-steps li.is-current {
    background: #c90c0f;
    color: #fff;
}

.pd-steps li.is-done {
    background: #2a9d8f;
    border-color: #2a9d8f;
    color: #fff;
}

.pd-stage {
    display: none;
}

.pd-stage.is-active {
    display: block;
}

.pd-solve-layout {
    display: block;
    max-width: 36rem;
    margin: 0 auto;
}

.pd-coord-card {
    background: #fff;
    border: 2px solid #d7c9b0;
    border-radius: 12px;
    padding: 0.8rem;
}

.pd-axis-block + .pd-axis-block {
    margin-top: 0.95rem;
    padding-top: 0.85rem;
    border-top: 1px solid #eee3d2;
}

.pd-axis-head {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0 0 0.55rem;
    font-size: 1.05rem;
    font-weight: 800;
    color: #1b140c;
}

.pd-figures {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.55rem;
}

.pd-figure {
    min-width: 0;
}

.pd-figure-role {
    margin: 0 0 0.28rem;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #6a5a42;
}

.pd-figure-clue,
.pd-coord-input {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    height: 3.4rem;
    min-height: 3.4rem;
    margin: 0;
    padding: 0.35rem 0.4rem;
    border: 2px solid #c90c0f;
    border-radius: 8px;
    font-size: 1.02rem;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
    color: #1b140c;
}

.pd-figure-clue {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 0 0.4rem;
    background: #fff8e8;
    border-style: dashed;
    overflow: hidden;
}

.pd-figure.is-given .pd-figure-clue {
    background: #eef7f4;
    border-style: solid;
    border-color: #2a9d8f;
}

.pd-coord-input {
    display: block;
    background: #fff;
    font-family: inherit;
}

.pd-coord-input:read-only {
    border-color: #2a9d8f;
    background: #eef7f4;
    color: #1b140c;
}

.pd-coord-input.is-wrong {
    border-color: #c90c0f;
    background: #fdecec;
}

.pd-coord-input.is-right {
    border-color: #2a9d8f;
    background: #eef7f4;
}

.pd-hemi {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.7rem;
    min-height: 1.7rem;
    padding: 0 0.35rem;
    border-radius: 6px;
    background: #c90c0f;
    color: #fff;
    font-size: 1.05rem;
    font-weight: 800;
    text-align: center;
}

.pd-coord-note {
    margin: 0.7rem 0 0;
    color: #4a5a58;
    font-size: 0.88rem;
}

.pd-map-caption {
    margin: 0 0 0.55rem;
    color: #3d524e;
    font-weight: 700;
}

.pd-map-wrap {
    position: relative;
    height: min(52vh, 420px);
    min-height: 260px;
    border-radius: 12px;
    overflow: hidden;
    border: 3px solid #1b3a4a;
    background: #8fb7c9;
}

.pd-map {
    position: absolute;
    inset: 0;
    height: 100%;
    min-height: 0;
    border: 0;
    border-radius: 0;
    background: #8fb7c9;
}

.pd-map-wrap .leaflet-container {
    width: 100%;
    height: 100%;
    background: #8fb7c9;
}

.pd-map-wrap.is-outline .leaflet-container {
    cursor: crosshair;
    background: #8fb7c9;
}

.pd-pin-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 500;
    overflow: hidden;
}

.pd-drop-pin {
    position: absolute;
    left: 0;
    top: 0;
    width: 28px;
    height: 42px;
    margin: 0;
    transform: translate(-50%, -100%);
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.35));
}

.pd-drop-pin svg {
    display: block;
    width: 100%;
    height: 100%;
}

.pd-drop-pin.is-preview {
    opacity: 0.42;
}

.pd-map-wrap.is-revealing .leaflet-tile-pane {
    animation: pdMapFade 1.1s ease forwards;
}

@keyframes pdMapFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.pd-map-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.pd-submit,
.pd-next {
    background: #c90c0f;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 0.7rem 1.15rem;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
}

.pd-submit:hover,
.pd-submit:focus,
.pd-next:hover,
.pd-next:focus {
    background: #a10a0c;
    color: #fff;
}

.pd-submit:disabled {
    background: #8a8a8a;
    color: #fff;
    cursor: not-allowed;
}

.pd-status {
    margin: 0;
    color: #3d524e;
    font-size: 0.92rem;
}

.pd-result {
    display: none;
    margin-top: 0.85rem;
    padding: 0.85rem 0.9rem;
    background: #fff;
    border: 2px solid #2a9d8f;
    border-radius: 12px;
}

.pd-result.is-open {
    display: block;
}

.pd-scoreline {
    margin: 0 0 0.45rem;
    font-weight: 800;
    color: #c90c0f;
}

.pd-working {
    margin: 0 0 0.7rem;
    padding-left: 1.15rem;
    color: #2b3533;
}

.pd-working li {
    margin: 0.2rem 0;
}

.pd-settings-panel__label {
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.pd-settings-panel__buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.difficulty-pill {
    background: #fff;
    color: #c90c0f;
    border: 2px solid #c90c0f;
    border-radius: 999px;
    padding: 0.45rem 0.9rem;
    font-weight: 700;
    cursor: pointer;
}

.difficulty-pill.is-selected,
.difficulty-pill:hover,
.difficulty-pill:focus {
    background: #c90c0f;
    color: #fff;
}

.pd-settings-note {
    margin: 0.8rem 0 0;
    color: #4a5a58;
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    z-index: 12000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #fff;
    color: #1a1a1a;
    border-radius: 1rem;
    max-width: 640px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-large {
    max-width: 760px;
}

.modal-header,
.modal-footer {
    padding: 1.1rem 1.4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.modal-header {
    border-bottom: 2px solid #eee;
}

.modal-header h2 {
    margin: 0;
    color: #c90c0f;
    font-size: 1.35rem;
}

.modal-close {
    background: #fff !important;
    border: 2px solid #c90c0f;
    color: #c90c0f !important;
    min-width: 44px;
    min-height: 44px;
    border-radius: 8px;
    cursor: pointer;
}

.modal-body {
    padding: 1.1rem 1.4rem;
}

.modal-footer {
    border-top: 2px solid #eee;
}

.pd-page .btn {
    font-weight: 700;
    border-radius: 10px;
    padding: 0.55rem 0.95rem;
    cursor: pointer;
}

.pd-page .btn-primary {
    background: #c90c0f;
    color: #fff;
    border: none;
}

.pd-page .btn-primary:hover,
.pd-page .btn-primary:focus {
    background: #a10a0c;
    color: #fff;
}

.pd-page .btn-secondary {
    background: #fff;
    color: #c90c0f;
    border: 2px solid #c90c0f;
}

.pd-page .btn-secondary:hover,
.pd-page .btn-secondary:focus {
    background: #c90c0f;
    color: #fff;
}

.help-section h3 {
    margin: 0.2rem 0 0.4rem;
    color: #c90c0f;
}

.help-section ul {
    margin: 0 0 1rem;
    padding-left: 1.2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
}

.stat-card {
    background: #f4f1e8;
    border-radius: 10px;
    padding: 0.8rem;
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: #c90c0f;
}

.stat-label {
    color: #5c4a32;
    font-size: 0.85rem;
}

.win-stats {
    display: flex;
    gap: 0.8rem;
    justify-content: space-around;
    margin: 0.8rem 0 1rem;
}

.win-stat {
    text-align: center;
}

.win-stat strong {
    display: block;
    font-size: 1.4rem;
    color: #c90c0f;
}

.result-message {
    margin: 0;
}

@media (max-width: 640px) {
    .pd-map-wrap {
        height: 48vh;
        min-height: 220px;
    }
    .pd-prompt {
        font-size: 1.08rem;
    }
    .pd-coord-input,
    .pd-figure-clue {
        height: 3.2rem;
        min-height: 3.2rem;
        padding: 0.3rem 0.3rem;
        font-size: 0.95rem;
    }
}
