.tp-shell {
    --tp-cw: 60px;
    --tp-ch: 85px;
    --tp-felt: #274a6b;
    max-width: 1020px;
    margin: 0 auto;
    padding: 0 0 26px;
    color: var(--cg-ink);
    font-family: Inter, Arial, sans-serif;
}

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

.tp-stats {
    display: flex;
    align-items: stretch;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
}

.tp-stat {
    flex: 0 1 auto;
    min-width: 74px;
    padding: 7px 10px;
    border: 1px solid var(--cg-line);
    border-radius: 8px;
    background: var(--cg-panel);
    box-shadow: 0 8px 18px rgba(33, 43, 40, 0.07);
}

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

.tp-stat strong {
    display: block;
    margin-top: 2px;
    font-size: 18px;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.tp-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tp-btn,
.tp-chip,
.tp-close {
    min-height: 44px;
    border: 1px solid var(--cg-line);
    border-radius: 8px;
    background: var(--cg-panel);
    color: var(--cg-ink);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(33, 43, 40, 0.07);
    transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.tp-btn {
    padding: 0 14px;
}

.tp-btn:hover,
.tp-chip:hover,
.tp-close:hover {
    transform: translateY(-1px);
    border-color: var(--cg-teal);
}

.tp-btn:focus-visible,
.tp-chip:focus-visible,
.tp-close:focus-visible,
.tp-table:focus-visible {
    outline: 3px solid rgba(18, 122, 137, 0.45);
    outline-offset: 2px;
}

.tp-icon {
    width: 44px;
    min-width: 44px;
    padding: 0;
    display: inline-grid;
    place-items: center;
    font-size: 1.05rem;
}

.tp-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

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

.tp-primary:hover {
    border-color: transparent;
    filter: brightness(1.07);
}

.tp-tablewrap {
    padding: 12px;
    overflow: hidden;
    border: 1px solid #142c42;
    border-radius: 14px;
    background:
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.022) 0 3px, rgba(0, 0, 0, 0.02) 3px 6px),
        radial-gradient(120% 96% at 50% -6%, #3a6790 0%, var(--tp-felt) 54%, #16304a 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.13), inset 0 0 60px rgba(0, 0, 0, 0.32), var(--cg-shadow);
}

.tp-table {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 0.53;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}

.tp-layer,
.tp-fx {
    position: absolute;
    inset: 0;
}

.tp-fx {
    z-index: 940;
    pointer-events: none;
}

.tp-slot,
.tp-card,
.tp-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: var(--tp-cw);
    height: var(--tp-ch);
    border-radius: calc(var(--tp-cw) * 0.09);
}

.tp-slot {
    display: grid;
    place-items: center;
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.16);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.22);
}

.tp-slot-stock {
    cursor: pointer;
}

.tp-slot .tp-mark {
    color: rgba(255, 255, 255, 0.26);
    font-size: calc(var(--tp-cw) * 0.42);
    font-style: normal;
    line-height: 1;
}

.tp-empty .tp-mark {
    opacity: 0.55;
}

.tp-badge {
    position: absolute;
    top: 0;
    left: 0;
    width: var(--tp-cw);
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: calc(var(--tp-cw) * 0.19);
    font-weight: 800;
    white-space: nowrap;
    pointer-events: none;
}

.tp-mult {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 930;
    padding: 4px 10px;
    border-radius: 999px;
    background: #f0f3f6;
    color: #1c3550;
    font-size: calc(var(--tp-cw) * 0.3);
    font-weight: 900;
    line-height: 1.2;
    white-space: nowrap;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.3);
    animation: tp-pump 0.3s ease;
    pointer-events: none;
}

