:root {
    --bg: #1a1008;
    --bg-warm: #2a1a0e;
    --glass: rgba(255, 200, 140, 0.08);
    --glass-border: rgba(255, 200, 140, 0.15);
    --glass-hover: rgba(255, 200, 140, 0.14);
    --glass-strong: rgba(255, 200, 140, 0.12);
    --text: #f5ece3;
    --text-secondary: rgba(245, 236, 227, 0.55);
    --accent: #d4915c;
    --accent-light: #e8b48a;
    --accent-glow: rgba(212, 145, 92, 0.35);
    --accent-gradient: linear-gradient(135deg, #d4915c, #e8b48a);
    --green: #6fcf97;
    --green-bg: rgba(111, 207, 151, 0.1);
    --red: #eb7070;
    --red-bg: rgba(235, 112, 112, 0.1);
    --orange: #f0a060;
    --blue: #7eb8da;
    --gold: #e8c36a;
    --radius: 20px;
    --radius-sm: 14px;
    --radius-xs: 10px;
    --blur: 24px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 4px 20px rgba(212, 145, 92, 0.15);
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    padding-bottom: 90px;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 10%, rgba(212, 145, 92, 0.14) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 30%, rgba(180, 100, 50, 0.10) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 90%, rgba(111, 207, 151, 0.06) 0%, transparent 40%),
        radial-gradient(circle at 70% 70%, rgba(126, 184, 218, 0.05) 0%, transparent 40%);
    pointer-events: none;
    z-index: 0;
    animation: gradientShift 15s ease infinite;
    background-size: 200% 200%;
}

body::after {
    content: '';
    position: fixed;
    top: -200px;
    right: -100px;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(212, 145, 92, 0.06) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    filter: blur(60px);
}

#app {
    position: relative;
    z-index: 1;
    max-width: 480px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ── Header ── */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0 16px;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-icon {
    font-size: 28px;
    width: 48px;
    height: 48px;
    animation: breathe 4s ease-in-out infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--glass);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-glow);
}

.header-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.3px;
    background: linear-gradient(135deg, var(--text) 0%, var(--accent-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.streak-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--glass);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid rgba(235, 112, 112, 0.2);
    padding: 6px 14px;
    border-radius: 24px;
    font-weight: 700;
    font-size: 15px;
}

.streak-fire { font-size: 16px; animation: iconWobble 3s ease-in-out infinite; }

.points-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--glass);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid rgba(232, 195, 106, 0.25);
    padding: 6px 14px;
    border-radius: 24px;
    font-weight: 700;
    font-size: 15px;
    transition: all 0.3s ease;
}

.points-icon { font-size: 14px; animation: sparkle 2s ease-in-out infinite; }

/* ── Tabs ── */
.tabs {
    display: flex;
    gap: 3px;
    background: var(--glass);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 5px;
    margin-bottom: 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
    flex: 1;
    min-width: 52px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 4px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.tab.active {
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: 0 4px 16px var(--accent-glow);
    animation: scaleIn 0.3s ease;
}

.tab.active .tab-icon {
    animation: iconBounce 0.5s ease;
}

.tab-icon { font-size: 18px; }
.tab-label { font-size: 10px; font-weight: 600; }

/* ── Tab content ── */
.tab-content {
    display: none;
    animation: fadeUp 0.4s ease;
}

.tab-content.active { display: block; animation: fadeUp 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94); }

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeUp 0.5s ease; }

/* ── Section title ── */
.section-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 12px;
}

/* ── Daily affirmation card ── */
.daily-card {
    background: var(--glass-strong);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 28px 24px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 200, 140, 0.1);
    animation: scaleIn 0.5s ease 0.1s both;
}

.daily-card::before {
    content: '';
    position: absolute;
    top: -40px;
    right: -40px;
    width: 140px;
    height: 140px;
    background: radial-gradient(circle, rgba(212, 145, 92, 0.15) 0%, transparent 70%);
    border-radius: 50%;
}

.daily-card::after {
    content: '';
    position: absolute;
    bottom: -30px;
    left: -30px;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(111, 207, 151, 0.08) 0%, transparent 70%);
    border-radius: 50%;
}

.daily-card-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--accent-light);
    margin-bottom: 14px;
}

.daily-card-text {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.55;
    margin-bottom: 18px;
    position: relative;
    z-index: 1;
}

/* ── Cards grid ── */
.cards-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.action-card {
    background: var(--glass);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 22px 16px;
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.action-card:nth-child(1) { animation: scaleIn 0.4s ease 0.1s both; }
.action-card:nth-child(2) { animation: scaleIn 0.4s ease 0.2s both; }
.action-card:nth-child(3) { animation: scaleIn 0.4s ease 0.3s both; }
.action-card:nth-child(4) { animation: scaleIn 0.4s ease 0.4s both; }

.action-card:active {
    transform: scale(0.94);
    background: var(--glass-hover);
    box-shadow: var(--shadow), 0 0 20px var(--accent-glow);
}

.action-card .action-icon {
    transition: transform 0.3s ease;
}

.action-card:active .action-icon {
    transform: scale(1.2) rotate(-5deg);
}

.action-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    border-radius: var(--radius) var(--radius) 0 0;
}

