:root {
    --bg: #050810;
    --bg-2: #0a0e1a;
    --bg-card: rgba(15, 22, 38, 0.85);
    --bg-card-2: rgba(20, 28, 46, 0.7);
    --border: rgba(34, 158, 217, 0.15);
    --border-strong: rgba(255, 215, 0, 0.30);

    --gold: #FFD700;
    --gold-2: #FFA500;
    --gold-bright: #FFE680;
    --ton: #229ED9;
    --ton-2: #0088CC;
    --green: #22c55e;
    --red: #ef4444;

    --text: #e8eef7;
    --text-2: #9bafc7;
    --text-mute: #5a6f8c;

    --grad-gold: linear-gradient(135deg, #FFE680, #FFA500);
    --grad-ton: linear-gradient(135deg, #229ED9, #0088CC);

    --shadow-gold: 0 0 30px rgba(255, 215, 0, 0.4);
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4);

    --tabbar-h: 64px;
    --header-h: 64px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior: none;
    touch-action: manipulation;
}
body {
    min-height: 100vh;
    background:
        radial-gradient(ellipse at top, rgba(34, 158, 217, 0.10), transparent 60%),
        radial-gradient(ellipse at bottom, rgba(255, 215, 0, 0.06), transparent 60%),
        var(--bg);
    background-attachment: fixed;
    user-select: none;
    -webkit-user-select: none;
}

button { font-family: inherit; cursor: pointer; }

/* Loader */
.loader {
    position: fixed; inset: 0; z-index: 9999;
    background: var(--bg);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 16px;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}
.loader.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-star { animation: spin 2s linear infinite; }
.loader-text { color: var(--gold); font-weight: 600; letter-spacing: 2px; font-size: 13px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Header */
.app-header {
    position: sticky; top: 0; z-index: 10;
    height: var(--header-h);
    padding: 8px 16px;
    background: rgba(5, 8, 16, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}

.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--grad-gold); color: #1a1500;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 18px;
    border: 2px solid var(--gold);
    overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-name { font-weight: 600; font-size: 14px; }
.user-tier { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 4px; }

.header-right { display: flex; align-items: center; gap: 8px; }
.score-display {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 14px; border-radius: 999px;
    background: rgba(255, 215, 0, 0.08);
    border: 1px solid rgba(255, 215, 0, 0.30);
    transition: transform 0.15s ease;
}
.score-display.bump { transform: scale(1.08); }
.settings-btn {
    width: 36px; height: 36px; border-radius: 50%;
    background: rgba(34, 158, 217, 0.10); border: 1px solid var(--border);
    color: var(--text-2);
    display: flex; align-items: center; justify-content: center;
}
.settings-btn:active { transform: scale(0.92); }

/* Ticker bar below header */
.ticker-bar {
    position: sticky; top: var(--header-h); z-index: 9;
    height: 32px; padding: 0 12px;
    background: rgba(8, 12, 22, 0.8); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-around;
    gap: 8px; font-size: 11px; overflow: hidden;
}
.ticker-item { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.ticker-label {
    font-weight: 700; color: var(--gold);
    font-size: 10px; letter-spacing: 1px;
}
.ticker-value { color: var(--text); font-weight: 600; font-feature-settings: "tnum"; }
.ticker-change { color: var(--text-mute); font-size: 10px; font-feature-settings: "tnum"; }
.ticker-change.positive { color: var(--green); }
.ticker-change.negative { color: var(--red); }
.ticker-divider { width: 1px; height: 14px; background: var(--border); }

/* Combo badge */
.combo-badge {
    position: absolute; top: -4px; left: 50%;
    transform: translate(-50%, -10px) scale(0.7);
    opacity: 0; pointer-events: none;
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    color: white;
    padding: 6px 14px 4px;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
    text-align: center;
    z-index: 4;
    transition: opacity 0.2s, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    min-width: 80px;
}
.combo-badge.active {
    opacity: 1; transform: translate(-50%, 0) scale(1);
}
.combo-mult { display: block; font-size: 24px; font-weight: 900; line-height: 1; font-feature-settings: "tnum"; }
.combo-label { display: block; font-size: 9px; font-weight: 700; letter-spacing: 1.5px; opacity: 0.9; }
.combo-bar { height: 3px; border-radius: 2px; background: rgba(0,0,0,0.3); margin-top: 4px; overflow: hidden; }
.combo-bar-fill { height: 100%; background: white; transition: width 0.1s linear; }

/* Onboarding */
.modal-onboard { padding: 28px 24px; text-align: center; }
.onboard-slide { display: none; padding: 12px 0 24px; min-height: 200px; }
.onboard-slide.active { display: block; animation: slideIn 0.3s ease; }
@keyframes slideIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.onboard-icon { font-size: 64px; margin-bottom: 16px; animation: floatIcon 3s ease-in-out infinite; }
@keyframes floatIcon {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
.onboard-slide h3 { font-size: 22px; font-weight: 700; margin-bottom: 12px; }
.onboard-slide p { font-size: 14px; line-height: 1.6; color: var(--text-2); padding: 0 12px; }
.onboard-dots { display: flex; gap: 6px; justify-content: center; margin: 8px 0 16px; }
.onboard-dots .dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--border-strong); opacity: 0.4;
    transition: all 0.2s;
}
.onboard-dots .dot.active { width: 20px; border-radius: 3px; opacity: 1; background: var(--gold); }
.onboard-actions { display: flex; gap: 10px; }
.onboard-skip {
    flex: 1; padding: 12px; border-radius: 10px;
    background: var(--bg-card); border: 1px solid var(--border);
    color: var(--text-2); font-weight: 600;
}
.onboard-next {
    flex: 2; padding: 12px; border-radius: 10px;
    background: var(--grad-gold); border: none;
    color: #1a1500; font-weight: 700;
}
.onboard-next:active { transform: scale(0.97); }

/* Settings */
.settings-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.setting-row {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; border-radius: 12px;
    background: var(--bg-card); border: 1px solid var(--border);
}
.setting-info { flex: 1; }
.setting-name { font-weight: 600; font-size: 14px; }
.setting-desc { font-size: 12px; color: var(--text-2); margin-top: 2px; }

/* Toggle switch */
.toggle { position: relative; width: 44px; height: 24px; flex-shrink: 0; }
.toggle input { display: none; }
.toggle-slider {
    position: absolute; inset: 0;
    background: rgba(34, 158, 217, 0.15);
    border-radius: 999px;
    transition: background 0.2s;
    cursor: pointer;
}
.toggle-slider::before {
    content: '';
    position: absolute; top: 2px; left: 2px;
    width: 20px; height: 20px;
    background: white; border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.toggle input:checked + .toggle-slider { background: var(--gold); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

.setting-action {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 14px; border-radius: 12px;
    background: var(--bg-card); border: 1px solid var(--border);
    color: var(--text); font-size: 14px; font-weight: 600;
}
.setting-action:active { transform: scale(0.98); }
.setting-action.danger { color: var(--red); border-color: rgba(239, 68, 68, 0.25); }
.score-icon { font-size: 16px; }
.score-value {
    font-weight: 700; color: var(--gold);
    font-feature-settings: "tnum"; letter-spacing: -0.3px;
}

/* Main */
.app-main {
    padding: 16px 16px calc(var(--tabbar-h) + 24px);
    min-height: calc(100vh - var(--header-h));
}

.panel { display: none; }
.panel.active { display: block; animation: panelIn 0.3s ease; }
@keyframes panelIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.panel-header { margin-bottom: 16px; }
.panel-header h2 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.panel-header p { color: var(--text-2); font-size: 14px; }

/* Balance row (tap panel) */
.balance-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.balance-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 14px; padding: 12px 16px;
}
.balance-label { font-size: 11px; color: var(--text-mute); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; }
.balance-value {
    font-size: 22px; font-weight: 700;
    background: var(--grad-gold);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
    font-feature-settings: "tnum";
}

/* Energy bar */
.energy-row { margin-bottom: 24px; }
.energy-bar {
    height: 8px; border-radius: 999px;
    background: rgba(34, 158, 217, 0.15);
    overflow: hidden; position: relative;
}
.energy-fill {
    height: 100%; border-radius: 999px;
    background: var(--grad-gold);
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.5);
    transition: width 0.3s ease;
    width: 100%;
}
.energy-label {
    display: flex; justify-content: space-between;
    margin-top: 6px; font-size: 12px; color: var(--text-2);
    font-feature-settings: "tnum";
}
.energy-regen { color: var(--gold); }

/* Tap area */
.tap-area {
    position: relative;
    display: flex; align-items: center; justify-content: center;
    padding: 24px 0;
    margin-bottom: 24px;
}
.tap-glow {
    position: absolute; width: 280px; height: 280px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.25), transparent 60%);
    animation: glowPulse 3s ease-in-out infinite;
    pointer-events: none;
}
@keyframes glowPulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.15); opacity: 1; }
}
.tap-button {
    position: relative; z-index: 1;
    border: none; background: none;
    padding: 0;
    transition: transform 0.08s ease;
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.5));
}
.tap-button:active { transform: scale(0.94); }
.tap-button:disabled { opacity: 0.4; filter: none; }

