#game-root .pf-shell {
    max-width: 700px;
    margin: 0 auto;
    padding: 16px;
    border: 1px solid var(--cg-line);
    border-radius: 12px;
    background: #fff;
    box-shadow: var(--cg-shadow);
}

#game-root .pf-bar,
#game-root .pf-hud,
#game-root .pf-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

#game-root .pf-bar {
    justify-content: center;
    margin-bottom: 10px;
}

#game-root .pf-mini,
#game-root .pf-card {
    min-width: 76px;
    padding: 7px 10px;
    border: 1px solid var(--cg-line);
    border-radius: 8px;
    background: #f8faf8;
    text-align: center;
}

#game-root .pf-mini span,
#game-root .pf-card span {
    display: block;
    color: var(--cg-muted);
    font-size: 0.67rem;
    font-weight: 800;
    text-transform: uppercase;
}

#game-root .pf-mini strong,
#game-root .pf-card strong {
    display: block;
    margin-top: 2px;
    font-size: 1rem;
}

#game-root .pf-btn,
#game-root .pf-icon {
    min-height: 40px;
    padding: 8px 13px;
    border: 1px solid #bbc8c3;
    border-radius: 8px;
    background: #fff;
    color: var(--cg-ink);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
}

#game-root .pf-icon {
    min-width: 48px;
    padding: 6px;
}

#game-root .pf-btn:hover,
#game-root .pf-btn:focus-visible,
#game-root .pf-icon:hover,
#game-root .pf-icon:focus-visible {
    border-color: var(--cg-teal);
    outline: none;
}

#game-root .pf-primary {
    border-color: var(--cg-green);
    background: var(--cg-green);
    color: #fff;
}

#game-root .pf-hud {
    justify-content: center;
    margin-bottom: 9px;
}

#game-root .pf-timebar {
    height: 9px;
    margin-bottom: 9px;
    overflow: hidden;
    border-radius: 99px;
    background: #dce5e1;
}

#game-root .pf-timefill {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #1d7f62, #42a985);
    transition: width 0.2s linear, background 0.2s ease;
}

#game-root .pf-low {
    background: linear-gradient(90deg, #bd3c37, #e17a4f);
}

#game-root .pf-status,
#game-root .pf-hint {
    color: var(--cg-muted);
    text-align: center;
    font-size: 0.82rem;
    line-height: 1.4;
}

#game-root .pf-status {
    min-height: 22px;
    margin-bottom: 8px;
}

#game-root .pf-boardwrap {
    position: relative;
    max-width: 580px;
    margin: 0 auto;
    padding: 18px 42px;
    border-radius: 14px;
    background: linear-gradient(145deg, #dce9e5, #eaf0f4);
}

#game-root .pf-board {
    display: grid;
    gap: 5px;
    outline: none;
}

#game-root .pf-cell {
    position: relative;
    aspect-ratio: 1;
    min-width: 0;
    padding: 4px;
    overflow: hidden;
    border: 1px solid #aab9b4;
    border-radius: 8px;
    background: #f8faf9;
    color: #64746f;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, transform 0.12s ease;
}

#game-root .pf-cell:hover {
    transform: scale(1.03);
}

#game-root .pf-cell svg {
    display: block;
    width: 100%;
    height: 100%;
    transition: transform 0.16s ease;
}

#game-root .pf-cell.pf-live {
    border-color: #2c8ba3;
    background: #d9f2f8;
    color: #1789aa;
    box-shadow: inset 0 0 12px rgba(23, 137, 170, 0.18);
}

#game-root .pf-cell.pf-wet {
    animation: pf-pulse 0.7s ease infinite alternate;
}

#game-root .pf-cell.pf-cursor {
    outline: 3px solid var(--cg-amber);
    outline-offset: 1px;
}

@keyframes pf-pulse {
    to { background: #bcebf5; }
}

#game-root .pf-marker {
    position: absolute;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 39px;
    height: 30px;
    transform: translateY(-50%);
    border-radius: 7px;
    color: #fff;
    font-size: 0.66rem;
    font-weight: 900;
    letter-spacing: 0.04em;
}

#game-root .pf-src {
    left: 3px;
    background: var(--cg-blue);
}

#game-root .pf-drain {
    right: 3px;
    background: var(--cg-green);
}

#game-root .pf-over {
    position: absolute;
    inset: 0;
    display: grid;
    z-index: 3;
    place-items: center;
    padding: 16px;
    border-radius: inherit;
    background: rgba(20, 31, 29, 0.58);
}

#game-root .pf-over[hidden] {
    display: none;
}

#game-root .pf-panel {
    width: min(380px, 100%);
    padding: 20px;
    border-radius: 12px;
    background: #fff;
    text-align: center;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.24);
}

#game-root .pf-panel h2 {
    margin: 0 0 6px;
}

#game-root .pf-panel p {
    margin: 0 0 14px;
    color: var(--cg-muted);
    line-height: 1.45;
}

#game-root .pf-row {
    justify-content: center;
}

#game-root .pf-hint {
    margin-top: 10px;
}

@media (max-width: 560px) {
    #game-root .pf-shell {
        padding: 10px;
    }

    #game-root .pf-bar {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
    }

    #game-root .pf-bar .pf-icon,
    #game-root .pf-bar .pf-btn {
        grid-row: 2;
    }

    #game-root .pf-mini {
        min-width: 0;
    }

    #game-root .pf-boardwrap {
        padding: 12px 30px;
    }

    #game-root .pf-board {
        gap: 3px;
    }

    #game-root .pf-cell {
        padding: 2px;
        border-radius: 5px;
    }

    #game-root .pf-marker {
        width: 29px;
        height: 24px;
        font-size: 0.56rem;
    }

    #game-root .pf-src { left: 1px; }
    #game-root .pf-drain { right: 1px; }
}
