/* ============================================
   HUYỀN HỌC VŨ TRỤ – MYSTIC UNIVERSE V4.0
   Admin-inspired Dark Theme
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Cinzel+Decorative:wght@400;700;900&family=Be+Vietnam+Pro:wght@300;400;500;600;700&display=swap');

:root {
    --bg-deep: #06050e;
    --bg-card: #110f24;
    --gold: #d4a843;
    --gold-dim: #8b7030;
    --purple-main: #7c3aed;
    --purple-deep: #6d28d9;
    --purple-darker: #4c1d95;
    --purple-light: #a78bfa;
    --purple-text: #e9d5ff;
    --teal: #3ab5a0;
    --teal-dark: #2a8a78;
    --success: #22c55e;
    --success-dark: #15803d;
    --error: #f87171;
    --error-bg: rgba(220,38,38,0.15);
    --warning: #f59e0b;
    --text-primary: #e8e0f0;
    --text-secondary: #9a90b0;
    --text-dim: #5e5578;
    --text-strong: #e8d5a0;
    --border: rgba(212,168,67,0.15);
    --border-md: rgba(212,168,67,0.2);
    --border-glow: rgba(212,168,67,0.3);
    --radius: 12px;
    --radius-md: 10px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --font-display: 'Cinzel Decorative', serif;
    --font-body: 'Be Vietnam Pro', 'Segoe UI', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
    font-family: var(--font-body);
    background: var(--bg-deep);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* ============ STARS BACKGROUND ============ */
#stars-container {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 0; overflow: hidden;
}
.star {
    position: absolute;
    background: #fff;
    border-radius: 50%;
    animation: twinkle var(--dur, 3s) ease-in-out infinite alternate;
}
@keyframes twinkle {
    from { opacity: 0.1; transform: scale(0.8); }
    to   { opacity: 0.9; transform: scale(1.2); }
}

/* ============ LAYOUT ============ */
#mainApp { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; padding-top: 66px; }

