:root {
    /* پالت خودمراقبتی پس از زایمان — آرام، مطمئن، بدون صورتی تند */
    --primary: #1a7a72;
    --primary-dark: #125a55;
    --primary-soft: #d8efe9;
    --secondary: #3d6b8a;
    --secondary-dark: #2d5169;
    --accent: #d4896a;
    --accent-soft: #f5e6df;
    --bg: #eef5f3;
    --bg-deep: #e2ece9;
    --surface: #ffffff;
    --text: #1e2f2c;
    --text-muted: #5a6e6a;
    --border: #c9ddd7;
    --success: #3d8b6e;
    --danger: #c45c5c;
    --card-shadow: 0 2px 14px rgba(18, 90, 85, 0.08);
    --radius: 14px;

    /* هماهنگ‌سازی با Bootstrap 5.3 */
    --bs-primary: #1a7a72;
    --bs-primary-rgb: 26, 122, 114;
    --bs-link-color: #1a7a72;
    --bs-link-hover-color: #125a55;
}

* { font-family: 'Vazirmatn', Tahoma, sans-serif; }

body {
    color: var(--text);
    background-color: var(--bg);
    background-image:
        radial-gradient(ellipse 80% 50% at 100% -10%, rgba(61, 107, 138, 0.12), transparent 55%),
        radial-gradient(ellipse 70% 45% at -5% 100%, rgba(212, 137, 106, 0.1), transparent 50%),
        linear-gradient(165deg, #eef5f3 0%, #e8f0f4 45%, #f2ebe6 100%);
    background-attachment: fixed;
    min-height: 100vh;
}

.app-navbar {
    background: linear-gradient(105deg, var(--primary-dark) 0%, var(--primary) 55%, var(--secondary) 100%);
    box-shadow: 0 2px 12px rgba(18, 90, 85, 0.22);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.app-navbar .navbar-brand {
    letter-spacing: -0.02em;
}

.score-badge {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    font-size: 0.85rem;
    padding: 0.4em 0.8em;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.level-badge {
    background: var(--accent);
    color: #fff;
    font-size: 0.85rem;
    border-radius: 8px;
}

.card-app {
    border: 1px solid rgba(201, 221, 215, 0.7);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    background: var(--surface);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.card-app:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 22px rgba(18, 90, 85, 0.12);
    border-color: rgba(26, 122, 114, 0.35);
}

.stat-card {
    text-align: center;
    padding: 1.5rem;
}

.stat-card .stat-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.stat-card .stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.btn-primary-app {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    color: white;
    padding: 0.65rem 1.5rem;
    border-radius: 10px;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(26, 122, 114, 0.25);
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.btn-primary-app:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #0e4844 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(18, 90, 85, 0.3);
    transform: translateY(-1px);
}

.btn-primary-app:active {
    transform: translateY(0);
}

.btn-secondary-app {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-dark) 100%);
    border: none;
    color: white;
    padding: 0.65rem 1.5rem;
    border-radius: 10px;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(61, 107, 138, 0.25);
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.btn-secondary-app:hover {
    color: white;
    background: var(--secondary-dark);
}

.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-card {
    max-width: 420px;
    width: 100%;
    padding: 2.5rem;
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(201, 221, 215, 0.8);
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent));
}

.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo i {
    font-size: 3rem;
    color: var(--primary);
}

.app-icon-lg {
    width: 88px;
    height: 88px;
    border-radius: 22px;
    box-shadow: 0 4px 16px rgba(26, 122, 114, 0.2);
}

.auth-logo h1 {
    font-size: 1.55rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-top: 0.75rem;
    letter-spacing: -0.02em;
}

.auth-logo .text-muted,
.auth-tagline {
    color: var(--text-muted) !important;
    font-size: 0.95rem;
}

.home-card {
    max-width: 480px;
}

