:root {
    --game-primary: #c90c0f;
    --game-secondary: #f4c430;
}

body.fs-page {
    margin: 0;
    min-height: 100vh;
    font-family: "Rockwell", "Rockwell Nova", "Roboto Slab", serif;
    color: #f8f1e3;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 12% 10%, rgba(244, 196, 48, 0.18), transparent 42%),
        radial-gradient(circle at 88% 8%, rgba(201, 12, 15, 0.22), transparent 46%),
        linear-gradient(180deg, #1b1020 0%, #3a1420 48%, #12080e 100%);
}

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

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

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

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

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

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

.fs-hud {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    max-width: 620px;
    margin: 0 auto 0.85rem;
    padding: 0.55rem 0.7rem;
    background: linear-gradient(180deg, #5a2430, #2a1018);
    border: 3px solid #12080e;
    border-radius: 12px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 10px 24px rgba(0, 0, 0, 0.35);
}

.fs-lcd {
    min-width: 4.6rem;
    padding: 0.2rem 0.45rem;
    background: #14080c;
    color: #f5c518;
    font-family: "Courier New", ui-monospace, monospace;
    font-size: 1.15rem;
    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);
}

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

.fs-chip {
    padding: 0.45rem 0.7rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #fde68a;
    font-weight: 700;
}

.fs-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.45rem;
    margin: 0 auto 0.85rem;
    max-width: 620px;
}

.fs-tool-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    min-height: 44px;
    border-radius: 999px;
    border: 1px solid rgba(244, 196, 48, 0.28);
    background: rgba(20, 8, 12, 0.75);
    color: #f8f1e3 !important;
    font-weight: 700;
    cursor: pointer;
}

.fs-tool-btn:hover:not(:disabled) {
    border-color: #f5c518;
    color: #f5c518 !important;
}

.fs-tool-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.fs-status {
    text-align: center;
    min-height: 1.4rem;
    margin: 0 auto 0.65rem;
    color: #fde68a;
    font-weight: 700;
}

.fs-target-wrap {
    text-align: center;
    margin: 0 auto 1rem;
}

.fs-target-label {
    margin: 0 0 0.35rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-size: 0.72rem;
    color: #f4a7b9;
}

.fs-target {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 7rem;
    padding: 0.55rem 1.1rem;
    background: #fff7ed;
    color: #7f1d1d;
    border: 4px solid #c90c0f;
    border-radius: 18px;
    box-shadow: 0 10px 24px rgba(201, 12, 15, 0.28);
    font-size: clamp(2.2rem, 8vw, 3.4rem);
    font-weight: 800;
    line-height: 1;
}

.fs-target sup {
    font-size: 0.72em;
}

.fs-target sub {
    font-size: 0.72em;
}

.fs-target .fs-whole {
    margin-right: 0.28em;
}

.fs-board-wrap {
    display: flex;
    justify-content: center;
    padding: 0.4rem;
}

.fs-board {
    width: min(92vw, 640px);
    background: linear-gradient(180deg, #4a2030 0%, #2c121c 100%);
    border: 4px solid #12080e;
    border-radius: 18px;
    padding: 1.6rem 1.1rem 1.3rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 16px 32px rgba(0, 0, 0, 0.4);
}

.fs-line {
    position: relative;
    height: 88px;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
}

.fs-rail {
    position: absolute;
    left: 0;
    right: 0;
    top: 28px;
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(180deg, #f8f1e3, #d6c4a8);
    box-shadow: inset 0 1px 0 #fff, 0 3px 0 #7f1d1d;
}

.fs-ticks {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.fs-tick {
    position: absolute;
    top: 16px;
    width: 3px;
    height: 34px;
    margin-left: -1.5px;
    background: #fde68a;
    border-radius: 2px;
}

.fs-tick span {
    position: absolute;
    top: 38px;
    left: 50%;
    transform: translateX(-50%);
    color: #fde68a;
    font-size: 0.92rem;
    font-weight: 800;
    white-space: nowrap;
}

.fs-marks {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.fs-splat {
    position: absolute;
    top: 10px;
    width: 28px;
    height: 28px;
    margin-left: -14px;
    border-radius: 60% 40% 55% 45%;
    background: #c90c0f;
    box-shadow: 0 0 0 3px rgba(201, 12, 15, 0.28);
    transform: rotate(-18deg);
}

.fs-true {
    position: absolute;
    top: 8px;
    width: 16px;
    height: 32px;
    margin-left: -8px;
    background: #f4c430;
    border-radius: 4px;
    box-shadow: 0 0 0 3px rgba(244, 196, 48, 0.35);
}

.fs-line.is-locked {
    cursor: default;
}

.fs-line.is-flash .fs-rail {
    box-shadow: 0 0 0 4px rgba(244, 196, 48, 0.45);
}

.fs-hint {
    text-align: center;
    max-width: 36rem;
    margin: 0.75rem auto 0;
    color: #e7d3b0;
    font-size: 0.92rem;
}

.fs-settings-panel__label {
    font-weight: 700;
    margin: 0.4rem 0 0.45rem;
}

.fs-settings-panel__buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 0.75rem;
}

.fs-settings-panel__note {
    color: #64748b;
    font-size: 0.92rem;
}

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

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

.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;
    border-radius: 8px;
    cursor: pointer;
    padding: 0.35rem 0.55rem;
}

.modal-close:hover {
    background: #c90c0f !important;
    color: #fff !important;
}

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

.modal-footer {
    border-top: 2px solid #eee;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.stat-card {
    background: #f8fafc;
    border-radius: 12px;
    padding: 0.85rem;
    text-align: center;
}

.stat-card .stat-value {
    font-size: 1.6rem;
    color: #c90c0f;
    font-weight: 700;
}

.stat-card .stat-label {
    color: #64748b;
    font-size: 0.85rem;
}

.difficulty-stats {
    display: grid;
    gap: 0.45rem;
}

.difficulty-stats div {
    display: flex;
    justify-content: space-between;
    padding: 0.45rem 0.55rem;
    background: #f8fafc;
    border-radius: 8px;
    color: #1a1a1a;
}

.help-section {
    margin-bottom: 1.1rem;
}

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

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

.result-message {
    font-size: 1.05rem;
    margin: 0 0 1rem;
}

.win-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
    text-align: center;
}

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

.win-stat span {
    color: #64748b;
    font-size: 0.82rem;
}

.fs-page .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.65rem 1.1rem;
    border-radius: 0.55rem;
    border: 2px solid transparent;
    font-weight: 700;
    cursor: pointer;
}

.fs-page .btn-primary {
    background: #c90c0f !important;
    color: #fff !important;
    border-color: #c90c0f;
}

.fs-page .btn-secondary {
    background: #fff !important;
    color: #c90c0f !important;
    border-color: #c90c0f;
}

.fs-page .btn-secondary:hover {
    background: #c90c0f !important;
    color: #fff !important;
}

@media (max-width: 640px) {
    body.fs-page.with-game-header .fs-shell {
        padding-top: 0.75rem;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        padding-bottom: 1.25rem;
    }

    .fs-hud {
        max-width: 100%;
        gap: 0.4rem;
        padding: 0.4rem 0.45rem;
    }

    .fs-lcd {
        min-width: 0;
        flex: 1 1 0;
        font-size: 1rem;
    }
}
