.kl-shell {
    --kl-cell: 60px;
    --kl-tray: #3b2a1c;
    --kl-tray-b: #23180f;
    max-width: 620px;
    margin: 0 auto;
    padding: 12px 10px 28px;
    color: var(--cg-ink);
    font-family: Inter, Arial, sans-serif;
}

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

.kl-stats,
.kl-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.kl-stat {
    min-width: 66px;
    padding: 7px 9px;
    border: 1px solid var(--cg-line);
    border-radius: 9px;
    background: var(--cg-panel);
    box-shadow: 0 6px 16px rgba(30, 37, 40, 0.06);
}

.kl-stat span {
    display: block;
    color: var(--cg-muted);
    font-size: 10px;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.kl-stat strong {
    display: block;
    margin-top: 2px;
    font-size: 18px;
    line-height: 1;
}

.kl-over-par #kl-moves {
    color: var(--cg-amber);
}

.kl-btn {
    min-height: 44px;
    padding: 9px 14px;
    border: 1px solid var(--cg-line);
    border-radius: 9px;
    background: var(--cg-panel);
    color: var(--cg-ink);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.1s ease, border-color 0.1s ease;
}

.kl-btn:hover {
    border-color: var(--cg-teal);
    transform: translateY(-1px);
}

.kl-btn:active {
    transform: translateY(0);
}

.kl-icon {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.kl-icon svg {
    width: 20px;
    height: 20px;
}

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

.kl-primary:hover {
    border-color: var(--cg-green);
    filter: brightness(1.08);
}

.kl-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    padding: 8px 12px;
    border: 1px solid var(--cg-line);
    border-radius: 9px;
    background: var(--cg-panel);
    font-size: 0.9rem;
    font-weight: 800;
}

.kl-bar #kl-best {
    color: var(--cg-muted);
    font-size: 0.82rem;
}

.kl-stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: clamp(360px, 72vh, 660px);
    padding: 10px;
    border-radius: 16px;
    border: 1px solid #101820;
    background:
        radial-gradient(circle at 50% 0%, rgba(120, 145, 175, 0.26), transparent 62%),
        linear-gradient(165deg, #263039, #141c24);
    box-shadow: var(--cg-shadow);
    overflow: hidden;
}

.kl-tray {
    position: relative;
    padding: 10px 10px 26px;
    border-radius: 14px;
    background: linear-gradient(160deg, var(--kl-tray), var(--kl-tray-b));
    box-shadow:
        inset 0 2px 0 rgba(255, 255, 255, 0.14),
        inset 0 -4px 10px rgba(0, 0, 0, 0.6),
        0 10px 24px rgba(0, 0, 0, 0.45);
}

.kl-board {
    position: relative;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.34);
    touch-action: none;
    outline: none;
}

.kl-board:focus-visible {
    box-shadow: 0 0 0 3px rgba(33, 199, 214, 0.75);
}

.kl-exit {
    position: absolute;
    left: 50%;
    bottom: 5px;
    transform: translateX(-50%);
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0 0 8px 8px;
    background: linear-gradient(180deg, rgba(240, 200, 120, 0.25), rgba(240, 200, 120, 0.05));
    box-shadow: inset 0 2px 0 rgba(255, 214, 140, 0.55);
}