.tp-mult-1 { background: #dbe8f5; color: #1c3550; }
.tp-mult-2 { background: #cfe9d9; color: #12603f; }
.tp-mult-3 { background: #fbe3ae; color: #7a4c07; }
.tp-mult-4 { background: #f9c07f; color: #7a3d07; }
.tp-mult-5 { background: linear-gradient(120deg, #f4712f, #d93b2b); color: #fff; }

@keyframes tp-pump {
    from { transform: scale(0.6); }
    60% { transform: scale(1.18); }
}

.tp-ring {
    z-index: 990;
    border: 3px solid #ffd66b;
    border-radius: calc(var(--tp-cw) * 0.12);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.25), 0 0 16px rgba(255, 214, 107, 0.5);
    pointer-events: none;
}

.tp-card {
    transition: transform 0.2s cubic-bezier(0.22, 0.61, 0.36, 1), opacity 0.2s ease;
    will-change: transform;
    -webkit-user-drag: none;
}

.tp-open,
.tp-top {
    cursor: pointer;
}

.tp-hide {
    opacity: 0;
    pointer-events: none;
}

.tp-face,
.tp-back {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    overflow: hidden;
}

.tp-face {
    background: linear-gradient(168deg, #ffffff 0%, #fbfaf4 62%, #f1efe4 100%);
    border: 1px solid #c9cdc2;
    box-shadow: 0 2px 5px rgba(4, 16, 28, 0.42);
    color: #23282b;
}

.tp-red .tp-face {
    color: #c0322b;
}

.tp-back {
    display: none;
    background:
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.1) 0 4px, transparent 4px 8px),
        repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.1) 0 4px, transparent 4px 8px),
        linear-gradient(160deg, #c9525a, #a03039 58%, #7d2027);
    border: 1px solid #f3e6df;
    box-shadow: 0 3px 7px rgba(4, 16, 28, 0.48);
}

.tp-back::after {
    content: '';
    position: absolute;
    inset: 8%;
    border: 1px solid rgba(255, 255, 255, 0.26);
    border-radius: calc(var(--tp-cw) * 0.05);
}

.tp-down .tp-face {
    display: none;
}

.tp-down .tp-back {
    display: block;
}

.tp-hot .tp-face {
    border-color: #e0b12f;
    box-shadow: 0 0 0 2px rgba(255, 214, 107, 0.9), 0 6px 14px rgba(0, 0, 0, 0.38);
}

.tp-hot::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(80% 60% at 50% 0%, rgba(255, 214, 107, 0.3), transparent 70%);
    pointer-events: none;
}

.tp-top .tp-face {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.7), 0 8px 18px rgba(0, 0, 0, 0.42);
}

.tp-ix {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 0.95;
}

.tp-tl {
    left: 6%;
    top: 3.5%;
}

.tp-br {
    right: 6%;
    bottom: 3.5%;
    transform: rotate(180deg);
}

.tp-ix b {
    font-size: calc(var(--tp-cw) * 0.3);
    font-weight: 800;
    letter-spacing: -0.03em;
}

.tp-ix i {
    margin-top: 1px;
    font-size: calc(var(--tp-cw) * 0.23);
    font-style: normal;
}

.tp-pips-face {
    position: absolute;
    left: 3%;
    right: 3%;
    top: 8%;
    bottom: 8%;
}

.tp-pip {
    position: absolute;
    font-size: calc(var(--tp-cw) * 0.22);
    font-style: normal;
    line-height: 1;
    transform: translate(-50%, -50%);
}

.tp-pip.tp-flip {
    transform: translate(-50%, -50%) rotate(180deg);
}

.tp-big {
    position: absolute;
    left: 50%;
    top: 50%;
    font-size: calc(var(--tp-cw) * 0.5);
    font-style: normal;
    line-height: 1;
    opacity: 0.92;
    transform: translate(-50%, -50%);
}

.tp-alt {
    display: none;
}

.tp-compact .tp-pips-face {
    display: none;
}

.tp-compact .tp-alt {
    display: block;
}

.tp-court {
    position: absolute;
    left: 20%;
    right: 20%;
    top: 19%;
    bottom: 19%;
    display: grid;
    place-items: center;
    border-radius: calc(var(--tp-cw) * 0.05);
    overflow: hidden;
}

.tp-court::before,
.tp-court::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
}

.tp-court::before {
    background: currentColor;
    opacity: 0.07;
}

.tp-court::after {
    border: 1px solid currentColor;
    opacity: 0.32;
}

.tp-court b {
    position: relative;
    z-index: 1;
    font-size: calc(var(--tp-cw) * 0.44);
    line-height: 1.05;
}

.tp-court i {
    position: absolute;
    z-index: 1;
    right: 6%;
    bottom: 2%;
    font-size: calc(var(--tp-cw) * 0.19);
    font-style: normal;
}

.tp-pop {
    position: absolute;
    top: 0;
    left: 0;
    width: var(--tp-cw);
    text-align: center;
    color: #fff;
    font-size: calc(var(--tp-cw) * 0.3);
    font-weight: 900;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
    animation: tp-float 0.9s ease-out forwards;
    pointer-events: none;
}

.tp-pop-hot {
    color: #ffd166;
}

.tp-pop-peak {
    color: #7ee0b2;
    font-size: calc(var(--tp-cw) * 0.22);
    letter-spacing: 0.08em;
}

@keyframes tp-float {
    from { opacity: 0; }
    20% { opacity: 1; }
    to { opacity: 0; margin-top: -46px; }
}

.tp-streakbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    padding: 9px 14px;
    border: 1px solid var(--cg-line);
    border-radius: 10px;
    background: var(--cg-panel);
    box-shadow: 0 8px 18px rgba(33, 43, 40, 0.06);
    transition: border-color 0.2s ease, background 0.2s ease;
    flex-wrap: wrap;
}

