/* ================== CSS VARIABLES & THEMES ================== */
:root {
    --sat: env(safe-area-inset-top, 0px);
    --sab: env(safe-area-inset-bottom, 0px);
    --sal: env(safe-area-inset-left, 0px);
    --sar: env(safe-area-inset-right, 0px);
    --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans Malayalam', 'Malayalam Sangam MN', 'Nirmala UI', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --transition-snappy: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-smooth: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    --card-radius: 2.2rem;
    --bento-radius: 2rem;
    --focus-ring: #38bdf8;
}

/* ---------------- DARK MODE (Screenshots 1 & 2) ---------------- */
:root[data-theme="dark"] {
    --bg-app: #06080f;
    --bg-header: rgba(6, 8, 15, 0.82);
    --brand-badge-bg: #ffffff;
    --brand-badge-color: #06080f;
    --brand-title-color: #ffffff;
    
    --btn-bg: rgba(255, 255, 255, 0.05);
    --btn-border: rgba(255, 255, 255, 0.1);
    --btn-text: #94a3b8;
    --btn-hover-bg: rgba(255, 255, 255, 0.12);
    --btn-hover-text: #ffffff;
    
    --bento-toggle-bg: #1e293b;
    --bento-toggle-border: rgba(255, 255, 255, 0.08);
    --bento-tab-active-bg: #334155;
    --bento-tab-active-text: #ffffff;
    --bento-tab-inactive-text: #94a3b8;

    --bg-card-front: #000000;
    --bg-card-back: #0f172a;
    --border-card: rgba(255, 255, 255, 0.08);
    --border-subtle: rgba(255, 255, 255, 0.06);
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --text-muted: #8ca3ba; /* WCAG 2.1 AA Compliant (4.8:1 contrast on dark backdrops) */

    --pill-bg: rgba(255, 255, 255, 0.08);
    --pill-text: #e2e8f0;
    --pill-border: rgba(255, 255, 255, 0.12);

    --shadow-card: 0 25px 60px -15px rgba(0, 0, 0, 0.9);
    --shadow-floating: 0 20px 40px -10px rgba(0, 0, 0, 0.5);

    /* Bento Card Backgrounds */
    --bento-img-bg: #000000;
    --bento-words-bg: #111827;
    --bento-card-border: rgba(255, 255, 255, 0.06);

    /* Fan stack background colors */
    --fan-l1: #0e1522;
    --fan-l2: #162032;
    --fan-r1: #0a0f18;
    --fan-r2: #141c2c;
    --fan-r3: #1a253a;

    --modal-bg: #0c1017;
    --modal-border: rgba(255, 255, 255, 0.1);
    --modal-shadow: 0 25px 50px rgba(0, 0, 0, 0.8);
    --cal-active-bg: #ffffff;
    --cal-active-color: #000000;
    --focus-ring: #38bdf8;
}

/* ---------------- LIGHT MODE (Screenshot 3) ---------------- */
:root[data-theme="light"] {
    --bg-app: #f8fafc;
    --bg-header: rgba(248, 250, 252, 0.85);
    --brand-badge-bg: #0f172a;
    --brand-badge-color: #ffffff;
    --brand-title-color: #0f172a;
    
    --btn-bg: #ffffff;
    --btn-border: rgba(0, 0, 0, 0.08);
    --btn-text: #64748b;
    --btn-hover-bg: #f1f5f9;
    --btn-hover-text: #0f172a;
    
    --bento-toggle-bg: #f1f5f9;
    --bento-toggle-border: rgba(0, 0, 0, 0.06);
    --bento-tab-active-bg: #ffffff;
    --bento-tab-active-text: #0f172a;
    --bento-tab-inactive-text: #94a3b8;

    --bg-card-front: #ffffff;
    --bg-card-back: #ffffff;
    --border-card: rgba(0, 0, 0, 0.08);
    --border-subtle: rgba(0, 0, 0, 0.06);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;

    --pill-bg: #e2e8f0;
    --pill-text: #334155;
    --pill-border: rgba(0, 0, 0, 0.06);

    --shadow-card: 0 20px 45px -10px rgba(0, 0, 0, 0.15);
    --shadow-floating: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.05);

    /* Bento Card Backgrounds */
    --bento-img-bg: #ffffff;
    --bento-words-bg: #ffffff;
    --bento-card-border: rgba(0, 0, 0, 0.05);

    /* Fan stack background colors */
    --fan-l1: #cbd5e1;
    --fan-l2: #94a3b8;
    --fan-r1: #e2e8f0;
    --fan-r2: #cbd5e1;
    --fan-r3: #94a3b8;

    --modal-bg: #ffffff;
    --modal-border: rgba(0, 0, 0, 0.08);
    --modal-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
    --cal-active-bg: #0f172a;
    --cal-active-color: #ffffff;
    --focus-ring: #0284c7;
}

/* ================== GLOBAL RESET & ACCESSIBILITY ================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: fixed;
    top: -120px;
    left: 1.25rem;
    background: var(--brand-badge-bg);
    color: var(--brand-badge-color);
    padding: 0.75rem 1.25rem;
    border-radius: 0.75rem;
    font-weight: 700;
    font-size: 0.875rem;
    z-index: 9999;
    text-decoration: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    transition: top var(--transition-snappy);
}

.skip-link:focus,
.skip-link:focus-visible {
    top: 1.25rem;
    outline: 3px solid var(--focus-ring);
    outline-offset: 3px;
}

/* WCAG 2.4.7 / 2.4.11 / 2.4.12 Keyboard Focus Visible Rings */
:focus-visible {
    outline: 2px solid var(--focus-ring) !important;
    outline-offset: 3px !important;
}

:focus:not(:focus-visible) {
    outline: none;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-app);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: stretch;
    overflow-x: hidden;
    transition: background-color var(--transition-smooth), color var(--transition-smooth);
    -webkit-font-smoothing: antialiased;
}

