/* ==========================================================================
   MysteryInAlphabets — Sanctuary Design System
   Modern Glassmorphism, Living Nature Themes, and Clean Multilingual UI
   ========================================================================== */

:root {
    --primary: #5c4ab5;
    --primary-light: #7c68d8;
    --primary-dark: #3f3187;
    --gold: #d4a017;
    --gold-light: #fbe083;
    --gold-dark: #8c6006;
    --ruby: #e05374;
    --emerald: #10b981;
    --surface: rgba(255, 255, 255, 0.88);
    --surface-glass: rgba(255, 255, 255, 0.72);
    --surface-border: rgba(255, 255, 255, 0.65);
    --text-main: #18233b;
    --text-muted: #57657e;
    --text-light: #8795ad;
    --shadow-soft: 0 10px 30px rgba(20, 30, 60, 0.08);
    --shadow-card: 0 16px 45px rgba(25, 38, 70, 0.12);
    --shadow-gold: 0 16px 45px rgba(212, 160, 23, 0.28);
    --radius-lg: 24px;
    --radius-md: 14px;
    --radius-sm: 8px;
    --font-heading: 'Cinzel', 'Noto Serif', Georgia, serif;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    color: var(--text-main);
    background: linear-gradient(180deg, #eaf2ff 0%, #f6f8fd 40%, #edf3fe 100%);
    min-height: 100vh;
    line-height: 1.6;
    position: relative;
    overflow-x: hidden;
}

/* --- Atmospheric Background Canvas --- */
#natureAtmosphereCanvas {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 0;
}

/* --- Top Navigation Bar --- */
.sanctuary-nav {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 4px 20px rgba(20, 30, 60, 0.06);
}

.sanctuary-nav-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.sanctuary-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-main);
}

.sanctuary-brand-logo {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, #5c4ab5, #8553c9 50%, #e07260);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.45rem;
    font-weight: 800;
    font-family: var(--font-heading);
    box-shadow: 0 6px 16px rgba(92, 74, 181, 0.35);
}

.sanctuary-brand-text h1 {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    line-height: 1.2;
    color: #1a2238;
}

.sanctuary-brand-text span {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    display: block;
}

.sanctuary-nav-links {
    display: flex;
    align-items: center;
    gap: 6px;
    list-style: none;
    flex-wrap: wrap;
}

.sanctuary-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 20px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.86rem;
    font-weight: 700;
    transition: all 0.18s ease;
}

.sanctuary-nav-link:hover {
    color: var(--primary);
    background: rgba(92, 74, 181, 0.08);
}

.sanctuary-nav-link.is-active {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    box-shadow: 0 4px 14px rgba(92, 74, 181, 0.32);
}

/* --- Atmospheric Controller in Nav --- */
.sanctuary-atmosphere-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.atmosphere-btn {
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid rgba(190, 205, 230, 0.7);
    background: #fff;
    color: #3b4966;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.atmosphere-btn:hover {
    border-color: var(--primary);
    background: #f7f9ff;
}

.atmosphere-btn.is-active {
    background: linear-gradient(135deg, #4d3da8, #6d58cb);
    color: #fff;
    border-color: #3d2f91;
    box-shadow: 0 3px 10px rgba(77, 61, 168, 0.28);
}

.sound-btn {
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid rgba(190, 205, 230, 0.7);
    background: #fff;
    color: #3b4966;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.sound-btn.is-active {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    border-color: #047857;
    box-shadow: 0 3px 10px rgba(16, 185, 129, 0.3);
}

/* --- Scenic Nature Panorama Stage --- */
.nature-stage-wrapper {
    max-width: 1280px;
    margin: 20px auto 0;
    padding: 0 20px;
    position: relative;
    z-index: 10;
}

.nature-stage-card {
    position: relative;
    height: 240px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: linear-gradient(180deg, #87ceeb 0%, #bde4f4 55%, #f4d090 90%, #dfb470 100%);
    box-shadow: 0 16px 40px rgba(40, 75, 120, 0.16);
    border: 2px solid rgba(255, 255, 255, 0.75);
}

.nature-stage-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.nature-stage-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 24px 30px;
    pointer-events: none;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.85) 0%, rgba(255, 255, 255, 0.4) 45%, rgba(255, 255, 255, 0) 100%);
}

.nature-stage-title-wrap {
    max-width: 580px;
    pointer-events: auto;
}

.nature-stage-kicker {
    display: inline-block;
    text-transform: uppercase;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    color: var(--primary);
    margin-bottom: 4px;
}

.nature-stage-title {
    font-family: var(--font-heading);
    font-size: clamp(1.6rem, 3.5vw, 2.3rem);
    color: #121e36;
    line-height: 1.15;
    margin-bottom: 6px;
}

.nature-stage-subtitle {
    font-size: 0.9rem;
    color: #384868;
    line-height: 1.45;
}