/* ============ NAVIGATION ============ */
nav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
    background: #110f24;
    border-bottom: 1px solid rgba(212,168,67,0.1);
    height: 56px; display: flex; align-items: center; padding: 0 20px;
    gap: 4px;
}
.nav-brand {
    font-family: var(--font-display);
    color: var(--gold);
    font-size: 12px;
    letter-spacing: 1px;
    white-space: nowrap;
    margin-right: 14px;
    text-decoration: none;
    flex-shrink: 0;
}
.nav-links {
    display: flex; align-items: center; gap: 2px; flex: 1;
    flex-wrap: nowrap; overflow-x: auto;
}
.nav-links::-webkit-scrollbar { display: none; }
.nav-btn {
    background: transparent;
    border: none; border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    padding: 6px 10px;
    cursor: pointer;
    font-size: 12px;
    font-family: var(--font-body);
    white-space: nowrap;
    transition: all 0.2s;
    border-radius: 0;
    line-height: 1;
}
.nav-btn:hover { color: var(--gold); border-bottom-color: rgba(212,168,67,0.4); }
.nav-btn.active { color: var(--gold); border-bottom-color: var(--gold); font-weight: 600; }
.nav-btn-maintain { opacity: 0.5; cursor: pointer; }
.nav-btn-maintain:hover { opacity: 0.75; color: #94a3b8 !important; border-bottom-color: rgba(148,163,184,0.3) !important; }
.nav-maintain-tag { font-size: 10px; vertical-align: middle; }
.nav-btn-history {
    color: var(--gold) !important;
    border: 1px solid rgba(212,168,67,0.3) !important;
    border-radius: 20px !important;
    padding: 4px 12px !important;
    background: rgba(212,168,67,0.06) !important;
    margin-left: 4px;
}
.nav-btn-history:hover {
    background: rgba(212,168,67,0.15) !important;
    border-color: var(--gold) !important;
    border-bottom-color: var(--gold) !important;
}
.nav-right { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0; }
.user-badge {
    display: none; align-items: center; gap: 8px;
    background: rgba(212,168,67,0.08);
    border: 1px solid var(--border);
    border-radius: 20px; padding: 4px 12px;
}
.user-badge.show { display: flex; }
#headerUserName { color: var(--gold); font-size: 13px; font-weight: 600; }
.history-btn, .logout-btn {
    background: transparent; border: none;
    cursor: pointer; font-size: 14px; padding: 4px 6px;
    border-radius: var(--radius-xs);
    transition: background 0.2s;
}
.history-btn:hover { background: rgba(212,168,67,0.1); }
.logout-btn:hover { background: rgba(220,38,38,0.12); }
.nav-auth-btn {
    background: linear-gradient(135deg, var(--gold), var(--gold-dim));
    border: none; color: #06050e; font-weight: 700;
    padding: 6px 14px; border-radius: var(--radius-sm); cursor: pointer;
    font-size: 12px; font-family: var(--font-body);
    transition: opacity 0.2s;
}
.nav-auth-btn:hover { opacity: 0.88; }

.lang-selector {
    background: rgba(255,255,255,0.06); border: 1px solid rgba(212,168,67,0.2);
    color: var(--text-primary); font-size: 12px; padding: 4px 6px;
    border-radius: var(--radius-sm); cursor: pointer; font-family: var(--font-body);
    outline: none; appearance: none; -webkit-appearance: none;
}
.lang-selector:focus { border-color: var(--gold); }
.lang-selector option { background: #110f24; color: var(--text-primary); }
.auth-lang-switch { text-align: center; margin-top: 16px; }
.auth-lang-switch .lang-selector { font-size: 13px; padding: 6px 12px; }
.lang-select-register {
    width: 100%; padding: 10px 12px; background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1); border-radius: var(--radius-sm);
    color: var(--text-primary); font-size: 14px; font-family: var(--font-body);
}

/* ============ AUTH SCREEN ============ */
#authScreen, #onboardingScreen {
    position: fixed; inset: 0; z-index: 2000;
    background: #06050e;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.auth-box {
    background: var(--bg-card);
    border: 1px solid var(--border-glow);
    border-radius: 14px;
    padding: 32px 28px;
    width: 100%; max-width: 420px;
}
.auth-logo {
    font-family: var(--font-display);
    color: var(--gold);
    font-size: 16px;
    text-align: center;
    margin-bottom: 6px;
    letter-spacing: 1px;
}
.auth-sub { text-align: center; color: var(--text-dim); font-size: 13px; margin-bottom: 24px; }
.auth-tabs {
    display: flex; margin-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.auth-tab {
    flex: 1; padding: 10px; text-align: center; cursor: pointer;
    background: transparent; border: none; border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-family: var(--font-body); font-size: 13px;
    transition: all 0.2s; margin-bottom: -1px;
}
.auth-tab.active { color: var(--gold); border-bottom-color: var(--gold); font-weight: 600; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 5px; }
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-xs);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 13px;
    padding: 10px 12px;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 2px rgba(212,168,67,0.15);
}
.form-group select option { background: #110f24; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
/* Password show/hide */
.password-wrap {
    position: relative; display: flex; align-items: center;
}
.password-wrap input {
    flex: 1; padding-right: 42px !important;
}
.pw-toggle {
    position: absolute; right: 8px;
    background: transparent; border: none;
    cursor: pointer; font-size: 16px; padding: 4px;
    opacity: 0.5; transition: opacity 0.2s; line-height: 1;
    color: var(--text-secondary);
}
.pw-toggle:hover { opacity: 1; }
.pw-toggle.show { opacity: 0.8; filter: brightness(1.3); }

/* Remember me */
.remember-row {
    margin: -4px 0 12px;
}
.remember-label {
    display: flex; align-items: center; gap: 8px;
    cursor: pointer; font-size: 12px; color: var(--text-secondary);
    user-select: none;
}
.remember-label input[type="checkbox"] {
    width: 14px; height: 14px; accent-color: var(--gold);
    cursor: pointer; flex-shrink: 0;
    margin: 0;
}
.remember-label span { line-height: 1.3; }

.auth-submit {
    width: 100%;
    background: linear-gradient(135deg, #d4a843, #8b7030);
    border: none; color: #06050e; font-weight: 700;
    padding: 12px; border-radius: var(--radius-sm); cursor: pointer;
    font-size: 14px; font-family: var(--font-body);
    margin-top: 8px; transition: opacity 0.2s;
}
.auth-submit:hover { opacity: 0.88; }
.auth-error {
    background: rgba(220,38,38,0.1);
    border: 1px solid rgba(220,38,38,0.3);
    color: var(--error); border-radius: var(--radius-xs);
    padding: 10px 12px; font-size: 12px;
    margin-bottom: 12px; display: none;
}
.auth-error.show { display: block; }

/* ============ SECTIONS ============ */
.section { display: none; padding: 28px 20px 60px; max-width: 900px; margin: 0 auto; }
.section.active { display: block; }
.section-header { text-align: center; margin-bottom: 28px; }
.section-title {
    font-family: var(--font-display);
    font-size: 22px; color: var(--gold);
    letter-spacing: 2px; margin-bottom: 8px;
}
.section-desc { color: var(--text-secondary); font-size: 13px; font-style: italic; }

/* ============ HOME SECTION ============ */
#section-home { max-width: 1000px; }
/* ===== HERO SIÊU ĐẸP ===== */
.home-hero {
    text-align: center; padding: 28px 20px 16px;
    position: relative; overflow: hidden; min-height: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(124,58,237,0.08) 0%, transparent 60%);
}
.hero-canvas {
    position: absolute; inset: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 0;
}
/* Aurora */
.hero-aurora {
    position: absolute; border-radius: 50%; filter: blur(80px);
    animation: auroraMove 10s ease-in-out infinite; pointer-events: none;
}
.hero-aurora-1 {
    width: 500px; height: 200px; left: -100px; top: 10px;
    background: linear-gradient(135deg, rgba(124,58,237,0.2), rgba(167,139,250,0.1));
    animation-delay: 0s;
}
.hero-aurora-2 {
    width: 400px; height: 250px; right: -80px; top: 0;
    background: linear-gradient(225deg, rgba(212,168,67,0.15), rgba(251,191,36,0.08));
    animation-delay: -4s;
}
.hero-aurora-3 {
    width: 300px; height: 180px; left: 50%; top: 40%; transform: translateX(-50%);
    background: radial-gradient(circle, rgba(52,211,153,0.07), transparent 70%);
    animation-delay: -7s;
}
@keyframes auroraMove {
    0%,100% { transform: translateY(0) scaleX(1); opacity: 0.8; }
    33%      { transform: translateY(-15px) scaleX(1.05); opacity: 1; }
    66%      { transform: translateY(10px) scaleX(0.95); opacity: 0.7; }
}
/* Meteor / Shooting stars */
.hero-meteor {
    position: absolute; left: var(--ml, 20%); top: var(--mt, 20%);
    width: 120px; height: 1.5px; pointer-events: none; z-index: 1;
    background: linear-gradient(90deg, rgba(255,255,255,0), rgba(212,168,67,0.9), rgba(255,255,255,0));
    border-radius: 2px; opacity: 0;
    animation: meteorFly 12s linear infinite;
    animation-delay: var(--md, 0s);
    transform-origin: left center; transform: rotate(-35deg);
}
@keyframes meteorFly {
    0%   { opacity: 0; transform: rotate(-35deg) translateX(0); }
    2%   { opacity: 1; }
    10%  { opacity: 0; transform: rotate(-35deg) translateX(180px); }
    100% { opacity: 0; transform: rotate(-35deg) translateX(180px); }
}
/* Rings */
.hero-ring {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
    border-radius: 50%; border: 1px solid rgba(212,168,67,0.08);
    pointer-events: none; animation: ringPulse 6s ease-in-out infinite;
}
.hero-ring-1 { width: 300px; height: 300px; animation-delay: 0s; }
.hero-ring-2 { width: 500px; height: 500px; border-color: rgba(124,58,237,0.05); animation-delay: -3s; }
@keyframes ringPulse {
    0%,100% { opacity: 0; transform: translate(-50%,-50%) scale(0.8); }
    50%      { opacity: 1; transform: translate(-50%,-50%) scale(1); }
}
/* Hero content */
.hero-content { position: relative; z-index: 2; }
/* Moon */
.hero-moon-wrap { position: relative; display: inline-block; margin-bottom: 4px; }
.hero-moon-glow {
    position: absolute; inset: -20px; border-radius: 50%;
    background: radial-gradient(circle, rgba(212,168,67,0.25), transparent 70%);
    animation: moonPulse 3s ease-in-out infinite;
}
@keyframes moonPulse {
    0%,100% { transform: scale(1); opacity: 0.6; }
    50%      { transform: scale(1.3); opacity: 1; }
}
.hero-moon-text {
    font-family: var(--font-display); font-size: 22px; color: #d4a843;
    text-shadow: 0 0 20px rgba(212,168,67,0.8), 0 0 40px rgba(212,168,67,0.4);
    display: block; position: relative; z-index: 1;
    animation: moonFloat 4s ease-in-out infinite;
}
@keyframes moonFloat {
    0%,100% { transform: translateY(0); }
    50%      { transform: translateY(-5px); }
}
/* Title letter-by-letter */
.home-title {
    font-family: var(--font-display);
    font-size: clamp(20px, 4.5vw, 36px);
    letter-spacing: 3px; margin-bottom: 8px;
    display: flex; justify-content: center; flex-wrap: wrap;
    line-height: 1;
}
.htw {
    background: linear-gradient(180deg, #fff5cc 0%, #f5d78a 30%, #d4a843 60%, #8b6020 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-block;
    animation: letterGlow 4s ease-in-out infinite, letterEntrance 0.8s cubic-bezier(0.34,1.56,0.64,1) both;
    animation-delay: calc(var(--i) * 0.06s), calc(var(--i) * 0.06s);
    filter: drop-shadow(0 0 6px rgba(212,168,67,0.4));
}
.htw:hover {
    filter: drop-shadow(0 0 16px rgba(212,168,67,1)) brightness(1.3);
    transform: scale(1.15) translateY(-3px);
    transition: all 0.15s;
}
@keyframes letterEntrance {
    from { opacity: 0; transform: translateY(20px) scale(0.8); filter: blur(4px) drop-shadow(0 0 0 transparent); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes letterGlow {
    0%,100% { filter: drop-shadow(0 0 4px rgba(212,168,67,0.3)); }
    50%      { filter: drop-shadow(0 0 14px rgba(212,168,67,0.8)); }
}
.htw-space { width: 0.35em; display: inline-block; }
.home-sub {
    color: var(--text-secondary); font-size: 13px; margin-bottom: 10px;
    line-height: 1.6; animation: fadeUp 1s ease-out 0.9s both;
}
.home-sub-em {
    font-style: normal; color: #c4b5fd; font-weight: 700;
    text-shadow: 0 0 14px rgba(196,181,253,0.5);
}
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
/* Tags */
.home-tags-wrap {
    display: flex; flex-wrap: wrap; justify-content: center;
    gap: 4px; margin-bottom: 16px;
    animation: fadeUp 1s ease-out 1.1s both;
}
.home-tag {
    font-size: 12px; color: rgba(255,255,255,0.5); padding: 4px 12px;
    border-radius: 20px; border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03); cursor: default;
    transition: all 0.25s; animation: tagEntrance 0.5s ease-out both;
    animation-delay: calc(1.2s + var(--ti,0) * 0.08s);
}
@keyframes tagEntrance {
    from { opacity: 0; transform: scale(0.8); }
    to   { opacity: 1; transform: scale(1); }
}
.home-tag:hover {
    color: var(--gold); border-color: rgba(212,168,67,0.4);
    background: rgba(212,168,67,0.08);
    box-shadow: 0 0 10px rgba(212,168,67,0.15);
    transform: translateY(-2px);
}
.home-tag-dot { color: rgba(255,255,255,0.12); font-size: 12px; align-self: center; }
.home-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px; padding: 0 16px 40px;
    max-width: 1000px; margin: 0 auto;
}
/* Layout mới: Tarot to + 5 card nhỏ */
.home-grid-new {
    display: flex; flex-direction: column; align-items: center;
    gap: 14px; padding: 0 16px 40px; max-width: 900px; margin: 0 auto;
}
.home-card-hero {
    width: 100%; max-width: 380px;
    padding: 32px 24px !important;
    border-color: rgba(212,168,67,0.35) !important;
    background: linear-gradient(135deg, rgba(212,168,67,0.06), rgba(124,58,237,0.04)) !important;
    box-shadow: 0 8px 40px rgba(212,168,67,0.12), 0 0 60px rgba(124,58,237,0.06) !important;
}
.home-card-hero .home-card-title { color: var(--gold) !important; }
.home-cards-mini {
    display: grid; grid-template-columns: repeat(5, 1fr);
    gap: 10px; width: 100%;
}
@media (max-width: 700px) {
    .home-cards-mini { grid-template-columns: repeat(2, 1fr); }
    .home-card-hero { max-width: 100%; }
}
@media (max-width: 480px) {
    .home-cards-mini { grid-template-columns: repeat(2, 1fr); }
}
.home-card-sm {
    padding: 14px 10px !important;
    opacity: 0.82;
}
.home-card-sm .home-card-icon { font-size: 26px !important; margin-bottom: 6px !important; }
.home-card-sm .home-card-title { font-size: 9px !important; letter-spacing: 0.5px; }
.home-card-sm .home-card-desc { font-size: 10px !important; -webkit-line-clamp: 2; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; }
.home-card-sm .home-card-badge { font-size: 8px !important; padding: 1px 6px !important; }
.home-card-sm:hover { opacity: 1; }
.home-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 18px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34,1.2,0.64,1);
    position: relative;
    overflow: hidden;
    animation: homeCardEntrance 0.6s cubic-bezier(0.34,1.2,0.64,1) both;
    animation-delay: var(--card-delay, 0s);
}
@keyframes homeCardEntrance {
    from { opacity: 0; transform: translateY(24px) scale(0.93); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
/* Lớp gradient shine khi hover */
.home-card::before {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(circle at var(--mx,50%) var(--my,50%), rgba(212,168,67,0.08) 0%, transparent 60%);
    opacity: 0; transition: opacity 0.3s;
    pointer-events: none;
}
.home-card:hover::before { opacity: 1; }
/* Sao nhỏ trang trí góc */
.home-card::after {
    content: '✦';
    position: absolute; top: 10px; right: 12px;
    font-size: 10px; color: rgba(212,168,67,0.3);
    animation: starTwinkle 2s ease-in-out infinite;
    animation-delay: var(--card-delay, 0s);
}
@keyframes starTwinkle {
    0%,100% { opacity: 0.2; transform: scale(1) rotate(0deg); }
    50%      { opacity: 1;   transform: scale(1.4) rotate(20deg); }
}
@keyframes homeStarFly {
    0%   { opacity: 1; transform: translate(0,0) scale(1); }
    100% { opacity: 0; transform: translate(var(--dx,0), var(--dy,-20px)) scale(0.3); }
}
.home-card:hover {
    border-color: rgba(212,168,67,0.5);
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 8px 28px rgba(212,168,67,0.2), 0 0 40px rgba(124,58,237,0.1);
}
.home-card.coming-soon { opacity: 0.4; cursor: not-allowed; }
.home-card.coming-soon:hover { transform: none; box-shadow: none; }
.home-card.coming-soon::after { display: none; }
.home-card-icon {
    font-size: 40px; margin-bottom: 12px; display: block;
    transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
    filter: drop-shadow(0 0 8px rgba(212,168,67,0.2));
}
.home-card:hover .home-card-icon { transform: scale(1.2) translateY(-3px); filter: drop-shadow(0 0 16px rgba(212,168,67,0.5)); }
.home-card-title {
    font-family: var(--font-display);
    font-size: 11px; color: var(--gold);
    letter-spacing: 1px; margin-bottom: 8px;
}
.home-card-desc { color: var(--text-secondary); font-size: 12px; line-height: 1.5; margin-bottom: 12px; }
.home-card-stars {
    font-size: 12px; letter-spacing: 1px; margin-bottom: 6px; display: block;
    filter: drop-shadow(0 0 4px rgba(212,168,67,0.5));
}
.maintain-stars {
    color: #94a3b8; font-size: 11px; filter: none;
    background: rgba(255,255,255,0.05); padding: 2px 8px; border-radius: 8px; display: inline-block;
}
.home-card-maintain {
    opacity: 0.6;
    border-style: dashed !important;
    border-color: rgba(255,255,255,0.12) !important;
}
.home-card-maintain:hover { opacity: 0.75 !important; }
.maintain-badge { background: rgba(100,100,120,0.15) !important; border-color: rgba(255,255,255,0.1) !important; color: #94a3b8 !important; }

/* Maintain popup */
.maintain-popup-overlay {
    display: none; position: fixed; inset: 0; z-index: 7000;
    background: rgba(0,0,0,0.75); align-items: center; justify-content: center; padding: 20px;
}
.maintain-popup-overlay.open { display: flex; }
.maintain-popup-box {
    background: #0e0c1f; border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px; padding: 32px 24px; max-width: 360px; width: 100%;
    text-align: center; animation: cardAppear 0.35s cubic-bezier(0.34,1.2,0.64,1);
}
.maintain-popup-icon { font-size: 48px; margin-bottom: 12px; display: block; animation: handPulse 1.5s ease-in-out infinite; }
.maintain-popup-title { font-family: var(--font-display); color: var(--gold); font-size: 18px; margin-bottom: 6px; }
.maintain-popup-name { color: #a78bfa; font-size: 15px; font-weight: 600; margin-bottom: 12px; }
.maintain-popup-desc { color: var(--text-dim); font-size: 13px; line-height: 1.7; margin-bottom: 20px; }
.maintain-popup-btn {
    width: 100%; padding: 12px; border-radius: 10px; cursor: pointer;
    background: linear-gradient(135deg, rgba(212,168,67,0.15), rgba(124,58,237,0.1));
    border: 1px solid rgba(212,168,67,0.3); color: var(--gold);
    font-size: 13px; font-family: var(--font-body); transition: all 0.2s;
}
.maintain-popup-btn:hover { background: linear-gradient(135deg, rgba(212,168,67,0.25), rgba(124,58,237,0.18)); }

.home-card-badge {
    display: inline-block;
    background: rgba(212,168,67,0.08);
    border: 1px solid var(--border-md);
    color: var(--gold-dim); font-size: 10px;
    padding: 2px 10px; border-radius: 10px;
    letter-spacing: 0.5px;
}

/* ============ QUESTION BOX ============ */
.question-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px; margin-bottom: 20px;
}
.question-title {
    font-family: var(--font-display);
    font-size: 13px; color: var(--gold); margin-bottom: 5px;
}
.question-sub { color: var(--text-dim); font-size: 12px; margin-bottom: 12px; font-style: italic; }
.question-input-row { display: flex; gap: 8px; align-items: flex-start; }
.question-input {
    flex: 1;
    width: 100%; box-sizing: border-box;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-xs);
    color: var(--text-primary);
    font-size: 13px; font-family: var(--font-body);
    padding: 10px 12px;
    transition: border-color 0.2s, box-shadow 0.2s;
    resize: vertical;
    min-height: 80px;
    line-height: 1.6;
    outline: none;
}
.question-input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 2px rgba(212,168,67,0.15);
}
.question-input::placeholder { color: var(--text-dim); font-style: italic; }
.question-input-lg { min-height: 130px; font-size: 14px; width: 100%; box-sizing: border-box; }
.question-hint {
    font-size: 12px; color: var(--gold-dim); margin-top: 6px;
    padding: 6px 10px; background: rgba(212,168,67,0.05);
    border-left: 2px solid rgba(212,168,67,0.3); border-radius: 0 4px 4px 0;
    line-height: 1.5;
}
.add-question-btn {
    flex-shrink: 0; width: 40px; height: 40px;
    background: rgba(212,168,67,0.08);
    border: 1px dashed var(--gold-dim);
    border-radius: 50%; cursor: pointer;
    font-size: 16px; display: flex; align-items: center; justify-content: center;
    transition: all 0.2s; margin-top: 4px; color: var(--gold-dim);
}
.add-question-btn:hover { background: rgba(212,168,67,0.15); color: var(--gold); }
.selected-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.selected-tag {
    background: rgba(212,168,67,0.1); border: 1px solid var(--border-glow);
    color: var(--gold); font-size: 12px; padding: 3px 10px; border-radius: 10px;
    display: flex; align-items: center; gap: 5px;
}
.selected-tag .remove-tag { cursor: pointer; opacity: 0.6; }
.selected-tag .remove-tag:hover { opacity: 1; }
.question-limit { font-size: 11px; color: var(--text-dim); margin-top: 6px; text-align: right; }
.question-suggestions { margin-top: 12px; }
.question-cat-label { font-size: 11px; color: var(--text-dim); margin-bottom: 5px; display: block; }
.question-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.question-chip {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-secondary); font-size: 12px;
    padding: 5px 12px; border-radius: 10px; cursor: pointer;
    transition: all 0.2s;
}
.question-chip:hover { border-color: var(--gold-dim); color: var(--gold); }
.question-chip.selected {
    background: rgba(212,168,67,0.1);
    border-color: var(--border-glow);
    color: var(--gold);
}