/* Boosters */
.boosters-section { margin-top: 8px; }
.boosters-title { font-size: 14px; color: var(--text-2); text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 10px; }
.boosters-grid { display: flex; flex-direction: column; gap: 10px; }
.booster-card {
    display: flex; align-items: center; gap: 12px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 14px; padding: 14px;
    color: var(--text); text-align: left; width: 100%;
    transition: all 0.2s;
}
.booster-card:active { transform: scale(0.98); }
.booster-card:disabled { opacity: 0.5; }
.booster-icon { font-size: 28px; flex-shrink: 0; }
.booster-info { flex: 1; }
.booster-name { font-weight: 600; font-size: 15px; }
.booster-level { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.booster-cost {
    font-size: 13px; font-weight: 700; color: var(--gold);
    padding: 6px 10px; border-radius: 8px;
    background: rgba(255, 215, 0, 0.10);
    border: 1px solid rgba(255, 215, 0, 0.25);
    flex-shrink: 0; font-feature-settings: "tnum";
}

/* Spin CTA on tap panel */
.spin-cta {
    margin-top: 16px;
    width: 100%; padding: 14px 16px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.10), rgba(34, 158, 217, 0.06));
    border: 1px solid rgba(255, 215, 0, 0.25);
    border-radius: 14px;
    color: var(--text);
    display: flex; align-items: center; justify-content: space-between;
    transition: all 0.2s;
}
.spin-cta:active { transform: scale(0.98); }
.spin-cta-left { display: flex; align-items: center; gap: 12px; text-align: left; }
.spin-cta-icon { font-size: 28px; animation: wobble 2s ease-in-out infinite; }
@keyframes wobble {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
}
.spin-cta-title { font-weight: 700; font-size: 15px; }
.spin-cta-sub { font-size: 12px; color: var(--gold); margin-top: 2px; }
.spin-cta-arrow { font-size: 22px; color: var(--gold); }
.spin-cta.locked .spin-cta-icon { animation: none; opacity: 0.5; }
.spin-cta.locked .spin-cta-sub { color: var(--text-mute); }