.tp-streak-head {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.tp-streak-head span {
    color: var(--cg-muted);
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.tp-streak-head strong {
    min-width: 46px;
    font-size: 1.5rem;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.tp-pips {
    display: flex;
    gap: 4px;
    flex: 1 1 120px;
    min-width: 100px;
}

.tp-pip-dot {
    flex: 1 1 auto;
    height: 8px;
    border-radius: 999px;
    background: #e4e8e2;
    transition: background 0.18s ease;
}

.tp-streak-note {
    color: var(--cg-muted);
    font-size: 0.8rem;
    font-weight: 700;
    flex: 0 1 auto;
}

.tp-streakbar[data-level='1'] { border-color: #a9c6de; background: #f2f7fb; }
.tp-streakbar[data-level='2'] { border-color: #8fc9ad; background: #f0faf5; }
.tp-streakbar[data-level='3'] { border-color: #e5c37c; background: #fdf7ea; }
.tp-streakbar[data-level='4'] { border-color: #ee9f56; background: #fef3e8; }
.tp-streakbar[data-level='5'] { border-color: #e2603c; background: #fdeee9; }

.tp-streakbar[data-level='1'] .tp-pip-on { background: #4f88bb; }
.tp-streakbar[data-level='2'] .tp-pip-on { background: #1d7f62; }
.tp-streakbar[data-level='3'] .tp-pip-on { background: #d69a26; }
.tp-streakbar[data-level='4'] .tp-pip-on { background: #ec8a2c; }
.tp-streakbar[data-level='5'] .tp-pip-on { background: #d93b2b; }

.tp-streakbar[data-level='3'] .tp-streak-head strong { color: #a8700c; }
.tp-streakbar[data-level='4'] .tp-streak-head strong { color: #c26512; }
.tp-streakbar[data-level='5'] .tp-streak-head strong { color: #c02f1f; }

.tp-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.tp-seg {
    display: flex;
    gap: 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 6px 14px rgba(33, 43, 40, 0.07);
}

.tp-seg .tp-chip {
    min-width: 46px;
    padding: 0 14px;
    border-radius: 0;
    box-shadow: none;
}

.tp-seg .tp-chip + .tp-chip {
    border-left: 0;
}

.tp-chip[aria-pressed='true'] {
    background: var(--cg-ink);
    border-color: var(--cg-ink);
    color: #fff;
}

.tp-status {
    margin: 10px 2px 0;
    min-height: 20px;
    color: var(--cg-muted);
    font-size: 0.9rem;
    font-weight: 600;
}

.tp-result {
    margin-top: 12px;
    padding: 16px;
    border: 1px solid #b9d6c9;
    border-radius: 12px;
    background: linear-gradient(135deg, #eef8f3, #ffffff 60%);
    box-shadow: var(--cg-shadow);
    text-align: center;
    animation: tp-rise 0.25s ease;
}

@keyframes tp-rise {
    from { opacity: 0; transform: translateY(8px); }
}

.tp-kicker {
    display: block;
    color: var(--cg-teal);
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.tp-result strong {
    display: block;
    margin: 4px 0 2px;
    font-size: 1.3rem;
}

.tp-result p {
    margin: 0 0 12px;
    color: var(--cg-muted);
    font-size: 0.9rem;
}

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

.tp-shell[data-state='dead'] .tp-result {
    border-color: #e6c3bf;
    background: linear-gradient(135deg, #fdefed, #ffffff 60%);
}

.tp-shell[data-state='dead'] .tp-kicker {
    color: var(--cg-red);
}

.tp-modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: grid;
    place-items: center;
    padding: 16px;
    background: rgba(16, 30, 25, 0.55);
}

.tp-modal-card {
    position: relative;
    width: min(100%, 460px);
    max-height: 86vh;
    overflow-y: auto;
    padding: 22px;
    border: 1px solid var(--cg-line);
    border-radius: 12px;
    background: var(--cg-panel);
    box-shadow: 0 24px 70px rgba(16, 30, 25, 0.3);
}

.tp-modal-card h2 {
    margin: 0 44px 10px 0;
    font-size: 1.2rem;
}

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

.tp-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    padding: 0;
    font-size: 22px;
    line-height: 1;
}

@media (max-width: 640px) {
    .tp-shell {
        padding-bottom: 74px;
    }

    .tp-topbar {
        flex-wrap: nowrap;
        gap: 8px;
    }

    .tp-stat {
        min-width: 50px;
        padding: 6px 6px;
    }

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

    .tp-stat-wide {
        display: none;
    }

    .tp-btn,
    .tp-chip,
    .tp-close {
        min-height: 40px;
        font-size: 0.82rem;
    }

    .tp-icon {
        width: 40px;
        min-width: 40px;
    }

    .tp-actions {
        gap: 6px;
    }

    .tp-tablewrap {
        padding: 7px;
        border-radius: 10px;
    }

    .tp-table {
        aspect-ratio: 1 / 0.7;
    }

    .tp-wide-only {
        display: none;
    }

    .tp-btn {
        padding: 0 11px;
    }

    .tp-seg .tp-chip {
        min-width: 40px;
        padding: 0 10px;
    }

    .tp-controls {
        gap: 6px;
    }

    .tp-streakbar {
        gap: 8px;
        padding: 8px 10px;
    }

    .tp-streak-head strong {
        font-size: 1.25rem;
    }

    .tp-streak-note {
        flex: 1 1 100%;
        font-size: 0.74rem;
    }
}