/* ============ CONTROLS ============ */
.tarot-controls { text-align: center; margin-bottom: 20px; }
.spread-selector { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 14px; }
.spread-btn {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-secondary);
    padding: 7px 14px; border-radius: var(--radius-xs);
    cursor: pointer; font-size: 12px; font-family: var(--font-body);
    transition: all 0.2s;
}
.spread-btn:hover, .spread-btn.active {
    background: rgba(212,168,67,0.1);
    border-color: var(--border-glow);
    color: var(--gold);
}

/* --- Base draw button --- */
.draw-btn {
    background: linear-gradient(135deg, #d4a843, #8b7030);
    border: none; color: #06050e;
    padding: 11px 26px; border-radius: var(--radius-sm);
    cursor: pointer; font-weight: 700; font-size: 13px;
    font-family: var(--font-body);
    display: inline-flex; align-items: center; gap: 8px;
    transition: opacity 0.2s, transform 0.2s; letter-spacing: 0.3px;
}
.draw-btn:hover { opacity: 0.88; transform: translateY(-1px); }
.draw-btn:active { transform: translateY(0); }
.draw-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.draw-icon { font-size: 16px; }

/* --- AI button (purple) --- */
.ai-btn {
    background: linear-gradient(135deg, #7c3aed, #4c1d95);
    color: var(--purple-text);
}
.ai-btn:hover { box-shadow: 0 4px 16px rgba(124,58,237,0.35); }

/* --- Flip all button --- */
.flip-all-btn {
    background: linear-gradient(135deg, #7c3aed, #4c1d95);
    color: var(--purple-text);
}

/* --- Tuvi button --- */
.tuvi-btn {
    background: linear-gradient(135deg, #7c3aed, #4c1d95);
    color: var(--purple-text);
}

/* --- Numerology button --- */
.num-btn {
    background: linear-gradient(135deg, #22c55e, #15803d);
    color: #fff;
}

/* --- Reset button --- */
.reset-btn {
    background: rgba(220,38,38,0.12);
    border: 1px solid rgba(220,38,38,0.3);
    color: var(--error);
    padding: 10px 18px; border-radius: var(--radius-sm);
    cursor: pointer; font-size: 12px; font-family: var(--font-body);
    margin-left: 10px; transition: all 0.2s;
}
.reset-btn:hover { background: rgba(220,38,38,0.2); }

/* --- Share button --- */
.share-btn {
    background: rgba(212,168,67,0.12);
    border: 1px solid var(--border-glow);
    color: var(--gold); padding: 7px 16px;
    border-radius: var(--radius-xs); cursor: pointer;
    font-size: 12px; font-family: var(--font-body);
    transition: all 0.2s;
}
.share-btn:hover { background: rgba(212,168,67,0.22); }

/* --- TTS button --- */
.tts-btn {
    background: linear-gradient(135deg, rgba(124,58,237,0.15), rgba(212,168,67,0.15));
    border: 1px solid rgba(124,58,237,0.3);
    color: #c4b5fd; padding: 7px 16px;
    border-radius: var(--radius-xs); cursor: pointer;
    font-size: 12px; font-family: var(--font-body);
    transition: all 0.3s; margin-left: 8px;
}
.tts-btn:hover {
    background: linear-gradient(135deg, rgba(124,58,237,0.3), rgba(212,168,67,0.25));
    color: #e8e0f0; transform: scale(1.05);
}
.tts-btn.tts-loading {
    opacity: 0.7; cursor: wait;
    animation: ttsPulse 1.2s ease-in-out infinite;
}
.tts-btn.tts-playing {
    background: linear-gradient(135deg, rgba(34,197,94,0.2), rgba(124,58,237,0.2));
    border-color: rgba(34,197,94,0.4); color: #86efac;
    animation: ttsGlow 2s ease-in-out infinite;
}
@keyframes ttsPulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}
@keyframes ttsGlow {
    0%, 100% { box-shadow: 0 0 6px rgba(34,197,94,0.2); }
    50% { box-shadow: 0 0 14px rgba(34,197,94,0.4); }
}

/* --- Cancel button --- */
.modal-cancel-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.12);
    color: var(--text-secondary); padding: 10px 20px;
    border-radius: var(--radius-sm); cursor: pointer;
    font-size: 13px; font-family: var(--font-body);
    transition: all 0.2s;
}
.modal-cancel-btn:hover { border-color: rgba(255,255,255,0.25); color: var(--text-primary); }

/* ============ DECK FAN ============ */
.deck-stage { text-align: center; margin-bottom: 20px; }
.deck-question-display {
    color: var(--gold); font-style: italic; font-size: 13px;
    margin-bottom: 14px; min-height: 20px;
}
.deck-fan {
    display: flex; flex-wrap: wrap; justify-content: center;
    gap: 8px; min-height: 160px; padding: 14px 10px;
    margin-bottom: 14px;
    perspective: 1200px;
}

/* === 3D CARD FLIP – ULTRA SMOOTH + MAGICAL === */
@keyframes cardAppear {
    from { opacity: 0; transform: scale(0.7) translateY(30px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes flipGlow {
    0%   { box-shadow: 0 0 0 rgba(212,168,67,0); }
    40%  { box-shadow: 0 0 40px rgba(212,168,67,0.6), 0 0 80px rgba(124,58,237,0.3); }
    100% { box-shadow: 0 6px 24px rgba(212,168,67,0.3); }
}
@keyframes sparkle {
    0%   { opacity: 0; transform: scale(0) rotate(0deg); }
    50%  { opacity: 1; transform: scale(1.2) rotate(180deg); }
    100% { opacity: 0; transform: scale(0) rotate(360deg); }
}
@keyframes cardFloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-3px); }
}
.fan-card {
    width: 72px; height: 120px;
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
    transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), opacity 0.3s;
    animation: cardAppear 0.5s cubic-bezier(0.34,1.56,0.64,1) both;
    animation-delay: var(--appear-delay, 0s);
}
/* Lá to hơn khi ít lá */
.deck-fan.few-cards .fan-card { width: 100px; height: 166px; }
.deck-fan.few-cards .fan-card-symbol { font-size: 32px; }
.deck-fan.few-cards .fan-card-name { font-size: 8px; }
.deck-fan.few-cards .fan-card-vn { font-size: 7px; }
.deck-fan.few-cards .fan-card-back-emoji { font-size: 36px; }
.fan-card:hover:not(.flipped) {
    transform: translateY(-12px) scale(1.08);
    z-index: 10;
}
.fan-card:hover:not(.flipped) .fan-card-inner {
    box-shadow: 0 12px 40px rgba(212,168,67,0.35), 0 0 20px rgba(124,58,237,0.2);
}
.fan-card-inner {
    width: 100%; height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border-radius: 8px;
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}
.fan-card.flipped .fan-card-inner {
    transform: rotateY(180deg);
    animation: flipGlow 0.8s ease-out;
}
.fan-card-back, .fan-card-front {
    position: absolute; inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 8px;
    overflow: hidden;
    display: flex; align-items: center; justify-content: center;
}
.fan-card-back {
    background: linear-gradient(135deg, #1e1b4b, #312e81);
    border: 2px solid rgba(167,139,250,0.4);
    flex-direction: column; gap: 4px;
    transition: border-color 0.3s;
}
.fan-card:hover:not(.flipped) .fan-card-back {
    border-color: rgba(212,168,67,0.6);
}
.fan-card-back-img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; }
.fan-card-back-emoji { font-size: 26px; transition: transform 0.3s; }
.fan-card:hover:not(.flipped) .fan-card-back-emoji { transform: scale(1.15); }
.fan-card-front {
    transform: rotateY(180deg);
    background: #0c0a1a;
    border: 2px solid rgba(212,168,67,0.5);
    flex-direction: column;
}
.fan-card-front-img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; display: block; }
.fan-card-front-fallback {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; padding: 4px; width: 100%; height: 100%;
    background: linear-gradient(135deg, #0f0e1a, #1a1735);
}
.fan-card-symbol { font-size: 22px; }
.fan-card-name { font-size: 6px; color: var(--gold); font-family: var(--font-display); margin-top: 2px; line-height: 1.2; text-align: center; }
.fan-card-vn { font-size: 5.5px; color: var(--text-secondary); text-align: center; }
.fan-card.reversed .fan-card-front-img { transform: rotate(180deg); }

/* Lá bài ngược – xoay 180° mọi nơi */
img.card-img-reversed,
.ai-card-figure-img img.card-img-reversed,
.ai-card-strip-img img.card-img-reversed,
.ai-block-card-item .ai-card-figure-img img.card-img-reversed {
    transform: rotate(180deg) !important;
    transform-origin: center center;
}
.fan-card.flipped { animation: none; }
.fan-card.flipped .fan-card-inner { box-shadow: 0 6px 24px rgba(212,168,67,0.3); }
.fan-card.card52-red .fan-card-back { background: linear-gradient(135deg, #3b0000, #6b1010); border-color: rgba(220,80,80,0.4); }
.fan-card.card52-red .fan-card-front { border-color: rgba(220,80,80,0.6); }

/* Sparkle effect on flip */
.fan-card .sparkle-burst {
    position: absolute; inset: 0; pointer-events: none; z-index: 20;
}
.fan-card .sparkle-burst span {
    position: absolute;
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--gold);
    animation: sparkle 0.6s ease-out forwards;
}

/* Flip count badge */
.flip-counter {
    text-align: center; margin: 8px 0;
    font-size: 12px; color: var(--text-dim);
    transition: all 0.3s;
}
.flip-counter strong { color: var(--gold); font-size: 14px; }

/* "All flipped" popup toast */
.flip-done-toast {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%) scale(0.8);
    background: var(--bg-card); border: 1px solid var(--border-glow);
    border-radius: 14px; padding: 28px 32px; text-align: center;
    z-index: 5000; opacity: 0; pointer-events: none;
    transition: all 0.4s cubic-bezier(0.34,1.56,0.64,1);
    box-shadow: 0 8px 40px rgba(212,168,67,0.3), 0 0 80px rgba(124,58,237,0.15);
    max-width: 360px;
}
.flip-done-toast.show { opacity: 1; transform: translate(-50%,-50%) scale(1); pointer-events: auto; }
.flip-done-toast .fdt-icon { font-size: 48px; margin-bottom: 12px; display: block; }
.flip-done-toast .fdt-title { color: var(--gold); font-family: var(--font-display); font-size: 14px; margin-bottom: 8px; }
.flip-done-toast .fdt-sub { color: var(--text-secondary); font-size: 12px; line-height: 1.6; margin-bottom: 16px; }
.flip-done-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 4999; opacity: 0; transition: opacity 0.3s;
    pointer-events: none;
}
.flip-done-overlay.show { opacity: 1; pointer-events: auto; }

