:root {
    --base-color: #1a1a2e;
    --accent: #e94560;
    --accent2: #f5a623;
    --card-bg: #ffffff;
    --card-border: #ccc;
    --text: #f0f0f0;
    --text-dark: #1a1a2e;
    --win-color: #27ae60;
    --lose-color: #c0392b;
    --tie-color: #7f8c8d;
    --btn-radius: 10px;
    --font: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font);
    background: var(--base-color);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

/* ── Login ── */
.login {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    font-size: 1.2rem;
}

/* ── Title bar ── */
.tp-title {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255,255,255,0.05);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.tp-title h2 {
    font-size: 1.2rem;
    color: var(--accent2);
    letter-spacing: 1px;
}

#balance_span {
    font-size: 0.9rem;
    color: var(--text);
}

/* ── Sections (dealer / player) ── */
.tp-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 0 6px;
}

.tp-label {
    font-size: 0.75rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.5);
    margin-bottom: 6px;
}

.tp-hand-name {
    margin-top: 6px;
    font-size: 0.85rem;
    color: var(--accent2);
    font-weight: bold;
}

/* ── Cards ── */
.tp-hand {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.tp-card {
    width: clamp(60px, 18vw, 80px);
    height: clamp(88px, 26vw, 115px);
    border-radius: 8px;
    background: var(--card-bg);
    border: 2px solid var(--card-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-dark);
    font-weight: bold;
    box-shadow: 2px 4px 10px rgba(0,0,0,0.4);
    position: relative;
}

.tp-card-rank {
    font-size: clamp(1.4rem, 5vw, 1.8rem);
    line-height: 1;
}

.tp-card-suit {
    font-size: clamp(1.2rem, 4.5vw, 1.5rem);
    line-height: 1;
}

.tp-card-red {
    color: #c0392b;
}

.tp-card-back {
    background: linear-gradient(135deg, #1e3a5f 25%, #0d2137 75%);
    background-image: repeating-linear-gradient(
        45deg,
        rgba(255,255,255,0.05) 0px,
        rgba(255,255,255,0.05) 2px,
        transparent 2px,
        transparent 8px
    );
    border-color: #1e3a5f;
}

.tp-card-empty {
    background: rgba(255,255,255,0.05);
    border: 2px dashed rgba(255,255,255,0.15);
}

.tp-card-anim {
    animation: card-deal 0.3s ease-out;
}

@keyframes card-deal {
    from { transform: translateY(-20px) scale(0.9); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}

/* ── Pot ── */
.tp-pot {
    text-align: center;
    font-size: 1rem;
    padding: 8px 0;
    color: var(--accent2);
    font-weight: bold;
    min-height: 36px;
}

/* ── Messages ── */
.tp-message {
    text-align: center;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.7);
    padding: 4px 16px;
    min-height: 28px;
}

.tp-result {
    text-align: center;
    font-size: 1.1rem;
    font-weight: bold;
    padding: 10px 20px;
    border-radius: 8px;
    margin: 6px 16px;
}

.tp-win  { background: rgba(39,174,96,0.25); color: #2ecc71; border: 1px solid #27ae60; }
.tp-lose { background: rgba(192,57,43,0.25); color: #e74c3c; border: 1px solid #c0392b; }
.tp-tie  { background: rgba(127,140,141,0.25); color: #bdc3c7; border: 1px solid #7f8c8d; }

/* ── Action buttons ── */
.tp-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    padding: 10px 16px;
    width: 100%;
}

.tp-deal-row {
    display: flex;
    gap: 10px;
    justify-content: center;
    padding: 10px 16px;
    width: 100%;
    margin-top: auto;
}

.tp-btn {
    padding: 12px 18px;
    border: none;
    border-radius: var(--btn-radius);
    font-size: 0.95rem;
    font-weight: bold;
    cursor: pointer;
    flex: 1;
    max-width: 130px;
    transition: opacity 0.15s;
}

.tp-btn:active { opacity: 0.75; }

.tp-btn-deal  { background: var(--accent2); color: #1a1a2e; }
.tp-btn-chips { background: rgba(255,255,255,0.1); color: var(--text); border: 1px solid rgba(255,255,255,0.2); }
.tp-btn-pack  { background: rgba(192,57,43,0.8); color: white; }
.tp-btn-chaal { background: rgba(39,174,96,0.8); color: white; }
.tp-btn-show  { background: rgba(52,152,219,0.8); color: white; }
.tp-btn-see   { background: rgba(155,89,182,0.8); color: white; }

/* ── Modal ── */
.tp-modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.tp-modal-backdrop.active { display: flex; }

.tp-modal-content {
    background: #16213e;
    border-radius: 12px;
    padding: 20px;
    width: min(90vw, 380px);
    position: relative;
}

.tp-close {
    position: absolute;
    top: 12px;
    right: 14px;
    cursor: pointer;
    font-size: 1.1rem;
    color: rgba(255,255,255,0.6);
}

.tp-modal-content h3 {
    text-align: center;
    margin-bottom: 14px;
    color: var(--accent2);
}

.tp-table-prices {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.tp-table-prices th,
.tp-table-prices td {
    padding: 8px 6px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.tp-table-prices th { color: var(--accent2); }

/* ── Leaderboard ── */
.tp-btn-leaderboard { background: rgba(255,255,255,0.1); color: var(--text); border: 1px solid rgba(255,255,255,0.2); font-size: 1.1rem; }

.tp-lb-tabs { width: 100%; border-collapse: collapse; }
.tp-lb-tabs th { width: 33%; padding: 12px 4px; text-align: center; cursor: pointer; font-size: 0.85rem; color: rgba(255,255,255,0.6); border-bottom: 2px solid rgba(255,255,255,0.1); }
.tp-lb-tabs th.selected_filter { color: var(--accent); border-bottom-color: var(--accent); }

.tp-top3 { display: flex; justify-content: center; align-items: flex-end; gap: 10px; padding: 20px 8px 8px; }
.tp-winner-card { display: flex; flex-direction: column; align-items: center; background: rgba(255,255,255,0.05); border-radius: 10px; padding: 10px 8px; min-width: 90px; text-align: center; gap: 4px; }
.tp-winner-card.first { transform: scale(1.08); border: 1px solid var(--accent2); }
.tp-winner-name { font-size: 0.8rem; color: var(--text); }
.tp-winner-chips { font-size: 0.75rem; color: var(--accent2); font-weight: bold; }

.tp-lb-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin-top: 8px; }
.tp-lb-table td { padding: 7px 8px; border-bottom: 1px solid rgba(255,255,255,0.07); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 30vw; }
.tp-lb-table tr.tp-my-row td { background: rgba(233,69,96,0.15); color: var(--accent2); }
.tp-lb-table tr:nth-child(even) td { background: rgba(255,255,255,0.03); }

.tp-note {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.4);
    text-align: center;
    margin-top: 12px;
}

.tp-ad-divider {
    text-align: center;
    color: rgba(255,255,255,0.3);
    font-size: 0.75rem;
    margin: 14px 0 10px;
    position: relative;
}
.tp-ad-divider::before,
.tp-ad-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 42%;
    height: 1px;
    background: rgba(255,255,255,0.1);
}
.tp-ad-divider::before { left: 0; }
.tp-ad-divider::after  { right: 0; }

.tp-ad-row {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
}

.tp-btn-share,
.tp-btn-ad {
    background: rgba(255,255,255,0.08);
    color: var(--text);
    border: 1px solid rgba(255,255,255,0.2);
    flex: 0 0 auto;
    max-width: none;
    padding: 10px 16px;
    white-space: nowrap;
}

.tp-ad-caption {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.5);
}