.nature-stage-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    pointer-events: auto;
}

.stage-badge {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.9);
    color: #273754;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* --- Main Layout Container --- */
.sanctuary-container {
    max-width: 1280px;
    margin: 24px auto 60px;
    padding: 0 20px;
    position: relative;
    z-index: 10;
}

/* --- Glassmorphic Section Cards --- */
.sanctuary-card {
    background: var(--surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: clamp(22px, 4vw, 36px);
    margin-bottom: 28px;
}

/* --- Form Fields & Controls --- */
.sanctuary-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.sanctuary-grid-full {
    grid-column: 1 / -1;
}

.sanctuary-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.88rem;
    font-weight: 700;
    color: #293855;
}

.sanctuary-field input,
.sanctuary-field select,
.sanctuary-field textarea {
    width: 100%;
    min-height: 46px;
    padding: 10px 14px;
    border: 1px solid #d2daeb;
    border-radius: var(--radius-md);
    background: #ffffff;
    font-family: inherit;
    font-size: 0.92rem;
    color: #17223b;
    transition: all 0.18s ease;
}

.sanctuary-field input:focus,
.sanctuary-field select:focus,
.sanctuary-field textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(92, 74, 181, 0.18);
}

.sanctuary-field small {
    font-size: 0.76rem;
    font-weight: 400;
    color: var(--text-muted);
}

/* --- Language Chips Selector --- */
.lang-chips-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.lang-chip-btn, .personal-lang-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 20px;
    border: 1.5px solid #d2daeb;
    background: #ffffff;
    color: #3b4966;
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    transition: all 0.18s ease;
}

.lang-chip-btn:hover, .personal-lang-chip:hover {
    border-color: #6455bb;
    background: #f7f9ff;
    transform: translateY(-1px);
}

.lang-chip-btn.is-active, .personal-lang-chip.is-active {
    background: linear-gradient(135deg, #5c4ab5 0%, #764ba2 60%, #4f46e5 100%) !important;
    border-color: #4338ca !important;
    color: #ffffff !important;
    box-shadow: 0 4px 14px rgba(92, 74, 181, 0.35) !important;
}

.lang-chip-btn .chip-flag, .personal-lang-chip .chip-flag {
    font-size: 1.15rem;
    line-height: 1;
}

.lang-chip-btn .chip-native, .personal-lang-chip .chip-native {
    font-weight: 800;
}

.lang-chip-btn .chip-name, .personal-lang-chip .chip-name {
    font-size: 0.74rem;
    opacity: 0.85;
}

.lang-chip-btn .chip-solo-tag, .personal-lang-chip .chip-solo-tag {
    display: inline-flex;
    align-items: center;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 1px 7px;
    border-radius: 999px;
    margin-left: 4px;
    background: rgba(0, 0, 0, 0.06);
    color: inherit;
    opacity: 0.7;
    transition: all 0.15s ease;
}

.lang-chip-btn:hover .chip-solo-tag, .personal-lang-chip:hover .chip-solo-tag {
    opacity: 1;
    background: rgba(92, 74, 181, 0.15);
    color: #5c4ab5;
}

.lang-chip-btn.is-active .chip-solo-tag, .personal-lang-chip.is-active .chip-solo-tag {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
    opacity: 0.9;
}

.lang-chip-btn .chip-solo-tag:hover, .personal-lang-chip .chip-solo-tag:hover {
    transform: scale(1.08);
    background: #ffffff !important;
    color: #4338ca !important;
}

/* --- Mass Convergence Engine --- */
.ce-quick-pill {
    transition: all 0.15s ease;
}
.ce-quick-pill:hover {
    background: #dcfce7 !important;
    border-color: #059669 !important;
    color: #065f46 !important;
    transform: translateY(-1px);
}
.ce-result-card {
    background: #ffffff;
    border: 1.5px solid #a7f3d0;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 12px;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.08);
    transition: all 0.18s ease;
}
.ce-result-card:hover {
    border-color: #10b981;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.16);
}
.ce-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 800;
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    color: #ffffff;
    letter-spacing: 0.03em;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 0 24px;
    border: 0;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #5142b5, #854aa5 55%, #df6d59);
    color: #ffffff;
    font-weight: 800;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(81, 66, 181, 0.28);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(81, 66, 181, 0.35);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 18px;
    border: 1px solid #d2daeb;
    border-radius: var(--radius-md);
    background: #ffffff;
    color: #4b5874;
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.18s ease;
}

.btn-secondary:hover {
    background: #f0f3fa;
    color: var(--text-main);
}

/* --- Exact Match Spotlight Celebration Card --- */
.spotlight-match-card {
    position: relative;
    overflow: hidden;
    padding: 30px 24px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, #ffea9f 0%, #ffd060 40%, #f6ab4a 100%);
    box-shadow: var(--shadow-gold);
    color: #382708;
    text-align: center;
    margin-bottom: 24px;
    border: 2px solid rgba(255, 255, 255, 0.8);
    animation: spotlight-glow 2.2s ease-in-out infinite alternate;
}