.app-layout {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    padding: calc(5.25rem + var(--sat)) max(1.25rem, var(--sal)) calc(4.75rem + var(--sab)) max(1.25rem, var(--sar));
}

@media (min-width: 640px) {
    .app-layout {
        padding: calc(5.75rem + var(--sat)) 2.5rem calc(5rem + var(--sab));
    }
}

/* ================== TOP NAVIGATION ================== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: calc(4.5rem + var(--sat));
    padding-top: var(--sat);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-left: max(1.25rem, var(--sal));
    padding-right: max(1.25rem, var(--sar));
    background: var(--bg-header);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 50;
    transition: background var(--transition-smooth);
}

@media (min-width: 640px) {
    .navbar {
        height: calc(5rem + var(--sat));
        padding-left: 2.5rem;
        padding-right: 2.5rem;
    }
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    user-select: none;
    text-decoration: none;
    cursor: default;
}

.brand-logo-container {
    width: 26px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform var(--transition-snappy);
}

.brand:hover .brand-logo-container {
    transform: scale(1.1) rotate(-3deg);
}

.brand-logo {
    height: 38px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.2));
}

[data-theme="dark"] .brand-logo.logo-light {
    display: none !important;
}

[data-theme="dark"] .brand-logo.logo-dark {
    display: block !important;
}

[data-theme="light"] .brand-logo.logo-dark {
    display: none !important;
}

[data-theme="light"] .brand-logo.logo-light {
    display: block !important;
}

.brand-badge {
    width: 38px;
    height: 38px;
    background: var(--brand-badge-bg);
    color: var(--brand-badge-color);
    border-radius: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 15px;
    letter-spacing: -0.04em;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: background var(--transition-smooth), color var(--transition-smooth);
}

.brand-title {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--brand-title-color);
    transition: color var(--transition-smooth);
}

@media (min-width: 640px) {
    .brand-title {
        font-size: 1.5rem;
    }
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

@media (min-width: 640px) {
    .nav-actions {
        gap: 0.75rem;
    }
}

/* Header Bento Pill Switcher [IMAGES | WORDS] */
.bento-header-toggle {
    display: flex;
    align-items: center;
    background: var(--bento-toggle-bg);
    border: 1px solid var(--bento-toggle-border);
    border-radius: 9999px;
    padding: 3px;
    transition: background var(--transition-smooth);
}

.bento-tab {
    padding: 5px 12px;
    border-radius: 9999px;
    border: none;
    background: transparent;
    color: var(--bento-tab-inactive-text);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all var(--transition-snappy);
    font-family: var(--font-sans);
}

@media (min-width: 640px) {
    .bento-tab {
        padding: 6px 14px;
        font-size: 11px;
    }
}

.bento-tab.active {
    background: var(--bento-tab-active-bg);
    color: var(--bento-tab-active-text);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

/* Nav Action Buttons */
.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--btn-bg);
    border: 1px solid var(--btn-border);
    color: var(--btn-text);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-snappy);
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* WCAG 2.5.5 / 2.5.8 Minimum Touch Target hit area expansion (44x44px) */
.icon-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: 44px;
    min-height: 44px;
    width: 100%;
    height: 100%;
}

@media (min-width: 640px) {
    .icon-btn {
        width: 42px;
        height: 42px;
    }
}

.icon-btn:hover {
    color: var(--btn-hover-text);
    background: var(--btn-hover-bg);
    transform: scale(1.05);
}

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

.check-emerald {
    color: #10b981;
}

/* ================== MAIN CONTENT ================== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
}

/* Subheader (Single view only) */
.date-header-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2rem;
    text-align: center;
    animation: fadeIn 0.4s ease-out;
}

.bento-active .date-header-group {
    display: none !important;
}

.pill-badge {
    background: var(--pill-bg);
    color: var(--pill-text);
    border: 1px solid var(--pill-border);
    padding: 6px 14px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
}

.formatted-date {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

@media (min-width: 640px) {
    .formatted-date {
        font-size: 2rem;
    }
}

/* ================== SINGLE CARD STAGE ================== */
.view-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.card-stage {
    position: relative;
    width: 100%;
    max-width: 420px;
    aspect-ratio: 3 / 4;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: pan-y;
}

/* Stacked Background Depth Effect */
.card-stack-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    z-index: 1;
}

.fan-card {
    position: absolute;
    inset: 0;
    border-radius: var(--card-radius);
    transition: all var(--transition-smooth);
}

.fan-l2 {
    background: var(--fan-l2);
    transform: rotate(-3.5deg) scale(0.96) translate(-8px, -4px);
    opacity: 0.8;
}

.fan-l1 {
    background: var(--fan-l1);
    transform: rotate(-1.8deg) scale(0.98) translate(-4px, -2px);
    opacity: 0.9;
}

.fan-r1 {
    background: var(--fan-r1);
    transform: rotate(1.8deg) scale(0.98) translate(4px, -2px);
    opacity: 0.9;
}

.fan-r2 {
    background: var(--fan-r2);
    transform: rotate(3.5deg) scale(0.96) translate(8px, -4px);
    opacity: 0.8;
}

.fan-r3 {
    background: var(--fan-r3);
    transform: rotate(5deg) scale(0.94) translate(12px, -6px);
    opacity: 0.7;
}

/* Active 3D Card */
.active-card-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    perspective: 2000px;
    cursor: pointer;
    z-index: 10;
    transition: transform var(--transition-snappy);
    touch-action: pan-y;
    will-change: transform;
}

.active-card-wrapper.dragging {
    transition: none !important;
    cursor: grabbing;
}

.active-card-wrapper.slide-out-left {
    transform: translateX(-120%) rotate(-6deg) !important;
    opacity: 0 !important;
    transition: transform 0.28s cubic-bezier(0.4, 0, 1, 1), opacity 0.24s ease !important;
}