.card-morning::after { background: linear-gradient(90deg, #f0a060, #e8c36a); }
.card-scenario::after { background: linear-gradient(90deg, #d4915c, #e8b48a); }
.card-technique::after { background: linear-gradient(90deg, #7eb8da, #a8d8ea); }
.card-challenge::after { background: linear-gradient(90deg, #6fcf97, #88e0a5); }

.action-icon { font-size: 28px; margin-bottom: 12px; animation: iconBounce 3s ease-in-out infinite; }
.cards-grid .action-card:nth-child(1) .action-icon { animation-delay: 0s; }
.cards-grid .action-card:nth-child(2) .action-icon { animation-delay: 0.5s; }
.cards-grid .action-card:nth-child(3) .action-icon { animation-delay: 1s; }
.cards-grid .action-card:nth-child(4) .action-icon { animation-delay: 1.5s; }
.action-title { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.action-desc { font-size: 12px; color: var(--text-secondary); }

/* ── Tip card ── */
.tip-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--glass);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.tip-icon { font-size: 24px; flex-shrink: 0; }
.tip-text { font-size: 14px; line-height: 1.55; color: var(--text-secondary); }

/* ── Evening card ── */
.evening-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--glass);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid rgba(139, 92, 246, 0.15);
    border-radius: var(--radius);
    padding: 18px 22px;
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    animation: fadeUp 0.5s ease 0.4s both;
}

.evening-card:active { transform: scale(0.97); box-shadow: var(--shadow), 0 0 20px rgba(139, 92, 246, 0.15); }

.evening-left { display: flex; align-items: center; gap: 14px; }
.evening-icon { font-size: 28px; animation: breathe 4s ease-in-out infinite; }
.evening-title { font-size: 15px; font-weight: 600; }
.evening-desc { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.evening-arrow { font-size: 20px; color: var(--accent-light); }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn:active { transform: scale(0.96); }

.btn-primary {
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: 0 4px 20px var(--accent-glow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn-primary::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    background-size: 200% 100%;
    animation: shimmer 4s ease-in-out infinite;
}

.btn-primary:active {
    transform: scale(0.96);
    box-shadow: 0 2px 12px var(--accent-glow), 0 0 30px rgba(212, 145, 92, 0.2);
}

.btn-glass {
    background: var(--glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    color: var(--text);
}

.btn-block { width: 100%; }

/* ── Trainer ── */
.scenario-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.scenario-badge {
    background: var(--accent-gradient);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 6px 16px;
    border-radius: 24px;
    box-shadow: 0 2px 12px var(--accent-glow);
}

.scenario-number {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
}

.scenario-text {
    font-size: 16px;
    line-height: 1.65;
    margin-bottom: 20px;
    padding: 20px;
    background: var(--glass);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    border-left: 3px solid var(--accent);
    box-shadow: var(--shadow);
}

.responses {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.response-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 18px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
}

.response-card:active { transform: scale(0.98); }

.response-toxic {
    background: var(--red-bg);
    border-color: rgba(235, 112, 112, 0.15);
}

.response-calm {
    background: var(--green-bg);
    border-color: rgba(111, 207, 151, 0.15);
}

.response-marker {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.response-toxic .response-marker { background: var(--red); color: #1a1008; }
.response-calm .response-marker { background: var(--green); color: #1a1008; }
.response-text { font-size: 14px; line-height: 1.55; }

.response-card.selected {
    border-color: rgba(255, 200, 140, 0.4);
    transform: scale(1.02);
}

.response-card.disabled {
    opacity: 0.45;
    pointer-events: none;
}

.explanation-card {
    background: var(--glass);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    text-align: center;
    animation: fadeUp 0.4s ease;
    box-shadow: var(--shadow);
}

.explanation-icon { font-size: 40px; margin-bottom: 10px; }
.explanation-title { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.explanation-text { font-size: 14px; line-height: 1.65; color: var(--text-secondary); }

.trainer-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-top: 20px;
    padding: 18px;
    background: var(--glass);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.stat-item { text-align: center; }
.stat-value { font-size: 24px; font-weight: 800; }
.stat-label { font-size: 11px; color: var(--text-secondary); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.5px; }

/* ── Techniques ── */
.techniques-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.technique-card {
    background: var(--glass);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.technique-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    cursor: pointer;
}

.technique-name { font-size: 15px; font-weight: 600; }

.technique-arrow {
    font-size: 14px;
    color: var(--text-secondary);
    transition: var(--transition);
}

.technique-card.open .technique-arrow { transform: rotate(180deg); }

.technique-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.technique-body-inner {
    padding: 0 20px 20px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-secondary);
    white-space: pre-line;
}

.technique-card.open .technique-body { max-height: 500px; }

/* ── Tips carousel ── */
.tips-carousel {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tip-mini {
    background: var(--glass);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 16px 18px;
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-secondary);
    box-shadow: var(--shadow);
}

/* ── Progress ── */
.progress-hero {
    display: flex;
    justify-content: center;
    padding: 24px 0;
}

.progress-circle {
    position: relative;
    width: 150px;
    height: 150px;
}

.progress-circle svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.progress-bg {
    fill: none;
    stroke: rgba(255, 200, 140, 0.08);
    stroke-width: 8;
}

.progress-fill {
    fill: none;
    stroke: var(--accent);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1.2s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 0 6px var(--accent-glow));
}

.progress-inner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.progress-level { font-size: 32px; animation: breathe 3s ease-in-out infinite; }
.progress-level-name { font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-top: 4px; }

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--glass);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 22px 16px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.stats-grid .stat-card:nth-child(1) { animation: scaleIn 0.35s ease 0.05s both; }
.stats-grid .stat-card:nth-child(2) { animation: scaleIn 0.35s ease 0.12s both; }
.stats-grid .stat-card:nth-child(3) { animation: scaleIn 0.35s ease 0.19s both; }
.stats-grid .stat-card:nth-child(4) { animation: scaleIn 0.35s ease 0.26s both; }

.stat-card:active { transform: scale(0.96); }

.stat-card-icon { font-size: 24px; margin-bottom: 8px; animation: iconBounce 3s ease-in-out infinite; }
.stat-card-value { font-size: 28px; font-weight: 800; }
.stat-card-label { font-size: 11px; color: var(--text-secondary); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.5px; }

.stat-card-accent {
    background: linear-gradient(135deg, rgba(232, 195, 106, 0.12), rgba(212, 145, 92, 0.08));
    border-color: rgba(232, 195, 106, 0.2);
}

.stat-card-accent .stat-card-value { color: var(--gold); }

.motivation-card {
    background: var(--glass);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 22px;
    text-align: center;
    box-shadow: var(--shadow);
}

.motivation-text { font-size: 15px; line-height: 1.65; font-weight: 500; }

/* ── Points info card ── */
.points-info-card {
    background: var(--glass);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.points-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    font-size: 13px;
    border-bottom: 1px solid rgba(255, 200, 140, 0.06);
}

.points-row:last-child { border-bottom: none; }
.points-val { font-weight: 700; color: var(--gold); }

/* ── Modal ── */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(10, 6, 2, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: fadeBg 0.3s ease;
}

.modal-overlay.hidden { display: none; }

@keyframes fadeBg {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--bg-warm);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius) var(--radius) 0 0;
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    animation: slideUp 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 28px 24px;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.4);
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.modal-icon { font-size: 28px; }
.modal-title { flex: 1; font-size: 18px; font-weight: 700; }

.modal-close {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--glass-border);
    background: var(--glass);
    color: var(--text);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 24px;
    white-space: pre-line;
}

.modal-actions { padding-bottom: 16px; }

/* ── Rating tab ── */
.rating-toggle {
    display: flex;
    gap: 4px;
    background: var(--glass);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 4px;
    margin-bottom: 16px;
}

.rating-btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: var(--transition);
}

.rating-btn.active {
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: 0 2px 12px var(--accent-glow);
}

.my-rank-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--glass);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid rgba(212, 145, 92, 0.2);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.my-rank-pos { font-size: 20px; font-weight: 800; color: var(--accent-light); min-width: 40px; }
.my-rank-info { flex: 1; }
.my-rank-name { font-size: 15px; font-weight: 600; }
.my-rank-pts { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.my-rank-badge { font-size: 28px; }

.leaderboard {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.lb-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--glass);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.lb-row.me {
    border-color: rgba(212, 145, 92, 0.3);
    background: rgba(212, 145, 92, 0.08);
}

.lb-row.top-1 {
    background: linear-gradient(135deg, rgba(232, 195, 106, 0.12), rgba(212, 145, 92, 0.06));
    border-color: rgba(232, 195, 106, 0.25);
}

.lb-row.top-2 {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.08), rgba(169, 169, 169, 0.04));
    border-color: rgba(192, 192, 192, 0.15);
}

.lb-row.top-3 {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.08), rgba(180, 83, 9, 0.04));
    border-color: rgba(205, 127, 50, 0.15);
}

.lb-pos { font-size: 14px; font-weight: 800; min-width: 28px; text-align: center; }
.lb-pos-medal { font-size: 20px; min-width: 28px; text-align: center; }
.lb-info { flex: 1; }
.lb-name { font-size: 14px; font-weight: 600; }
.lb-meta { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.lb-pts { font-size: 15px; font-weight: 700; color: var(--gold); }
.lb-rank { font-size: 20px; }

.leaderboard-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    font-size: 14px;
}

.online-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

.online-dot {
    width: 8px;
    height: 8px;
    background: var(--green);
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(111, 207, 151, 0.5);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ── Referral / Team tab ── */
.ref-stats-card {
    background: var(--glass);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid rgba(212, 145, 92, 0.2);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.ref-stats-header { display: flex; align-items: center; gap: 14px; }
.ref-stats-icon { font-size: 36px; }
.ref-stats-title { font-size: 13px; color: var(--text-secondary); margin-bottom: 2px; }
.ref-stats-value { font-size: 28px; font-weight: 800; color: var(--gold); }

.ref-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
}

.ref-stat-mini {
    background: var(--glass);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 14px 6px;
    text-align: center;
    box-shadow: var(--shadow);
}

.ref-stat-num { font-size: 20px; font-weight: 800; color: var(--text); }
.ref-stat-lbl { font-size: 10px; color: var(--text-secondary); margin-top: 2px; }

.ref-referrer-card {
    background: var(--glass);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid rgba(111, 207, 151, 0.15);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    font-size: 14px;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.ref-referrer-card strong { color: var(--green); }

.ref-invite-card {
    background: var(--glass);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.ref-link-box {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    margin-top: 12px;
}

.ref-link-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xs);
    padding: 12px 14px;
    font-size: 12px;
    color: var(--text);
    font-family: monospace;
    outline: none;
}

.ref-copy-btn {
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-xs);
    padding: 12px 16px;
    font-size: 18px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 12px var(--accent-glow);
}

.ref-copy-btn:active { transform: scale(0.95); }

.ref-levels { margin-bottom: 20px; }

.ref-level {
    background: var(--glass);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.ref-level-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    cursor: pointer;
    transition: var(--transition);
}

.ref-level-header:hover { background: var(--glass-hover); }
.ref-level-title { font-weight: 700; font-size: 14px; }
.ref-level-count { font-size: 13px; color: var(--accent-light); font-weight: 600; }
.ref-level-bonus { font-size: 11px; color: var(--text-secondary); }

.ref-level-members { display: none; padding: 0 18px 14px; }
.ref-level.open .ref-level-members { display: block; }

.ref-member {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 0;
    border-bottom: 1px solid rgba(255, 200, 140, 0.06);
    font-size: 13px;
}

.ref-member:last-child { border-bottom: none; }
.ref-member-name { color: var(--text); }
.ref-member-pts { color: var(--gold); font-weight: 600; }

.ref-level-empty {
    text-align: center;
    color: var(--text-secondary);
    padding: 24px;
    font-size: 14px;
}

.ref-info-card {
    background: var(--glass);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.ref-info-row {
    padding: 9px 0;
    font-size: 13px;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 200, 140, 0.06);
}

.ref-info-row:last-child { border-bottom: none; }

/* ── Utility ── */
.hidden { display: none !important; }

/* ── Responsive ── */
@media (max-width: 360px) {
    .header-title { font-size: 16px; }
    .daily-card-text { font-size: 16px; }
    .cards-grid { gap: 8px; }
    .action-card { padding: 18px 12px; }
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 200, 140, 0.12); border-radius: 4px; }

/* ── Points popup ── */
.points-popup {
    position: fixed;
    top: 70px;
    right: 20px;
    z-index: 200;
    pointer-events: none;
}

.points-popup.hidden { display: none; }

.points-popup-text {
    display: inline-block;
    background: var(--accent-gradient);
    color: #fff;
    font-weight: 800;
    font-size: 18px;
    padding: 8px 18px;
    border-radius: 24px;
    animation: popFloat 1.2s ease forwards;
    box-shadow: 0 4px 24px var(--accent-glow);
}

@keyframes popFloat {
    0% { opacity: 0; transform: translateY(10px) scale(0.8); }
    20% { opacity: 1; transform: translateY(0) scale(1.1); }
    40% { transform: translateY(-5px) scale(1); }
    100% { opacity: 0; transform: translateY(-40px) scale(0.8); }
}

/* ── Name prompt ── */
.name-prompt {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(10, 6, 2, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.name-prompt.hidden { display: none; }

.name-prompt-card {
    background: var(--bg-warm);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 36px 28px;
    text-align: center;
    max-width: 340px;
    width: 100%;
    box-shadow: 0 16px 64px rgba(0, 0, 0, 0.5);
}

.name-prompt-icon { font-size: 48px; margin-bottom: 16px; }
.name-prompt-title { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.name-prompt-desc { font-size: 13px; color: var(--text-secondary); margin-bottom: 24px; }

.name-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid rgba(255, 200, 140, 0.15);
    border-radius: var(--radius-sm);
    background: var(--glass);
    color: var(--text);
    font-family: inherit;
    font-size: 16px;
    text-align: center;
    outline: none;
    margin-bottom: 18px;
    transition: var(--transition);
}

.name-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
}

/* ─── Binary Tree User View ─── */

.binary-balance-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--glass);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid rgba(111, 207, 151, 0.15);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.binary-balance-icon { font-size: 36px; }
.binary-balance-label { font-size: 13px; color: var(--text-secondary); }
.binary-balance-value { font-size: 28px; font-weight: 800; color: var(--green); }

.binary-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
}