@keyframes spotlight-glow {
    from { box-shadow: 0 12px 35px rgba(212, 160, 23, 0.28); }
    to { box-shadow: 0 18px 55px rgba(212, 160, 23, 0.45); }
}

.spotlight-kicker {
    text-transform: uppercase;
    font-weight: 800;
    font-size: 0.8rem;
    letter-spacing: 0.16em;
    color: #7c4c0b;
    margin-bottom: 6px;
}

.spotlight-figures {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 18px;
    margin: 14px 0 10px;
}

.spotlight-figure {
    min-width: 170px;
    padding: 14px 20px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(8px);
}

.spotlight-figure span {
    display: block;
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
    color: #72460b;
    letter-spacing: 0.05em;
}

.spotlight-figure strong {
    display: block;
    font-size: clamp(2.4rem, 7vw, 4rem);
    line-height: 1;
    color: #1a1102;
}

.spotlight-figure em {
    font-style: normal;
    font-size: 0.82rem;
    font-weight: 700;
    color: #6b4009;
}

/* --- Results Cards Grid --- */
.results-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 18px;
}

.result-card {
    background: #ffffff;
    border: 1px solid #e1e7f4;
    border-radius: var(--radius-md);
    padding: 18px;
    box-shadow: 0 4px 16px rgba(20, 30, 60, 0.04);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.result-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(20, 30, 60, 0.09);
}

.result-card.is-exact-match {
    border-color: var(--gold);
    background: radial-gradient(circle at top right, rgba(255, 220, 120, 0.42), #ffffff 60%), #ffffff;
    box-shadow: 0 0 0 2px rgba(212, 160, 23, 0.35), 0 14px 34px rgba(180, 120, 15, 0.16);
}

.result-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.result-lang-tag {
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--primary);
}

.result-brain-origin {
    font-size: 0.72rem;
    font-weight: 700;
    color: #6050b5;
    background: #f0edfa;
    padding: 2px 8px;
    border-radius: 999px;
}

.result-exact-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 240, 180, 0.95);
    color: #7b4a08;
    font-size: 0.78rem;
    font-weight: 800;
    margin-bottom: 8px;
    border: 1px solid rgba(212, 160, 23, 0.4);
}

.result-sentence {
    font-size: 1.05rem;
    line-height: 1.45;
    color: #1a253d;
    margin-bottom: 10px;
    min-height: 48px;
}

.result-total-wrap {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin: 10px 0;
}

.result-total-wrap span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.result-total-wrap strong {
    font-size: 1.8rem;
    color: var(--primary);
    font-weight: 800;
}

.is-exact-match .result-total-wrap strong {
    color: #7b4a08;
    font-size: 2.2rem;
}

.result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    align-items: center;
}

.action-pill-btn {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 0;
    background: #f0effc;
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.action-pill-btn:hover {
    background: #e3dffa;
}

/* ==========================================================================
   Live Multilingual Calculator Components
   ========================================================================== */

.calc-lang-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.calc-lang-chip {
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid #d4dceb;
    background: rgba(255, 255, 255, 0.9);
    font-size: 0.85rem;
    font-weight: 700;
    color: #334155;
    cursor: pointer;
    transition: all 0.16s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.calc-lang-chip:hover {
    border-color: var(--primary-light);
    color: var(--primary);
    transform: translateY(-1px);
}

.calc-lang-chip.is-active {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(92, 74, 181, 0.3);
}

.calc-textarea-wrap {
    position: relative;
    margin-bottom: 14px;
}

.calc-textarea {
    width: 100%;
    min-height: 120px;
    padding: 16px 18px;
    border-radius: var(--radius-md);
    border: 1.5px solid #d2daeb;
    background: #ffffff;
    font-size: 1.15rem;
    line-height: 1.5;
    color: #111827;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.03);
}

.calc-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(92, 74, 181, 0.14);
}

.calc-meta-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.calc-stats-group {
    display: flex;
    gap: 14px;
    align-items: center;
    font-weight: 600;
}

.calc-stat-badge {
    background: #f1f5f9;
    padding: 3px 10px;
    border-radius: 999px;
    color: #334155;
}

.calc-translate-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    margin-bottom: 12px;
    padding: 8px 14px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(168, 85, 247, 0.08));
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: var(--radius-md);
    flex-wrap: wrap;
    animation: fadeIn 0.25s ease-out;
}

.calc-translate-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 16px;
    font-size: 0.88rem;
    font-weight: 700;
    color: #ffffff;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    border: none;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(79, 70, 229, 0.3);
    transition: all 0.2s ease;
}

.calc-translate-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(79, 70, 229, 0.4);
}