/* Achievement list */
.achievement-list { display: flex; flex-direction: column; gap: 8px; }
.achievement-row {
    display: flex; align-items: center; gap: 12px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 12px; padding: 12px;
    transition: all 0.3s;
}
.achievement-row.claimed { background: rgba(34, 197, 94, 0.06); border-color: rgba(34, 197, 94, 0.20); }
.achievement-row.ready { background: rgba(255, 215, 0, 0.08); border-color: rgba(255, 215, 0, 0.45); animation: readyPulse 2s ease-in-out infinite; }
@keyframes readyPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.3); }
    50% { box-shadow: 0 0 0 6px rgba(255, 215, 0, 0); }
}
.ach-icon { font-size: 24px; flex-shrink: 0; }
.ach-content { flex: 1; min-width: 0; }
.ach-title { font-weight: 600; font-size: 14px; }
.ach-desc { font-size: 12px; color: var(--text-2); margin-top: 1px; }
.ach-progress {
    height: 4px; border-radius: 2px;
    background: rgba(34, 158, 217, 0.10);
    overflow: hidden; margin-top: 6px;
}
.ach-progress-fill {
    height: 100%; background: var(--grad-gold);
    transition: width 0.5s ease;
}
.ach-reward {
    padding: 6px 10px; border-radius: 8px;
    background: rgba(255, 215, 0, 0.10); color: var(--gold);
    font-weight: 700; font-size: 12px; border: none;
    flex-shrink: 0; font-feature-settings: "tnum";
}
.ach-reward.claimed-badge {
    background: rgba(34, 197, 94, 0.15); color: var(--green);
}