.binary-stat-item {
    background: var(--glass);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
    box-shadow: var(--shadow);
}

.binary-stat-num { font-size: 22px; font-weight: 800; }
.binary-stat-lbl { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

.binary-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--glass);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xs);
    margin-bottom: 8px;
    font-size: 13px;
    box-shadow: var(--shadow);
}

.binary-info-row span { color: var(--text-secondary); }
.binary-info-row strong { color: var(--text); }

.binary-tree-user {
    background: var(--glass);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 18px 10px;
    overflow-x: auto;
    min-height: 200px;
    box-shadow: var(--shadow);
}

/* CSS Binary tree (user view) */
.bin-tree ul {
    padding-top: 16px;
    position: relative;
    display: flex;
    justify-content: center;
    list-style: none;
}

.bin-tree li {
    text-align: center;
    list-style: none;
    position: relative;
    padding: 16px 4px 0 4px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
}

.bin-tree li::before, .bin-tree li::after {
    content: '';
    position: absolute;
    top: 0;
    right: 50%;
    border-top: 2px solid rgba(255, 200, 140, 0.1);
    width: 50%;
    height: 16px;
}

.bin-tree li::after {
    right: auto;
    left: 50%;
    border-left: 2px solid rgba(255, 200, 140, 0.1);
}