.calc-revert-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 0.84rem;
    font-weight: 600;
    color: #475569;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.calc-revert-btn:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.translate-status-text {
    font-size: 0.82rem;
    color: #6366f1;
    font-weight: 600;
}

.calc-actions-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.calc-btn-primary {
    padding: 11px 24px;
    border-radius: var(--radius-md);
    border: 0;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    font-size: 0.96rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(92, 74, 181, 0.35);
    transition: all 0.16s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.calc-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(92, 74, 181, 0.45);
}

.calc-btn-secondary {
    padding: 11px 18px;
    border-radius: var(--radius-md);
    border: 1px solid #d2daeb;
    background: #fff;
    color: #475569;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.16s ease;
}

.calc-btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #1e293b;
}

.calc-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 600;
    color: #334155;
    user-select: none;
}

.calc-checkbox-label input[type="checkbox"] {
    width: 17px;
    height: 17px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* --- Word Card Animation Selector Bar --- */
.calc-anim-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(226, 232, 240, 0.8);
}

.calc-anim-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.calc-anim-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-right: 4px;
}

.calc-anim-btn {
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid #d4dceb;
    background: #ffffff;
    font-size: 0.82rem;
    font-weight: 700;
    color: #475569;
    cursor: pointer;
    transition: all 0.16s ease;
    user-select: none;
}

.calc-anim-btn:hover {
    border-color: var(--primary-light);
    color: var(--primary);
    transform: translateY(-1px);
}

.calc-anim-btn.is-active {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 3px 10px rgba(92, 74, 181, 0.3);
}

.calc-theme-toggle-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* --- Live Total Spotlight Card --- */
.calc-total-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(248, 250, 255, 0.9));
    border: 2px solid #e2e8f5;
    border-radius: var(--radius-lg);
    padding: 24px;
    margin: 20px 0;
    box-shadow: 0 10px 30px rgba(25, 38, 70, 0.08);
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    overflow: hidden;
}

.calc-total-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), #a855f7, #ec4899);
}

.calc-total-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.calc-total-number-wrap {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.calc-total-kicker {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.calc-total-big-val {
    font-size: 3.5rem;
    line-height: 1;
    font-weight: 900;
    color: var(--primary-dark);
    font-variant-numeric: tabular-nums;
    text-shadow: 0 2px 10px rgba(92, 74, 181, 0.2);
}

.calc-quick-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* --- Word Block Display & Animated Cards --- */
.breakdown-container {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 10px;
    min-height: 50px;
}

.word-block {
    position: relative;
    border-radius: 16px;
    padding: 12px 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
    display: inline-flex;
    flex-direction: column;
    vertical-align: top;
    min-width: 90px;
    max-width: 100%;
    transition: transform 0.2s cubic-bezier(0.2, 0, 0.2, 1), box-shadow 0.2s ease;
    overflow: hidden;
    opacity: 0;
}

.word-block:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.25);
    z-index: 2;
}

/* Shimmer shine effect across word blocks */
.word-block::before {
    content: '';
    position: absolute;
    top: 0;
    left: -130%;
    width: 80%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
    transform: skewX(-25deg);
    transition: left 0.65s ease;
    pointer-events: none;
}

.word-block:hover::before {
    left: 140%;
}

.word-block-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.28);
}

.word-text {
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.01em;
}

.word-total {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.55);
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 900;
    padding: 2px 10px;
    border-radius: 999px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* Glass Card Variant */
.word-block.style-glass {
    background: rgba(255, 255, 255, 0.92);
    border: 1.5px solid rgba(92, 74, 181, 0.2);
    color: #1e293b;
    text-shadow: none;
    box-shadow: 0 6px 20px rgba(25, 38, 70, 0.08);
}

.word-block.style-glass .word-block-top {
    border-bottom-color: #f1f5f9;
}

.word-block.style-glass .word-text {
    color: #0f172a;
}

.word-block.style-glass .word-total {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-color: transparent;
    color: #ffffff;
    text-shadow: none;
}

/* Character Breakdown Cells */
.breakdown-table {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.breakdown-char-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    padding: 4px 6px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(4px);
    transition: all 0.15s ease;
}

.word-block.style-glass .breakdown-char-cell {
    background: #f8fafc;
    border-color: #e2e8f0;
}

.breakdown-char-cell:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.38);
}

.word-block.style-glass .breakdown-char-cell:hover {
    background: #ffffff;
    border-color: var(--primary-light);
    box-shadow: 0 3px 8px rgba(92, 74, 181, 0.15);
}

.breakdown-char-cell .char-symbol {
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1.15;
}

.breakdown-char-cell .char-formula {
    font-size: 0.68rem;
    font-weight: 700;
    opacity: 0.85;
    font-family: monospace;
}

.breakdown-char-cell .char-value {
    font-size: 0.78rem;
    font-weight: 900;
    margin-top: 2px;
}

.word-block.style-glass .char-value {
    color: var(--primary);
}