.active-card-wrapper.slide-out-right {
    transform: translateX(120%) rotate(6deg) !important;
    opacity: 0 !important;
    transition: transform 0.28s cubic-bezier(0.4, 0, 1, 1), opacity 0.24s ease !important;
}

.active-card-wrapper.slide-in-right {
    animation: cardSlideInRight 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.active-card-wrapper.slide-in-left {
    animation: cardSlideInLeft 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes cardSlideInRight {
    from {
        transform: translateX(90px) rotate(4deg);
        opacity: 0.2;
    }
    to {
        transform: translateX(0) rotate(0deg);
        opacity: 1;
    }
}

@keyframes cardSlideInLeft {
    from {
        transform: translateX(-90px) rotate(-4deg);
        opacity: 0.2;
    }
    to {
        transform: translateX(0) rotate(0deg);
        opacity: 1;
    }
}

.active-card-wrapper:hover {
    transform: scale(1.015);
}

.card-3d-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
    transition: transform 0.65s cubic-bezier(0.23, 1, 0.32, 1);
    border-radius: var(--card-radius);
    box-shadow: var(--shadow-card);
}

.active-card-wrapper.flipped .card-3d-inner {
    transform: rotateY(180deg);
    -webkit-transform: rotateY(180deg);
}

.card-side {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: var(--card-radius);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
    border: 1px solid var(--border-card);
}

/* FRONT FACE */
.card-front {
    background: var(--bg-card-front);
    display: flex;
    align-items: center;
    justify-content: center;
    transform: rotateY(0deg) translateZ(1px);
    -webkit-transform: rotateY(0deg) translateZ(1px);
    pointer-events: auto;
    user-select: none;
    -webkit-user-select: none;
}

.image-frame {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card-front);
    transition: background var(--transition-smooth);
}

.graphic-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.5s ease;
}

.active-card-wrapper:hover .graphic-img {
    transform: scale(1.05);
}

/* Front Quick Share Button */
.card-front-share-btn {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(0, 0, 0, 0.65);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 9999px;
    padding: 6px 14px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: all var(--transition-snappy);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.card-front-share-btn:hover {
    background: rgba(0, 0, 0, 0.85);
    transform: scale(1.06);
}

/* Reveal Meaning Overlay */
.card-front-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.2) 35%, transparent 60%);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 2.5rem;
    opacity: 0;
    transition: opacity var(--transition-snappy);
    pointer-events: auto;
    cursor: pointer;
}

.active-card-wrapper:hover .card-front-overlay {
    opacity: 1;
}

@media (max-width: 768px), (hover: none) {
    .card-front-overlay {
        opacity: 1;
        background: linear-gradient(to top, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0.15) 30%, transparent 55%);
        padding-bottom: 1.75rem;
    }
}

.reveal-pill {
    background: rgba(0, 0, 0, 0.65);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 9999px;
    padding: 8px 18px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    backdrop-filter: blur(10px);
    cursor: pointer;
    user-select: none;
    transition: transform var(--transition-snappy), background var(--transition-snappy);
}

.reveal-pill:hover {
    transform: scale(1.05);
    background: rgba(0, 0, 0, 0.85);
}

/* BACK FACE - COPY FRIENDLY & SELECTABLE */
.card-back {
    background: var(--bg-card-back);
    transform: rotateY(180deg) translateZ(1px);
    -webkit-transform: rotateY(180deg) translateZ(1px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2.25rem 2rem;
    transition: background var(--transition-smooth);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    cursor: default;
    user-select: text;
    -webkit-user-select: text;
}

.back-content,
.back-word-title,
.back-phonetic,
.back-section,
.back-definition,
.back-example,
.trans-result-display,
.trans-text,
.back-pos-tag,
.section-label {
    user-select: text;
    -webkit-user-select: text;
    cursor: text;
}

/* Beautiful, high-contrast text selection highlight */
.card-back ::selection {
    background: rgba(99, 102, 241, 0.35);
    color: inherit;
}

[data-theme="dark"] .card-back ::selection {
    background: rgba(255, 255, 255, 0.28);
    color: #ffffff;
}

[data-theme="light"] .card-back ::selection {
    background: rgba(15, 23, 42, 0.18);
    color: #0f172a;
}

/* FLIPPED STATE INTERACTION */
.active-card-wrapper.flipped .card-front {
    pointer-events: none;
}

.active-card-wrapper.flipped .card-back {
    pointer-events: auto;
}

.active-card-wrapper:not(.flipped) .card-back {
    pointer-events: none;
}

.card-back::-webkit-scrollbar {
    display: none;
}

@media (min-width: 640px) {
    .card-back {
        padding: 2.5rem 2.25rem;
    }
}

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

.back-pos-tag {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.back-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.back-icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--btn-bg);
    border: 1px solid var(--btn-border);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-snappy);
}

.back-icon-btn:hover {
    color: var(--text-primary);
    background: var(--btn-hover-bg);
    transform: scale(1.1);
}

.back-content {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin: 1.25rem 0;
}

.back-word-title {
    font-size: 2.6rem;
    font-weight: 900;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    line-height: 1.05;
}

.back-phonetic {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-style: italic;
    font-family: var(--font-mono);
}

.back-section {
    margin-top: 0.4rem;
}

.section-label {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    display: block;
}

.back-definition {
    font-size: 1.12rem;
    line-height: 1.5;
    color: var(--text-primary);
    font-weight: 500;
}

.back-example {
    font-size: 0.95rem;
    font-style: italic;
    color: var(--text-secondary);
    line-height: 1.5;
    padding-left: 0.6rem;
    border-left: 2px solid var(--border-card);
}

/* ================== SEARCHABLE TRANSLATION DROPDOWN ================== */
.back-translation-row {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-subtle);
    position: relative;
}