.bin-tree li::before {
    border-right: 2px solid rgba(255, 200, 140, 0.1);
}

.bin-tree li:only-child::before, .bin-tree li:only-child::after { display: none; }
.bin-tree li:first-child::before { border: none; }
.bin-tree li:last-child::after { border: none; }
.bin-tree li:first-child::after { border-radius: 5px 0 0 0; }
.bin-tree li:last-child::before { border-radius: 0 5px 0 0; }

.bin-tree ul ul::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    border-left: 2px solid rgba(255, 200, 140, 0.1);
    width: 0;
    height: 16px;
}

.bin-node {
    display: inline-block;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xs);
    padding: 8px 12px;
    background: var(--glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    min-width: 70px;
    text-align: center;
    box-shadow: var(--shadow);
}

.bin-node.me {
    border-color: var(--accent);
    background: rgba(212, 145, 92, 0.12);
    box-shadow: 0 0 16px var(--accent-glow);
}

.bin-node.empty {
    border: 2px dashed rgba(255, 200, 140, 0.1);
    background: transparent;
    min-width: 60px;
    padding: 6px 10px;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
}

.bin-node-name { font-size: 10px; font-weight: 700; white-space: nowrap; }
.bin-node-bal { font-size: 9px; color: var(--green); font-weight: 600; }
.bin-node-pairs { font-size: 8px; color: var(--orange); }