/* RTL Word Blocks */
.word-block.is-rtl {
    direction: rtl;
    text-align: right;
}

.word-block.is-rtl .breakdown-table {
    direction: rtl;
}

.breakdown-word-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid #f1f5f9;
}

.breakdown-word-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1e293b;
}

.breakdown-word-subtotal {
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--primary);
    background: #f0effc;
    padding: 2px 10px;
    border-radius: 999px;
}

.breakdown-chips-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.char-chip {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    padding: 6px 8px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    transition: all 0.14s ease;
}

.char-chip:hover {
    border-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(92, 74, 181, 0.15);
}

.char-chip-letter {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
    color: #0f172a;
}

.char-chip-value {
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--primary);
    margin-top: 2px;
}

.char-chip.chinese-stroke-chip .char-chip-formula {
    font-size: 0.68rem;
    color: #64748b;
    font-weight: 600;
}

/* RTL Word Blocks */
.breakdown-word-block.is-rtl {
    direction: rtl;
    text-align: right;
}

.breakdown-word-block.is-rtl .breakdown-chips-grid {
    direction: rtl;
}

/* --- Quick Try Examples Grid --- */
.quick-examples-section {
    margin: 32px 0;
}

.quick-examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
    margin-top: 14px;
}

.quick-example-card {
    background: #ffffff;
    border: 1px solid #e2e8f5;
    border-radius: var(--radius-md);
    padding: 16px;
    cursor: pointer;
    transition: all 0.18s ease;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quick-example-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(92, 74, 181, 0.12);
}

.quick-example-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quick-example-lang {
    font-size: 0.74rem;
    font-weight: 800;
    color: var(--primary);
    background: #f0effc;
    padding: 2px 8px;
    border-radius: 999px;
}

.quick-example-expected {
    font-size: 0.88rem;
    font-weight: 800;
    color: #0f172a;
}

.quick-example-text {
    font-size: 0.94rem;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.quick-example-note {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* --- Bridges to Other Screens --- */
.bridges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin: 36px 0;
}

.bridge-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(246, 248, 255, 0.9));
    border: 1px solid #e0e7f7;
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 16px;
    box-shadow: var(--shadow-card);
    transition: all 0.2s ease;
    text-decoration: none;
    color: inherit;
}

.bridge-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary-light);
    box-shadow: 0 16px 36px rgba(92, 74, 181, 0.16);
}

.bridge-card.is-gold {
    background: linear-gradient(135deg, rgba(255, 253, 244, 0.98), rgba(254, 248, 230, 0.95));
    border-color: rgba(212, 160, 23, 0.4);
}

.bridge-card-icon {
    font-size: 2rem;
    line-height: 1;
}

.bridge-card h3 {
    font-size: 1.25rem;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 6px;
}

.bridge-card p {
    font-size: 0.92rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.bridge-card-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--primary);
}

.bridge-card.is-gold .bridge-card-cta {
    color: #8c6006;
}

/* ==========================================================================
   Alphabet Mappings & Cipher Reference Page
   ========================================================================== */

.mappings-tab-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
}

.mappings-tab-btn {
    padding: 10px 18px;
    border-radius: 999px;
    border: 1px solid #d4dceb;
    background: #fff;
    color: #334155;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.16s ease;
}

.mappings-tab-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.mappings-tab-btn.is-active {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(92, 74, 181, 0.28);
}

.mapping-search-input {
    width: 100%;
    min-height: 48px;
    padding: 12px 18px;
    border-radius: var(--radius-md);
    border: 1.5px solid #d2daeb;
    background: #fff;
    font-size: 1rem;
    margin-bottom: 20px;
    transition: border-color 0.15s ease;
}

.mapping-search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(92, 74, 181, 0.12);
}

.mappings-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 16px rgba(20, 30, 60, 0.04);
}

.mappings-table th {
    background: #f8fafc;
    padding: 12px 16px;
    text-align: left;
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    border-bottom: 1.5px solid #e2e8f0;
}

.mappings-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.94rem;
    color: #1e293b;
}

.mappings-table tr:last-child td {
    border-bottom: none;
}

.mappings-table tr:hover td {
    background: #f8fafc;
}

.map-char-cell {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1;
    color: #0f172a;
}

.map-val-cell {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--primary);
}

.map-badge-cell {
    font-size: 0.78rem;
    font-weight: 700;
    background: #f1f5f9;
    color: #475569;
    padding: 3px 8px;
    border-radius: 999px;
    display: inline-block;
}