/* "View Meaning" button */
.view-meaning-bar {
    display: none; text-align: center; margin: 14px 0; padding: 14px;
    background: rgba(212,168,67,0.06); border: 1px solid var(--border);
    border-radius: var(--radius);
    animation: cardAppear 0.4s ease-out;
}
.view-meaning-btn {
    background: linear-gradient(135deg, #d4a843, #8b7030);
    border: none; color: #06050e;
    padding: 10px 24px; border-radius: var(--radius-sm);
    cursor: pointer; font-weight: 700; font-size: 13px;
    font-family: var(--font-body);
    display: inline-flex; align-items: center; gap: 8px;
    transition: opacity 0.2s, transform 0.2s;
}
.view-meaning-btn:hover { opacity: 0.88; transform: translateY(-1px); }

.deck-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

.hand-guide {
    text-align: center; margin: 8px 0 4px;
    font-size: 15px; font-weight: 600; letter-spacing: 0.5px;
    color: var(--gold); min-height: 28px;
    transition: all 0.4s ease;
}
.hand-guide .hand-icon { font-size: 22px; margin-right: 6px; display: inline-block; animation: handPulse 1s ease-in-out infinite; }
@keyframes handPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
}

.quick-meaning-bar {
    min-height: 0; overflow: hidden;
    transition: all 0.3s ease;
}
.quick-meaning-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px; margin: 4px 0;
    background: rgba(212,168,67,0.07);
    border: 1px solid rgba(212,168,67,0.2);
    border-radius: 10px;
    animation: slideUp 0.35s cubic-bezier(0.34,1.56,0.64,1);
}
.quick-meaning-item .qm-hand { font-size: 20px; flex-shrink: 0; }
.quick-meaning-item .qm-card { font-weight: 700; color: var(--gold); font-size: 13px; }
.quick-meaning-item .qm-rev { font-size: 10px; color: var(--text-dim); margin-left: 4px; }
.quick-meaning-item .qm-desc { color: var(--text-secondary); font-size: 12px; line-height: 1.5; }
@keyframes slideUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============ TAROT 5 SAO ============ */

