/**
 * iching-divination.css — QuizzMan I-Ching Divination Tool
 * Matches QMF design system (qmf-tools-shared.css)
 */

/* ═══════ VARIABLES ═══════ */
:root {
    --ic-primary: #8b5cf6;
    --ic-primary-hover: #7c3aed;
    --ic-primary-light: rgba(139, 92, 246, 0.12);
    --ic-gold: #d4af37;
    --ic-gold-light: rgba(212, 175, 55, 0.15);
    --ic-yang: #dc2626;
    --ic-yin: #2563eb;
    --ic-cat: #10b981;
    --ic-hung: #ef4444;
    --ic-binh: #f59e0b;
    --glass-bg: rgba(255, 255, 255, 0.55);
    --glass-border: rgba(255, 255, 255, 0.35);
    --glass-blur: 20px;
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
}
[data-theme="dark"] {
    --ic-primary-light: rgba(139, 92, 246, 0.2);
    --ic-gold-light: rgba(212, 175, 55, 0.2);
    --glass-bg: rgba(30, 41, 59, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* ═══════ LAYOUT ═══════ */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--qmf-bg-gradient, #f8fafc);
    color: var(--qmf-text, #1e293b);
    min-height: 100vh;
}

/* Header */
header {
    background: var(--qmf-glass, rgba(255,255,255,.85));
    backdrop-filter: var(--qmf-glass-blur, blur(12px));
    border-bottom: 1px solid var(--qmf-border, #e2e8f0);
    position: sticky; top: 0; z-index: 100;
}
.header-container {
    max-width: 960px; margin: 0 auto; padding: 10px 20px;
    display: flex; align-items: center; justify-content: space-between;
}
.logo-container a { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.logo { height: 32px; }
.site-title { font-weight: 700; font-size: 15px; }
.nav-actions { display: flex; gap: 8px; align-items: center; }
.nav-actions a, .nav-actions button {
    background: none; border: 1px solid var(--qmf-border, #e2e8f0);
    border-radius: var(--qmf-radius-sm, 6px); padding: 6px 10px; cursor: pointer;
    color: var(--qmf-text-secondary, #64748b); font-size: 14px; text-decoration: none;
    transition: all .2s;
}
.nav-actions a:hover, .nav-actions button:hover {
    background: var(--ic-primary-light); color: var(--ic-primary); border-color: var(--ic-primary);
}

/* Container */
.container { max-width: 960px; margin: 0 auto; padding: 20px; }

/* Page title */
.page-title.compact { text-align: center; margin-bottom: 20px; }
.page-title h1 { font-size: 24px; font-weight: 800; margin-bottom: 4px; color: var(--ic-primary); }
.page-title .subtitle { font-size: 14px; color: var(--qmf-text-secondary); }

/* Feature tabs */
.feature-tabs {
    display: flex; gap: 8px; margin-bottom: 20px; justify-content: center; flex-wrap: wrap;
}
.feature-tab {
    display: flex; align-items: center; gap: 6px; padding: 8px 18px;
    border: 1px solid var(--qmf-border); border-radius: 999px; background: var(--qmf-card);
    cursor: pointer; font-size: 14px; font-weight: 600; color: var(--qmf-text-secondary);
    transition: all .2s;
}
.feature-tab:hover { border-color: var(--ic-primary); color: var(--ic-primary); }
.feature-tab.active {
    background: var(--ic-primary); color: #fff; border-color: var(--ic-primary);
}
.feature-panel { display: none; }
.feature-panel.active { display: block; }

/* ═══════ CARDS — Liquid Glass ═══════ */
.iching-card {
    background: var(--glass-bg); border: 1px solid var(--glass-border);
    border-radius: 20px; margin-bottom: 16px;
    box-shadow: var(--glass-shadow);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.iching-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.10);
}
[data-theme="dark"] .iching-card:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
.iching-card.input-card {
    background: var(--qmf-card, #fff);
    backdrop-filter: none;
    border-radius: 20px;
}
.card-header {
    display: flex; align-items: center; gap: 10px; padding: 14px 18px;
    border-bottom: 1px solid rgba(0,0,0,0.06); font-weight: 700;
}
[data-theme="dark"] .card-header { border-bottom-color: rgba(255,255,255,0.06); }
.card-header h2 { font-size: 16px; flex: 1; }
.card-icon {
    width: 32px; height: 32px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    background: var(--ic-primary-light); color: var(--ic-primary); font-size: 14px;
}
.card-body { padding: 16px 18px; }

/* Toggle cards */
.toggle-card { cursor: pointer; }
.toggle-icon { transition: transform .2s; font-size: 12px; color: var(--qmf-text-muted); }
.collapsed-card .card-body.hidden + .toggle-icon,
.toggle-card[aria-expanded="true"] .toggle-icon { transform: rotate(180deg); }

/* ═══════ FORMS ═══════ */
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px;
    color: var(--qmf-text-secondary);
}
.form-group label i { margin-right: 4px; }
textarea, input[type="text"], input[type="number"], select {
    width: 100%; padding: 10px 12px; border: 1px solid var(--qmf-border);
    border-radius: var(--qmf-radius-sm); font-size: 14px;
    background: var(--qmf-card); color: var(--qmf-text);
    transition: border-color .2s; font-family: inherit;
}
textarea:focus, input:focus, select:focus {
    outline: none; border-color: var(--ic-primary);
    box-shadow: 0 0 0 3px var(--ic-primary-light);
}
textarea { resize: vertical; }
.char-count { text-align: right; font-size: 12px; color: var(--qmf-text-muted); margin-top: 4px; }

.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 150px; }

/* Manual input */
.manual-lines { display: flex; flex-direction: column-reverse; gap: 6px; margin-top: 8px; }
.manual-line {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 10px; background: var(--qmf-bg, #f8fafc);
    border-radius: var(--qmf-radius-sm);
}
.manual-line span { font-size: 13px; min-width: 100px; font-weight: 600; }
.manual-line input { width: 80px; text-align: center; }

/* Primary button */
.primary-btn {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; padding: 12px 20px; margin-top: 12px;
    background: linear-gradient(135deg, var(--ic-primary), var(--ic-primary-hover));
    color: #fff; border: none; border-radius: var(--qmf-radius);
    font-size: 16px; font-weight: 700; cursor: pointer;
    transition: all .2s; box-shadow: var(--qmf-shadow);
}
.primary-btn:hover { transform: translateY(-1px); box-shadow: var(--qmf-shadow-lg); }
.primary-btn:active { transform: translateY(0); }
.primary-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.outline-btn {
    background: transparent; color: var(--ic-primary);
    border: 2px solid var(--ic-primary);
}
.outline-btn:hover { background: var(--ic-primary-light); }

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

/* ═══════ PROGRESS ═══════ */
#progress-area { margin: 16px 0; }
.progress-bar-container {
    width: 100%; height: 6px; background: var(--qmf-border);
    border-radius: 999px; overflow: hidden;
}
.progress-bar {
    height: 100%; width: 0%; background: linear-gradient(90deg, var(--ic-primary), var(--ic-gold));
    border-radius: 999px; transition: width .3s ease;
}
.progress-message {
    text-align: center; margin-top: 8px; font-size: 13px;
    color: var(--qmf-text-secondary); font-style: italic;
}

/* ═══════ HEXAGRAM VISUAL ═══════ */
.hex-visual-row {
    display: flex; align-items: center; justify-content: center; gap: 30px;
    padding: 16px 0;
}
.hex-column { text-align: center; }
.hex-label { font-size: 12px; font-weight: 700; color: var(--qmf-text-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }
.hex-figure { display: flex; flex-direction: column-reverse; gap: 5px; align-items: center; }
.hex-line {
    height: 6px; border-radius: 3px; transition: background .3s;
}
.hex-line.yang { width: 60px; background: var(--ic-yang); }
.hex-line.yin { width: 60px; display: flex; gap: 10px; }
.hex-line.yin::before, .hex-line.yin::after {
    content: ''; flex: 1; height: 6px; background: var(--ic-yin); border-radius: 3px;
}
.hex-line.moving { position: relative; }
.hex-line.moving::after {
    content: '◯'; position: absolute; right: -20px; top: -5px; font-size: 12px;
    color: var(--ic-gold); font-weight: bold;
}
.hex-line.yin.moving::after { right: -20px; }

.hex-name {
    margin-top: 10px; font-size: 16px; font-weight: 800;
    color: var(--qmf-text);
}
.hex-name .han { font-size: 20px; display: block; color: var(--ic-primary); }

.hex-arrow { font-size: 24px; color: var(--ic-gold); }

/* Hex meta */
.hex-meta {
    display: flex; flex-wrap: wrap; gap: 10px; justify-content: center;
    margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--qmf-border);
}
.hex-meta .meta-tag {
    font-size: 12px; padding: 3px 10px; background: var(--qmf-bg, #f8fafc);
    border-radius: 999px; color: var(--qmf-text-secondary); border: 1px solid var(--qmf-border);
}

/* ═══════ CONCLUSION ═══════ */
.outcome-badge {
    font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
}
.outcome-badge.cat { background: rgba(16,185,129,.15); color: #059669; }
.outcome-badge.dai-cat { background: rgba(16,185,129,.25); color: #047857; }
.outcome-badge.hung { background: rgba(239,68,68,.15); color: #dc2626; }
.outcome-badge.dai-hung { background: rgba(239,68,68,.25); color: #b91c1c; }
.outcome-badge.binh { background: rgba(245,158,11,.15); color: #d97706; }

.conclusion-text { font-size: 16px; font-weight: 600; line-height: 1.6; margin-bottom: 10px; }
.zhu-xi-rule {
    font-size: 13px; color: var(--qmf-text-secondary); padding: 10px;
    background: var(--ic-gold-light); border-radius: var(--qmf-radius-sm);
    border-left: 3px solid var(--ic-gold);
}

/* ═══════ INTERPRETATION ═══════ */
.interp-section { margin-bottom: 16px; }
.interp-section h3 {
    font-size: 14px; font-weight: 700; color: var(--ic-primary);
    margin-bottom: 8px; display: flex; align-items: center; gap: 6px;
}
.interp-section > div { font-size: 14px; line-height: 1.7; color: var(--qmf-text); white-space: pre-wrap; }

/* ═══════ SEMANTIC GRID ═══════ */
.sem-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
}
.sem-item {
    padding: 12px; border-radius: var(--qmf-radius-sm);
    background: var(--qmf-bg, #f8fafc); border: 1px solid var(--qmf-border);
}
.sem-item .sem-label {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    color: var(--qmf-text-muted); letter-spacing: .5px; margin-bottom: 4px;
}
.sem-item .sem-value { font-size: 14px; line-height: 1.5; }

/* ═══════ DOMAIN ADVICE ═══════ */
.advice-row {
    display: flex; align-items: flex-start; gap: 10px; padding: 8px 0;
    border-bottom: 1px solid var(--qmf-border);
}
.advice-row:last-child { border-bottom: none; }
.advice-row .advice-icon {
    width: 28px; height: 28px; border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    background: var(--ic-primary-light); color: var(--ic-primary); font-size: 12px; flex-shrink: 0;
}
.advice-row .advice-text { font-size: 14px; line-height: 1.5; }
.advice-row .advice-label { font-weight: 700; font-size: 12px; color: var(--qmf-text-muted); }

/* ═══════ RECOMMENDATIONS ═══════ */
#recommendations-list { list-style: none; padding: 0; }
#recommendations-list li {
    padding: 8px 0 8px 20px; position: relative; font-size: 14px; line-height: 1.5;
    border-bottom: 1px solid var(--qmf-border);
}
#recommendations-list li:last-child { border-bottom: none; }
#recommendations-list li::before {
    content: '💡'; position: absolute; left: 0; top: 8px;
}

/* Grouped recommendation sections */
.reco-section { margin-bottom: 16px; }
.reco-section:last-child { margin-bottom: 0; }
.reco-section-header {
    font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--qmf-primary, #6366f1); padding: 6px 0 4px; margin-bottom: 4px;
    border-bottom: 2px solid var(--qmf-primary, #6366f1); display: flex; align-items: center; gap: 6px;
}
.reco-section-header i { font-size: 12px; opacity: 0.8; }
.reco-section-list { list-style: none; padding: 0; margin: 0; }
.reco-section-list li {
    padding: 6px 0 6px 22px; position: relative; font-size: 14px; line-height: 1.55;
    border-bottom: 1px solid color-mix(in srgb, var(--qmf-border) 50%, transparent);
}
.reco-section-list li:last-child { border-bottom: none; }
.reco-section-list li::before {
    content: '▸'; position: absolute; left: 6px; top: 6px; color: var(--qmf-primary, #6366f1); font-size: 13px;
}

/* ═══════ EVIDENCE ═══════ */
#evidence-list { list-style: none; padding: 0; }
#evidence-list li {
    padding: 6px 0 6px 18px; position: relative; font-size: 13px; color: var(--qmf-text-secondary);
}
#evidence-list li::before { content: '🔗'; position: absolute; left: 0; }

/* ═══════ NLP INFO ═══════ */
.nlp-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px;
}
.nlp-chip {
    padding: 6px 10px; background: var(--qmf-bg); border: 1px solid var(--qmf-border);
    border-radius: var(--qmf-radius-sm); font-size: 12px;
}
.nlp-chip .nlp-label { font-weight: 700; color: var(--qmf-text-muted); }

/* ═══════ CALENDAR ═══════ */
.cal-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px;
}
.cal-item {
    padding: 10px; background: var(--qmf-bg); border: 1px solid var(--qmf-border);
    border-radius: var(--qmf-radius-sm); text-align: center;
}
.cal-item .cal-label { font-size: 11px; font-weight: 700; color: var(--qmf-text-muted); }
.cal-item .cal-value { font-size: 16px; font-weight: 800; color: var(--ic-primary); }
.cal-item .cal-sub { font-size: 12px; color: var(--qmf-text-secondary); }

/* ═══════ LOOKUP ═══════ */
.hex-quick-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
    gap: 4px; margin-top: 12px;
}
.hex-quick-btn {
    aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; border: 1px solid var(--qmf-border);
    border-radius: var(--qmf-radius-sm); background: var(--qmf-card);
    cursor: pointer; color: var(--qmf-text-secondary); transition: all .15s;
}
.hex-quick-btn:hover { background: var(--ic-primary); color: #fff; border-color: var(--ic-primary); }

#lookup-content { font-size: 14px; line-height: 1.7; }
#lookup-content h3 { font-size: 15px; margin: 14px 0 6px; color: var(--ic-primary); font-weight: 700; }
#lookup-content .text-block { margin-bottom: 10px; }
#lookup-content .han-text { font-size: 16px; color: var(--ic-gold); font-weight: 600; }
#lookup-content .vi-text { color: var(--qmf-text); }
#lookup-content .en-text { color: var(--qmf-text-secondary); font-style: italic; }

/* ═══════ RESPONSIVE ═══════ */
@media (max-width: 640px) {
    .container { padding: 12px; }
    .page-title h1 { font-size: 20px; }
    .form-row { flex-direction: column; }
    .hex-visual-row { flex-direction: column; gap: 16px; }
    .hex-arrow { transform: rotate(90deg); }
    .sem-grid { grid-template-columns: 1fr; }
}

/* ═══════ DARK THEME ═══════ */
[data-theme="dark"] body { background: #0f172a; color: #e2e8f0; }
[data-theme="dark"] header { background: rgba(15,23,42,.9); border-color: #1e293b; }
[data-theme="dark"] .iching-card { background: var(--glass-bg); border-color: var(--glass-border); }
[data-theme="dark"] .card-header { border-color: rgba(255,255,255,0.06); }
[data-theme="dark"] textarea, [data-theme="dark"] input, [data-theme="dark"] select {
    background: #0f172a; border-color: #334155; color: #e2e8f0;
}
[data-theme="dark"] .manual-line, [data-theme="dark"] .sem-item,
[data-theme="dark"] .nlp-chip, [data-theme="dark"] .cal-item,
[data-theme="dark"] .hex-meta .meta-tag { background: #0f172a; border-color: #334155; }
[data-theme="dark"] .hex-quick-btn { background: #1e293b; border-color: #334155; color: #94a3b8; }

/* ═══════ CASTING OVERLAY ═══════ */
.casting-overlay {
    display: none; position: fixed; inset: 0; z-index: 2000;
    background: rgba(0,0,0,0.92); flex-direction: column;
    align-items: center; justify-content: center; gap: 28px;
}
.casting-overlay.show { display: flex; }
.casting-title {
    font-size: 20px; font-weight: 700; color: var(--ic-gold);
    letter-spacing: 1px; text-align: center;
}
.coins-container { display: flex; gap: 24px; }
.coin {
    width: 64px; height: 64px; border-radius: 50%;
    background: linear-gradient(145deg, #d4b860, #a08030);
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; color: #1e293b; font-weight: 900;
    box-shadow: 0 4px 16px rgba(212,175,55,0.4);
    animation: coinFlip 0.6s ease-in-out infinite;
}
.coin:nth-child(2) { animation-delay: 0.15s; }
.coin:nth-child(3) { animation-delay: 0.3s; }
@keyframes coinFlip {
    0%, 100% { transform: rotateY(0deg) scale(1); }
    50% { transform: rotateY(180deg) scale(0.9); }
}
.casting-progress {
    display: flex; gap: 8px; align-items: center;
}
.casting-line {
    width: 36px; height: 6px; border-radius: 3px;
    background: rgba(255,255,255,0.15); transition: all 0.4s ease;
}
.casting-line.done { background: var(--ic-gold); box-shadow: 0 0 8px rgba(212,175,55,0.5); }
.casting-text {
    font-size: 14px; color: rgba(255,255,255,0.6);
    text-align: center;
}

/* ═══════ LINES DETAIL ═══════ */
.lines-detail {
    margin-top: 16px; padding-top: 14px;
    border-top: 1px solid var(--qmf-border);
}
/* Legacy legend (top) - keep for compatibility */
.lines-legend {
    background: var(--qmf-bg, #f1f5f9);
    border: 1px solid var(--qmf-border, #e2e8f0);
    border-radius: var(--qmf-radius-sm, 6px);
    padding: 10px 14px;
    margin-bottom: 12px;
    font-size: 12px !important;
    line-height: 1.7 !important;
    color: var(--qmf-text, #334155) !important;
}
.lines-legend strong {
    color: var(--ic-primary, #1e40af);
    font-size: 13px;
    display: block;
    margin-bottom: 6px;
}
.lines-legend em {
    font-style: normal;
    font-weight: 600;
    color: var(--ic-primary, #1e40af);
    background: var(--ic-gold-light, #fef3c7);
    padding: 1px 5px;
    border-radius: 3px;
    margin-right: 2px;
}
/* New collapsible legend (bottom) */
.lines-legend-details {
    margin-top: 12px;
    border: 1px dashed var(--qmf-border, #cbd5e1);
    border-radius: var(--qmf-radius-sm, 6px);
    background: linear-gradient(135deg, #fefce8 0%, #fef3c7 100%);
    font-size: 11px;
}
.lines-legend-summary {
    cursor: pointer;
    padding: 8px 12px;
    font-weight: 600;
    color: var(--ic-primary, #92400e);
    user-select: none;
    list-style: none;
}
.lines-legend-summary::-webkit-details-marker { display: none; }
.lines-legend-summary::before {
    content: '▶ ';
    font-size: 9px;
    margin-right: 4px;
    transition: transform 0.2s;
    display: inline-block;
}
.lines-legend-details[open] .lines-legend-summary::before {
    transform: rotate(90deg);
}
.lines-legend-content {
    padding: 8px 12px 12px;
    border-top: 1px dashed var(--qmf-border, #cbd5e1);
    line-height: 1.8;
    color: var(--qmf-text, #44403c);
}
.legend-section {
    margin-bottom: 4px;
}
.legend-section:last-child { margin-bottom: 0; }
.legend-title {
    font-weight: 700;
    color: var(--ic-primary, #78350f);
    margin-right: 6px;
}
.legend-symbol {
    font-family: monospace;
    font-size: 10px;
    background: #fff;
    padding: 1px 4px;
    border-radius: 2px;
    border: 1px solid #e5e7eb;
    margin: 0 2px;
    letter-spacing: -1px;
}
.legend-symbol-stack {
    font-family: monospace;
    font-size: 9px;
    display: inline-flex;
    flex-direction: column;
    line-height: 0.7;
    vertical-align: middle;
    background: #fff;
    padding: 2px 4px;
    border-radius: 2px;
    border: 1px solid #e5e7eb;
    margin: 0 2px;
    letter-spacing: -1px;
}
.lines-detail-table {
    width: 100%; border-collapse: collapse; font-size: 13px;
}
.lines-detail-table th {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    color: var(--qmf-text-muted); letter-spacing: .5px;
    padding: 6px 8px; text-align: left;
    border-bottom: 1px solid var(--qmf-border);
}
.lines-detail-table td {
    padding: 6px 8px; border-bottom: 1px solid var(--qmf-border);
    color: var(--qmf-text);
}
.lines-detail-table tr:last-child td { border-bottom: none; }
.lines-detail-table .moving-badge {
    display: inline-block; padding: 1px 6px; border-radius: 999px;
    font-size: 11px; font-weight: 700;
    background: var(--ic-gold-light); color: var(--ic-gold);
}
.raw-symbol {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1;
    vertical-align: middle;
    font-family: monospace;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 3px;
    padding: 2px 6px;
    min-width: 32px;
    text-align: center;
}

/* ═══════ LIUYAO GRID (Rich Line Detail) ═══════ */
.liuyao-grid { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.liuyao-line {
    display: flex; flex-direction: column; gap: 4px;
    padding: 8px 12px; border-radius: var(--qmf-radius-sm, 6px);
    background: var(--qmf-bg, #f8fafc);
    border-left: 3px solid var(--qmf-border, #e2e8f0);
    transition: border-color 0.2s;
}
.liuyao-line--moving { border-left-color: var(--ic-gold, #c9a02c); background: var(--ic-gold-light, #fef9e7); }
.liuyao-line__header { display: flex; align-items: center; gap: 8px; }
.liuyao-line__pos { font-size: 13px; font-weight: 700; color: var(--ic-primary, #2d3748); }
.liuyao-line__yy { font-size: 16px; line-height: 1; }
.liuyao-line__body { display: flex; flex-direction: column; gap: 3px; padding-left: 4px; }
.liuyao-line__main { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.liuyao-line__meta { display: flex; flex-wrap: wrap; gap: 6px; font-size: 11px; color: var(--qmf-text-muted, #718096); }
.liuyao-line__changed {
    font-size: 12px; color: var(--ic-gold, #c9a02c); font-weight: 600;
    padding: 2px 0; border-top: 1px dashed var(--qmf-border, #e2e8f0); margin-top: 2px;
}
.liuyao-chip {
    display: inline-block; padding: 1px 7px; border-radius: 999px;
    font-size: 11px; font-weight: 600; line-height: 1.5;
}
.chip--najia { background: var(--ic-primary-light, #ebf4ff); color: var(--ic-primary, #2b6cb0); }
.chip--element { background: #f0f0f0; color: #555; }
.chip--relation { background: #e6f7e6; color: #276749; }
.chip--spirit { background: #fef3e6; color: #9c4221; }
.liuyao-meta { white-space: nowrap; }
.shi-badge, .ying-badge {
    display: inline-block; padding: 0 4px; border-radius: 3px;
    font-size: 11px; font-weight: 700; margin-left: 4px;
}
.shi-badge { background: #c53030; color: #fff; }
.ying-badge { background: #2b6cb0; color: #fff; }
.moving-badge {
    display: inline-block; padding: 1px 6px; border-radius: 999px;
    font-size: 11px; font-weight: 700;
    background: var(--ic-gold-light, #fef9e7); color: var(--ic-gold, #c9a02c);
}

/* ═══════ CLASSICAL MOVING CARD ═══════ */
.classical-card .card-icon { background: var(--ic-gold-light); color: var(--ic-gold); }
.classical-line-block {
    padding: 12px; margin-bottom: 10px;
    background: var(--qmf-bg, #f8fafc); border-radius: var(--qmf-radius-sm);
    border-left: 3px solid var(--ic-gold);
}
.classical-line-block:last-child { margin-bottom: 0; }
.classical-line-header {
    display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.classical-line-pos {
    font-size: 13px; font-weight: 700; color: var(--ic-primary);
}
.classical-line-moving {
    font-size: 11px; font-weight: 700; color: var(--ic-gold);
    padding: 1px 6px; background: var(--ic-gold-light); border-radius: 999px;
}
.classical-han {
    font-size: 16px; color: var(--ic-gold); font-weight: 600;
    font-family: 'Noto Serif SC', 'Songti SC', serif;
    margin-bottom: 4px;
}
.classical-vi {
    font-size: 14px; font-weight: 600; color: var(--qmf-text);
    margin-bottom: 4px;
}
.classical-meaning {
    font-size: 13px; color: var(--qmf-text-secondary); line-height: 1.6;
}
.classical-xiao-xiang {
    margin-top: 8px; padding: 8px; font-size: 12px;
    background: var(--ic-primary-light); border-radius: var(--qmf-radius-sm);
    color: var(--qmf-text-secondary);
}
.classical-xiao-xiang .xiao-label {
    font-weight: 700; color: var(--ic-primary); margin-right: 4px;
}
[data-theme="dark"] .classical-line-block { background: #0f172a; }
[data-theme="dark"] .classical-xiao-xiang { background: rgba(139,92,246,0.15); }

/* ═══════ CLASSICAL OVERVIEW ═══════ */
.classical-section {
    margin-bottom: 16px; padding-bottom: 16px;
    border-bottom: 1px solid var(--qmf-border);
}
.classical-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.classical-section-title {
    font-size: 13px; font-weight: 700; color: var(--ic-primary);
    margin-bottom: 8px; display: flex; align-items: center; gap: 6px;
}
.classical-section-title .section-han {
    font-size: 14px; color: var(--ic-gold);
    font-family: 'Noto Serif SC', 'Songti SC', serif;
}
.text-lang-block {
    margin-bottom: 6px; padding: 10px 12px;
    border-radius: var(--qmf-radius-sm);
    background: var(--qmf-bg, #f8fafc);
}
.text-lang-block:last-child { margin-bottom: 0; }
.text-lang-label {
    display: inline-block; font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .5px;
    padding: 1px 6px; border-radius: 3px; margin-bottom: 4px;
    color: #fff;
}
.text-lang-label.lang-han { background: var(--ic-gold); }
.text-lang-label.lang-vi { background: var(--ic-primary); }
.text-lang-label.lang-en { background: #64748b; }
.text-lang-label.lang-note { background: var(--ic-cat); }
.text-lang-content { font-size: 14px; line-height: 1.7; }
.text-lang-content.content-han {
    font-size: 16px; color: var(--ic-gold); font-weight: 600;
    font-family: 'Noto Serif SC', 'Songti SC', serif;
    line-height: 1.8;
}
.text-lang-content.content-vi { color: var(--qmf-text); font-weight: 500; }
.text-lang-content.content-en { color: var(--qmf-text-secondary); font-style: italic; }
.text-lang-content.content-note { color: var(--qmf-text); }
[data-theme="dark"] .text-lang-block { background: #0f172a; }

/* ═══════ FORMATTED ANALYSIS ═══════ */
.analysis-block {
    padding: 10px 12px; margin-bottom: 8px;
    border-radius: var(--qmf-radius-sm);
    background: var(--qmf-bg, #f8fafc);
    border-left: 3px solid var(--ic-primary);
    font-size: 14px; line-height: 1.7;
}
.analysis-block:last-child { margin-bottom: 0; }
.analysis-block .analysis-header {
    font-size: 13px; font-weight: 700; color: var(--ic-primary);
    margin-bottom: 4px;
}
.analysis-block .analysis-body { color: var(--qmf-text); }
.analysis-block .analysis-body-en {
    color: var(--qmf-text-secondary); font-style: italic;
    border-left: 2px solid var(--qmf-border); padding-left: 10px;
    margin-top: 6px; font-size: 13px;
}
.analysis-block.block-moving { border-left-color: var(--ic-gold); }
.analysis-block.block-changed { border-left-color: var(--ic-yin); }
[data-theme="dark"] .analysis-block { background: #0f172a; }

/* ═══════ SEMANTIC TAGS ═══════ */
.sem-tag-list {
    display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px;
}
.sem-tag {
    display: inline-block; font-size: 12px; padding: 2px 8px;
    border-radius: 999px; background: var(--ic-primary-light);
    color: var(--ic-primary); font-weight: 600;
}
.sem-tag.tag-warning {
    background: rgba(239,68,68,0.1); color: #dc2626;
}
.sem-tag.tag-action {
    background: rgba(16,185,129,0.1); color: #059669;
}
/* ═══════ RESULT ACTIONS ═══════ */
@keyframes highlightPulse {
    0% { background-color: rgba(67, 97, 238, 0.1); transform: scale(1.00); }
    50% { background-color: rgba(67, 97, 238, 0.2); transform: scale(1.01); }
    100% { background-color: transparent; transform: scale(1.00); }
}

.result-actions {
    display: flex; gap: 12px; margin-top: 20px;
    flex-wrap: wrap;
}
.result-actions .primary-btn { flex: 1; min-width: 180px; margin-top: 0; }

/* ═══════ FOLLOW-UP UI ═══════ */
.follow-up-hint {
    background: var(--ic-primary-light);
    color: var(--ic-primary);
    padding: 10px 14px;
    border-radius: var(--qmf-radius-sm);
    margin-bottom: 12px;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-left: 4px solid var(--ic-primary);
    animation: slideInDown 0.3s ease-out;
}
.follow-up-hint strong { margin: 0 4px; }
.text-btn {
    background: none;
    border: none;
    color: var(--ic-primary);
    font-weight: 700;
    cursor: pointer;
    text-decoration: underline;
    font-size: 13px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}
.text-btn:hover { background: var(--ic-primary-light); color: var(--ic-primary-hover); }

@keyframes slideInDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ═══════ RESULT SECTIONS — Liquid Glass Groups ═══════ */
.result-section {
    margin-bottom: 24px;
    padding: 4px;
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.04), rgba(212, 175, 55, 0.04));
}
.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px 8px;
}
.section-icon {
    width: 40px; height: 40px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    background: linear-gradient(135deg, var(--ic-primary), var(--ic-primary-hover));
    color: #fff;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}
#section-divination .section-icon {
    background: linear-gradient(135deg, var(--ic-gold), #b8941f);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}
.section-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--qmf-text, #1e293b);
    margin: 0;
}
.section-subtitle {
    font-size: 12px;
    color: var(--qmf-text-muted, #94a3b8);
    letter-spacing: 0.5px;
}
[data-theme="dark"] .result-section {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.06), rgba(212, 175, 55, 0.06));
}

/* ═══════ QUESTION ECHO ═══════ */
.question-echo {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.08), rgba(212, 175, 55, 0.08));
    border: 1px solid rgba(139, 92, 246, 0.15);
    border-radius: 14px;
    padding: 16px 20px;
    margin-bottom: 14px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.question-echo-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--ic-primary);
    margin-bottom: 6px;
}
.question-echo-question {
    font-size: 15px;
    font-weight: 600;
    color: var(--qmf-text, #1e293b);
    margin-bottom: 8px;
}
.question-echo-answer {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.5;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.6);
    border-left: 4px solid var(--ic-primary);
}
.question-echo-answer.verdict-yes { border-left-color: #10b981; color: #047857; }
.question-echo-answer.verdict-leaning_yes { border-left-color: #34d399; color: #059669; }
.question-echo-answer.verdict-cautious { border-left-color: #f59e0b; color: #d97706; }
.question-echo-answer.verdict-leaning_no { border-left-color: #f87171; color: #dc2626; }
.question-echo-answer.verdict-no { border-left-color: #ef4444; color: #b91c1c; }
[data-theme="dark"] .question-echo-answer { background: rgba(15, 23, 42, 0.5); }

/* ═══════ SCORE MATRIX ═══════ */
.score-matrix-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}
.score-item {
    padding: 14px;
    border-radius: 14px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    text-align: center;
    transition: transform 0.2s ease;
}
.score-item:hover { transform: scale(1.03); }
.score-item-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--qmf-text-muted, #94a3b8);
    margin-bottom: 6px;
}
.score-item-bar {
    height: 6px;
    border-radius: 3px;
    background: var(--qmf-border, #e2e8f0);
    overflow: hidden;
    margin-bottom: 6px;
}
.score-item-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}
.score-item-fill.level-high { background: linear-gradient(90deg, #10b981, #34d399); }
.score-item-fill.level-mid { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.score-item-fill.level-low { background: linear-gradient(90deg, #ef4444, #f87171); }
.score-item-value {
    font-size: 20px;
    font-weight: 800;
    color: var(--qmf-text, #1e293b);
}
.score-item-value .score-pct {
    font-size: 12px;
    font-weight: 600;
    color: var(--qmf-text-muted, #94a3b8);
}

/* ═══════ SMOOTH GLASSMORPHISM BODY BG ═══════ */
body {
    background: linear-gradient(135deg, #f0f4ff 0%, #faf5ff 25%, #fefce8 50%, #f0fdf4 75%, #f0f4ff 100%) !important;
    background-attachment: fixed;
}
[data-theme="dark"] body {
    background: linear-gradient(135deg, #0f172a 0%, #1a1033 25%, #1a1a0a 50%, #0a1a12 75%, #0f172a 100%) !important;
}

/* ═══════ SMOOTH CARD TRANSITIONS ═══════ */
.iching-card.glass-card {
    animation: cardFadeIn 0.4s ease-out;
}
@keyframes cardFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.result-section .iching-card:nth-child(2) { animation-delay: 0.05s; }
.result-section .iching-card:nth-child(3) { animation-delay: 0.1s; }
.result-section .iching-card:nth-child(4) { animation-delay: 0.15s; }
.result-section .iching-card:nth-child(5) { animation-delay: 0.2s; }