.trans-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.trans-header .section-label {
    margin-bottom: 0;
}

.lang-dropdown-wrapper {
    position: relative;
    display: inline-block;
}

.lang-dropdown-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--btn-bg);
    border: 1px solid var(--btn-border);
    border-radius: 9999px;
    padding: 4px 10px;
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-snappy);
    letter-spacing: 0.03em;
}

.lang-dropdown-trigger:hover {
    background: var(--btn-hover-bg);
    border-color: var(--border-card);
    transform: translateY(-1px);
}

.lang-dropdown-trigger.open {
    border-color: var(--text-primary);
}

.dropdown-chevron-icon {
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.lang-dropdown-trigger.open .dropdown-chevron-icon {
    transform: rotate(180deg);
}

.lang-dropdown-menu {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    width: 250px;
    max-height: 230px;
    background: var(--modal-bg);
    border: 1px solid var(--modal-border);
    border-radius: 14px;
    box-shadow: var(--modal-shadow);
    z-index: 999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    animation: dropdownPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dropdownPop {
    from {
        opacity: 0;
        transform: translateY(6px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.lang-search-box {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--btn-bg);
    flex-shrink: 0;
}

.lang-search-icon {
    color: var(--text-muted);
    flex-shrink: 0;
}

.lang-search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-size: 11px;
    color: var(--text-primary);
    font-family: var(--font-sans);
}

.lang-search-input::placeholder {
    color: var(--text-muted);
    opacity: 0.8;
}

.clear-search-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.clear-search-btn:hover {
    color: var(--text-primary);
}

.lang-options-list {
    flex: 1;
    overflow-y: auto;
    max-height: 180px;
    padding: 4px;
    scrollbar-width: thin;
    scrollbar-color: var(--btn-border) transparent;
}

.lang-options-list::-webkit-scrollbar {
    width: 4px;
}

.lang-options-list::-webkit-scrollbar-thumb {
    background: var(--btn-border);
    border-radius: 4px;
}

.lang-option-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 11px;
    color: var(--text-secondary);
    transition: background 0.15s ease, color 0.15s ease;
    user-select: none;
}

.lang-option-item:hover,
.lang-option-item.focused {
    background: var(--btn-hover-bg);
    color: var(--text-primary);
}

.lang-option-item.selected {
    background: var(--btn-hover-bg);
    color: var(--text-primary);
    font-weight: 700;
}

.lang-option-left {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.lang-name-en {
    font-weight: 600;
    color: var(--text-primary);
}

.lang-name-native {
    font-size: 10px;
    color: var(--text-muted);
}

.lang-pill-badge {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--pill-bg);
    color: var(--text-muted);
    border: 1px solid var(--pill-border);
    margin-left: 3px;
    flex-shrink: 0;
}

.lang-check-icon {
    color: var(--text-primary);
    flex-shrink: 0;
}

.no-lang-found {
    padding: 14px 10px;
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
}

/* Instant Translation Result Presentation */
.trans-result-display {
    margin-top: 0.35rem;
    min-height: 1.6rem;
    display: flex;
    align-items: center;
}

.trans-text {
    font-size: 1.22rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    line-height: 1.25;
    animation: fadeInTrans 0.2s ease-out;
}

@keyframes fadeInTrans {
    from {
        opacity: 0.4;
        transform: translateY(2px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.back-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border-subtle);
}

.back-date-text {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.back-flip-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.38rem;
    background: var(--btn-bg);
    color: var(--text-primary);
    border: 1px solid var(--btn-border);
    border-radius: 9999px;
    padding: 5px 13px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: all var(--transition-snappy);
    user-select: none;
}

.back-flip-btn:hover {
    background: var(--btn-hover-bg);
    border-color: var(--btn-hover-border);
    transform: scale(1.05);
}

.back-flip-btn svg {
    transition: transform var(--transition-snappy);
}

.back-flip-btn:hover svg {
    transform: rotate(-45deg);
}

.footer-dots {
    display: flex;
    gap: 4px;
}

.footer-dots .dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--text-muted);
    opacity: 0.6;
}

/* Navigation Arrow Buttons */
.stage-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--btn-bg);
    border: 1px solid var(--btn-border);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 30;
    transition: all var(--transition-snappy);
    backdrop-filter: blur(8px);
}

.prev-btn {
    left: -70px;
}

.next-btn {
    right: -70px;
}

@media (max-width: 600px) {
    .stage-nav-btn {
        display: none;
    }
}

.stage-nav-btn:hover {
    color: var(--text-primary);
    background: var(--btn-hover-bg);
    transform: translateY(-50%) scale(1.1);
}