/* Real on-chain balance card */
.real-balance-card {
    margin-top: 16px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 16px; padding: 16px;
}
.rb-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 12px;
}
.rb-title { font-weight: 700; font-size: 14px; }
.rb-source { font-size: 11px; color: var(--text-mute); }
.rb-ton {
    display: flex; align-items: center; gap: 12px;
    padding: 12px;
    background: rgba(0, 152, 234, 0.08);
    border: 1px solid rgba(0, 152, 234, 0.20);
    border-radius: 12px;
    margin-bottom: 12px;
}
.rb-ton-icon { flex-shrink: 0; }
.rb-ton-info { flex: 1; }
.rb-amount { font-size: 18px; font-weight: 700; font-feature-settings: "tnum"; }
.rb-usd { font-size: 12px; color: var(--text-2); margin-top: 2px; font-feature-settings: "tnum"; }
.rb-refresh {
    width: 32px; height: 32px; border-radius: 8px;
    background: rgba(34, 158, 217, 0.10); border: 1px solid var(--border);
    color: var(--ton); display: flex; align-items: center; justify-content: center;
}
.rb-refresh:active svg { animation: spin 0.6s linear; }
.rb-jettons { display: flex; flex-direction: column; gap: 6px; max-height: 280px; overflow-y: auto; }
.rb-jetton-row {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 10px;
    background: rgba(34, 158, 217, 0.04);
    border: 1px solid var(--border);
}
.rb-j-symbol { font-weight: 600; font-size: 13px; }
.rb-j-amount { font-family: monospace; font-size: 13px; color: var(--text-2); margin-left: auto; font-feature-settings: "tnum"; }
.rb-jettons-empty { text-align: center; padding: 16px; color: var(--text-mute); font-size: 12px; }

/* Modal & spin wheel */
.modal-overlay {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(5, 8, 16, 0.85);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center; justify-content: center;
    padding: 16px;
}
.modal-overlay.show { display: flex; animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
    width: 100%; max-width: 420px;
    background: var(--bg-2); border: 1px solid var(--border-strong);
    border-radius: 20px; padding: 24px;
    position: relative;
    box-shadow: var(--shadow-card);
    animation: modalIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}
.modal-close {
    position: absolute; top: 12px; right: 12px;
    width: 32px; height: 32px; border-radius: 50%;
    border: 1px solid var(--border); background: var(--bg-card);
    color: var(--text); font-size: 22px; line-height: 1;
}
.modal-title { font-size: 22px; font-weight: 700; text-align: center; }
.modal-sub { font-size: 13px; color: var(--text-2); text-align: center; margin-top: 4px; margin-bottom: 20px; }

.wheel-wrap {
    position: relative;
    width: 280px; height: 280px;
    margin: 0 auto 20px;
}
.wheel-pointer {
    position: absolute;
    top: -4px; left: 50%;
    transform: translateX(-50%);
    color: var(--gold);
    font-size: 28px;
    z-index: 3;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}