.install-banner {
    background: linear-gradient(145deg, var(--primary-soft), #e8eef4);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.25rem;
    text-align: center;
}

.install-banner-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 0.75rem;
    border-radius: 14px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--primary);
    box-shadow: 0 2px 10px rgba(26, 122, 114, 0.1);
}

.install-steps {
    text-align: right;
    background: white;
    border-radius: 10px;
    padding: 0.85rem 1rem;
    border: 1px solid rgba(201, 221, 215, 0.6);
}

.form-control, .form-select {
    border-color: var(--border);
    border-radius: 10px;
    padding: 0.65rem 0.9rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(26, 122, 114, 0.18);
}

.question-card {
    background: white;
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(201, 221, 215, 0.7);
}

.question-text {
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.8;
    margin-bottom: 1.5rem;
    color: var(--text);
}

.option-btn {
    display: block;
    width: 100%;
    text-align: right;
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    border: 2px solid #dce8e4;
    border-radius: 12px;
    background: #f7fbfa;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.option-btn:hover, .option-btn.selected {
    border-color: var(--primary);
    background: var(--primary-soft);
    box-shadow: 0 2px 8px rgba(26, 122, 114, 0.1);
}

.timer-bar {
    height: 8px;
    background: #dce8e4;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.timer-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: width 1s linear;
}

.timer-fill.danger { background: linear-gradient(90deg, var(--accent), var(--danger)); }