/* ================== BENTO GRID VIEW ================== */
/* Exact replica of Screenshots 1, 2, and 3 */
.bento-grid-wrapper {
    width: 100%;
    max-width: 1040px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    padding: 0.5rem 0 2rem;
    animation: fadeIn 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

@media (max-width: 820px) {
    .bento-grid-wrapper {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

/* Bento Card Item */
.bento-item {
    position: relative;
    border-radius: var(--bento-radius);
    aspect-ratio: 1 / 1;
    overflow: hidden;
    cursor: pointer;
    user-select: none;
    transition: transform 0.35s cubic-bezier(0.23, 1, 0.32, 1), box-shadow 0.35s cubic-bezier(0.23, 1, 0.32, 1);
}

/* Hero Item: 2x2 Grid (Sep 26 in screenshots) */
.bento-item.is-hero {
    grid-column: span 2;
    grid-row: span 2;
}

.bento-item:hover {
    transform: scale(1.025);
}

.bento-item:active {
    transform: scale(0.985);
}

/* Bento Item Inner Card */
.bento-card-inner {
    width: 100%;
    height: 100%;
    position: relative;
    border-radius: var(--bento-radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: background-color var(--transition-smooth), border-color var(--transition-smooth);
}

/* Dark Mode - Images View (Screenshot 1) */
[data-theme="dark"] .bento-item.mode-image .bento-card-inner {
    background: var(--bento-img-bg);
    border: 1px solid var(--bento-card-border);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

/* Dark Mode - Words View (Screenshot 2) */
[data-theme="dark"] .bento-item.mode-word .bento-card-inner {
    background: var(--bento-words-bg);
    border: 1px solid var(--bento-card-border);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

/* Light Mode - Words View (Screenshot 3) */
[data-theme="light"] .bento-item.mode-word .bento-card-inner {
    background: var(--bento-words-bg);
    border: 1px solid var(--bento-card-border);
    box-shadow: var(--shadow-floating);
}

/* Light Mode - Images View (White background with black line art) */
[data-theme="light"] .bento-item.mode-image .bento-card-inner {
    background: var(--bento-img-bg);
    border: 1px solid rgba(0, 0, 0, 0.04);
    box-shadow: var(--shadow-floating);
}

/* Bento Top Left Share Button */
.bento-share-btn {
    position: absolute;
    top: 0.85rem;
    left: 0.85rem;
    z-index: 20;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: all var(--transition-snappy);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.bento-item.is-hero .bento-share-btn {
    top: 1.25rem;
    left: 1.25rem;
    width: 36px;
    height: 36px;
}

.bento-share-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

/* Bento Top Right Date Badge (e.g. • SEP 26) */
.bento-date-badge {
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(0, 0, 0, 0.85);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 9999px;
    padding: 3px 9px;
    font-size: 9.5px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    user-select: none;
}

.bento-item.is-hero .bento-date-badge {
    top: 1.25rem;
    right: 1.25rem;
    padding: 5px 12px;
    font-size: 11.5px;
}

.bento-date-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #ffffff;
    opacity: 0.85;
}

/* Bento Image Graphic */
.bento-img-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.2rem;
}

.bento-item.is-hero .bento-img-container {
    padding: 2.5rem;
}

.bento-graphic-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.4s ease;
}

.bento-item:hover .bento-graphic-img {
    transform: scale(1.06);
}

/* Bento Word Content (Screenshots 2 & 3) */
.bento-word-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    text-align: center;
}

.bento-pos-text {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 0.35rem;
}

.bento-item.is-hero .bento-pos-text {
    font-size: 11px;
    margin-bottom: 0.5rem;
}

.bento-title-text {
    font-weight: 900;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 0.35rem;
}

/* Typography sizing */
.bento-item.is-hero .bento-title-text {
    font-size: 2.85rem;
}

.bento-item:not(.is-hero) .bento-title-text {
    font-size: 1.45rem;
}

[data-theme="dark"] .bento-title-text {
    color: #ffffff;
}

[data-theme="light"] .bento-title-text {
    color: #0f172a;
}

.bento-phonetic-text {
    font-family: var(--font-mono);
    font-style: italic;
    color: #64748b;
    font-size: 10px;
}

.bento-item.is-hero .bento-phonetic-text {
    font-size: 14px;
}

/* Tap to Flip Overlay on Bento hover */
.bento-hover-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
    transition: opacity var(--transition-snappy);
    pointer-events: none;
    border-radius: var(--bento-radius);
    z-index: 15;
}

.bento-item:hover .bento-hover-overlay {
    opacity: 1;
}

.bento-flip-tag {
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    background: rgba(0, 0, 0, 0.65);
    padding: 6px 14px;
    border-radius: 9999px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

/* ================== CALENDAR MODAL ================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1.5rem;
    animation: fadeIn 0.2s ease-out;
}

.calendar-card {
    background: var(--modal-bg);
    border: 1px solid var(--modal-border);
    border-radius: 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--modal-shadow);
    overflow: hidden;
    animation: scaleUp 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    transition: background var(--transition-smooth);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 1.75rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary);
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-snappy), background var(--transition-snappy);
}

.close-btn:hover {
    color: var(--text-primary);
}

.calendar-body {
    padding: 1.5rem 1.75rem;
}

.calendar-month-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.cal-month-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-primary);
}

.cal-nav-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--btn-bg);
    border: 1px solid var(--btn-border);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-snappy);
}

.cal-nav-btn:hover {
    color: var(--text-primary);
    background: var(--btn-hover-bg);
}

.cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 11px;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 0.75rem;
}

.cal-days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.cal-day-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    font-size: 13px;
    font-weight: 600;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-snappy);
}

.cal-day-cell:hover:not(:disabled) {
    background: var(--btn-hover-bg);
    color: var(--text-primary);
}

.cal-day-cell.active-selected {
    background: var(--cal-active-bg) !important;
    color: var(--cal-active-color) !important;
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.cal-day-cell.has-word {
    font-weight: 800;
    color: var(--text-primary);
    position: relative;
}

.cal-day-cell.has-word::after {
    content: '';
    position: absolute;
    bottom: 4px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #10b981;
}

.cal-day-cell.other-month {
    opacity: 0.2;
}

.calendar-footer {
    padding: 1rem 1.75rem 1.5rem;
    border-top: 1px solid var(--border-subtle);
}

.cal-today-btn {
    width: 100%;
    padding: 10px;
    border-radius: 0.85rem;
    border: 1px solid var(--btn-border);
    background: var(--btn-bg);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-snappy);
}

.cal-today-btn:hover {
    color: var(--text-primary);
    background: var(--btn-hover-bg);
}

/* ================== TOAST NOTIFICATION ================== */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
    border-radius: 1.25rem;
    padding: 10px 18px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    z-index: 200;
    backdrop-filter: blur(12px);
    max-width: 90vw;
    animation: toastIn 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

[data-theme="light"] .toast {
    background: rgba(15, 23, 42, 0.95);
    color: #ffffff;
}

.toast-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.toast-content {
    display: flex;
    flex-direction: column;
}

.toast-title {
    font-size: 13px;
    font-weight: 700;
}

.toast-subtitle {
    font-size: 11px;
    color: #94a3b8;
    font-family: var(--font-mono);
}

/* ================== FOOTER ================== */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding-top: 0.75rem;
    padding-bottom: max(0.75rem, calc(0.4rem + var(--sab)));
    padding-left: max(1rem, var(--sal));
    padding-right: max(1rem, var(--sar));
    text-align: center;
    background: var(--bg-header);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 40;
    pointer-events: none;
    transition: background var(--transition-smooth);
}

.footer-text {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.04em;
}

/* ================== SHARE MODAL ================== */
.share-card {
    background: var(--modal-bg);
    border: 1px solid var(--modal-border);
    border-radius: 2rem;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--modal-shadow);
    overflow: hidden;
    animation: scaleUp 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    transition: background var(--transition-smooth);
}

.share-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.75rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.share-header-title-group {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.share-header-date {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 2px 8px;
    border-radius: 9999px;
    background: var(--pill-bg);
    color: var(--text-muted);
    border: 1px solid var(--btn-border);
}

.share-preview-banner {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 1.75rem;
    background: var(--pill-bg);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.share-preview-thumb {
    width: 58px;
    height: 58px;
    border-radius: 1rem;
    overflow: hidden;
    background: var(--bg-card-front);
    border: 1px solid var(--border-card);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
}

.share-preview-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.share-preview-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    gap: 2px;
}

.share-preview-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.share-preview-pos {
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    text-transform: uppercase;
}

.share-preview-phonetic {
    font-size: 11px;
    font-family: var(--font-serif);
    color: var(--text-secondary);
    font-style: italic;
}

.share-preview-word {
    font-size: 1.3rem;
    font-weight: 900;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    line-height: 1.15;
}

.share-preview-def {
    font-size: 11.5px;
    color: var(--text-secondary);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.share-preview-malayalam {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 4px;
    background: rgba(255, 122, 0, 0.1);
    border: 1px solid rgba(255, 122, 0, 0.25);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    width: fit-content;
}

.malayalam-flag {
    font-size: 11px;
}

.malayalam-label {
    font-size: 9.5px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
}

.malayalam-val {
    font-size: 11.5px;
    font-weight: 800;
    color: #ff7a00;
    letter-spacing: 0.02em;
}

[data-theme="light"] .malayalam-val {
    color: #d95300;
}

.share-options-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 1.25rem 1.5rem 1.75rem;
    overflow-y: auto;
    flex: 1;
}

.share-options-list::-webkit-scrollbar {
    width: 6px;
}
.share-options-list::-webkit-scrollbar-track {
    background: transparent;
}
.share-options-list::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
    border-radius: 9999px;
}

/* ================== POST & CAPTION STUDIO CARD ================== */
.post-studio-card {
    background: linear-gradient(135deg, rgba(225, 48, 108, 0.08) 0%, rgba(2, 133, 255, 0.06) 50%, rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 1.25rem;
    padding: 1rem 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transition: all var(--transition-smooth);
}

[data-theme="light"] .post-studio-card {
    background: linear-gradient(135deg, rgba(225, 48, 108, 0.05) 0%, rgba(2, 133, 255, 0.04) 50%, rgba(0, 0, 0, 0.02) 100%);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

/* Post & Caption Platform Tabs */
.post-caption-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 2px 2px 4px;
    scrollbar-width: none;
}

.post-caption-tabs::-webkit-scrollbar {
    display: none;
}

.post-tab-btn {
    padding: 5px 11px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 700;
    font-family: var(--font-sans);
    background: var(--btn-bg);
    border: 1px solid var(--btn-border);
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition-snappy);
    white-space: nowrap;
    flex-shrink: 0;
}

.post-tab-btn:hover {
    color: var(--text-primary);
    background: var(--btn-hover-bg);
}

.tab-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dot-instagram { background: #e1306c; }
.dot-bluesky { background: #0285ff; }
.dot-twitter { background: #1da1f2; }
.dot-whatsapp { background: #25d366; }
.dot-full { background: #ff7a00; }

.post-tab-btn.active {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
    background: var(--btn-hover-bg);
}

[data-theme="light"] .post-tab-btn.active {
    border-color: rgba(0, 0, 0, 0.15);
}

.post-tab-btn.active[data-platform="instagram"] {
    border-color: rgba(225, 48, 108, 0.4);
    background: rgba(225, 48, 108, 0.14);
    color: #e1306c;
}

.post-tab-btn.active[data-platform="bluesky"] {
    border-color: rgba(2, 133, 255, 0.4);
    background: rgba(2, 133, 255, 0.14);
    color: #0285ff;
}

.post-tab-btn.active[data-platform="twitter"] {
    border-color: rgba(29, 161, 242, 0.4);
    background: rgba(29, 161, 242, 0.14);
    color: #1da1f2;
}

.post-tab-btn.active[data-platform="whatsapp"] {
    border-color: rgba(37, 211, 102, 0.4);
    background: rgba(37, 211, 102, 0.14);
    color: #25d366;
}

.post-tab-btn.active[data-platform="full"] {
    border-color: rgba(255, 122, 0, 0.4);
    background: rgba(255, 122, 0, 0.14);
    color: #ff7a00;
}

/* Studio Header & Info */
.studio-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.studio-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.studio-icon-box {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
    transition: background var(--transition-snappy);
}

.studio-card-title {
    font-size: 13.5px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.studio-card-sub {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
}

.studio-badge-pill {
    font-size: 9.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 3px 8px;
    border-radius: 9999px;
    background: rgba(225, 48, 108, 0.15);
    color: #e1306c;
    border: 1px solid rgba(225, 48, 108, 0.3);
    flex-shrink: 0;
    transition: all var(--transition-snappy);
}

.badge-bluesky {
    background: rgba(2, 133, 255, 0.15) !important;
    color: #0285ff !important;
    border-color: rgba(2, 133, 255, 0.3) !important;
}

.badge-twitter {
    background: rgba(29, 161, 242, 0.15) !important;
    color: #1da1f2 !important;
    border-color: rgba(29, 161, 242, 0.3) !important;
}

.badge-whatsapp {
    background: rgba(37, 211, 102, 0.15) !important;
    color: #25d366 !important;
    border-color: rgba(37, 211, 102, 0.3) !important;
}

.badge-full {
    background: rgba(255, 122, 0, 0.15) !important;
    color: #ff7a00 !important;
    border-color: rgba(255, 122, 0, 0.3) !important;
}

.badge-instagram {
    background: rgba(225, 48, 108, 0.15) !important;
    color: #e1306c !important;
    border-color: rgba(225, 48, 108, 0.3) !important;
}

.studio-caption-box {
    background: var(--bg-card-front);
    border: 1px solid var(--border-card);
    border-radius: 0.95rem;
    padding: 0.75rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.caption-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.caption-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.caption-copy-action {
    background: var(--btn-bg);
    border: 1px solid var(--btn-border);
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 10.5px;
    font-weight: 700;
    color: var(--text-primary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all var(--transition-snappy);
    font-family: var(--font-sans);
}

.caption-copy-action:hover {
    background: var(--btn-hover-bg);
    border-color: rgba(225, 48, 108, 0.4);
}

.caption-copy-action.copied {
    background: rgba(16, 185, 129, 0.15) !important;
    border-color: #10b981 !important;
    color: #10b981 !important;
}

.caption-preview-content {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, monospace;
    font-size: 11px;
    line-height: 1.45;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 95px;
    overflow-y: auto;
    margin: 0;
    padding-right: 4px;
}

.caption-preview-content::-webkit-scrollbar {
    width: 4px;
}
.caption-preview-content::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
    border-radius: 4px;
}

.studio-actions-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.share-channels-heading {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding: 0.35rem 0.25rem 0;
}

.bluesky-icon {
    color: #0285ff;
}

.ig-btn {
    padding: 0.65rem 0.85rem;
    border-radius: 0.85rem;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: all var(--transition-snappy);
    font-family: var(--font-sans);
}

.ig-btn-primary {
    background: linear-gradient(135deg, #e1306c 0%, #c13584 100%);
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 12px rgba(225, 48, 108, 0.3);
}

.ig-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(225, 48, 108, 0.45);
    filter: brightness(1.08);
}

.ig-btn-secondary {
    background: var(--btn-bg);
    border: 1px solid var(--btn-border);
    color: var(--text-primary);
}

.ig-btn-secondary:hover {
    background: var(--btn-hover-bg);
    border-color: rgba(225, 48, 108, 0.3);
    transform: translateY(-1px);
}

.ig-btn.copied {
    background: rgba(16, 185, 129, 0.15) !important;
    border-color: #10b981 !important;
    color: #10b981 !important;
}

.share-option-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 1rem;
    border-radius: 1.15rem;
    background: var(--btn-bg);
    border: 1px solid var(--btn-border);
    color: var(--text-primary);
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-snappy);
    font-family: var(--font-sans);
}

.share-option-item:hover {
    background: var(--btn-hover-bg);
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="light"] .share-option-item:hover {
    border-color: rgba(0, 0, 0, 0.12);
}

.share-option-icon {
    width: 36px;
    height: 36px;
    border-radius: 0.75rem;
    background: var(--pill-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    flex-shrink: 0;
    transition: transform var(--transition-snappy);
}

.share-option-item:hover .share-option-icon {
    transform: scale(1.1);
}

.whatsapp-icon {
    color: #25d366;
}

.instagram-icon {
    color: #e1306c;
}

.share-option-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    text-align: left;
    overflow: hidden;
}

.share-option-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.share-option-desc {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.share-option-badge {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 4px 10px;
    border-radius: 9999px;
    background: var(--pill-bg);
    border: 1px solid var(--btn-border);
    color: var(--text-secondary);
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.share-option-badge.copied {
    color: #10b981 !important;
    border-color: #10b981 !important;
    background: rgba(16, 185, 129, 0.15) !important;
}

.share-arrow-icon {
    color: var(--text-muted);
    opacity: 0.6;
    flex-shrink: 0;
}

/* ================== UTILITIES & ANIMATIONS ================== */
.hidden {
    display: none !important;
}

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

@keyframes scaleUp {
    from { opacity: 0; transform: scale(0.95) translateY(12px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes toastIn {
    from { opacity: 0; transform: translate(-50%, 15px) scale(0.95); }
    to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

/* ================== MOBILE ADAPTIVE & RESPONSIVE SCALING ================== */
.mobile-nav-bar {
    display: none;
}

@media (max-width: 600px) {
    /* App Layout Safe Padding */
    .app-layout {
        padding: calc(4.75rem + var(--sat)) max(0.85rem, var(--sal)) calc(5rem + var(--sab)) max(0.85rem, var(--sar));
    }

    /* Subheader spacing */
    .date-header-group {
        margin-bottom: 1.25rem;
    }

    .formatted-date {
        font-size: 1.35rem;
    }

    .pill-badge {
        font-size: 10px;
        padding: 5px 12px;
        margin-bottom: 0.5rem;
    }

    /* Card Stage Mobile Dimensioning (Never Cut Off) */
    .card-stage {
        max-width: 350px;
        width: 100%;
        aspect-ratio: 3 / 4.15;
        margin: 0 auto;
    }

    /* Tamed Fan Spacing on Small Screens */
    .fan-l2 {
        transform: rotate(-2.5deg) scale(0.97) translate(-5px, -3px);
    }
    .fan-l1 {
        transform: rotate(-1.2deg) scale(0.985) translate(-2px, -1px);
    }
    .fan-r1 {
        transform: rotate(1.2deg) scale(0.985) translate(2px, -1px);
    }
    .fan-r2 {
        transform: rotate(2.5deg) scale(0.97) translate(5px, -3px);
    }
    .fan-r3 {
        transform: rotate(3.5deg) scale(0.95) translate(8px, -4px);
    }

    /* Card Back Mobile Polish (No Text Cut Off) */
    .card-back {
        padding: 1.25rem 1.15rem 1rem;
    }

    .back-content {
        gap: 0.45rem;
        margin: 0.45rem 0;
    }

    .back-word-title {
        font-size: clamp(1.75rem, 6.5vw, 2.25rem);
        line-height: 1.08;
        word-break: break-word;
    }

    .back-phonetic {
        font-size: 0.95rem;
    }

    .back-definition {
        font-size: clamp(0.9rem, 3vw, 1.02rem);
        line-height: 1.42;
    }

    .back-example {
        font-size: clamp(0.82rem, 2.7vw, 0.88rem);
        line-height: 1.38;
        padding-left: 0.5rem;
    }

    .trans-text {
        font-size: 1.1rem;
        line-height: 1.25;
        word-break: break-word;
    }

    .back-footer {
        padding-top: 0.65rem;
    }

    .back-date-text {
        font-size: 11px;
    }

    .back-flip-btn {
        padding: 4px 10px;
        font-size: 10px;
    }

    /* Mobile Navigation Bar */
    .mobile-nav-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        max-width: 350px;
        margin-top: 1.15rem;
        padding: 0 0.25rem;
        user-select: none;
    }

    .mobile-nav-btn {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        padding: 7px 13px;
        border-radius: 9999px;
        background: var(--btn-bg);
        border: 1px solid var(--btn-border);
        color: var(--text-primary);
        font-size: 11px;
        font-weight: 700;
        cursor: pointer;
        transition: all var(--transition-snappy);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }

    .mobile-nav-btn:hover {
        background: var(--btn-hover-bg);
        transform: scale(1.04);
    }

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

    .mobile-swipe-indicator {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        font-size: 10px;
        font-weight: 700;
        color: var(--text-muted);
        letter-spacing: 0.05em;
        text-transform: uppercase;
        opacity: 0.8;
    }

    .swipe-arrow-left {
        animation: swipeNudgeLeft 1.8s infinite ease-in-out;
    }

    .swipe-arrow-right {
        animation: swipeNudgeRight 1.8s infinite ease-in-out;
    }

    @keyframes swipeNudgeLeft {
        0%, 100% { transform: translateX(0); opacity: 0.5; }
        50% { transform: translateX(-3px); opacity: 1; }
    }

    @keyframes swipeNudgeRight {
        0%, 100% { transform: translateX(0); opacity: 0.5; }
        50% { transform: translateX(3px); opacity: 1; }
    }

    /* Mobile Modals (Bottom-Sheet / Fit to Screen, Never Cut Off) */
    .modal-overlay {
        padding: 0.65rem;
        align-items: flex-end;
    }

    .share-card,
    .calendar-card {
        max-height: calc(90dvh - var(--sab));
        border-radius: 1.75rem 1.75rem 1.25rem 1.25rem;
        width: 100%;
    }

    .share-header {
        padding: 1rem 1.25rem 0.75rem;
    }

    .share-preview-banner {
        padding: 0.75rem 1.15rem;
        gap: 0.75rem;
    }

    .share-preview-thumb {
        width: 48px;
        height: 48px;
    }

    .share-preview-word {
        font-size: 1.15rem;
    }

    .share-options-list {
        padding: 0.75rem 1rem calc(1rem + var(--sab));
        gap: 0.5rem;
    }

    .share-option-item {
        padding: 0.65rem 0.85rem;
    }

    .post-studio-card {
        padding: 0.75rem 0.85rem;
    }

    .calendar-header {
        padding: 1.15rem 1.25rem 0.75rem;
    }

    .calendar-body {
        padding: 1rem 1.15rem calc(1.25rem + var(--sab));
    }

    .cal-day-cell {
        font-size: 12px;
    }
}

/* Extra Small Phones (320px - 380px, e.g. iPhone SE) */
@media (max-width: 380px) {
    .navbar {
        padding-left: 0.65rem;
        padding-right: 0.65rem;
    }

    .brand-title {
        font-size: 1.05rem;
    }

    .brand-logo-container {
        width: 22px;
        height: 36px;
    }

    .nav-actions {
        gap: 0.3rem;
    }

    .icon-btn {
        width: 34px;
        height: 34px;
    }

    .card-stage {
        max-width: 300px;
    }

    .mobile-nav-bar {
        max-width: 300px;
    }

    .back-word-title {
        font-size: 1.65rem;
    }
}

/* ================== ACCESSIBILITY: PREFERS REDUCED MOTION (WCAG 2.3.3) ================== */
@media (prefers-reduced-motion: reduce) {
    .nudge-anim {
        animation: none !important;
    }

    .brand-logo-container {
        transition: none !important;
    }

    .active-card-wrapper.slide-out-left,
    .active-card-wrapper.slide-out-right,
    .active-card-wrapper.slide-in-left,
    .active-card-wrapper.slide-in-right {
        animation: none !important;
        transition: none !important;
    }

    /* Flip smoothly without breaking 3D composition or backface visibility */
    .card-3d-inner {
        transition: transform 0.25s ease !important;
    }
}

/* ================== ACCESSIBILITY: HIGH CONTRAST / FORCED COLORS ================== */
@media (forced-colors: active) {
    .icon-btn,
    .btn-action-primary,
    .btn-action-secondary,
    .bento-tab,
    .card-face,
    .modal-card {
        border: 2px solid CanvasText !important;
    }

    :focus-visible {
        outline: 3px solid Highlight !important;
    }
}