/* Hero */
.tarot-hero {
    position: relative; overflow: hidden;
    padding: 16px 20px 12px; text-align: center;
    margin-bottom: 14px;
    background: radial-gradient(ellipse at 50% 0%, rgba(212,168,67,0.08) 0%, transparent 65%);
    border-radius: 12px;
    border: 1px solid rgba(212,168,67,0.1);
}
.tarot-hero-glow {
    position: absolute; top: -40px; left: 50%; transform: translateX(-50%);
    width: 300px; height: 200px;
    background: radial-gradient(ellipse, rgba(212,168,67,0.18) 0%, transparent 70%);
    pointer-events: none;
}
.tarot-hero-icon { font-size: 28px; margin-bottom: 4px; display: inline-block; animation: handPulse 3s ease-in-out infinite; }
.tarot-hero-title {
    font-family: var(--font-display); font-size: clamp(14px, 3vw, 20px);
    color: var(--gold); letter-spacing: 2px; margin-bottom: 4px; display: inline-block; margin-left: 8px;
    text-shadow: 0 0 20px rgba(212,168,67,0.3);
}
.tarot-hero-content { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 12px; }
.tarot-hero-sub { font-size: 11px; color: var(--text-dim); margin-bottom: 6px; line-height: 1.4; width: 100%; }
.tarot-hero-badges { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.tarot-badge {
    padding: 2px 9px; border-radius: 20px; font-size: 10px; font-weight: 600;
    background: rgba(212,168,67,0.08); border: 1px solid rgba(212,168,67,0.2);
    color: var(--gold);
}

/* Question cards */
.tarot-question-card, .tarot-spread-card {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(212,168,67,0.12);
    border-radius: 14px; padding: 22px 20px; margin-bottom: 16px;
}
.tqc-header { margin-bottom: 14px; }
.tqc-step {
    display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: 2px;
    color: var(--gold); background: rgba(212,168,67,0.1);
    padding: 3px 10px; border-radius: 20px; margin-bottom: 8px;
}
.tqc-title { font-size: 17px; font-weight: 700; color: var(--text-primary); margin-bottom: 5px; }
.tqc-desc { font-size: 13px; color: var(--text-dim); line-height: 1.5; }
.tarot-question-input {
    width: 100%; padding: 14px 16px; box-sizing: border-box;
    background: rgba(0,0,0,0.25); border: 1.5px solid rgba(255,255,255,0.1);
    border-radius: 10px; color: var(--text-primary); font-size: 14px;
    font-family: var(--font-body); resize: vertical; min-height: 130px;
    line-height: 1.7; outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.tarot-question-input:focus { border-color: rgba(212,168,67,0.5); box-shadow: 0 0 0 3px rgba(212,168,67,0.08); }
.tarot-question-input::placeholder { color: var(--text-dim); font-style: italic; }
.tqc-actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.tqc-suggest-btn {
    padding: 9px 18px; border-radius: 22px; cursor: pointer; font-size: 13px;
    background: rgba(212,168,67,0.08); border: 1.5px solid rgba(212,168,67,0.25);
    color: var(--gold); font-family: var(--font-body); transition: all 0.2s;
}
.tqc-suggest-btn:hover { background: rgba(212,168,67,0.15); border-color: var(--gold); }
.tqc-preview { font-size: 12px; color: var(--text-dim); font-style: italic; flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* Spread grid */
.tarot-spread-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 18px;
}
@media (min-width: 600px) { .tarot-spread-grid { grid-template-columns: repeat(4, 1fr); } }
.tsb {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 14px 10px; border-radius: 12px; cursor: pointer; position: relative;
    background: rgba(255,255,255,0.03); border: 1.5px solid rgba(255,255,255,0.1);
    color: var(--text-secondary); font-family: var(--font-body); transition: all 0.2s;
}
.tsb:hover { border-color: rgba(212,168,67,0.4); background: rgba(212,168,67,0.05); color: var(--text-primary); }
.tsb-active { border-color: var(--gold) !important; background: rgba(212,168,67,0.1) !important; color: var(--gold) !important; }
.tsb-icon { font-size: 20px; }
.tsb-name { font-size: 14px; font-weight: 700; }

/* Layout mới Bước 1+2 Tarot */
.tqs-row {
    display: flex; gap: 10px; align-items: stretch; margin-bottom: 12px;
}
.tqs-left { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.tqs-right { display: flex; align-items: center; flex-shrink: 0; }
.tqc-suggest-btn-v2 {
    padding: 12px 14px; border-radius: 12px; cursor: pointer;
    background: rgba(212,168,67,0.08); border: 1.5px solid rgba(212,168,67,0.25);
    color: var(--gold); font-size: 12px; font-weight: 600; font-family: var(--font-body);
    transition: all 0.2s; text-align: center; line-height: 1.6; height: 100%;
    min-width: 64px;
}
.tqc-suggest-btn-v2:hover { background: rgba(212,168,67,0.18); border-color: var(--gold); }
.tqs-step2 {
    background: rgba(255,255,255,0.02); border: 1px solid rgba(212,168,67,0.1);
    border-radius: 12px; padding: 14px 16px;
}
/* Spread cards grid */
.spread-cards-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
    margin-bottom: 16px;
}
.spread-card {
    position: relative; display: flex; flex-direction: column; align-items: center;
    gap: 4px; padding: 16px 8px 12px; border-radius: 12px; cursor: pointer;
    background: rgba(255,255,255,0.03); border: 1.5px solid rgba(255,255,255,0.08);
    color: var(--text-secondary); font-family: var(--font-body); transition: all 0.25s;
    text-align: center;
}
.spread-card:hover {
    border-color: rgba(212,168,67,0.35); background: rgba(212,168,67,0.06);
    transform: translateY(-2px);
}
.spread-card-active {
    border-color: var(--gold) !important; background: rgba(212,168,67,0.1) !important;
    box-shadow: 0 0 16px rgba(212,168,67,0.15), inset 0 0 20px rgba(212,168,67,0.05);
}
.spread-card-active .spread-card-num { color: var(--gold); text-shadow: 0 0 12px rgba(212,168,67,0.5); }
.spread-card-active .spread-card-label { color: var(--gold); }
.spread-card-active .spread-card-desc { color: rgba(212,168,67,0.7); }
.spread-card-num {
    font-size: 28px; font-weight: 800; font-family: var(--font-display);
    color: rgba(255,255,255,0.5); line-height: 1; transition: all 0.25s;
}
.spread-card-label {
    font-size: 13px; font-weight: 600; color: var(--text-primary);
    letter-spacing: 0.3px; transition: color 0.25s;
}
.spread-card-desc {
    font-size: 10px; color: var(--text-dim); line-height: 1.35;
    opacity: 0.8; transition: color 0.25s;
}
.spread-card-badge {
    position: absolute; top: -8px; left: 50%; transform: translateX(-50%);
    font-size: 9px; background: var(--gold); color: #06050e;
    padding: 2px 8px; border-radius: 10px; font-weight: 700;
    white-space: nowrap; letter-spacing: 0.3px;
}
@media (max-width: 480px) {
    .spread-cards-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .spread-card { padding: 12px 6px 10px; }
    .spread-card-num { font-size: 22px; }
    .spread-card-label { font-size: 12px; }
    .spread-card-desc { font-size: 9px; }
}

/* Draw button premium */
.tarot-draw-btn {
    width: 100%; padding: 18px 24px; border-radius: 14px; cursor: pointer;
    background: linear-gradient(135deg, #d4a843 0%, #7c3aed 50%, #d4a843 100%);
    background-size: 200% 200%; animation: gradientShift 4s ease infinite;
    border: none; color: #fff; font-family: var(--font-display);
    font-size: 16px; font-weight: 700; letter-spacing: 1px;
    display: flex; align-items: center; justify-content: center; gap: 12px;
    flex-direction: column; gap: 3px;
    box-shadow: 0 6px 30px rgba(124,58,237,0.35), 0 0 40px rgba(212,168,67,0.15);
    transition: transform 0.2s, box-shadow 0.2s;
}
.tarot-draw-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 40px rgba(124,58,237,0.5); }
.tarot-draw-icon { font-size: 24px; }
.tarot-draw-sub { font-size: 11px; opacity: 0.8; font-family: var(--font-body); font-weight: 400; letter-spacing: 0; }
@keyframes gradientShift {
    0%,100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* AI button premium */
.tarot-ai-btn {
    width: 100%; padding: 20px 24px; border-radius: 14px; cursor: pointer;
    background: linear-gradient(135deg, rgba(124,58,237,0.15), rgba(212,168,67,0.1));
    border: 1.5px solid rgba(124,58,237,0.4); color: var(--text-primary);
    font-family: var(--font-body); display: flex; align-items: center; gap: 16px;
    transition: all 0.25s; text-align: left;
}
.tarot-ai-btn:hover {
    background: linear-gradient(135deg, rgba(124,58,237,0.25), rgba(212,168,67,0.15));
    border-color: var(--gold); transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(124,58,237,0.3);
}
.tarot-ai-btn-icon { font-size: 36px; flex-shrink: 0; }
.tarot-ai-btn-text { flex: 1; }
.tarot-ai-btn-title { display: block; font-size: 16px; font-weight: 700; color: var(--gold); margin-bottom: 3px; }
.tarot-ai-btn-sub { display: block; font-size: 12px; color: var(--text-dim); }
.tarot-ai-btn-arrow { font-size: 22px; color: var(--gold); opacity: 0.7; flex-shrink: 0; }

/* ============ TAROT RESULTS ============ */
.tarot-spread-labels { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 14px; }
.spread-label {
    background: rgba(212,168,67,0.08);
    border: 1px solid var(--border);
    color: var(--gold-dim); font-size: 11px;
    padding: 3px 10px; border-radius: 8px;
}
.tarot-result, .iching-result, .tuvi-result { margin-bottom: 16px; }
.card-result {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px; margin-bottom: 8px;
    display: flex; gap: 12px; align-items: flex-start;
}
.card-emoji { font-size: 28px; flex-shrink: 0; }
.card-info h4 { color: var(--gold); font-size: 13px; margin-bottom: 3px; }
.card-info .card-name-vn { color: var(--text-secondary); font-size: 12px; }
.card-reversed { color: var(--error); font-size: 11px; }

/* ============ ICHING ============ */
.iching-hexagram-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px; text-align: center;
}
.iching-hex-number { color: var(--text-dim); font-size: 12px; margin-bottom: 4px; }
.iching-hex-name { font-family: var(--font-display); font-size: 18px; color: var(--gold); margin-bottom: 4px; }
.iching-hex-vn { color: var(--text-secondary); font-size: 13px; margin-bottom: 4px; }
.iching-hex-chinese { color: var(--text-dim); font-size: 18px; margin-bottom: 10px; }
.iching-hexagram-visual { margin: 14px auto; width: fit-content; }
.iching-line { margin: 4px 0; }
.iching-line-solid { width: 120px; height: 8px; background: var(--gold); border-radius: 4px; }
.iching-line-broken { display: flex; gap: 12px; }
.iching-line-broken span { width: 54px; height: 8px; background: var(--gold-dim); border-radius: 4px; }
.iching-judgment, .iching-image, .iching-interpret {
    text-align: left; margin-top: 14px; padding: 12px;
    background: rgba(255,255,255,0.03); border-radius: var(--radius-md);
    border-left: 3px solid var(--gold-dim);
}
.iching-judgment h4, .iching-image h4, .iching-interpret h4 { color: var(--gold); font-size: 12px; margin-bottom: 5px; }
.iching-judgment p, .iching-image p, .iching-interpret p { color: var(--text-secondary); font-size: 12px; line-height: 1.7; }

/* ============ TU VI / NUMEROLOGY FORM ============ */
.tuvi-form {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px; margin-bottom: 16px;
}
.tuvi-result, .num-result-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}
.tuvi-result h3, .num-result-box h3 {
    font-family: var(--font-display); color: var(--gold);
    font-size: 13px; margin-bottom: 14px;
}
.batu-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
.batu-item {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px; text-align: center;
}
.batu-label { font-size: 10px; color: var(--text-dim); margin-bottom: 3px; }
.batu-value { font-size: 16px; color: var(--gold); font-weight: 700; }
.batu-sub { font-size: 10px; color: var(--text-secondary); }
.ngu-hanh-bar { display: flex; border-radius: 6px; overflow: hidden; height: 28px; margin: 10px 0; }
.ngu-hanh-bar > div { display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 600; color: #fff; padding: 0 4px; text-shadow: 0 1px 2px rgba(0,0,0,0.5); }
.el-kim  { background: #b0b8c1; color: #06050e !important; }
.el-moc  { background: #4a9e5c; }
.el-thuy { background: #3a7abf; }
.el-hoa  { background: #e05c3a; }
.el-tho  { background: #b8860b; }
.tuvi-text-block {
    border-left: 3px solid var(--gold-dim);
    padding: 10px 14px; margin: 10px 0;
    background: rgba(255,255,255,0.02); border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
.tuvi-text-block h4 { color: var(--gold); font-size: 12px; margin-bottom: 5px; }
.tuvi-text-block p { color: var(--text-secondary); font-size: 12px; line-height: 1.7; }
.num-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.num-item {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px; text-align: center;
}
.num-item-number { font-size: 28px; color: var(--gold); font-weight: 700; line-height: 1; }
.num-item-label { font-size: 10px; color: var(--text-dim); margin-top: 3px; }
.num-item-name { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

/* ============ AI ACTION BAR ============ */
.ai-action-bar {
    display: none; flex-direction: column; align-items: center;
    gap: 8px; margin: 16px 0; padding: 16px;
    background: rgba(124,58,237,0.06);
    border: 1px solid rgba(124,58,237,0.2);
    border-radius: var(--radius);
}
.ai-action-hint { color: var(--text-dim); font-size: 12px; text-align: center; }
.ai-result-container { margin-top: 8px; }

/* ============ AI LOADING & RESULT ============ */
@keyframes pulse {
    0%, 100% { opacity: 0.4; }
    50%       { opacity: 1; }
}
.thinking-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--purple-main);
    animation: pulse 1.5s infinite;
    display: inline-block;
}
.ai-loading {
    display: flex; flex-direction: column; align-items: center;
    gap: 16px; padding: 40px 24px 32px;
    background: linear-gradient(135deg, rgba(17,15,36,0.98), rgba(6,5,14,0.98));
    border-radius: var(--radius);
    border: 1px solid rgba(212,168,67,0.25);
    position: relative; overflow: hidden;
}
.ai-loading::before {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(212,168,67,0.08) 0%, transparent 70%);
    pointer-events: none;
}
.ai-loading-orb {
    position: relative; width: 80px; height: 80px;
}
.ai-loading-orb-ring {
    position: absolute; inset: 0; border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: var(--gold); border-bottom-color: rgba(124,58,237,0.5);
    animation: aiOrbSpin 1.8s linear infinite;
}
.ai-loading-orb-ring:nth-child(2) {
    inset: 8px; border-top-color: rgba(124,58,237,0.6); border-bottom-color: rgba(212,168,67,0.3);
    animation-duration: 2.4s; animation-direction: reverse;
}
.ai-loading-orb-icon {
    position: absolute; inset: 18px;
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; animation: aiOrbPulse 2s ease-in-out infinite;
}
@keyframes aiOrbSpin { to { transform: rotate(360deg); } }
@keyframes aiOrbPulse { 0%,100% { transform: scale(1); opacity: 0.9; } 50% { transform: scale(1.15); opacity: 1; } }

.ai-loading-text {
    color: var(--gold); font-size: 16px; font-weight: 700;
    font-family: var(--font-display); text-align: center;
}
.ai-loading-warn {
    display: flex; align-items: center; gap: 8px;
    background: rgba(212,168,67,0.1); border: 1px solid rgba(212,168,67,0.25);
    border-radius: 8px; padding: 10px 16px;
    color: #fbbf24; font-size: 13px; font-weight: 600;
    animation: aiWarnPulse 2s ease-in-out infinite;
}
@keyframes aiWarnPulse { 0%,100% { opacity: 0.85; } 50% { opacity: 1; } }

.ai-loading-steps {
    display: flex; gap: 6px; align-items: center; margin-top: 4px;
}
.ai-loading-step {
    display: flex; align-items: center; gap: 4px;
    font-size: 11px; color: #6b6188; transition: color 0.4s;
}
.ai-loading-step.active { color: var(--gold); font-weight: 600; }
.ai-loading-step.done { color: var(--success); }
.ai-loading-step-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: #6b6188; transition: background 0.4s, box-shadow 0.4s;
}
.ai-loading-step.active .ai-loading-step-dot {
    background: var(--gold);
    box-shadow: 0 0 8px rgba(212,168,67,0.5);
    animation: aiStepPulse 1s ease-in-out infinite;
}
.ai-loading-step.done .ai-loading-step-dot { background: var(--success); }
@keyframes aiStepPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.4); } }
.ai-loading-step-arrow { color: #4a3f6b; font-size: 10px; margin: 0 2px; }

.ai-loading-timer {
    font-size: 12px; color: #9a90b0;
    font-variant-numeric: tabular-nums;
}
.ai-loading-timer strong { color: var(--gold); font-weight: 700; }

.ai-loading-sub {
    color: #7a6fa0; font-size: 11px; text-align: center;
    max-width: 320px; line-height: 1.5;
}

@keyframes spin { to { transform: rotate(360deg); } }
.ai-response-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    font-size: 14px; line-height: 1.85;
    color: var(--text-primary);
}
.ai-response-box h1, .ai-response-box h2, .ai-response-box h3 {
    color: var(--gold); margin: 14px 0 7px;
    font-family: var(--font-body); font-weight: 600;
}
.ai-response-box h1 { font-size: 17px; }
.ai-response-box h2 { font-size: 15px; }
.ai-response-box h3 { font-size: 14px; }
.ai-response-box strong { color: var(--text-strong); }
.ai-response-box em { color: var(--purple-light); font-style: italic; }
.ai-response-box ul, .ai-response-box ol { padding-left: 20px; margin: 8px 0; }
.ai-response-box li { margin-bottom: 4px; }
.ai-response-box p { margin-bottom: 10px; }
.ai-response-box hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
/* ===== CARD FIGURE – Hình lá bài trong AI output ===== */

/* Strip tổng quan ở đầu output */
.ai-card-strip {
    margin-bottom: 20px; padding-bottom: 18px;
    border-bottom: 1px solid rgba(212,168,67,0.2);
}
.ai-card-strip-title {
    font-size: 11px; color: var(--text-dim);
    text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 12px;
}
.ai-card-strip-row {
    display: flex; gap: 14px; flex-wrap: wrap; justify-content: center;
}
.ai-card-strip-item {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.ai-card-strip-label {
    font-size: 10px; color: var(--text-dim); text-align: center;
    max-width: 80px; line-height: 1.3;
}
.ai-card-strip-img {
    width: 72px; height: 120px;
    background: linear-gradient(135deg,#1e1b4b,#312e81);
    border: 1.5px solid rgba(212,168,67,0.4);
    border-radius: 8px; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
}
.ai-card-strip-name {
    font-size: 11px; color: var(--gold); font-weight: 600;
    text-align: center; max-width: 80px; line-height: 1.35;
}

/* Figure lá bài inline (khi inject vào heading) */
.ai-card-figure {
    flex-shrink: 0;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    min-width: 90px;
}
.ai-card-figure-img {
    width: 90px; height: 150px;
    background: linear-gradient(135deg,#1e1b4b,#312e81);
    border: 1.5px solid rgba(212,168,67,0.45);
    border-radius: 9px; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.ai-card-figure-img img {
    width: 100%; height: 100%; object-fit: cover;
    border-radius: 8px; display: block;
}
.ai-card-figure-name {
    font-size: 12px; font-weight: 700; color: var(--gold);
    text-align: center; max-width: 90px; line-height: 1.35;
}
.ai-card-rev-badge {
    font-size: 10px; color: #fca5a5;
    background: rgba(220,60,60,0.18);
    border: 1px solid rgba(220,60,60,0.3);
    border-radius: 4px; padding: 2px 7px;
    text-align: center;
}

/* Block ảnh ở đầu khi output ngắn */
.ai-card-block-top {
    display: flex; flex-wrap: wrap; gap: 16px;
    padding: 16px; margin-bottom: 20px;
    background: rgba(212,168,67,0.05);
    border: 1px solid rgba(212,168,67,0.2);
    border-radius: 12px; justify-content: center;
}
.ai-block-card-item {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.ai-block-card-label {
    font-size: 10px; color: var(--text-dim); text-align: center; max-width: 90px;
}

/* Inline card + heading wrapper */
.ai-inline-card {
    display: flex; align-items: flex-start; gap: 16px;
    margin: 22px 0 8px;
    padding: 14px 16px;
    background: rgba(212,168,67,0.04);
    border: 1px solid rgba(212,168,67,0.18);
    border-left: 3px solid rgba(212,168,67,0.5);
    border-radius: 10px;
}
.ai-inline-card h2, .ai-inline-card h3 {
    margin: 0 !important; flex: 1; padding-top: 4px;
}

.ai-text-content { }
.ai-text-content h1,.ai-text-content h2,.ai-text-content h3 { color:var(--gold); margin:16px 0 8px; font-weight:600; }
.ai-text-content strong { color:var(--text-strong); }
.ai-text-content em { color:var(--purple-light); font-style:italic; }
.ai-text-content ul,.ai-text-content ol { padding-left:20px; margin:8px 0; }
.ai-text-content li { margin-bottom:5px; }
.ai-text-content p { margin-bottom:11px; }
.ai-text-content hr { border:none; border-top:1px solid var(--border); margin:16px 0; }

.ai-queue-notice {
    background: linear-gradient(135deg, rgba(124,58,237,0.1), rgba(212,168,67,0.05));
    border: 1px solid rgba(124,58,237,0.3);
    color: var(--purple-light); border-radius: var(--radius);
    padding: 20px; font-size: 14px; line-height: 1.7;
    margin-bottom: 10px; text-align: center;
}
.ai-queue-notice-icon {
    font-size: 32px; margin-bottom: 8px; display: block;
    animation: aiOrbPulse 2s ease-in-out infinite;
}
.ai-queue-notice-title {
    font-weight: 700; color: var(--gold); font-size: 15px; margin-bottom: 6px;
}
.ai-queue-notice-sub {
    font-size: 12px; color: #9a90b0; margin-top: 4px;
    display: flex; align-items: center; gap: 8px;
}
.ai-error {
    background: rgba(220,38,38,0.1);
    border: 1px solid rgba(220,38,38,0.3);
    color: var(--error); border-radius: var(--radius-xs);
    padding: 10px 14px; font-size: 13px;
    margin-bottom: 10px;
}
.ai-share-row {
    display: flex; gap: 10px; margin-top: 14px;
    padding-top: 12px; border-top: 1px solid var(--border);
    flex-wrap: wrap; align-items: center;
}

/* ===== QUESTION SUGGEST POPUP ===== */
.qpop-overlay {
    display: none; position: fixed; inset: 0; z-index: 6500;
    background: rgba(0,0,0,0.82);
    align-items: flex-end; justify-content: center;
    padding: 0;
}
.qpop-overlay.open { display: flex; }
.qpop-box {
    background: #0e0c1f;
    border: 1px solid rgba(212,168,67,0.25);
    border-radius: 20px 20px 0 0;
    width: 100%; max-width: 680px;
    max-height: 92vh;
    display: flex; flex-direction: column;
    animation: qpopSlideUp 0.38s cubic-bezier(0.34,1.2,0.64,1);
    overflow: hidden;
}
@keyframes qpopSlideUp {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}
@media (min-width: 700px) {
    .qpop-overlay { align-items: center; padding: 20px; }
    .qpop-box { border-radius: 18px; max-height: 88vh; }
}
.qpop-header {
    padding: 20px 20px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    position: relative; flex-shrink: 0;
    background: linear-gradient(180deg, rgba(212,168,67,0.08) 0%, transparent 100%);
}
.qpop-title {
    font-family: var(--font-display); color: var(--gold);
    font-size: 18px; font-weight: 700; margin-bottom: 4px;
}
.qpop-sub { font-size: 13px; color: var(--text-dim); }
.qpop-close {
    position: absolute; top: 16px; right: 16px;
    background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-dim); border-radius: 50%; width: 32px; height: 32px;
    cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
}
.qpop-close:hover { background: rgba(255,255,255,0.12); color: #fff; }

.qpop-body {
    flex: 1; overflow-y: auto; padding: 16px 16px 8px;
    scrollbar-width: thin; scrollbar-color: rgba(212,168,67,0.3) transparent;
}

/* Category label */
.qpop-cat-label {
    font-size: 11px; font-weight: 700; color: var(--text-dim);
    text-transform: uppercase; letter-spacing: 1.5px;
    margin: 14px 0 8px 2px;
}
.qpop-cat-label:first-child { margin-top: 0; }

/* Hint top */
.qpop-hint-top {
    background: rgba(124,58,237,0.1); border: 1px solid rgba(124,58,237,0.25);
    border-radius: 10px; padding: 11px 14px; font-size: 13px;
    color: var(--text-secondary); line-height: 1.6; margin-bottom: 16px;
}
.qpop-hint-top strong { color: var(--gold); }
.qpop-hint-top em { color: #a78bfa; font-style: normal; }

/* Question chips trong popup */
.qpop-chips { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.qpop-chip {
    padding: 13px 16px; border-radius: 12px; cursor: pointer;
    background: rgba(255,255,255,0.03);
    border: 1.5px solid rgba(255,255,255,0.1);
    color: var(--text-secondary); font-family: var(--font-body);
    transition: all 0.2s; text-align: left; width: 100%;
    display: flex; align-items: flex-start; gap: 10px;
}
.qpop-chip:hover { border-color: rgba(212,168,67,0.4); color: var(--text-primary); background: rgba(212,168,67,0.06); transform: translateX(3px); }
.qpop-chip.selected {
    background: linear-gradient(135deg, rgba(212,168,67,0.15), rgba(124,58,237,0.1));
    border-color: var(--gold); color: #fff;
    box-shadow: 0 2px 14px rgba(212,168,67,0.2);
}
.qpop-chip-emoji { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.qpop-chip-text { font-size: 14px; line-height: 1.5; }

.qpop-footer {
    padding: 14px 16px 20px; border-top: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0; background: rgba(0,0,0,0.3);
}
.qpop-selected-info {
    font-size: 12px; color: var(--gold); margin-bottom: 12px;
    min-height: 18px; text-align: center;
}
.qpop-btns { display: flex; gap: 10px; }
.qpop-btn-self {
    flex: 1; padding: 13px; border-radius: 12px; cursor: pointer;
    background: rgba(255,255,255,0.05); border: 1.5px solid rgba(255,255,255,0.12);
    color: var(--text-secondary); font-size: 14px; font-family: var(--font-body);
    transition: all 0.2s;
}
.qpop-btn-self:hover { background: rgba(255,255,255,0.09); color: #fff; }
.qpop-btn-ok {
    flex: 1.4; padding: 13px; border-radius: 12px; cursor: pointer;
    background: linear-gradient(135deg, #d4a843, #8b7030);
    border: none; color: #06050e;
    font-size: 14px; font-weight: 700; font-family: var(--font-body);
    transition: opacity 0.2s;
}
.qpop-btn-ok:hover { opacity: 0.88; }

/* Nút mở popup trong question box */
.q-action-row {
    display: flex; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap;
}
.q-suggest-btn {
    padding: 10px 20px; border-radius: 24px; cursor: pointer; font-size: 13px;
    background: rgba(212,168,67,0.08); border: 1.5px solid rgba(212,168,67,0.3);
    color: var(--gold); font-family: var(--font-body); transition: all 0.2s;
    display: flex; align-items: center; gap: 6px;
}
.q-suggest-btn:hover { background: rgba(212,168,67,0.15); border-color: var(--gold); }
.q-selected-preview {
    font-size: 12px; color: var(--text-dim); font-style: italic;
    flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Nút "↓ Nội dung mới" khi user đang kéo lên đọc */
.ai-jump-btn {
    position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
    z-index: 8000;
    padding: 10px 22px; border-radius: 24px; cursor: pointer;
    background: linear-gradient(135deg, var(--purple-main), #5b21b6);
    border: 1px solid rgba(167,139,250,0.4);
    color: #fff; font-size: 13px; font-weight: 600;
    box-shadow: 0 4px 20px rgba(124,58,237,0.5);
    display: flex; align-items: center; gap: 6px;
    animation: cardAppear 0.3s ease-out;
    transition: opacity 0.2s, transform 0.2s;
    white-space: nowrap;
}
.ai-jump-btn:hover { opacity: 0.88; transform: translateX(-50%) translateY(-2px); }

/* ============ MODAL USER INFO ============ */
.modal-overlay {
    position: fixed; inset: 0; z-index: 3000;
    background: rgba(0,0,0,0.7);
    display: none; align-items: center; justify-content: center; padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border-glow);
    border-radius: 14px; width: 100%; max-width: 460px;
    overflow: hidden;
}
.modal-header { padding: 22px 24px 0; }
.modal-title { font-family: var(--font-display); color: var(--gold); font-size: 15px; margin-bottom: 5px; }
.modal-desc { color: var(--text-secondary); font-size: 12px; margin-bottom: 18px; }
.birthdate-warning {
    background: linear-gradient(135deg, rgba(248,113,113,0.12), rgba(212,168,67,0.12));
    border: 1px solid rgba(248,113,113,0.35);
    border-radius: 10px;
    padding: 12px 16px;
    margin: 0 24px 14px;
    font-size: 12.5px;
    line-height: 1.7;
    color: #f8d87a;
    text-align: center;
}
.birthdate-warning strong { color: #f87171; }
.birthdate-hint {
    font-size: 11px;
    color: #f8d87a;
    margin-top: 5px;
    line-height: 1.5;
}
.modal-body { padding: 0 24px; }
.modal-textarea {
    width: 100%; padding: 10px 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-xs);
    color: var(--text-primary); font-family: var(--font-body); font-size: 13px;
    resize: vertical; min-height: 80px; line-height: 1.6; outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.modal-textarea:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 2px rgba(212,168,67,0.15);
}
.modal-footer {
    padding: 18px 24px 22px;
    display: flex; gap: 10px; justify-content: flex-end;
}

/* ============ HISTORY PANEL ============ */
.history-panel {
    position: fixed; right: 0; top: 0; bottom: 0; z-index: 1500;
    width: 420px; max-width: 100vw;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    display: flex; flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    box-shadow: -8px 0 40px rgba(0,0,0,0.5);
}
.history-panel.open { transform: translateX(0); }
.history-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(212,168,67,0.1);
    flex-shrink: 0;
    background: rgba(212,168,67,0.04);
}
.history-header h3 { font-family: var(--font-display); color: var(--gold); font-size: 13px; }
.history-close {
    background: transparent; border: none; color: var(--text-secondary);
    font-size: 16px; cursor: pointer; padding: 4px 8px; border-radius: var(--radius-xs);
    transition: all 0.2s;
}
.history-close:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }
.history-list { flex: 1; overflow-y: auto; padding: 10px; }
.history-list::-webkit-scrollbar { width: 4px; }
.history-list::-webkit-scrollbar-track { background: transparent; }
.history-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.history-item {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px; margin-bottom: 8px;
    transition: border-color 0.2s;
}
.history-item:hover { border-color: var(--border-md); }
.history-item-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 6px;
}
.history-type-badge {
    background: rgba(212,168,67,0.08);
    border: 1px solid var(--border-md);
    color: var(--gold); font-size: 10px;
    padding: 2px 8px; border-radius: 8px;
}
.history-date { color: var(--text-dim); font-size: 11px; }
.history-question { color: var(--text-secondary); font-size: 12px; margin-bottom: 8px; font-style: italic; }
.history-actions { display: flex; gap: 5px; flex-wrap: wrap; }
.history-btn-sm {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-secondary); font-size: 11px;
    padding: 3px 10px; border-radius: 8px; cursor: pointer;
    transition: all 0.2s; font-family: var(--font-body);
}
.history-btn-sm:hover { border-color: var(--gold-dim); color: var(--gold); background: rgba(212,168,67,0.08); }
.history-content { margin-top: 8px; display: none; }
.history-content.open { display: block; }
.history-content-inner {
    font-size: 12px; line-height: 1.7; color: var(--text-secondary);
    border-top: 1px solid var(--border); padding-top: 8px;
    max-height: 200px; overflow-y: auto;
}
.history-content-inner h1,
.history-content-inner h2,
.history-content-inner h3 { color: var(--gold); font-size: 12px; margin: 6px 0 3px; }
.history-content-inner strong { color: var(--text-primary); }
.history-empty { color: var(--text-dim); text-align: center; padding: 36px; font-size: 13px; }

/* ============ HISTORY MODAL ============ */
.history-modal-overlay {
    position: fixed; inset: 0; z-index: 4000;
    background: rgba(0,0,0,0.92);
    display: none; align-items: stretch; justify-content: center;
}
.history-modal-overlay.open { display: flex; }
.history-modal-box {
    background: var(--bg-card);
    width: 100%; max-width: 100%;
    height: 100%; min-height: 100vh;
    display: flex; flex-direction: column;
    overflow: hidden;
}
@media (min-width: 768px) {
    .history-modal-box { max-width: 820px; margin: 0 auto; border-left: 1px solid var(--border-glow); border-right: 1px solid var(--border-glow); }
}
.history-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(212,168,67,0.15);
    background: rgba(6,5,14,0.98);
    position: sticky; top: 0; z-index: 10;
    flex-shrink: 0;
}
.history-modal-title { font-family: var(--font-display); color: var(--gold); font-size: 14px; }
.history-modal-close {
    background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-secondary); font-size: 16px; cursor: pointer;
    border-radius: 8px; padding: 6px 14px; transition: all 0.2s;
    display: flex; align-items: center; gap: 6px;
}
.history-modal-close:hover { background: rgba(255,255,255,0.1); color: var(--text-primary); }
.history-modal-body { padding: 24px 20px; overflow-y: auto; flex: 1; }
.history-modal-content { font-size: 15px; line-height: 1.9; color: var(--text-primary); }
.history-modal-content h1,
.history-modal-content h2,
.history-modal-content h3 { color: var(--gold); margin: 16px 0 8px; font-weight: 600; }
.history-modal-content strong { color: var(--text-strong); }
.history-modal-content em { color: var(--purple-light); }
.history-modal-content ul,
.history-modal-content ol { padding-left: 20px; margin: 8px 0; }

/* Share popup */
.share-popup-overlay {
    position: fixed; inset: 0; z-index: 6000;
    background: rgba(0,0,0,0.75);
    display: none; align-items: center; justify-content: center; padding: 16px;
}
.share-popup-overlay.open { display: flex; }
.share-popup-box {
    background: var(--bg-card); border: 1px solid var(--border-glow);
    border-radius: 14px; padding: 24px; max-width: 420px; width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    animation: cardAppear 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
.share-popup-title { color: var(--gold); font-size: 15px; font-weight: 700; margin-bottom: 16px; text-align: center; }
.share-link-input {
    width: 100%; padding: 10px 12px; background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.15); border-radius: 8px;
    color: var(--text-primary); font-size: 13px; font-family: monospace;
    box-sizing: border-box; margin-bottom: 12px; cursor: text;
}
.share-copy-btn {
    width: 100%; padding: 12px; border-radius: 8px; cursor: pointer;
    background: linear-gradient(135deg, var(--gold), #8b7030);
    border: none; color: #06050e; font-weight: 700; font-size: 14px;
    transition: opacity 0.2s; margin-bottom: 8px;
}
.share-copy-btn:hover { opacity: 0.88; }
.share-copy-btn.copied { background: linear-gradient(135deg, #16a34a, #166534); color: #fff; }
.share-close-btn {
    width: 100%; padding: 9px; border-radius: 8px; cursor: pointer;
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-dim); font-size: 13px; transition: all 0.2s;
}
.share-close-btn:hover { background: rgba(255,255,255,0.09); }

/* ============ SETTINGS MODAL ============ */
.settings-overlay {
    display: none; position: fixed; inset: 0; z-index: 5500;
    background: rgba(0,0,0,0.75);
    align-items: flex-start; justify-content: center;
    padding: 24px 16px; overflow-y: auto;
}
.settings-overlay.open { display: flex; }
.settings-box {
    background: var(--bg-card);
    border: 1px solid var(--border-glow);
    border-radius: 16px;
    width: 100%; max-width: 560px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    animation: cardAppear 0.35s cubic-bezier(0.34,1.56,0.64,1);
    margin: auto;
}
.settings-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 20px 0;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}
.settings-tabs { display: flex; gap: 4px; }
.settings-tab {
    padding: 8px 18px; border-radius: 8px 8px 0 0;
    background: transparent; border: none;
    color: var(--text-dim); font-size: 13px; font-family: var(--font-body);
    cursor: pointer; transition: all 0.2s; margin-bottom: -1px;
    border-bottom: 2px solid transparent;
}
.settings-tab.active { color: var(--gold); border-bottom-color: var(--gold); }
.settings-tab:hover:not(.active) { color: var(--text-primary); }
.settings-close {
    background: none; border: none; color: var(--text-dim);
    font-size: 18px; cursor: pointer; padding: 4px 8px; line-height: 1;
    transition: color 0.2s; margin-bottom: 4px;
}
.settings-close:hover { color: var(--text-primary); }
.settings-panel { padding: 22px 22px 24px; }
.settings-title { color: var(--gold); font-size: 15px; margin-bottom: 4px; }
.settings-desc { color: var(--text-dim); font-size: 12px; margin-bottom: 18px; }

/* Lịch sử trong settings */
.sh-item {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 10px; padding: 14px 16px;
    margin-bottom: 10px; transition: border-color 0.2s;
}
.sh-item:hover { border-color: rgba(212,168,67,0.2); }
.sh-item-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.sh-type { font-size: 12px; font-weight: 700; color: var(--gold); }
.sh-date { font-size: 11px; color: var(--text-dim); }
.sh-question { font-size: 12px; color: var(--text-secondary); font-style: italic; margin-bottom: 8px; line-height: 1.5; }
.sh-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.sh-content { display: none; margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,0.07); }
.sh-content.open { display: block; }
.sh-content-inner { font-size: 12px; color: var(--text-secondary); line-height: 1.7; max-height: 300px; overflow-y: auto; }
.sh-content-inner h1,.sh-content-inner h2,.sh-content-inner h3 { color: var(--gold); font-size: 13px; margin: 12px 0 6px; }
.sh-content-inner p { margin: 6px 0; }
.sh-content-inner strong { color: var(--text-primary); }

/* ============ ONBOARDING ============ */
#onboardingScreen .auth-box { max-width: 520px; }
.onboarding-step { display: none; }
.onboarding-step.active { display: block; }
.progress-bar-wrap { height: 4px; background: rgba(255,255,255,0.06); border-radius: 2px; margin-bottom: 22px; }
.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--purple-main), var(--gold));
    border-radius: 2px; transition: width 0.3s;
}

/* ============ SECTION HERO (Kinh Dịch / Tử Vi / Thần Số) ============ */
.section-hero {
    text-align: center; padding: 32px 20px 24px; margin-bottom: 22px;
    border-radius: 14px; border: 1px solid rgba(255,255,255,0.07);
    position: relative; overflow: hidden;
}
.section-hero-icon { font-size: 44px; margin-bottom: 8px; display: block; }
.section-hero-title {
    font-family: var(--font-display); font-size: clamp(18px, 4vw, 28px);
    letter-spacing: 2px; margin-bottom: 6px;
}
.section-hero-sub { font-size: 13px; color: var(--text-dim); line-height: 1.6; }

.section-hero-iching {
    background: radial-gradient(ellipse at 50% 0%, rgba(167,139,250,0.1) 0%, transparent 65%);
    border-color: rgba(167,139,250,0.15);
}
.section-hero-iching .section-hero-title { color: #a78bfa; }

.section-hero-battu {
    background: radial-gradient(ellipse at 50% 0%, rgba(220,38,38,0.1) 0%, rgba(212,168,67,0.06) 50%, transparent 80%);
    border-color: rgba(220,38,38,0.2);
}
.section-hero-battu .section-hero-title { color: #ef4444; }
.section-hero-battu .section-hero-sub { color: #fbbf24; }

.section-hero-tuvi {
    background: radial-gradient(ellipse at 50% 0%, rgba(251,191,36,0.1) 0%, transparent 65%);
    border-color: rgba(251,191,36,0.15);
}
.section-hero-tuvi .section-hero-title { color: #fbbf24; }

.section-hero-num {
    background: radial-gradient(ellipse at 50% 0%, rgba(52,211,153,0.1) 0%, transparent 65%);
    border-color: rgba(52,211,153,0.15);
}
.section-hero-num .section-hero-title { color: #34d399; }

/* Maintain box (chung cho IChing/TuVi/Numerology) */
.maintain-box {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px; padding: 20px 24px; margin-bottom: 16px;
    width: 100%; box-sizing: border-box;
}
.maintain-rule {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 12px 14px; margin-bottom: 14px;
    background: rgba(167,139,250,0.06); border: 1px solid rgba(167,139,250,0.15);
    border-radius: 10px; font-size: 13px; color: var(--text-secondary); line-height: 1.6;
}
.maintain-rule-icon { font-size: 20px; flex-shrink: 0; }
.maintain-label { font-size: 14px; color: var(--text-secondary); margin-bottom: 12px; font-weight: 500; line-height: 1.6; }

.maintain-draw-btn {
    padding: 14px 36px; border-radius: 12px; cursor: pointer; font-size: 15px; font-weight: 700;
    background: linear-gradient(135deg, #5b21b6, #7c3aed);
    border: none; color: #fff; font-family: var(--font-display); letter-spacing: 1px;
    display: inline-flex; align-items: center; gap: 10px;
    box-shadow: 0 4px 20px rgba(124,58,237,0.4); transition: all 0.2s;
}
.maintain-draw-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(124,58,237,0.5); }

/* ============ NUMEROLOGY 4 SAO ============ */
.num-input-card {
    background: rgba(52,211,153,0.03);
    border: 1px solid rgba(52,211,153,0.15);
    border-radius: 14px; padding: 20px; margin-bottom: 16px;
}
.num-input-row { display: grid; grid-template-columns: 1fr; gap: 16px; margin-bottom: 16px; }
@media (min-width: 600px) { .num-input-row { grid-template-columns: 1fr 1fr; } }
.num-input-group { display: flex; flex-direction: column; gap: 5px; }
.num-label { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.num-input {
    padding: 11px 14px; border-radius: 8px; font-size: 14px;
    background: rgba(0,0,0,0.25); border: 1.5px solid rgba(255,255,255,0.1);
    color: var(--text-primary); font-family: var(--font-body); outline: none;
    transition: border-color 0.2s;
}
.num-input:focus { border-color: rgba(52,211,153,0.5); }
.num-input-hint { font-size: 11px; color: var(--text-dim); }
.num-calc-btn {
    width: 100%; padding: 15px; border-radius: 12px; cursor: pointer;
    background: linear-gradient(135deg, #059669, #34d399);
    border: none; color: #fff; font-size: 15px; font-weight: 700;
    font-family: var(--font-display); letter-spacing: 1px;
    display: flex; align-items: center; justify-content: center; gap: 10px;
    box-shadow: 0 4px 20px rgba(52,211,153,0.3); transition: all 0.2s;
}
.num-calc-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(52,211,153,0.4); }

/* ============ FOOTER ============ */
footer {
    background: var(--bg-card);
    border-top: 1px solid rgba(212,168,67,0.1);
    padding: 20px; text-align: center; z-index: 1;
}
.footer-brand { font-family: var(--font-display); color: var(--gold); font-size: 12px; margin-bottom: 6px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin: 8px 0; }
.footer-links a { color: var(--text-dim); text-decoration: none; font-size: 12px; transition: color 0.2s; }
.footer-links a:hover { color: var(--gold); }
.footer-copy { color: var(--text-dim); font-size: 11px; margin-top: 6px; }

/* ============ TOAST NOTIFICATION (ADMIN STYLE) ============ */
.nc-toast {
    position: fixed; bottom: 24px; right: 24px;
    z-index: 9999;
    display: flex; flex-direction: column; gap: 8px;
    pointer-events: none;
}
.nc-toast-item {
    padding: 12px 18px; border-radius: 10px;
    font-size: 13px; font-weight: 600; color: #fff;
    max-width: 320px; min-width: 220px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    opacity: 0; transform: translateY(16px);
    transition: all 0.3s;
    pointer-events: auto;
}
.nc-toast-item.show { opacity: 1; transform: translateY(0); }
.nc-toast-item.success { background: linear-gradient(135deg, #22c55e, #15803d); }
.nc-toast-item.error   { background: linear-gradient(135deg, #ef4444, #991b1b); }
.nc-toast-item.info    { background: linear-gradient(135deg, #7c3aed, #4c1d95); }
.nc-toast-item.warn    { background: linear-gradient(135deg, #f59e0b, #b45309); }
.nc-toast-item.default { background: var(--bg-card); border: 1px solid var(--border-glow); color: var(--text-primary); }

/* ============ SPECIAL DRAW BUTTONS ============ */
.draw-btn-cards52 {
    background: linear-gradient(135deg, #e05c3a, #c0392b);
    color: #fff;
}
.draw-btn-iching {
    background: linear-gradient(135deg, #3ab5a0, #2a8a78);
    color: #fff;
}

/* ============ ONBOARDING BUTTONS ============ */
.onboard-btn-row {
    display: flex; gap: 10px; margin-top: 8px;
}
.onboard-skip-btn { flex: 1; }
.onboard-save-btn { flex: 2; margin-top: 0; }

/* ============ MISC ============ */
.badge { display: inline-block; font-size: 10px; padding: 2px 8px; border-radius: 8px; }
.badge-gold { background: rgba(212,168,67,0.1); border: 1px solid var(--border-md); color: var(--gold); }
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.loading-dots::after {
    content: '...'; animation: dots 1.2s steps(4, end) infinite;
}
@keyframes dots {
    0%, 20%  { content: ''; }
    40%      { content: '.'; }
    60%      { content: '..'; }
    80%, 100%{ content: '...'; }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
    .home-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 0 10px 28px; }
    .home-title { font-size: 20px; }
    .section { padding: 18px 12px 48px; }
    .section-title { font-size: 16px; }
    .num-grid { grid-template-columns: repeat(2, 1fr); }
    .batu-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    nav { padding: 0 10px; height: 52px; gap: 2px; }
    main { padding-top: 62px; }
    .nav-brand { font-size: 10px; }
    .history-panel { width: 100vw; }
    .modal-box { max-width: 100%; border-radius: 14px 14px 0 0; align-self: flex-end; }
    .modal-footer { flex-direction: column; }
    .fan-card { width: 54px; height: 90px; }
    .fan-card-symbol { font-size: 18px; }
    .fan-card-name { font-size: 5px; }
    .fan-card-vn { font-size: 4.5px; }
    .auth-box { padding: 24px 18px; }
    .nc-toast { bottom: 16px; right: 12px; left: 12px; }
    .nc-toast-item { max-width: 100%; }
}

@media (max-width: 480px) {
    .home-grid { grid-template-columns: 1fr; }
    .spread-selector { gap: 4px; }
    .spread-btn { font-size: 11px; padding: 6px 10px; }
    .draw-btn { padding: 10px 20px; font-size: 12px; }
    .num-grid { grid-template-columns: repeat(2, 1fr); }
}