.kl-exit span {
    color: #f6d9a4;
    font-size: 0.6rem;
    font-weight: 900;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

.kl-p {
    position: absolute;
    top: 0;
    left: 0;
    border-radius: 7px;
    transition: transform 0.11s ease-out;
    will-change: transform;
    cursor: grab;
    box-shadow:
        inset 0 2px 0 rgba(255, 255, 255, 0.34),
        inset 0 -3px 6px rgba(0, 0, 0, 0.4),
        0 4px 10px rgba(0, 0, 0, 0.45);
}

.kl-p::after {
    content: '';
    position: absolute;
    inset: 14%;
    border-radius: 5px;
    border: 2px solid rgba(255, 255, 255, 0.14);
}

.kl-B {
    background: linear-gradient(160deg, #f0a24f, #b85f16);
    box-shadow:
        inset 0 3px 0 rgba(255, 255, 255, 0.42),
        inset 0 -5px 10px rgba(0, 0, 0, 0.42),
        0 0 18px rgba(240, 162, 79, 0.4),
        0 6px 14px rgba(0, 0, 0, 0.5);
    z-index: 3;
}

.kl-B::after {
    inset: 12%;
    border-color: rgba(255, 255, 255, 0.3);
}

.kl-V {
    background: linear-gradient(160deg, #74a4c8, #35617f);
}

.kl-H {
    background: linear-gradient(160deg, #6fc0ac, #2b7f6c);
}

.kl-S {
    background: linear-gradient(160deg, #cbc0a4, #8b7d5d);
}

.kl-p.kl-sel {
    outline: 3px solid #ffd66b;
    outline-offset: -3px;
    z-index: 4;
}

.kl-p.kl-cursor {
    outline: 3px dashed rgba(255, 255, 255, 0.7);
    outline-offset: -3px;
    z-index: 4;
}

.kl-p.kl-drag {
    filter: brightness(1.1);
    cursor: grabbing;
}

.kl-win {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
    background: rgba(12, 18, 24, 0.74);
    animation: kl-fade 0.2s ease;
}

@keyframes kl-fade {
    from { opacity: 0; }
}

.kl-win-card {
    max-width: 340px;
    width: 100%;
    padding: 18px;
    border: 1px solid var(--cg-line);
    border-radius: 14px;
    background: var(--cg-panel);
    box-shadow: var(--cg-shadow);
    text-align: center;
}

.kl-win-kicker {
    display: block;
    color: var(--cg-amber);
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.kl-win-card strong {
    display: block;
    margin: 5px 0 3px;
    font-size: 1.3rem;
}

.kl-win-card p {
    margin: 0 0 12px;
    color: var(--cg-muted);
    font-size: 0.88rem;
}

.kl-win-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.kl-status {
    min-height: 22px;
    margin: 11px 2px 10px;
    color: var(--cg-muted);
    font-size: 0.92rem;
    font-weight: 600;
}

.kl-controls {
    display: flex;
    gap: 8px;
}

.kl-wide {
    flex: 1;
    min-width: 90px;
    padding: 9px 6px;
}

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

.kl-modal-card {
    position: relative;
    max-width: 430px;
    width: 100%;
    padding: 20px 22px;
    border-radius: 14px;
    background: var(--cg-panel);
    border: 1px solid var(--cg-line);
    box-shadow: var(--cg-shadow);
}

.kl-modal-wide {
    max-width: 520px;
    max-height: 82vh;
    overflow-y: auto;
}

.kl-modal-card h2 {
    margin: 0 0 10px;
    font-size: 1.15rem;
}

.kl-modal-card p {
    margin: 0 0 10px;
    color: var(--cg-muted);
    font-size: 0.92rem;
    line-height: 1.45;
}

.kl-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--cg-muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.kl-close:hover {
    color: var(--cg-ink);
    background: var(--cg-bg);
}

.kl-picker-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
}

.kl-pick {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    min-height: 62px;
    padding: 8px 10px;
    border: 1px solid var(--cg-line);
    border-radius: 10px;
    background: var(--cg-panel);
    color: var(--cg-ink);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.kl-pick b {
    color: var(--cg-muted);
    font-size: 0.68rem;
    letter-spacing: 0.06em;
}

.kl-pick span {
    font-size: 0.92rem;
    font-weight: 800;
}

.kl-pick em {
    color: var(--cg-muted);
    font-size: 0.72rem;
    font-style: normal;
    font-weight: 700;
}

.kl-pick:hover {
    border-color: var(--cg-teal);
}

.kl-pick-done {
    border-color: #84b8a6;
    background: #e3f5ed;
}

.kl-pick-daily {
    box-shadow: inset 0 0 0 2px var(--cg-amber);
}

.kl-pick-now {
    border-color: var(--cg-teal);
    box-shadow: 0 0 0 2px rgba(18, 122, 137, 0.35);
}

@media (max-width: 640px) {
    .kl-shell {
        padding: 8px 6px 22px;
    }

    .kl-stat {
        min-width: 56px;
        padding: 6px 7px;
    }

    .kl-stat strong {
        font-size: 15px;
    }

    .kl-stage {
        height: clamp(330px, 62vh, 470px);
        padding: 6px;
        border-radius: 13px;
    }

    .kl-tray {
        padding: 8px 8px 22px;
    }

    .kl-btn {
        padding: 9px 6px;
        font-size: 0.82rem;
    }

    .kl-bar {
        font-size: 0.82rem;
        padding: 7px 10px;
    }

    .kl-status {
        font-size: 0.84rem;
    }
}