.wheel {
    position: relative;
    width: 100%; height: 100%;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid var(--gold);
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.3), inset 0 0 20px rgba(0,0,0,0.3);
    transition: transform 4.5s cubic-bezier(0.17, 0.67, 0.23, 1);
    background: var(--bg);
}
.wheel-segment {
    position: absolute;
    inset: 0;
    transform: rotate(var(--rot));
    clip-path: polygon(50% 50%, 50% 0%, 100% 0%, 100% 35.355%);
    background: linear-gradient(135deg, var(--color1), var(--color2));
    border-right: 1px dashed rgba(255, 255, 255, 0.2);
}
.wheel-segment span {
    position: absolute;
    top: 22%; left: 70%;
    transform: translate(-50%, -50%) rotate(var(--seg-rot));
    color: white;
    font-weight: 800;
    font-size: 14px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    font-feature-settings: "tnum";
}
.wheel-center {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 50px; height: 50px; border-radius: 50%;
    background: var(--bg-2);
    border: 2px solid var(--gold);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    z-index: 2;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.5);
}
.spin-action-btn {
    width: 100%;
    padding: 14px;
    background: var(--grad-gold);
    border: none;
    border-radius: 12px;
    color: #1a1500;
    font-weight: 800;
    font-size: 16px;
    letter-spacing: 1px;
    transition: all 0.2s;
}
.spin-action-btn:active { transform: scale(0.98); }
.spin-action-btn:disabled { opacity: 0.4; }
.spin-result {
    text-align: center;
    margin-top: 16px;
    font-size: 16px;
    font-weight: 700;
    min-height: 24px;
    color: var(--gold);
    font-feature-settings: "tnum";
}
.spin-result.show { animation: resultPop 0.5s ease; }
@keyframes resultPop {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

/* Quests */
.quest-list { display: flex; flex-direction: column; gap: 10px; }
.quest-card {
    display: flex; align-items: center; gap: 12px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 14px; padding: 14px;
}
.quest-icon { font-size: 24px; }
.quest-content { flex: 1; }
.quest-title { font-weight: 600; font-size: 14px; }
.quest-desc { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.quest-reward {
    padding: 8px 14px; border-radius: 10px;
    background: var(--grad-gold); color: #1a1500;
    font-weight: 700; font-size: 13px; border: none;
    transition: transform 0.2s;
    font-feature-settings: "tnum";
}
.quest-reward:active { transform: scale(0.95); }
.quest-reward.claimed {
    background: rgba(34, 197, 94, 0.15); color: var(--green);
    border: 1px solid rgba(34, 197, 94, 0.3);
}
.quest-reward:disabled { opacity: 0.5; cursor: default; }

/* Streak */
.streak-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 16px; padding: 16px;
}
.streak-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 14px; }
.streak-day {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    aspect-ratio: 1; border-radius: 10px;
    background: rgba(34, 158, 217, 0.06);
    border: 1px solid var(--border);
    font-size: 9px; color: var(--text-2); padding: 4px;
    text-align: center;
}
.streak-day span:last-child { color: var(--gold); font-weight: 700; font-size: 10px; margin-top: 2px; }
.streak-day.completed {
    background: rgba(255, 215, 0, 0.10); border-color: rgba(255, 215, 0, 0.40);
    color: var(--gold);
}
.streak-day.today {
    background: var(--grad-gold); color: #1a1500; border-color: transparent;
}
.streak-day.today span:last-child { color: #1a1500; }
.streak-claim-btn {
    width: 100%; padding: 14px; border-radius: 12px;
    background: var(--grad-gold); border: none;
    color: #1a1500; font-weight: 700; font-size: 14px;
}
.streak-claim-btn:disabled { background: rgba(34, 158, 217, 0.10); color: var(--text-mute); }

/* Friends */
.referral-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 16px; padding: 18px;
}
.referral-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.ref-stat {
    background: rgba(34, 158, 217, 0.06); border: 1px solid var(--border);
    border-radius: 12px; padding: 14px; text-align: center;
}
.ref-stat-value {
    font-size: 24px; font-weight: 700;
    background: var(--grad-gold);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.ref-stat-label { font-size: 11px; color: var(--text-2); text-transform: uppercase; letter-spacing: 1px; margin-top: 2px; }
.share-btn, .copy-link-btn, .connect-ton-btn {
    width: 100%; padding: 13px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    font-size: 14px; font-weight: 600; border: none;
    transition: all 0.2s;
}
.share-btn { background: var(--grad-gold); color: #1a1500; margin-bottom: 8px; }
.share-btn:active { transform: scale(0.98); }
.copy-link-btn {
    background: rgba(34, 158, 217, 0.10); color: var(--ton);
    border: 1px solid var(--border);
}
.connect-ton-btn { background: var(--grad-ton); color: white; }

.friends-list { display: flex; flex-direction: column; gap: 8px; }
.friend-row {
    display: flex; align-items: center; gap: 12px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 12px; padding: 12px;
}
.friend-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--grad-ton); display: flex;
    align-items: center; justify-content: center;
    color: white; font-weight: 700; font-size: 14px;
}
.friend-info { flex: 1; }
.friend-name { font-weight: 600; font-size: 14px; }
.friend-bonus { font-size: 12px; color: var(--text-2); }
.friend-earnings { color: var(--gold); font-weight: 700; font-size: 13px; font-feature-settings: "tnum"; }
.empty-state {
    text-align: center; padding: 32px 20px;
    color: var(--text-mute); font-size: 13px;
}

