#game-root {
    --fs-teal: #2fb99a;
    --fs-amber: #f2c14e;
    --fs-red: #d9483b;
    --fs-deep: #14303a;
    color: var(--cg-ink);
    font-family: Inter, Arial, Helvetica, sans-serif;
}

.fs-game {
    position: relative;
    max-width: 720px;
    margin: 0 auto;
    padding: 2px 0 20px;
}

.fs-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.fs-stats,
.fs-tools {
    display: flex;
    align-items: center;
    gap: 6px;
}

.fs-stats {
    flex: 1 1 auto;
    min-width: 0;
}

.fs-chip {
    display: flex;
    align-items: baseline;
    gap: 6px;
    min-height: 44px;
    padding: 0 10px;
    border: 1px solid var(--cg-line);
    border-radius: 12px;
    background: linear-gradient(180deg, #fff, #f1f4ef);
    box-shadow: 0 3px 8px rgba(20, 48, 58, 0.08);
    align-items: center;
}

.fs-chip span {
    color: var(--cg-muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.fs-chip strong {
    display: flex;
    align-items: center;
    gap: 3px;
    color: var(--cg-ink);
    font-size: 17px;
    font-variant-numeric: tabular-nums;
}

.fs-heart {
    width: 14px;
    height: 13px;
    background: #d3d9d4;
    clip-path: path('M7 13 C-3 6 2 -2 7 3 C12 -2 17 6 7 13 Z');
    transition: background 200ms ease, transform 200ms ease;
}

.fs-heart.on {
    background: linear-gradient(180deg, #ff7d6e, #d9483b);
}

.fs-off {
    color: var(--cg-muted);
    font-size: 13px;
    font-style: normal;
}

.fs-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--cg-line);
    border-radius: 12px;
    background: linear-gradient(180deg, #fff, #f1f4ef);
    color: var(--cg-ink);
    font: inherit;
    font-size: 20px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 3px 8px rgba(20, 48, 58, 0.08);
}

.fs-icon:disabled {
    opacity: 0.4;
    cursor: default;
}

.fs-ico {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.fs-stage {
    display: flex;
    justify-content: center;
}

.fs-board-wrap {
    position: relative;
    width: min(100%, 640px, calc(100svh - 230px));
    min-width: 280px;
    aspect-ratio: 1;
    border-radius: 22px;
    box-shadow: 0 18px 40px rgba(13, 32, 41, 0.35), 0 4px 10px rgba(13, 32, 41, 0.25);
}

.fs-board {
    display: block;
    width: 100%;
    height: 100%;
    aspect-ratio: 1;
    border-radius: 22px;
    background: #14303a;
    touch-action: manipulation;
    outline: none;
    cursor: pointer;
}

.fs-board:focus-visible {
    box-shadow: 0 0 0 3px var(--fs-teal);
}

.fs-result {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 18px;
    border-radius: 22px;
    background: rgba(12, 30, 38, 0.82);
    color: #f4fbf8;
    text-align: center;
    backdrop-filter: blur(3px);
    animation: fs-in 300ms ease both;
}

.fs-result[hidden] {
    display: none;
}

.fs-result > strong {
    font-size: clamp(26px, 7vw, 40px);
    color: var(--fs-amber);
}

.fs-loss > strong {
    color: #ff8e80;
}

.fs-result p {
    margin: 0;
    color: #c8ddd6;
    font-size: 14px;
}

.fs-tiles {
    display: flex;
    gap: 8px;
}

.fs-tiles > div {
    min-width: 76px;
    padding: 8px 10px;
    border: 1px solid rgba(160, 230, 215, 0.3);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.07);
}

.fs-tiles span {
    display: block;
    color: #9fbdb5;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.fs-tiles strong {
    font-size: 20px;
}

.fs-result-actions {
    display: flex;
    gap: 8px;
}

@keyframes fs-in {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: none; }
}

.fs-pad {
    display: grid;
    grid-template-columns: repeat(var(--n, 5), 1fr);
    gap: 8px;
    width: min(100%, 640px);
    margin: 12px auto 0;
}

.fs-pad[data-n="4"] { --n: 4; }
.fs-pad[data-n="5"] { --n: 5; }
.fs-pad[data-n="6"] { --n: 6; }

.fs-pad-key {
    position: relative;
    min-height: 52px;
    padding: 0;
    border: 1px solid #b9c9c0;
    border-bottom-width: 3px;
    border-radius: 12px;
    background: linear-gradient(180deg, #fff, #e9f0ea);
    color: var(--fs-deep);
    font: inherit;
    cursor: pointer;
    transition: transform 90ms ease;
}

.fs-pad-key:active {
    transform: translateY(2px);
}

.fs-pad-key b {
    font-size: 24px;
    font-weight: 800;
}

.fs-pad-key small {
    position: absolute;
    right: 6px;
    bottom: 3px;
    color: var(--cg-muted);
    font-size: 10px;
    font-weight: 800;
}

.fs-pad-key.fs-done {
    opacity: 0.35;
}

.fs-pad.fs-notes .fs-pad-key {
    background: linear-gradient(180deg, #fff7dc, #f3e2ae);
    border-color: #d7b85c;
}

.fs-actions,
.fs-modes {
    display: flex;
    gap: 8px;
    width: min(100%, 640px);
    margin: 10px auto 0;
}

.fs-action {
    flex: 1 1 0;
    min-width: 0;
    min-height: 44px;
    padding: 0 6px;
    border: 1px solid var(--cg-line);
    border-radius: 12px;
    background: linear-gradient(180deg, #fff, #f1f4ef);
    color: var(--cg-ink);
    font: inherit;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 3px 8px rgba(20, 48, 58, 0.06);
}

.fs-action:disabled {
    opacity: 0.4;
    cursor: default;
}

.fs-action[aria-pressed="true"] {
    border-color: var(--fs-teal);
    background: linear-gradient(180deg, #dff6ee, #b9e9da);
    color: #0c4a3a;
}

.fs-actions .fs-action[data-action="notes"][aria-pressed="true"] {
    border-color: #d7b85c;
    background: linear-gradient(180deg, #fff2c4, #f6d97e);
    color: #6b4e08;
}

.fs-new,
.fs-primary {
    border-color: #1f8f77;
    background: linear-gradient(180deg, #37c4a3, #1f9c80);
    color: #fff;
}

.fs-result .fs-action {
    flex: 0 0 auto;
    min-width: 110px;
    color: var(--fs-deep);
}

.fs-result .fs-primary {
    color: #fff;
}

.fs-modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(10, 24, 30, 0.6);
}

.fs-modal[hidden] {
    display: none;
}

.fs-modal-panel {
    width: min(100%, 460px);
    max-height: 86vh;
    overflow: auto;
    padding: 16px 18px 6px;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}

.fs-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 20px;
}

.fs-modal-panel p {
    margin: 0 0 10px;
    color: #33433f;
    font-size: 14px;
    line-height: 1.45;
}

@media (max-width: 480px) {
    .fs-chip:not(:last-child) span {
        display: none;
    }
    .fs-chip {
        padding: 0 8px;
    }
    .fs-board-wrap {
        width: 100%;
    }
    .fs-actions,
    .fs-modes,
    .fs-pad {
        gap: 6px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .fs-result {
        animation: none;
    }
}