.feedback-correct {
    background: linear-gradient(135deg, #e6f5ee, #cfead9);
    border-right: 4px solid var(--success);
}

.feedback-wrong {
    background: linear-gradient(135deg, #fceeee, #f5d4d4);
    border-right: 4px solid var(--danger);
}

.leaderboard-row.highlight {
    background: linear-gradient(90deg, rgba(26, 122, 114, 0.12), rgba(26, 122, 114, 0.04));
    font-weight: 600;
}

.rank-badge {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.rank-1 { background: gold; color: #333; }
.rank-2 { background: silver; color: #333; }
.rank-3 { background: #cd7f32; color: white; }
.rank-other { background: #dce8e4; color: #5a6e6a; }

.medal-icon { font-size: 1.5rem; }
.medal-weekly_gold { color: #e6b800; }
.medal-weekly_silver { color: #8a8a8a; }
.medal-weekly_bronze { color: #cd7f32; }
.medal-streak_excellent { color: #4a90b8; }
.medal-streak_fantastic { color: #5b8fa8; }
.medal-streak_unbelievable { color: #d4896a; }
.medal-streak_champion { color: #1a7a72; }
.medal-streak_milestone { color: #c9a227; }

.page-header {
    margin-bottom: 2rem;
}

.page-header h2 {
    color: var(--primary-dark);
    font-weight: 700;
}

.waiting-animation {
    text-align: center;
    padding: 3rem;
}

.waiting-animation .spinner-grow {
    color: var(--primary);
}

.progress-game {
    height: 10px;
    border-radius: 5px;
}

.progress-bar.bg-primary,
.bg-primary {
    background-color: var(--primary) !important;
}

.text-primary {
    color: var(--primary) !important;
}

.btn-outline-primary {
    --bs-btn-color: var(--primary);
    --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary);
    --bs-btn-hover-border-color: var(--primary);
    --bs-btn-active-bg: var(--primary-dark);
    --bs-btn-active-border-color: var(--primary-dark);
}

.messages-container { margin-bottom: 1rem; }

table.table-app th {
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-weight: 600;
}

table.table-app tbody tr:hover {
    background: rgba(26, 122, 114, 0.05);
}

.profile-avatar-sm {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.5);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.profile-avatar-lg {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--primary);
}

.profile-avatar-placeholder {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 1.2rem;
}

.profile-avatar-lg.profile-avatar-placeholder {
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.medal-help-btn {
    font-size: 1.1rem;
    line-height: 1;
    text-decoration: none;
}

.medal-help-btn:hover {
    color: var(--primary) !important;
}

/* ── Medal celebration ── */
.medal-celebration {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    margin: 1.25rem 0;
    padding: 2rem 1.5rem;
    text-align: center;
    animation: medalSlideIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes medalSlideIn {
    from { opacity: 0; transform: translateY(24px) scale(0.92); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.medal-celebration-weekly_gold {
    background: linear-gradient(135deg, #fff9e6 0%, #ffe082 50%, #ffd54f 100%);
    border: 2px solid #ffc107;
    box-shadow: 0 8px 32px rgba(255, 193, 7, 0.35);
}
.medal-celebration-weekly_silver {
    background: linear-gradient(135deg, #fafafa 0%, #e0e0e0 50%, #bdbdbd 100%);
    border: 2px solid #9e9e9e;
    box-shadow: 0 8px 32px rgba(158, 158, 158, 0.3);
}
.medal-celebration-weekly_bronze {
    background: linear-gradient(135deg, #fff3e0 0%, #ffcc80 50%, #cd7f32 100%);
    border: 2px solid #cd7f32;
    box-shadow: 0 8px 32px rgba(205, 127, 50, 0.35);
}
.medal-celebration-streak_excellent {
    background: linear-gradient(135deg, #e3f2fd 0%, #90caf9 100%);
    border: 2px solid #42a5f5;
    box-shadow: 0 8px 32px rgba(66, 165, 245, 0.35);
}
.medal-celebration-streak_fantastic {
    background: linear-gradient(135deg, #e8f0f4 0%, #a8c4d4 100%);
    border: 2px solid #5b8fa8;
    box-shadow: 0 8px 32px rgba(91, 143, 168, 0.35);
}
.medal-celebration-streak_unbelievable {
    background: linear-gradient(135deg, #f5e6df 0%, #e8b9a4 100%);
    border: 2px solid #d4896a;
    box-shadow: 0 8px 32px rgba(212, 137, 106, 0.35);
}
.medal-celebration-streak_champion {
    background: linear-gradient(135deg, #d8efe9 0%, #7ec4b8 50%, #1a7a72 100%);
    border: 2px solid #1a7a72;
    box-shadow: 0 8px 32px rgba(26, 122, 114, 0.35);
}
.medal-celebration-streak_milestone {
    background: linear-gradient(135deg, #fff8e1 0%, #ffd54f 50%, #c9a227 100%);
    border: 2px solid #c9a227;
    box-shadow: 0 8px 32px rgba(201, 162, 39, 0.4);
}

.medal-celebration-rays {
    position: absolute;
    inset: -50%;
    background: repeating-conic-gradient(
        from 0deg,
        rgba(255,255,255,0.08) 0deg 10deg,
        transparent 10deg 20deg
    );
    animation: medalRaysSpin 8s linear infinite;
    pointer-events: none;
}

@keyframes medalRaysSpin {
    to { transform: rotate(360deg); }
}

.medal-celebration-body {
    position: relative;
    z-index: 2;
}

.medal-celebration-icon-wrap {
    position: relative;
    display: inline-block;
    margin-bottom: 0.75rem;
}

.medal-celebration-icon {
    font-size: 4rem;
    display: block;
    animation: medalBounce 1s ease infinite;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
}

@keyframes medalBounce {
    0%, 100% { transform: translateY(0) scale(1); }
    50%       { transform: translateY(-8px) scale(1.08); }
}

.medal-celebration-ring {
    position: absolute;
    inset: -12px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.6);
    animation: medalRingPulse 1.5s ease-out infinite;
}

.medal-celebration-ring-2 {
    animation-delay: 0.5s;
    inset: -22px;
    border-color: rgba(255,255,255,0.3);
}

@keyframes medalRingPulse {
    0%   { transform: scale(0.8); opacity: 1; }
    100% { transform: scale(1.4); opacity: 0; }
}

.medal-celebration-kicker {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    animation: medalFadeUp 0.5s 0.2s both;
}

.medal-celebration-title {
    font-weight: 700;
    font-size: 1.35rem;
    margin-bottom: 0.35rem;
    color: #333;
    animation: medalFadeUp 0.5s 0.35s both;
}

.medal-celebration-streak {
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
    animation: medalFadeUp 0.5s 0.45s both;
}

.medal-celebration-subtitle {
    font-size: 0.85rem;
    color: #555;
    margin-bottom: 0.75rem;
    animation: medalFadeUp 0.5s 0.5s both;
}

@keyframes medalFadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.medal-celebration-bonus {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255,255,255,0.85);
    border-radius: 12px;
    padding: 0.5rem 1.5rem;
    animation: medalBonusPop 0.6s 0.65s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

@keyframes medalBonusPop {
    from { opacity: 0; transform: scale(0.5); }
    to   { opacity: 1; transform: scale(1); }
}

.medal-celebration-bonus-label {
    font-size: 0.75rem;
    color: #666;
}

.medal-celebration-bonus-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: #2e7d32;
    animation: medalBonusShine 2s ease-in-out infinite;
}

@keyframes medalBonusShine {
    0%, 100% { text-shadow: 0 0 0 transparent; }
    50%       { text-shadow: 0 0 12px rgba(46,125,50,0.5); }
}

/* Confetti */
.medal-celebration-confetti {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 1;
}

.confetti-piece {
    position: absolute;
    width: 8px;
    height: 8px;
    top: -10px;
    border-radius: 2px;
    animation: confettiFall 2.5s ease-in forwards;
}

.confetti-piece:nth-child(6n+1) { background: #e6b800; border-radius: 2px; }
.confetti-piece:nth-child(6n+2) { background: #1a7a72; width: 6px; height: 10px; }
.confetti-piece:nth-child(6n+3) { background: #3d6b8a; border-radius: 50%; }
.confetti-piece:nth-child(6n+4) { background: #3d8b6e; width: 10px; height: 6px; }
.confetti-piece:nth-child(6n+5) { background: #d4896a; border-radius: 2px; }
.confetti-piece:nth-child(6n+6) { background: #7ec4b8; border-radius: 50%; width: 6px; height: 6px; }

@keyframes confettiFall {
    0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(220px) rotate(720deg); opacity: 0; }
}

/* Streak toast (no medal) */
.streak-toast {
    background: linear-gradient(90deg, var(--accent-soft), #f0ebe4);
    border-right: 4px solid var(--accent);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    font-weight: 600;
    animation: medalSlideIn 0.5s ease both;
}

/* ═══════════════════════════════════════════
   رابط کاربران — موبایل / تبلت / لپ‌تاپ
   ═══════════════════════════════════════════ */

.user-app {
    padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
}

.user-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(201, 221, 215, 0.7);
    padding-top: env(safe-area-inset-top, 0px);
}

.user-topbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.7rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    text-decoration: none;
    color: var(--primary-dark);
    font-weight: 800;
    flex-shrink: 0;
}

.user-brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
}

.user-brand-text {
    font-size: 1.05rem;
    letter-spacing: -0.02em;
}

.user-desktop-nav {
    flex: 1;
    justify-content: center;
    gap: 0.25rem;
}

.user-desk-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.88rem;
    transition: background 0.15s ease, color 0.15s ease;
}

.user-desk-link:hover { color: var(--primary-dark); background: var(--primary-soft); }
.user-desk-link.active {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.user-topbar-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: auto;
}

.user-chips {
    align-items: center;
    gap: 0.35rem;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
}

.user-chip-score {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.user-chip-level {
    background: var(--accent-soft);
    color: #9a4f32;
}

.user-music-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 1.05rem;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.user-music-btn:hover {
    background: var(--primary-soft);
    border-color: rgba(26, 122, 114, 0.35);
}

.user-music-btn.is-muted {
    color: var(--text-muted);
    opacity: 0.75;
}

.user-music-btn.is-muted i::after {
    content: '';
}

.music-switch {
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg);
    min-height: 48px;
    display: flex;
    align-items: center;
}

.music-switch .form-check-input {
    width: 2.4em;
    height: 1.25em;
    margin-left: 0.65em;
    cursor: pointer;
}

.music-switch .form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

#music-settings .form-range {
    accent-color: var(--primary);
}

.user-avatar-link { text-decoration: none; }

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.user-avatar-ph {
    background: var(--primary-soft);
    color: var(--primary);
}

.user-logout {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-muted);
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.user-logout:hover { color: var(--danger); border-color: #f0c4c4; }

.user-main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.1rem 1rem 1.5rem;
}

.user-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1040;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid rgba(201, 221, 215, 0.85);
    padding: 0.35rem 0.25rem calc(0.35rem + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -6px 24px rgba(18, 90, 85, 0.08);
}

.user-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 600;
    padding: 0.35rem 0.15rem;
    min-height: 52px;
    -webkit-tap-highlight-color: transparent;
}

.user-tab i { font-size: 1.25rem; line-height: 1; }
.user-tab.active { color: var(--primary); }

.user-tab-fab {
    width: 46px;
    height: 46px;
    margin-top: -1.35rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--secondary), var(--secondary-dark));
    color: #fff;
    box-shadow: 0 6px 16px rgba(61, 107, 138, 0.35);
    font-size: 1.2rem !important;
}

.user-tab-accent.active .user-tab-fab {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.user-tab-accent span:last-child { margin-top: 0.1rem; }

/* Page intro */
.u-hero {
    margin-bottom: 1.15rem;
}

.u-hero h1 {
    margin: 0;
    font-size: clamp(1.25rem, 2.5vw, 1.65rem);
    font-weight: 800;
    color: var(--primary-dark);
    letter-spacing: -0.02em;
}

.u-hero p {
    margin: 0.35rem 0 0;
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.6;
}

.u-mobile-chips {
    display: none;
    gap: 0.4rem;
    margin-top: 0.75rem;
}

@media (max-width: 575.98px) {
    .u-mobile-chips { display: flex; flex-wrap: wrap; }
}

/* Stats */
.u-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.15rem;
}

.u-stat {
    background: var(--surface);
    border: 1px solid rgba(201, 221, 215, 0.75);
    border-radius: 16px;
    padding: 0.95rem 0.85rem;
    text-align: center;
    box-shadow: var(--card-shadow);
}

.u-stat-icon {
    width: 38px;
    height: 38px;
    margin: 0 auto 0.5rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.u-stat-icon.tone-gold { background: #fff4df; color: #c9852a; }
.u-stat-icon.tone-green { background: #dff5ea; color: #2f8f68; }
.u-stat-icon.tone-teal { background: var(--primary-soft); color: var(--primary); }
.u-stat-icon.tone-sky { background: #e4eef5; color: var(--secondary); }

.u-stat-value {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--primary-dark);
    line-height: 1.1;
}

.u-stat-label {
    margin-top: 0.2rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Action cards */
.u-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
    margin-bottom: 1.15rem;
}

.u-action {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid rgba(201, 221, 215, 0.75);
    border-radius: 18px;
    padding: 1.15rem 1.1rem;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--card-shadow);
    min-height: 150px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.u-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(18, 90, 85, 0.12);
    color: inherit;
}

.u-action-ico {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 0.75rem;
}

.u-action-ico.solo { background: var(--primary-soft); color: var(--primary); }
.u-action-ico.duo { background: #e4eef5; color: var(--secondary); }
.u-action-ico.ai { background: var(--accent-soft); color: #b86a4d; }
.u-action-ico.forum { background: #ebe8f8; color: #5b4d9a; }

.u-action h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text);
}

.u-action p {
    margin: 0.35rem 0 0.85rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.55;
    flex: 1;
}

.u-action-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--primary);
}

.u-action.duo-card .u-action-cta { color: var(--secondary); }
.u-action.ai-card .u-action-cta { color: #b86a4d; }
.u-action.forum-card .u-action-cta { color: #5b4d9a; }

/* Panels & list cards */
.u-panel {
    background: var(--surface);
    border: 1px solid rgba(201, 221, 215, 0.75);
    border-radius: 18px;
    box-shadow: var(--card-shadow);
    padding: 1.15rem;
    margin-bottom: 1rem;
}

.u-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.u-panel-head h2,
.u-panel-head h5 {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
    color: var(--primary-dark);
}

.u-panel-head .hint {
    margin: 0.2rem 0 0;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.u-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.u-list-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 0.9rem;
    border-radius: 14px;
    background: #f7fbfa;
    border: 1px solid #e4efeb;
    text-decoration: none;
    color: inherit;
}

a.u-list-item:hover {
    border-color: rgba(26, 122, 114, 0.35);
    color: inherit;
}

.u-list-item .meta {
    flex: 1;
    min-width: 0;
}

.u-list-item .meta strong {
    display: block;
    font-size: 0.92rem;
    font-weight: 700;
}

.u-list-item .meta span {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.u-list-item .side {
    text-align: left;
    flex-shrink: 0;
}

.u-score-pos { color: var(--success); font-weight: 800; }
.u-score-neg { color: var(--danger); font-weight: 800; }

.u-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
}

.u-pill-ok { background: #dff5ea; color: #1f6b4a; }
.u-pill-bad { background: #fde8e8; color: #9b2c2c; }
.u-pill-mute { background: #eef2f4; color: #5a6e6a; }
.u-pill-warn { background: #fff4df; color: #9a5b12; }
.u-pill-turn { background: var(--primary-soft); color: var(--primary-dark); }

.u-period {
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    padding-bottom: 0.35rem;
    margin-bottom: 0.9rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.u-period::-webkit-scrollbar { display: none; }

.u-period a {
    flex: 0 0 auto;
    padding: 0.45rem 0.95rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 600;
}

.u-period a.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.u-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
}

.u-empty i {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.75rem;
    opacity: 0.55;
}

/* Touch-friendly game options */
.option-btn {
    min-height: 52px;
    display: flex;
    align-items: center;
    -webkit-tap-highlight-color: transparent;
}

.option-btn input { margin-left: 0.5rem; }

.btn-primary-app,
.btn-secondary-app {
    min-height: 46px;
}

.question-card {
    padding: 1.35rem 1.15rem;
}

@media (max-width: 991.98px) {
    .u-actions { grid-template-columns: 1fr; }
}

@media (max-width: 767.98px) {
    .u-stats { grid-template-columns: repeat(2, 1fr); }
    .user-brand-text { display: none; }
    .page-header h2 { font-size: 1.25rem; }
}

@media (min-width: 992px) {
    .user-app { padding-bottom: 0; }
    .user-main { padding: 1.5rem 1.25rem 2rem; }
}

/* Hide desktop table on small, show cards; reverse on large where dual markup exists */
.u-table-desktop { display: none; }
.u-cards-mobile { display: block; }

@media (min-width: 768px) {
    .u-table-desktop { display: block; }
    .u-cards-mobile { display: none; }
}

.rank-badge {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}
.rank-1 { background: gold; color: #333; }
.rank-2 { background: silver; color: #333; }
.rank-3 { background: #cd7f32; color: white; }
.rank-other { background: #e0e0e0; color: #666; }

/* AI consult chat */
.ai-chat-shell {
    display: flex;
    flex-direction: column;
    min-height: min(72vh, 640px);
    padding: 0;
    overflow: hidden;
}

.ai-chat-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid rgba(201, 221, 215, 0.8);
    flex-wrap: wrap;
}

.ai-chat-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.85rem;
    align-items: center;
    font-size: 0.82rem;
}

.ai-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 700;
}

.ai-status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.ai-status.is-ready { color: var(--success); }
.ai-status.is-off { color: var(--danger); }
.ai-quota { color: var(--text-muted); }

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background:
        linear-gradient(180deg, rgba(216, 239, 233, 0.35), transparent 120px),
        #f7fbfa;
    min-height: 320px;
    max-height: min(56vh, 480px);
}

.ai-empty {
    margin: auto;
    text-align: center;
    max-width: 420px;
    color: var(--text-muted);
    padding: 1.5rem 0.5rem;
}

.ai-empty i {
    font-size: 2rem;
    color: var(--primary);
    display: block;
    margin-bottom: 0.65rem;
}

.ai-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    justify-content: center;
    margin-top: 0.9rem;
}

.ai-chip {
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    border-radius: 999px;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.ai-bubble {
    max-width: min(92%, 520px);
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.ai-bubble-user { align-self: flex-start; }
.ai-bubble-assistant { align-self: flex-end; }

.ai-bubble-body {
    padding: 0.75rem 0.9rem;
    border-radius: 16px;
    line-height: 1.7;
    font-size: 0.95rem;
    word-break: break-word;
}

.ai-bubble-user .ai-bubble-body {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border-bottom-right-radius: 6px;
}

.ai-bubble-assistant .ai-bubble-body {
    background: #fff;
    border: 1px solid rgba(201, 221, 215, 0.9);
    color: var(--text);
    border-bottom-left-radius: 6px;
}

.ai-bubble.is-typing .ai-bubble-body {
    color: var(--text-muted);
    font-style: italic;
}

.ai-bubble-time {
    font-size: 0.72rem;
    color: var(--text-muted);
    padding: 0 0.35rem;
}

.ai-bubble-user .ai-bubble-time { align-self: flex-start; }
.ai-bubble-assistant .ai-bubble-time { align-self: flex-end; }

.ai-chat-composer {
    display: flex;
    gap: 0.55rem;
    align-items: flex-end;
    padding: 0.85rem 1rem 1rem;
    border-top: 1px solid rgba(201, 221, 215, 0.8);
    background: #fff;
}

.ai-chat-composer textarea {
    flex: 1;
    resize: none;
    min-height: 46px;
    max-height: 140px;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0.7rem 0.85rem;
    line-height: 1.5;
    background: #f8fbfa;
}

.ai-chat-composer textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 122, 114, 0.12);
}

.ai-send-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: none;
    border-radius: 14px;
    min-height: 46px;
    padding: 0 1rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font-weight: 700;
}

.ai-send-btn:disabled { opacity: 0.55; }
.ai-send-btn.is-loading { opacity: 0.75; }

.ai-config-hint {
    margin: 0;
    padding: 0 1rem 1rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

@media (max-width: 575.98px) {
    .ai-send-btn span { display: none; }
    .ai-chat-messages { max-height: min(52vh, 420px); }
}

/* Forum */
.forum-hero-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.forum-new-btn {
    white-space: nowrap;
}

.forum-item {
    text-decoration: none;
    color: inherit;
}

.forum-item:hover {
    background: rgba(216, 239, 233, 0.45);
}

.forum-pin { color: #c9852a; margin-left: 0.2rem; }
.forum-lock { color: var(--text-muted); margin-left: 0.2rem; }

.forum-back {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
}

.forum-back:hover { color: var(--primary); }

.forum-section-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--primary-dark);
    margin: 1.1rem 0 0.75rem;
}

.forum-post {
    margin-bottom: 0.75rem;
}

.forum-post-topic {
    border-color: rgba(26, 122, 114, 0.25);
}

.forum-post-admin {
    border-color: rgba(61, 107, 138, 0.35);
    background: linear-gradient(180deg, #f4f8fb, #fff);
}

.forum-author {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.forum-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.forum-avatar-ph {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 1.1rem;
}

.forum-time {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.forum-post-body {
    margin-top: 0.75rem;
    line-height: 1.8;
    white-space: pre-wrap;
    word-break: break-word;
}

.forum-badge-admin {
    background: #e4eef5 !important;
    color: var(--secondary) !important;
    margin-right: 0.35rem;
}

.forum-locked-note {
    color: var(--text-muted);
    font-weight: 600;
}

.forum-form textarea {
    min-height: 110px;
}