/* Chinese Hanzi Stroke Lookup Box */
.chinese-lookup-card {
    background: linear-gradient(135deg, #fffdf8, #fff8ee);
    border: 2px solid rgba(212, 160, 23, 0.4);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
}

.chinese-lookup-head {
    margin-bottom: 14px;
}

.chinese-lookup-head h3 {
    font-size: 1.25rem;
    font-weight: 800;
    color: #7b4a08;
    margin-bottom: 4px;
}

.chinese-lookup-head p {
    font-size: 0.9rem;
    color: #786551;
}

.chinese-lookup-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.chinese-lookup-input {
    flex: 1;
    min-width: 240px;
    min-height: 48px;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    border: 1px solid #d4a017;
    font-size: 1.25rem;
    background: #fff;
}

.chinese-lookup-result {
    margin-top: 16px;
    padding: 16px;
    background: #fff;
    border-radius: var(--radius-md);
    border: 1px solid #f3e4b7;
    display: none;
}

/* FAQ Accordion */
.faq-wrap {
    margin: 36px 0;
}

.faq-title {
    font-size: 1.45rem;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 16px;
}

.faq-item {
    background: #fff;
    border: 1px solid #e2e8f5;
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    overflow: hidden;
}

.faq-item summary {
    padding: 16px 20px;
    font-weight: 700;
    color: #1e293b;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: '+';
    font-size: 1.3rem;
    color: var(--primary);
    font-weight: 700;
}

.faq-item[open] summary::after {
    content: '−';
}

.faq-content {
    padding: 0 20px 18px;
    color: #475569;
    font-size: 0.94rem;
    line-height: 1.6;
}

/* Footer */
.sanctuary-footer {
    margin-top: 60px;
    padding: 36px 20px 48px;
    background: rgba(255, 255, 255, 0.7);
    border-top: 1px solid #e2e8f0;
    text-align: center;
    position: relative;
    z-index: 10;
}

.footer-credits {
    max-width: 800px;
    margin: 0 auto 20px;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    font-size: 0.88rem;
    color: #64748b;
}

.footer-credit-pill {
    background: #fff;
    border: 1px solid #e2e8f0;
    padding: 8px 16px;
    border-radius: 999px;
    font-weight: 600;
}

.footer-copy {
    font-size: 0.82rem;
    color: #94a3b8;
}

/* --- Responsive Breakpoints --- */
@media (max-width: 900px) {
    .sanctuary-grid-2 { grid-template-columns: 1fr; }
    .results-grid { grid-template-columns: 1fr; }
    .bridges-grid { grid-template-columns: 1fr; }
}

@media (max-width: 650px) {
    .sanctuary-nav-inner { flex-direction: column; align-items: stretch; }
    .sanctuary-nav-links { justify-content: center; }
    .sanctuary-atmosphere-controls { justify-content: center; }
    .nature-stage-card { height: 280px; }
    .nature-stage-overlay { padding: 18px; }
    .calc-total-big-val { font-size: 2.8rem; }
}

/* Celebration & Perfect Match Animations */
@keyframes goldShimmerGlow {
    0% {
        box-shadow: 0 0 15px rgba(245, 158, 11, 0.4), 0 0 30px rgba(16, 185, 129, 0.2);
        border-color: #f59e0b;
    }
    50% {
        box-shadow: 0 0 35px rgba(245, 158, 11, 0.8), 0 0 50px rgba(16, 185, 129, 0.5);
        border-color: #10b981;
    }
    100% {
        box-shadow: 0 0 15px rgba(245, 158, 11, 0.4), 0 0 30px rgba(16, 185, 129, 0.2);
        border-color: #f59e0b;
    }
}

@keyframes emojiFloatUp {
    0% {
        opacity: 0;
        transform: translate3d(0, 40px, 0) scale(0.4) rotate(0deg);
    }
    20% {
        opacity: 1;
        transform: translate3d(var(--drift-x, 0px), -40px, 0) scale(1.3) rotate(var(--rot, 15deg));
    }
    80% {
        opacity: 0.9;
        transform: translate3d(var(--drift-x, 0px), -180px, 0) scale(1.1) rotate(var(--rot, 30deg));
    }
    100% {
        opacity: 0;
        transform: translate3d(var(--drift-x, 0px), -260px, 0) scale(0.6) rotate(var(--rot, 45deg));
    }
}

.celebration-emoji-particle {
    position: fixed;
    pointer-events: none;
    z-index: 99999;
    font-size: 2rem;
    will-change: transform, opacity;
    animation: emojiFloatUp 2.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.celebration-glow {
    animation: goldShimmerGlow 2.5s infinite ease-in-out !important;
}

.celebration-exclamation-toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    background: linear-gradient(135deg, #064e3b 0%, #047857 50%, #065f46 100%);
    color: #ffffff;
    border: 2px solid #fbbf24;
    border-radius: 20px;
    padding: 16px 28px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35), 0 0 30px rgba(245, 158, 11, 0.5);
    z-index: 99998;
    text-align: center;
    max-width: 90vw;
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.celebration-exclamation-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) scale(1);
    pointer-events: auto;
}

/* Quick View Button on Cards */
.personal-quickview-btn {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 50%, #0369a1 100%) !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 6px 14px !important;
    font-size: 0.8rem !important;
    cursor: pointer !important;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3) !important;
    transition: all 0.25s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
}