/* Direction toggle */
.binary-direction-card {
    background: var(--glass);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.binary-direction-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-align: center;
}

.binary-direction-toggle {
    display: flex;
    gap: 8px;
}

.direction-btn {
    flex: 1;
    padding: 12px;
    border-radius: var(--radius-xs);
    border: 1px solid var(--glass-border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.direction-btn.active {
    border-color: var(--accent);
    background: rgba(212, 145, 92, 0.12);
    color: var(--text);
    box-shadow: 0 0 16px var(--accent-glow);
}

.direction-btn:active { transform: scale(0.97); }

/* ── Telegram theme integration ── */
body.tg-theme {
    --bg: var(--tg-theme-bg-color, #1a1008);
    --text: var(--tg-theme-text-color, #f5ece3);
}

/* ══════════════════════════════════════════════ */
/* ────────── GAME: Путь Добра ────────── */
/* ══════════════════════════════════════════════ */

/* ── Pet Card ── */
.game-pet-card {
    background: linear-gradient(145deg, rgba(212, 145, 92, 0.14), rgba(111, 207, 151, 0.08));
    border: 1px solid rgba(212, 145, 92, 0.25);
    border-radius: var(--radius);
    padding: 28px 22px 22px;
    text-align: center;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow), 0 0 40px rgba(212, 145, 92, 0.08);
    animation: scaleIn 0.5s ease both;
}

.game-pet-card::before {
    content: '';
    position: absolute;
    top: -60px; right: -60px;
    width: 180px; height: 180px;
    background: radial-gradient(circle, rgba(232, 195, 106, 0.1) 0%, transparent 70%);
    border-radius: 50%;
}

.game-pet-aura {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100px; height: 100px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(232, 195, 106, 0.2) 0%, rgba(212, 145, 92, 0.05) 50%, transparent 70%);
    margin-bottom: 12px;
    animation: petFloat 3s ease-in-out infinite, petGlow 4s ease-in-out infinite;
    position: relative;
}

.game-pet-aura::before {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 2px solid rgba(232, 195, 106, 0.1);
    animation: breathe 3s ease-in-out infinite;
}

.game-pet-aura::after {
    content: '';
    position: absolute;
    inset: -16px;
    border-radius: 50%;
    border: 1px solid rgba(232, 195, 106, 0.05);
    animation: breathe 3s ease-in-out infinite 0.5s;
}

@keyframes petFloat {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-8px) scale(1.03); }
}

@keyframes petGlow {
    0%, 100% { box-shadow: 0 0 20px rgba(232, 195, 106, 0.15), 0 0 40px rgba(212, 145, 92, 0.05); }
    50% { box-shadow: 0 0 30px rgba(232, 195, 106, 0.3), 0 0 60px rgba(212, 145, 92, 0.12); }
}

@keyframes iconBounce {
    0%, 100% { transform: translateY(0); }
    25% { transform: translateY(-3px); }
    75% { transform: translateY(1px); }
}

@keyframes iconWobble {
    0%, 100% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(-5deg) scale(1.05); }
    75% { transform: rotate(5deg) scale(1.05); }
}

@keyframes shimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

@keyframes gentleSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes breathe {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.04); opacity: 0.9; }
}

@keyframes sparkle {
    0%, 100% { opacity: 1; filter: brightness(1); }
    50% { opacity: 0.8; filter: brightness(1.4); }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.85); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes floatParticle {
    0% { transform: translateY(0) translateX(0) scale(0); opacity: 0; }
    10% { opacity: 0.6; transform: scale(1); }
    90% { opacity: 0.2; }
    100% { transform: translateY(-120px) translateX(30px) scale(0.3); opacity: 0; }
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes rippleGlow {
    0% { box-shadow: 0 0 0 0 rgba(212, 145, 92, 0.2); }
    70% { box-shadow: 0 0 0 12px rgba(212, 145, 92, 0); }
    100% { box-shadow: 0 0 0 0 rgba(212, 145, 92, 0); }
}

@keyframes swayIcon {
    0%, 100% { transform: rotate(0deg) translateY(0); }
    33% { transform: rotate(-8deg) translateY(-2px); }
    66% { transform: rotate(8deg) translateY(-2px); }
}

.game-pet-emoji { font-size: 56px; filter: drop-shadow(0 4px 12px rgba(232, 195, 106, 0.3)); transition: transform 0.3s ease; }
.game-pet-card:active .game-pet-emoji { transform: scale(1.15) rotate(-5deg); }

.game-pet-info { margin-bottom: 10px; }
.game-pet-name { font-size: 18px; font-weight: 800; }
.game-pet-stage { font-size: 12px; color: var(--accent-light); font-weight: 600; margin-top: 2px; }

.game-pet-speech {
    font-size: 14px;
    line-height: 1.55;
    color: var(--text-secondary);
    font-style: italic;
    padding: 10px 16px;
    background: var(--glass);
    border-radius: var(--radius-sm);
    margin: 12px 0;
    position: relative;
}

.game-pet-progress { margin-top: 8px; }

.game-pet-bar {
    height: 8px;
    background: rgba(255, 200, 140, 0.08);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 6px;
}

.game-pet-bar-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 4px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 8px var(--accent-glow);
    position: relative;
    overflow: hidden;
}

