/* ===== WINGO — Royale Violet ===== */
#game-wingo {
    --rv-gold: #f5c451;
    --rv-gold-bright: #ffd76a;
    --rv-gold-deep: #b9822a;
    --rv-violet: #8b5cf6;
    --rv-emerald: #22c55e;
    --rv-red: #ef4444;
    --rv-text: #f5f0ff;
    --rv-text2: #a79fc2;
    --rv-text3: #6f6794;
    font-family: -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--rv-text);
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    flex-shrink: 0;
}
#game-wingo > * { flex-shrink: 0; }

.wingo-app { display: flex; flex-direction: column; gap: 8px; }
.wingo-app > * { flex-shrink: 0; }

/* ---------- self-contained header ---------- */
.wingo-header-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 2px;
}
.wingo-header-back {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.06);
    color: var(--rv-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.wingo-header-back:active { transform: scale(0.92); }
.wingo-header-user { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; }
.wingo-header-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid rgba(139, 92, 246, 0.6);
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.4);
    background: #1a1030;
}
.wingo-header-avatar img { width: 100%; height: 100%; object-fit: cover; }
.wingo-header-name { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.wingo-header-name span:first-child { font-weight: 800; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wingo-header-uid { font-size: 0.7rem; color: var(--rv-text3); font-weight: 600; }
.wingo-header-balance { text-align: right; }
.wingo-balance-label { display: block; font-size: 0.6rem; letter-spacing: 0.1em; color: var(--rv-text3); font-weight: 700; }
.wingo-balance-value {
    font-size: 1.25rem;
    font-weight: 900;
    background: linear-gradient(180deg, #ffe9a8, #f5c451 55%, #c98f1f);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    white-space: nowrap;
}
.wingo-coin { font-size: 0.95rem; }

/* ---------- mode tabs ---------- */
.wingo-modes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.wingo-mode-card {
    border-radius: 14px;
    padding: 9px 4px;
    border: 1px solid rgba(245, 196, 81, 0.18);
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.015));
    color: var(--rv-text2);
    cursor: pointer;
}
.wingo-mode-card:active { transform: scale(0.96); }
.wingo-mode-card.active {
    background: linear-gradient(180deg, var(--rv-gold-bright), #e8a91c);
    border-color: transparent;
    box-shadow: 0 6px 16px rgba(245, 196, 81, 0.4);
}
.wingo-mode-card.active .wingo-mode-title { color: #2a1a00; }
.wingo-mode-title { font-size: 0.68rem; font-weight: 900; line-height: 1.3; }

/* ---------- ticket ---------- */
.wingo-ticket {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-radius: 18px;
    padding: 10px 14px;
    background:
        radial-gradient(120% 100% at 50% 0%, rgba(139, 92, 246, 0.22), transparent 60%),
        linear-gradient(165deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(245, 196, 81, 0.25);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.wingo-ticket-title { font-size: 0.9rem; font-weight: 900; color: var(--rv-gold-bright); margin-bottom: 6px; }
.wingo-ticket-balls { display: flex; gap: 4px; }
.wingo-ticket-balls img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5);
}
.wingo-ticket-right { text-align: right; }
.wingo-time-label { font-size: 0.6rem; color: var(--rv-text3); font-weight: 700; letter-spacing: 0.04em; }
.wingo-timer-digits { display: flex; align-items: center; justify-content: flex-end; gap: 3px; margin: 2px 0; }
.wingo-digit {
    min-width: 40px;
    padding: 4px 6px;
    border-radius: 10px;
    background: rgba(10, 6, 22, 0.65);
    border: 1px solid rgba(139, 92, 246, 0.45);
    font-size: 1.25rem;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    color: var(--rv-gold-bright);
    text-align: center;
    text-shadow: 0 0 12px rgba(245, 196, 81, 0.4);
}
.wingo-colon { font-size: 1.1rem; font-weight: 900; color: var(--rv-violet); }
.wingo-period { font-family: ui-monospace, monospace; font-size: 0.72rem; color: var(--rv-text2); font-weight: 700; }

/* ---------- bet panel ---------- */
.wingo-bet-panel {
    position: relative;
    border-radius: 18px;
    padding: 10px;
    background:
        radial-gradient(120% 90% at 50% 0%, rgba(139, 92, 246, 0.12), transparent 60%),
        linear-gradient(165deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015));
    border: 1px solid rgba(245, 196, 81, 0.2);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: hidden;
}
.wingo-lock-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
    background: rgba(6, 3, 14, 0.72);
    backdrop-filter: blur(3px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}
.wingo-lock-num {
    font-size: 2.4rem;
    font-weight: 900;
    background: linear-gradient(180deg, #ffe9a8, #f5c451 55%, #c98f1f);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-variant-numeric: tabular-nums;
}
.wingo-lock-text { font-size: 0.75rem; font-weight: 800; color: #f87171; letter-spacing: 0.06em; }

.wingo-color-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.wingo-color-btn {
    padding: 10px 4px;
    border: none;
    border-radius: 14px;
    font-size: 0.82rem;
    font-weight: 900;
    letter-spacing: 0.03em;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.wingo-color-btn:active { transform: scale(0.96); }
.wingo-color-btn.wingo-green { background: linear-gradient(180deg, #4ade80, #15803d); }
.wingo-color-btn.wingo-violet { background: linear-gradient(180deg, #a78bfa, #7c3aed); }
.wingo-color-btn.wingo-red { background: linear-gradient(180deg, #f87171, #dc2626); }

.wingo-balls-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.wingo-ball-btn {
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
    border-radius: 50%;
    transition: transform 0.1s ease;
}
.wingo-ball-btn:active { transform: scale(0.88); }
.wingo-ball-btn img {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    display: block;
    border: 2px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.5), 0 0 10px rgba(139, 92, 246, 0.25);
}

.wingo-mult-row { display: flex; gap: 5px; align-items: center; }
.wingo-random-btn {
    flex: 1;
    padding: 8px 4px;
    border-radius: 12px;
    border: 1px solid rgba(245, 196, 81, 0.4);
    background: rgba(245, 196, 81, 0.12);
    color: var(--rv-gold-bright);
    font-size: 0.7rem;
    font-weight: 800;
    cursor: pointer;
}
.wingo-random-btn:active { transform: scale(0.96); }
.wingo-mult-chip {
    padding: 8px 7px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.06);
    color: var(--rv-text2);
    font-size: 0.66rem;
    font-weight: 800;
    cursor: pointer;
}
.wingo-mult-chip.active {
    background: linear-gradient(180deg, var(--rv-gold-bright), #e8a91c);
    border-color: transparent;
    color: #2a1a00;
}

.wingo-bs-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.wingo-bs-btn {
    padding: 11px 4px;
    border: none;
    border-radius: 14px;
    font-size: 0.85rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.wingo-bs-btn:active { transform: scale(0.96); }
.wingo-bs-btn.wingo-big { background: linear-gradient(180deg, #fbbf24, #d97706); }
.wingo-bs-btn.wingo-small { background: linear-gradient(180deg, #60a5fa, #2563eb); }

/* ---------- history ---------- */
.wingo-history-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.wingo-hist-tab {
    padding: 9px 4px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.05);
    color: var(--rv-text2);
    font-size: 0.76rem;
    font-weight: 800;
    cursor: pointer;
}
.wingo-hist-tab.active {
    background: rgba(139, 92, 246, 0.25);
    border-color: rgba(139, 92, 246, 0.6);
    color: #e9e2ff;
}
.wingo-table-wrap {
    border-radius: 16px;
    border: 1px solid rgba(245, 196, 81, 0.18);
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015));
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 220px;
}
.wingo-table-head {
    display: grid;
    grid-template-columns: 1.2fr 0.7fr 0.8fr 0.9fr;
    padding: 8px 12px;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: var(--rv-text3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
#wingo-table-body { overflow-y: auto; scrollbar-width: none; }
#wingo-table-body::-webkit-scrollbar { display: none; }
.wingo-table-row {
    display: grid;
    grid-template-columns: 1.2fr 0.7fr 0.8fr 0.9fr;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.76rem;
}
.wingo-color-dots { display: flex; gap: 4px; }
.wingo-color-dot { width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 0 6px currentColor; }
.wingo-color-dot.red { background: #ef4444; color: #ef4444; }
.wingo-color-dot.green { background: #22c55e; color: #22c55e; }
.wingo-color-dot.violet { background: #8b5cf6; color: #8b5cf6; }

/* ---------- bet modal ---------- */
.wingo-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(6, 3, 14, 0.7);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.wingo-modal-card {
    width: 100%;
    max-width: 360px;
    border-radius: 22px;
    overflow: hidden;
    background: linear-gradient(165deg, #2a1a4e, #150a28);
    border: 1px solid rgba(245, 196, 81, 0.3);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}
.wingo-modal-header { padding: 14px 16px 10px; }
.wingo-modal-header.theme-green { background: linear-gradient(135deg, #22c55e, #15803d); }
.wingo-modal-header.theme-red { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.wingo-modal-header.theme-violet { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.wingo-modal-header.theme-orange { background: linear-gradient(135deg, #f59e0b, #d97706); }
.wingo-modal-header.theme-blue { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.wingo-modal-title { font-size: 1rem; font-weight: 900; color: #fff; }
.wingo-modal-badge { font-size: 0.74rem; font-weight: 700; color: rgba(255, 255, 255, 0.85); margin-top: 2px; }
.wingo-modal-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.wingo-modal-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wingo-modal-label { font-size: 0.78rem; font-weight: 700; color: var(--rv-text2); }
.wingo-balance-chips { display: flex; gap: 6px; }
.wingo-chip-base {
    min-width: 44px;
    padding: 7px 10px;
    border-radius: 10px;
    text-align: center;
    font-size: 0.74rem;
    font-weight: 800;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.06);
    color: var(--rv-text2);
    cursor: pointer;
}
.wingo-chip-base.active {
    background: linear-gradient(180deg, var(--rv-gold-bright), #e8a91c);
    border-color: transparent;
    color: #2a1a00;
}
.wingo-qty-stepper { display: flex; align-items: center; gap: 6px; }
.wingo-step-btn {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.07);
    color: var(--rv-text);
    font-size: 1.05rem;
    font-weight: 800;
    cursor: pointer;
}
.wingo-qty-input {
    width: 64px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid rgba(139, 92, 246, 0.4);
    background: rgba(10, 6, 22, 0.6);
    color: var(--rv-text);
    font-size: 0.9rem;
    font-weight: 800;
    text-align: center;
}
.wingo-modal-mult-row { display: flex; gap: 5px; }
.wingo-mult-chip-modal {
    flex: 1;
    padding: 8px 2px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.06);
    color: var(--rv-text2);
    font-size: 0.66rem;
    font-weight: 800;
    cursor: pointer;
}
.wingo-mult-chip-modal.active.theme-green { background: linear-gradient(180deg, #4ade80, #16a34a); color: #06130c; border-color: transparent; }
.wingo-mult-chip-modal.active.theme-red { background: linear-gradient(180deg, #f87171, #dc2626); color: #fff; border-color: transparent; }
.wingo-mult-chip-modal.active.theme-violet { background: linear-gradient(180deg, #a78bfa, #7c3aed); color: #fff; border-color: transparent; }
.wingo-mult-chip-modal.active.theme-orange { background: linear-gradient(180deg, #fbbf24, #d97706); color: #2a1a00; border-color: transparent; }
.wingo-mult-chip-modal.active.theme-blue { background: linear-gradient(180deg, #60a5fa, #2563eb); color: #fff; border-color: transparent; }
.wingo-rules-box { display: flex; align-items: center; gap: 8px; font-size: 0.74rem; color: var(--rv-text2); }
.wingo-rules-box input { width: 18px; height: 18px; accent-color: var(--rv-violet); }
.wingo-rules-link { font-weight: 800; cursor: pointer; }
.wingo-rules-link.theme-green { color: #4ade80; }
.wingo-rules-link.theme-red { color: #f87171; }
.wingo-rules-link.theme-violet { color: #c4b5fd; }
.wingo-rules-link.theme-orange { color: #fbbf24; }
.wingo-rules-link.theme-blue { color: #93c5fd; }
.wingo-modal-footer { display: grid; grid-template-columns: 1fr 1.4fr; gap: 8px; padding: 0 16px 16px; }
.wingo-btn-cancel {
    padding: 13px 4px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.07);
    color: var(--rv-text);
    font-size: 0.85rem;
    font-weight: 800;
    cursor: pointer;
}
.wingo-btn-confirm {
    padding: 13px 4px;
    border: none;
    border-radius: 14px;
    font-size: 0.85rem;
    font-weight: 900;
    cursor: pointer;
    color: #fff;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.wingo-btn-confirm.theme-green { background: linear-gradient(180deg, #4ade80, #16a34a); }
.wingo-btn-confirm.theme-red { background: linear-gradient(180deg, #f87171, #dc2626); }
.wingo-btn-confirm.theme-violet { background: linear-gradient(180deg, #a78bfa, #7c3aed); }
.wingo-btn-confirm.theme-orange { background: linear-gradient(180deg, #fbbf24, #d97706); color: #2a1a00; }
.wingo-btn-confirm.theme-blue { background: linear-gradient(180deg, #60a5fa, #2563eb); }

@media (max-width: 340px) {
    .wingo-balls-grid { gap: 6px; }
    .wingo-digit { min-width: 34px; font-size: 1.05rem; }
    .wingo-table-wrap { max-height: 180px; }
}

@media (prefers-reduced-motion: reduce) {
    .wingo-ball-btn, .wingo-color-btn, .wingo-bs-btn { transition: none; }
}