.personal-quickview-btn:hover {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
    box-shadow: 0 6px 18px rgba(14, 165, 233, 0.45) !important;
    transform: translateY(-1.5px) !important;
}

/* Quick View Modal Dialog */
.quick-view-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 15, 30, 0.8);
    display: none;
    z-index: 100000;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    overflow-y: auto;
    padding: 24px 16px;
    box-sizing: border-box;
}

.quick-view-modal.is-open {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.quick-view-content {
    background: #ffffff;
    border-radius: 20px;
    padding: 28px;
    max-width: 960px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.45), 0 0 40px rgba(99, 102, 241, 0.2);
    position: relative;
    border: 1.5px solid #e2e8f0;
    animation: quickViewPop 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes quickViewPop {
    0% { opacity: 0; transform: scale(0.92) translateY(20px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

.quick-view-close {
    position: absolute;
    top: 16px;
    right: 18px;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.quick-view-close:hover {
    background: #ef4444;
    color: #ffffff;
    border-color: #ef4444;
    transform: rotate(90deg) scale(1.08);
}

.quick-words-container .word-block {
    animation-fill-mode: both !important;
}

@keyframes grandTotalReveal {
    0% {
        opacity: 0;
        transform: translateY(35px) scale(0.92);
    }
    60% {
        opacity: 1;
        transform: translateY(-4px) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.quick-view-total-card.anim-reveal {
    animation: grandTotalReveal 0.65s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

/* ==========================================================================
   Interactive Animated Word Cards (Main Calculator Flight Mode in Sanctuary)
   ========================================================================== */

@keyframes spiralAppear {
    0% {
        opacity: 0;
        transform: scale(0) rotate(180deg) translateX(220px) translateY(220px);
        filter: blur(8px);
    }
    50% {
        opacity: 0.85;
        transform: scale(1.12) rotate(90deg) translateX(40px) translateY(40px);
        filter: blur(1px);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg) translateX(0) translateY(0);
        filter: blur(0px);
    }
}

@keyframes bounceAppear {
    0% {
        opacity: 0;
        transform: translateY(-120px) scale(0.3) rotate(-12deg);
    }
    50% {
        opacity: 0.9;
        transform: translateY(24px) scale(1.12) rotate(6deg);
    }
    70% {
        transform: translateY(-12px) scale(0.96) rotate(-2deg);
    }
    85% {
        transform: translateY(6px) scale(1.02) rotate(1deg);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(0deg);
    }
}

@keyframes zoomAppear {
    0% {
        opacity: 0;
        transform: scale(0) rotateZ(180deg);
        filter: brightness(2) blur(10px);
    }
    30% {
        opacity: 0.6;
        transform: scale(0.35) rotateZ(90deg);
        filter: brightness(1.5) blur(5px);
    }
    60% {
        opacity: 0.95;
        transform: scale(1.15) rotateZ(-8deg);
        filter: brightness(1.2) blur(1px);
    }
    80% {
        transform: scale(0.96) rotateZ(3deg);
        filter: brightness(1.05) blur(0px);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotateZ(0deg);
        filter: brightness(1) blur(0px);
    }
}

@keyframes waveAppear {
    0% {
        opacity: 0;
        transform: translateY(60px) skewX(18deg) rotateZ(-6deg);
    }
    25% {
        opacity: 0.45;
        transform: translateY(22px) skewX(-12deg) rotateZ(4deg);
    }
    50% {
        opacity: 0.75;
        transform: translateY(-12px) skewX(9deg) rotateZ(-3deg);
    }
    75% {
        opacity: 0.92;
        transform: translateY(6px) skewX(-4deg) rotateZ(1deg);
    }
    100% {
        opacity: 1;
        transform: translateY(0) skewX(0deg) rotateZ(0deg);
    }
}

@keyframes flipAppear {
    0% {
        opacity: 0;
        transform: perspective(600px) rotateX(90deg) scale(0.75) translateZ(-100px);
    }
    40% {
        opacity: 0.75;
        transform: perspective(600px) rotateX(-18deg) scale(1.1) translateZ(25px);
    }
    70% {
        transform: perspective(600px) rotateX(10deg) scale(0.96) translateZ(-10px);
    }
    100% {
        opacity: 1;
        transform: perspective(600px) rotateX(0deg) scale(1) translateZ(0px);
    }
}

@keyframes fadeAppear {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(24px);
        filter: blur(6px);
    }
    60% {
        opacity: 0.85;
        transform: scale(1.06) translateY(-6px);
        filter: blur(1px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
        filter: blur(0px);
    }
}

@keyframes pulseAppear {
    0% {
        opacity: 0;
        transform: scale(0);
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.7);
    }
    40% {
        opacity: 0.7;
        transform: scale(0.85);
        box-shadow: 0 0 0 30px rgba(99, 102, 241, 0.35);
    }
    70% {
        opacity: 0.95;
        transform: scale(1.1);
        box-shadow: 0 0 0 50px rgba(78, 205, 196, 0.2);
    }
    100% {
        opacity: 1;
        transform: scale(1);
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    }
}

/* Explicit Animation Selectors for Modal Word Blocks */
.quick-words-container .word-block,
.personal-calc-dialog .word-block {
    display: inline-flex !important;
    flex-direction: column !important;
    vertical-align: top !important;
    margin: 6px !important;
    animation-fill-mode: both !important;
    will-change: transform, opacity !important;
}

.quick-words-container .word-block.anim-spiral,
.personal-calc-dialog .word-block.anim-spiral {
    animation-name: spiralAppear !important;
    animation-duration: 0.85s !important;
    animation-timing-function: ease-out !important;
    animation-fill-mode: both !important;
}

.quick-words-container .word-block.anim-bounce,
.personal-calc-dialog .word-block.anim-bounce {
    animation-name: bounceAppear !important;
    animation-duration: 0.85s !important;
    animation-timing-function: cubic-bezier(0.68, -0.55, 0.265, 1.55) !important;
    animation-fill-mode: both !important;
}

.quick-words-container .word-block.anim-fade,
.personal-calc-dialog .word-block.anim-fade {
    animation-name: fadeAppear !important;
    animation-duration: 0.75s !important;
    animation-timing-function: ease-out !important;
    animation-fill-mode: both !important;
}

.quick-words-container .word-block.anim-flip,
.personal-calc-dialog .word-block.anim-flip {
    animation-name: flipAppear !important;
    animation-duration: 0.85s !important;
    animation-timing-function: ease-out !important;
    animation-fill-mode: both !important;
}

.quick-words-container .word-block.anim-zoom,
.personal-calc-dialog .word-block.anim-zoom {
    animation-name: zoomAppear !important;
    animation-duration: 0.9s !important;
    animation-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
    animation-fill-mode: both !important;
}

.quick-words-container .word-block.anim-wave,
.personal-calc-dialog .word-block.anim-wave {
    animation-name: waveAppear !important;
    animation-duration: 0.95s !important;
    animation-timing-function: ease-in-out !important;
    animation-fill-mode: both !important;
}

.quick-words-container .word-block.anim-pulse,
.personal-calc-dialog .word-block.anim-pulse {
    animation-name: pulseAppear !important;
    animation-duration: 1.1s !important;
    animation-timing-function: ease-out !important;
    animation-fill-mode: both !important;
}

/* Word block breakdown row and cell styling for modal */
.quick-words-container .breakdown-table {
    display: table;
    margin: 6px auto 0;
    border-collapse: separate;
    border-spacing: 3px;
}

.quick-words-container .breakdown-row {
    display: table-row;
}

.quick-words-container .breakdown-char-cell,
.quick-words-container .breakdown-value-cell {
    display: table-cell;
    padding: 3px 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
    border-radius: 4px;
}

.quick-words-container .breakdown-char-cell {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    font-family: inherit;
}

.quick-words-container .breakdown-value-cell {
    background: rgba(0, 0, 0, 0.22);
    color: #fef08a;
    font-size: 0.72rem;
}

/* Quick View Static Mode (No Animation) */
.personal-calc-content.static-mode .word-block {
    animation: none !important;
    transform: none !important;
    opacity: 1 !important;
    animation-delay: 0s !important;
}

.personal-calc-content.static-mode .quick-view-total-card {
    display: block !important;
    opacity: 1 !important;
    animation: none !important;
    transform: none !important;
}

/* --- Mystery Hourglass Animation --- */
@keyframes mysteryHourglassFlip {
    0% {
        transform: rotate(0deg) scale(1);
        filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.4));
    }
    45% {
        transform: rotate(180deg) scale(1.12);
        filter: drop-shadow(0 0 16px rgba(16, 185, 129, 0.75));
    }
    50% {
        transform: rotate(180deg) scale(1.05);
    }
    95% {
        transform: rotate(360deg) scale(1.12);
        filter: drop-shadow(0 0 16px rgba(16, 185, 129, 0.75));
    }
    100% {
        transform: rotate(360deg) scale(1);
        filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.4));
    }
}

.mystery-hourglass {
    display: inline-block;
    animation: mysteryHourglassFlip 2.2s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
    transform-origin: center center;
    user-select: none;
}

.mystery-hourglass-spin {
    display: inline-block;
    animation: mysteryHourglassFlip 1.8s ease-in-out infinite;
    transform-origin: center center;
    user-select: none;
}

.mystery-hourglass-card {
    text-align: center;
    padding: 38px 20px;
    background: linear-gradient(180deg, #ffffff 0%, #ecfdf5 100%);
    border: 2px dashed #6ee7b7;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.09);
    margin: 14px 0;
}