.game-pet-bar-fill::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
    background-size: 200% 100%;
    animation: shimmer 2.5s ease-in-out infinite;
}

.game-pet-next {
    font-size: 11px;
    color: var(--text-secondary);
}

/* ── Game Stats Row ── */
.game-stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.game-stat-card {
    background: var(--glass);
    backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 14px 8px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.game-stat-card:nth-child(1) { animation: slideInLeft 0.4s ease 0.1s both; }
.game-stat-card:nth-child(2) { animation: scaleIn 0.4s ease 0.2s both; }
.game-stat-card:nth-child(3) { animation: slideInRight 0.4s ease 0.3s both; }

.game-stat-icon { font-size: 22px; margin-bottom: 4px; animation: sparkle 2.5s ease-in-out infinite; }
.game-karma-card .game-stat-icon { animation: sparkle 2s ease-in-out infinite; }
.game-streak-card .game-stat-icon { animation: iconWobble 3s ease-in-out infinite; }
.game-actions-stat .game-stat-icon { animation: breathe 3s ease-in-out infinite; }
.game-stat-value { font-size: 24px; font-weight: 800; transition: all 0.3s ease; }
.game-stat-card:active .game-stat-value { transform: scale(1.1); }
.game-stat-label { font-size: 10px; color: var(--text-secondary); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.5px; }

.game-karma-card { border-color: rgba(232, 195, 106, 0.2); }
.game-karma-card .game-stat-value { color: var(--gold); }
.game-streak-card .game-stat-value { color: var(--orange); }

/* ── Principles Grid ── */
.principles-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.principle-card {
    background: var(--glass);
    backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 14px 12px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.principle-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.03) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.3s;
}

.principle-card:active::before {
    opacity: 1;
}

.principle-card:active {
    transform: scale(0.96);
    box-shadow: var(--shadow), 0 0 20px rgba(212, 145, 92, 0.12);
}

.principles-grid .principle-card:nth-child(1) { animation: scaleIn 0.35s ease 0.05s both; }
.principles-grid .principle-card:nth-child(2) { animation: scaleIn 0.35s ease 0.1s both; }
.principles-grid .principle-card:nth-child(3) { animation: scaleIn 0.35s ease 0.15s both; }
.principles-grid .principle-card:nth-child(4) { animation: scaleIn 0.35s ease 0.2s both; }
.principles-grid .principle-card:nth-child(5) { animation: scaleIn 0.35s ease 0.25s both; }

.principle-card-wide {
    grid-column: 1 / -1;
}

.principle-icon { font-size: 24px; margin-bottom: 4px; animation: swayIcon 4s ease-in-out infinite; }
[data-p="protection"] .principle-icon { animation-delay: 0s; }
[data-p="justice"] .principle-icon { animation-delay: 0.5s; }
[data-p="opportunities"] .principle-icon { animation-delay: 1s; }
[data-p="happiness"] .principle-icon { animation-delay: 1.5s; }
[data-p="future"] .principle-icon { animation-delay: 2s; }
.principle-name { font-size: 11px; font-weight: 700; margin-bottom: 6px; }

.principle-bar {
    height: 6px;
    background: rgba(255, 200, 140, 0.06);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 4px;
}

.principle-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
    position: relative;
    overflow: hidden;
}

.principle-fill::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    background-size: 200% 100%;
    animation: shimmer 3s ease-in-out infinite;
}