/* Wallet */
.wallet-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 16px; padding: 18px; margin-bottom: 16px;
}
.wallet-balance { margin-bottom: 16px; }
.wb-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 0; border-bottom: 1px solid var(--border);
}
.wb-row:last-child { border-bottom: none; }
.wb-label { font-size: 13px; color: var(--text-2); }
.wb-value { font-weight: 700; color: var(--gold); font-feature-settings: "tnum"; }

.connected-info {
    margin-top: 12px; padding: 12px; border-radius: 10px;
    background: rgba(34, 197, 94, 0.10); border: 1px solid rgba(34, 197, 94, 0.30);
    display: flex; align-items: center; gap: 8px; font-size: 13px;
}
.ci-label { color: var(--text-2); }
.ci-addr { font-family: monospace; color: var(--green); flex: 1; }
.disconnect-btn {
    background: none; border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--red); padding: 4px 10px; border-radius: 8px;
    font-size: 11px;
}

.info-banner {
    display: flex; gap: 12px;
    background: rgba(34, 158, 217, 0.06);
    border: 1px solid rgba(34, 158, 217, 0.20);
    border-radius: 12px; padding: 14px;
}
.info-icon { font-size: 22px; flex-shrink: 0; }
.info-text { font-size: 13px; line-height: 1.5; color: var(--text-2); }
.info-text strong { color: var(--text); }

/* Tabbar */
.tabbar {
    position: fixed; bottom: 0; left: 0; right: 0;
    height: var(--tabbar-h);
    padding: 8px max(env(safe-area-inset-left), 8px) max(env(safe-area-inset-bottom), 8px);
    background: rgba(5, 8, 16, 0.95);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
    z-index: 10;
}
.tab {
    background: none; border: none;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; padding: 4px;
    color: var(--text-mute); transition: color 0.2s;
    border-radius: 10px;
}
.tab.active { color: var(--gold); background: rgba(255, 215, 0, 0.06); }
.tab-icon { font-size: 22px; }
.tab-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }

/* Particles & toast */
#tapParticles {
    position: fixed; inset: 0; pointer-events: none; z-index: 5;
}
.tap-floater {
    position: fixed; pointer-events: none; z-index: 6;
    font-weight: 700; color: var(--gold); font-size: 18px;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
    animation: floatUp 1s ease-out forwards;
    will-change: transform, opacity;
    font-feature-settings: "tnum";
}
@keyframes floatUp {
    0% { opacity: 1; transform: translate(-50%, 0); }
    100% { opacity: 0; transform: translate(-50%, -100px); }
}
.toast {
    position: fixed; bottom: calc(var(--tabbar-h) + 16px);
    left: 50%; transform: translateX(-50%) translateY(20px);
    background: var(--bg-card); border: 1px solid var(--border-strong);
    border-radius: 12px; padding: 12px 18px;
    font-size: 14px; font-weight: 500;
    box-shadow: var(--shadow-card);
    opacity: 0; pointer-events: none; z-index: 100;
    transition: opacity 0.3s, transform 0.3s;
    max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Telegram theme adaptation when available */
@media (prefers-color-scheme: light) {
    /* Stay dark — Mini App is themed regardless of Telegram light/dark */
}

@media (max-width: 360px) {
    .balance-row { grid-template-columns: 1fr; }
    .tap-button svg { width: 160px; height: 160px; }
    .tap-glow { width: 240px; height: 240px; }
}