[data-p="protection"] .principle-fill { background: linear-gradient(90deg, #7eb8da, #5a9fcf); }
[data-p="justice"] .principle-fill { background: linear-gradient(90deg, #e8c36a, #d4a830); }
[data-p="opportunities"] .principle-fill { background: linear-gradient(90deg, #d4915c, #c07848); }
[data-p="happiness"] .principle-fill { background: linear-gradient(90deg, #f0a060, #e88040); }
[data-p="future"] .principle-fill { background: linear-gradient(90deg, #6fcf97, #4fb87a); }

.principle-level { font-size: 11px; color: var(--text-secondary); font-weight: 600; }

/* ── Game Actions Grid ── */
.game-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.game-action-card {
    background: var(--glass);
    backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 22px 14px 18px;
    text-align: center;
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.game-action-card:active {
    transform: scale(0.94);
    box-shadow: var(--shadow), 0 0 25px var(--accent-glow);
}

.game-actions-grid .game-action-card:nth-child(1) { animation: scaleIn 0.35s ease 0.05s both; }
.game-actions-grid .game-action-card:nth-child(2) { animation: scaleIn 0.35s ease 0.12s both; }
.game-actions-grid .game-action-card:nth-child(3) { animation: scaleIn 0.35s ease 0.19s both; }
.game-actions-grid .game-action-card:nth-child(4) { animation: scaleIn 0.35s ease 0.26s both; }

.game-action-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    border-radius: var(--radius) var(--radius) 0 0;
}

.ga-missions::after { background: linear-gradient(90deg, #eb7070, #f09060); }
.ga-care::after { background: linear-gradient(90deg, #6fcf97, #4fb87a); }
.ga-circle::after { background: linear-gradient(90deg, #7eb8da, #a8d8ea); }
.ga-wisdom::after { background: linear-gradient(90deg, #e8c36a, #d4a830); }

.game-action-icon { font-size: 32px; margin-bottom: 8px; transition: transform 0.3s ease; }
.game-action-card:active .game-action-icon { transform: scale(1.25) rotate(-10deg); }
.ga-missions .game-action-icon { animation: iconWobble 3s ease-in-out infinite; }
.ga-care .game-action-icon { animation: breathe 3s ease-in-out infinite 0.5s; }
.ga-circle .game-action-icon { animation: sparkle 2.5s ease-in-out infinite 1s; }
.ga-wisdom .game-action-icon { animation: swayIcon 4s ease-in-out infinite 1.5s; }
.game-action-title { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.game-action-desc { font-size: 11px; color: var(--text-secondary); }

.game-action-badge {
    position: absolute;
    top: 10px; right: 10px;
    background: var(--accent-gradient);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    min-width: 22px;
    height: 22px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    box-shadow: 0 2px 8px var(--accent-glow);
    animation: rippleGlow 2s ease-in-out infinite;
}

/* ── Thought Card ── */
.game-thought-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: linear-gradient(145deg, rgba(111, 207, 151, 0.08), rgba(126, 184, 218, 0.06));
    border: 1px solid rgba(111, 207, 151, 0.15);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    animation: fadeUp 0.6s ease 0.3s both;
}

.game-thought-icon { font-size: 22px; flex-shrink: 0; animation: swayIcon 5s ease-in-out infinite; }
.game-thought-text { font-size: 14px; line-height: 1.6; color: var(--text-secondary); font-style: italic; }

/* ── Game Screens (sub-navigation) ── */
.game-screen { animation: fadeUp 0.3s ease; }

.game-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xs);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    margin-bottom: 16px;
    transition: var(--transition);
}

.game-back-btn:active { transform: scale(0.96); }

/* ── Missions ── */
.game-mission-info {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.5;
}

.game-mission-card {
    background: var(--glass);
    backdrop-filter: blur(var(--blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 14px;
}

.game-mission-card:nth-child(1) { animation: slideInLeft 0.35s ease 0.05s both; }
.game-mission-card:nth-child(2) { animation: slideInLeft 0.35s ease 0.15s both; }
.game-mission-card:nth-child(3) { animation: slideInLeft 0.35s ease 0.25s both; }

.game-mission-card:active { transform: scale(0.97); box-shadow: var(--shadow), 0 0 20px var(--accent-glow); }

.game-mission-card.done {
    opacity: 0.5;
    pointer-events: none;
}

.game-mission-card.done::after {
    content: '✅';
    position: absolute;
    right: 14px;
    font-size: 18px;
}

.game-mission-card { position: relative; }

.gmc-icon { font-size: 30px; flex-shrink: 0; animation: iconWobble 4s ease-in-out infinite; }
.gmc-info { flex: 1; }
.gmc-title { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.gmc-principle { font-size: 11px; color: var(--accent-light); font-weight: 600; }
.gmc-karma { font-size: 12px; color: var(--gold); font-weight: 700; }

/* ── Mission Detail ── */
.game-mission-scenario {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
}

.game-mission-principle-badge {
    display: inline-block;
    background: var(--accent-gradient);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 5px 14px;
    border-radius: 20px;
    margin-bottom: 14px;
}

.game-mission-text {
    font-size: 16px;
    line-height: 1.65;
    margin-bottom: 20px;
    padding: 16px;
    background: rgba(0,0,0,0.15);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent);
}

.game-mission-choices {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.game-choice-btn {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid rgba(255,200,140,0.1);
    background: var(--glass);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    text-align: left;
    width: 100%;
}

.game-choice-btn:active { transform: scale(0.98); }

.game-choice-btn.correct {
    border-color: var(--green);
    background: var(--green-bg);
}

.game-choice-btn.wrong {
    border-color: var(--red);
    background: var(--red-bg);
    opacity: 0.6;
}

.game-choice-marker {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: rgba(255,200,140,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    flex-shrink: 0;
    color: var(--accent-light);
}

.game-mission-result {
    margin-top: 20px;
    padding: 22px;
    background: rgba(0,0,0,0.15);
    border-radius: var(--radius-sm);
    text-align: center;
    animation: fadeUp 0.4s ease;
}

.gmr-icon { font-size: 40px; margin-bottom: 8px; }
.gmr-title { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.gmr-text { font-size: 14px; line-height: 1.6; color: var(--text-secondary); margin-bottom: 10px; }
.gmr-karma { font-size: 18px; font-weight: 800; color: var(--gold); }

/* ── Care Events ── */
.game-care-card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    box-shadow: var(--shadow);
    margin-bottom: 12px;
}

.game-care-emoji { font-size: 72px; margin-bottom: 14px; animation: petFloat 2.5s ease-in-out infinite; filter: drop-shadow(0 4px 16px rgba(232, 195, 106, 0.25)); }
.game-care-title { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.game-care-desc { font-size: 14px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 18px; }

.game-care-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.game-care-btn {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    border: 2px solid rgba(255,200,140,0.1);
    background: var(--glass);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
}

.game-care-btn:active { transform: scale(0.97); }

.game-care-btn.best {
    border-color: var(--green);
    background: var(--green-bg);
}

.game-care-btn.ok {
    border-color: var(--orange);
    background: rgba(240, 160, 96, 0.08);
}

.game-care-btn.bad {
    border-color: var(--red);
    background: var(--red-bg);
    opacity: 0.6;
}

.game-care-result {
    margin-top: 16px;
    padding: 18px;
    background: rgba(0,0,0,0.15);
    border-radius: var(--radius-sm);
    text-align: center;
    animation: fadeUp 0.3s ease;
}

.game-care-result-emoji { font-size: 36px; margin-bottom: 6px; }
.game-care-result-text { font-size: 14px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 6px; }
.game-care-result-karma { font-size: 16px; font-weight: 800; color: var(--gold); }
.game-care-circle-msg { font-size: 12px; color: var(--blue); margin-top: 6px; font-style: italic; }

/* ── Circle of Kindness ── */
.game-circle-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 16px;
}

.game-circle-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
}

.game-circle-stat {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
    box-shadow: var(--shadow);
}

.gcs-value { font-size: 26px; font-weight: 800; color: var(--gold); }
.gcs-label { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

.game-gift-card {
    background: linear-gradient(145deg, rgba(126, 184, 218, 0.1), rgba(111, 207, 151, 0.08));
    border: 1px solid rgba(126, 184, 218, 0.18);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInRight 0.35s ease both;
}

.game-gift-emoji { font-size: 28px; flex-shrink: 0; animation: sparkle 2s ease-in-out infinite; }
.game-gift-info { flex: 1; }
.game-gift-from { font-size: 12px; color: var(--accent-light); font-weight: 600; }
.game-gift-text { font-size: 13px; color: var(--text-secondary); }
.game-gift-karma { font-size: 14px; font-weight: 700; color: var(--gold); flex-shrink: 0; }

/* ── Wisdom Cards ── */
.game-wisdom-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 16px;
}

.game-wisdom-card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 10px;
    box-shadow: var(--shadow);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeUp 0.4s ease both;
}

.game-wisdom-card:nth-child(odd) { animation: slideInLeft 0.4s ease both; }
.game-wisdom-card:nth-child(even) { animation: slideInRight 0.4s ease both; }

.game-wisdom-card:active {
    transform: scale(0.98);
    box-shadow: var(--shadow), 0 0 20px rgba(232, 195, 106, 0.15);
}

.game-wisdom-card.locked {
    opacity: 0.4;
    filter: blur(2px);
    pointer-events: none;
    position: relative;
}

.game-wisdom-card.locked::after {
    content: '🔒';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 32px;
    filter: blur(0);
}

.gwc-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.gwc-text {
    font-size: 14px;
    line-height: 1.65;
    color: var(--text-secondary);
}

.gwc-principle {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent-light);
    margin-top: 10px;
}

/* ── Karma popup (shared) ── */
.karma-popup {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 300;
    pointer-events: none;
}

.karma-popup-text {
    display: inline-block;
    background: linear-gradient(135deg, #e8c36a, #d4915c);
    color: #fff;
    font-weight: 800;
    font-size: 22px;
    padding: 12px 26px;
    border-radius: 28px;
    animation: popFloat 1.4s ease forwards;
    box-shadow: 0 4px 30px rgba(232, 195, 106, 0.5);
    letter-spacing: 0.5px;
}

.game-circle-explain {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
}

/* ── Pet Particles ── */
.pet-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.pet-particle {
    position: absolute;
    font-size: 12px;
    opacity: 0;
    animation: floatParticle 4s ease-in-out infinite;
}

.pet-particle:nth-child(1) { left: 15%; bottom: 10%; animation-delay: 0s; }
.pet-particle:nth-child(2) { left: 35%; bottom: 5%; animation-delay: 0.8s; }
.pet-particle:nth-child(3) { left: 55%; bottom: 15%; animation-delay: 1.6s; }
.pet-particle:nth-child(4) { left: 75%; bottom: 8%; animation-delay: 2.4s; }
.pet-particle:nth-child(5) { left: 25%; bottom: 20%; animation-delay: 3.2s; }
.pet-particle:nth-child(6) { left: 65%; bottom: 12%; animation-delay: 1.2s; }
.pet-particle:nth-child(7) { left: 45%; bottom: 3%; animation-delay: 2s; }
.pet-particle:nth-child(8) { left: 85%; bottom: 18%; animation-delay: 2.8s; }

/* ── Enhanced game screen transitions ── */
.game-screen {
    animation: fadeUp 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ── Game choice button hover glow ── */
.game-choice-btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.game-choice-btn:active {
    transform: scale(0.97);
    box-shadow: 0 0 20px rgba(212, 145, 92, 0.15);
}

.game-choice-btn.correct {
    animation: scaleIn 0.3s ease;
    box-shadow: 0 0 20px rgba(111, 207, 151, 0.2);
}

.game-choice-btn.wrong {
    animation: fadeUp 0.3s ease;
}

/* ── Care button animations ── */
.game-care-btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.game-care-btn.best {
    animation: scaleIn 0.3s ease;
    box-shadow: 0 0 20px rgba(111, 207, 151, 0.2);
}

.game-care-result {
    animation: scaleIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ── Binary tree node animations ── */
.bin-node {
    transition: all 0.3s ease;
}

.bin-node.me {
    animation: rippleGlow 3s ease-in-out infinite;
}

/* ── Online dot enhanced ── */
.online-dot {
    animation: pulse 2s infinite, rippleGlow 2s infinite;
}

/* ── Leaderboard row stagger ── */
.lb-row {
    animation: slideInLeft 0.3s ease both;
}
.lb-row:nth-child(1) { animation-delay: 0.03s; }
.lb-row:nth-child(2) { animation-delay: 0.06s; }
.lb-row:nth-child(3) { animation-delay: 0.09s; }
.lb-row:nth-child(4) { animation-delay: 0.12s; }
.lb-row:nth-child(5) { animation-delay: 0.15s; }
.lb-row:nth-child(6) { animation-delay: 0.18s; }
.lb-row:nth-child(7) { animation-delay: 0.21s; }
.lb-row:nth-child(8) { animation-delay: 0.24s; }
.lb-row:nth-child(9) { animation-delay: 0.27s; }
.lb-row:nth-child(10) { animation-delay: 0.30s; }
