/* ============================================
   Poetry Explainer — Three-Phase UI
   Phase 0: Front page (hero / marketing)
   Phase 1: Auth + Centered landing
   Phase 2: Full-viewport dashboard
   ============================================ */

/* --- Reset --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* --- Variables --- */
:root {
    --bg: #f6f8fc;
    --bg-card: #ffffff;
    --text: #172033;
    --text-secondary: #41506a;
    --text-muted: #72819a;
    --accent: #9b59b6;
    --accent-hover: #8e44ad;
    --accent-light: #d7bde2;
    --accent-bg: #f5eef8;
    --border: #dce3ef;
    --border-light: #e9eef6;
    --error: #c0392b;
    --error-bg: #fdf0ef;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 2px 8px rgba(16, 24, 40, 0.05);
    --shadow: 0 8px 24px rgba(16, 24, 40, 0.08);
    --shadow-lg: 0 18px 42px rgba(16, 24, 40, 0.14);
    --font-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    --font-display: "Playfair Display", Georgia, serif;
    --font-poetry: "Georgia", "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", serif;
    --gap: 8px;
    --transition: 0.2s ease;

    /* Vibrant gradient palette */
    --grad-1: #9b59b6;
    --grad-2: #e74c8b;
    --grad-3: #f39c12;
    --gradient-main: linear-gradient(135deg, var(--grad-1), var(--grad-2));
    --gradient-warm: linear-gradient(135deg, var(--grad-2), var(--grad-3));
    --gradient-full: linear-gradient(135deg, var(--grad-1), var(--grad-2), var(--grad-3));
    --heading-font: var(--font-display);
    --text-primary: var(--text);
    --border-subtle: var(--border-light);

    /* ---- Liquid-glass dashboard tokens (used by #dashboard tiles) ---- */
    --tile-radius: 14px;
    --tile-bg: linear-gradient(
        155deg,
        rgba(255, 255, 255, 0.78) 0%,
        rgba(255, 255, 255, 0.46) 55%,
        rgba(252, 247, 255, 0.42) 100%
    );
    --tile-border: 1px solid rgba(255, 255, 255, 0.55);
    --tile-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.95),
        inset 0 -1px 0 rgba(24, 34, 54, 0.05),
        0 1px 2px rgba(24, 34, 54, 0.05),
        0 8px 22px rgba(24, 34, 54, 0.08),
        0 0 0 1px rgba(155, 89, 182, 0.05);
    --tile-shadow-hover:
        inset 0 1px 0 rgba(255, 255, 255, 1),
        inset 0 -1px 0 rgba(24, 34, 54, 0.05),
        0 2px 4px rgba(24, 34, 54, 0.05),
        0 12px 28px rgba(24, 34, 54, 0.10),
        0 0 0 1px rgba(155, 89, 182, 0.10);
    --tile-header-bg: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.62) 0%,
        rgba(255, 255, 255, 0.18) 100%
    );
    --tile-divider: rgba(24, 34, 54, 0.08);
    --tile-row-hover: rgba(155, 89, 182, 0.06);
    --tile-chip-bg: linear-gradient(
        135deg,
        rgba(245, 238, 248, 0.78),
        rgba(255, 255, 255, 0.55)
    );
    --tile-chip-border: 1px solid rgba(155, 89, 182, 0.18);

    /* One label scale (UPPERCASE accent labels) shared across the dashboard */
    --label-size: 0.68rem;
    --label-letter: 0.06em;
    --label-weight: 700;
}

/* clip avoids horizontal bleed without breaking descendant position:sticky (overflow-x:hidden often does). */
html {
    font-size: clamp(13px, 1.2vw + 8px, 15px);
    scroll-behavior: smooth;
    overflow-x: clip;
    /* Let document height follow tall #landing so the page isn’t shorter than its content */
    min-height: 100dvh;
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100dvh;
    overflow-x: clip;
}

button, input, select, textarea {
    font: inherit;
}

button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
    outline: 2px solid rgba(155, 89, 182, 0.45);
    outline-offset: 2px;
}

/* Initial loading (avoids flash on refresh until auth is ready) */
.app-init-loading {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    z-index: 9999;
    transition: opacity 0.15s ease;
}
.app-init-loading.hidden {
    pointer-events: none;
    opacity: 0;
}
.app-init-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: app-init-spin 0.7s linear infinite;
}
@keyframes app-init-spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   FRONT PAGE
   ============================================ */
.front-page {
    min-height: 100dvh;
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, #fdf8ff 0%, #faf5f0 30%, #fff5f8 60%, #faf5f0 100%);
}

/* --- Background decorations --- */
.fp-bg-decor {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.fp-circle {
    position: absolute;
    border-radius: 50%;
    opacity: 0.12;
}

.fp-circle-1 {
    width: 500px; height: 500px;
    background: var(--grad-1);
    top: -120px; right: -100px;
    animation: fpFloat 20s ease-in-out infinite;
}

.fp-circle-2 {
    width: 350px; height: 350px;
    background: var(--grad-2);
    bottom: 10%; left: -80px;
    animation: fpFloat 25s ease-in-out infinite reverse;
}

.fp-circle-3 {
    width: 250px; height: 250px;
    background: var(--grad-3);
    top: 50%; right: 20%;
    animation: fpFloat 18s ease-in-out infinite 3s;
}

.fp-blob {
    position: absolute;
    border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
    opacity: 0.07;
}

.fp-blob-1 {
    width: 600px; height: 400px;
    background: var(--gradient-full);
    top: 15%; left: 10%;
    animation: fpMorph 30s ease-in-out infinite;
}

.fp-blob-2 {
    width: 400px; height: 300px;
    background: var(--gradient-warm);
    bottom: 5%; right: 5%;
    animation: fpMorph 25s ease-in-out infinite reverse;
}

@keyframes fpFloat {
    0%, 100% { transform: translate(0, 0); }
    33% { transform: translate(30px, -20px); }
    66% { transform: translate(-20px, 15px); }
}

@keyframes fpMorph {
    0%, 100% { border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%; }
    25% { border-radius: 70% 30% 50% 50% / 30% 30% 70% 70%; }
    50% { border-radius: 50% 60% 30% 60% / 50% 40% 70% 40%; }
    75% { border-radius: 30% 40% 60% 50% / 60% 70% 30% 40%; }
}

/* --- Navigation --- */
.fp-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin: 0;
    padding: 0.78rem clamp(12px, 3vw, 34px);
    background: rgba(250, 248, 255, 0.92);
    backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid rgba(155, 89, 182, 0.18);
    box-shadow: 0 8px 32px rgba(24, 34, 54, 0.08);
    transition: all 0.3s ease;
}

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

.fp-nav-icon { width: 24px; height: 24px; }

.fp-nav-brand-text {
    display: inline-flex;
    flex-direction: column;
    line-height: 1.05;
}

.fp-nav-brand-title {
    font-weight: 800;
    font-size: 1.08rem;
    letter-spacing: -0.1px;
    color: #2b2f4b;
}

.fp-nav-brand-subtitle {
    display: block;
    margin-top: 2px;
    font-size: 0.76rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #7f5b9c;
    font-weight: 800;
    opacity: 1;
}

.fp-nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.fp-nav-links,
.fp-nav-auth {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fp-nav-auth {
    padding-left: 12px;
    border-left: 1px solid rgba(155, 89, 182, 0.15);
    transition: border-color 0.3s ease;
}

/* Language dropdown — globe + native select (options filled in i18n.js) */
.lang-select-wrap {
    position: relative;
    display: inline-flex;
    align-items: stretch;
    vertical-align: middle;
}

.lang-select-wrap::before {
    content: "";
    position: absolute;
    inset-inline-start: 11px;
    top: 50%;
    transform: translateY(-50%);
    width: 17px;
    height: 17px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2372819a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M2 12h20M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    pointer-events: none;
    z-index: 1;
    opacity: 0.92;
}

.lang-select {
    min-height: 38px;
    padding: 0 36px 0 12px;
    border: 1.5px solid var(--border-light);
    border-radius: 9px;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(155, 89, 182, 0.08);
    position: relative;
    appearance: none;
    background-color: transparent;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23718290' d='M1 1l5 5 5-5'/%3E%3C/svg%3E"),
        linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.88));
    background-repeat: no-repeat, no-repeat;
    background-position: right 10px center, center;
    background-size: 12px, auto;
    padding-inline-end: 36px;
}

.lang-select-wrap .lang-select {
    padding-inline-start: 38px;
    min-width: min(240px, 72vw);
    max-width: 100%;
}

@media (max-width: 520px) {
    .lang-select-wrap .lang-select {
        min-width: 0;
        width: 100%;
    }
}

.lang-select:hover {
    border-color: rgba(155, 89, 182, 0.25);
    box-shadow: 0 4px 12px rgba(155, 89, 182, 0.12);
    transform: translateY(-1px);
}

.lang-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.15), 0 4px 12px rgba(155, 89, 182, 0.15);
    transform: translateY(-1px);
}

[dir="rtl"] .lang-select {
    background-position: left 10px center, center;
}

.fp-nav-link {
    padding: 0.42rem 0.86rem;
    min-height: 36px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.fp-nav-link::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent);
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.fp-nav-link:hover {
    color: var(--accent);
    background: rgba(155, 89, 182, 0.08);
    transform: translateY(-1px);
}

.fp-nav-link:hover::before {
    transform: translateX(0);
}

.fp-nav-link.active {
    color: var(--accent);
    background: var(--accent-bg);
    font-weight: 600;
}

.fp-nav-link.active::before {
    transform: translateX(0);
}

/* Nav link — text with a living underline */
.fp-btn-ghost {
    padding: 0.42rem 0.86rem;
    min-height: 36px;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: var(--font-body);
    color: var(--text-secondary);
    background: rgba(155, 89, 182, 0.05);
    border: 1.5px solid rgba(155, 89, 182, 0.2);
    border-radius: 8px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.fp-btn-ghost::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(155, 89, 182, 0.08);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.fp-btn-ghost:hover {
    color: var(--accent);
    border-color: rgba(155, 89, 182, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(155, 89, 182, 0.1);
}

.fp-btn-ghost:hover::before {
    transform: scaleX(1);
}

/* Nav CTA — compact pill with soft fill, not a screaming gradient */
.fp-btn-solid {
    padding: 0.42rem 0.92rem;
    min-height: 36px;
    font-size: 0.88rem;
    font-weight: 600;
    font-family: var(--font-body);
    color: #fff;
    background: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 8px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.01em;
    box-shadow: 0 4px 12px rgba(155, 89, 182, 0.2);
    position: relative;
    overflow: hidden;
}

.fp-btn-solid::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0));
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.fp-btn-solid:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    box-shadow: 0 8px 20px rgba(155, 89, 182, 0.3);
    transform: translateY(-2px);
}

.fp-btn-solid:hover::before {
    opacity: 1;
}

.fp-nav-link:focus-visible,
.fp-btn-ghost:focus-visible,
.fp-btn-solid:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Authenticated landing/dashboard: language + account are separate controls */
.fp-nav-authenticated .top-bar-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    row-gap: 8px;
    padding: 0;
    border: none;
    background: transparent;
}

/* Nav language: custom button shows native name only; list shows native — English */
.lang-select-wrap.lang-select-wrap--nav::before {
    display: none;
}

.lang-select-wrap--nav {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: stretch;
    width: max-content;
    max-width: min(100%, 92vw);
    flex-shrink: 0;
    padding: 3px;
    border-radius: 14px;
    background: linear-gradient(
        145deg,
        rgba(255, 255, 255, 0.95),
        rgba(248, 244, 255, 0.88)
    );
    border: 1px solid rgba(155, 89, 182, 0.2);
    box-shadow:
        0 2px 12px rgba(24, 34, 54, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.lang-select-face-globe-svg {
    width: 17px;
    height: 17px;
}

.lang-select-wrap--nav.is-open {
    z-index: 150;
}

.lang-select-wrap--nav > .lang-select.lang-select--sync-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    opacity: 0;
    pointer-events: none;
    min-width: 0 !important;
    max-width: 1px !important;
}

.lang-select-face {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 7px;
    min-height: 34px;
    padding: 6px 10px 6px 9px;
    margin: 0;
    border: none;
    border-radius: 11px;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(252, 248, 255, 0.92));
    box-shadow: none;
    transition:
        border-color var(--transition),
        box-shadow var(--transition),
        transform var(--transition);
    width: max-content;
    max-width: 100%;
}

.lang-select-face:hover {
    color: var(--accent);
}

.lang-select-face:focus-visible {
    outline: 2px solid rgba(155, 89, 182, 0.45);
    outline-offset: 2px;
}

.lang-select-face-globe-svg {
    flex-shrink: 0;
    color: var(--text-muted);
    opacity: 0.95;
}

.lang-select-face-label {
    flex: 0 1 auto;
    min-width: 0;
    text-align: start;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lang-select-face-chevron-svg {
    flex-shrink: 0;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.lang-select-wrap--nav.is-open .lang-select-face-chevron-svg {
    transform: rotate(180deg);
}

.lang-select-panel {
    position: absolute;
    top: calc(100% + 6px);
    inset-inline-end: 0;
    min-width: max(100%, 15.5rem);
    max-width: min(92vw, 320px);
    max-height: min(55vh, 340px);
    overflow-y: auto;
    margin: 0;
    padding: 6px;
    list-style: none;
    border-radius: 12px;
    border: 1px solid rgba(155, 89, 182, 0.18);
    background: rgba(255, 255, 255, 0.98);
    box-shadow:
        0 12px 36px rgba(24, 34, 54, 0.14),
        0 2px 10px rgba(155, 89, 182, 0.08);
    backdrop-filter: blur(12px);
    z-index: 160;
}

.lang-select-panel li {
    margin: 0;
}

.lang-select-option {
    display: block;
    width: 100%;
    text-align: start;
    padding: 10px 12px;
    margin: 0;
    border: none;
    border-radius: 8px;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text);
    background: transparent;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.lang-select-option:hover {
    background: var(--accent-bg);
    color: var(--accent-hover);
}

.lang-select-option.is-selected {
    background: rgba(155, 89, 182, 0.12);
    color: var(--accent);
    font-weight: 600;
}

@media (max-width: 520px) {
    .lang-select-wrap--nav {
        max-width: min(100%, 88vw);
    }

    .lang-select-face {
        max-width: 100%;
    }

    .lang-select-panel {
        inset-inline-start: 0;
        inset-inline-end: auto;
        min-width: min(100%, 15.5rem);
        max-width: calc(100vw - 24px);
    }
}

/* Account pill: avatar + email only (language lives outside) */
.user-account-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    max-width: min(300px, 42vw);
    padding: 5px 14px 5px 7px;
    border-radius: 999px;
    border: 1px solid rgba(155, 89, 182, 0.22);
    background: linear-gradient(
        155deg,
        rgba(255, 255, 255, 0.98),
        rgba(252, 249, 255, 0.94)
    );
    box-shadow:
        0 2px 14px rgba(24, 34, 54, 0.07),
        inset 0 1px 0 rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    flex-shrink: 1;
    min-width: 0;
}

.user-avatar--chip {
    width: 34px;
    height: 34px;
    font-size: 0.82rem;
    font-weight: 700;
    box-shadow:
        0 0 0 2px rgba(255, 255, 255, 0.98),
        0 2px 10px rgba(155, 89, 182, 0.28);
}

.user-email-text--chip,
.topbar-user--chip {
    font-size: 0.78rem;
    color: var(--text);
    font-weight: 600;
    max-width: min(200px, 30vw);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-user--chip {
    color: var(--text-secondary);
}

/* Account menu (landing + dashboard chip) */
.user-account-menu {
    position: relative;
    flex-shrink: 0;
    min-width: 0;
    z-index: 180;
}

.user-account-menu.is-open {
    z-index: 200;
}

button.user-account-chip--trigger {
    appearance: none;
    -webkit-appearance: none;
    font: inherit;
    text-align: start;
    width: max-content;
    max-width: min(300px, 42vw);
}

.landing-account-chip-mobile-icon {
    display: none;
}

button.user-account-chip--trigger:hover {
    border-color: rgba(155, 89, 182, 0.35);
    box-shadow:
        0 4px 18px rgba(24, 34, 54, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

button.user-account-chip--trigger:focus-visible {
    outline: 2px solid rgba(155, 89, 182, 0.45);
    outline-offset: 2px;
}

.user-account-chevron {
    flex-shrink: 0;
    margin-inline-start: auto;
    color: var(--text-muted);
    opacity: 0.85;
    transition: transform 0.2s ease;
}

.user-account-menu.is-open .user-account-chevron {
    transform: rotate(180deg);
}

.user-account-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    inset-inline-end: 0;
    min-width: min(17.5rem, calc(100vw - 24px));
    max-width: min(20rem, calc(100vw - 20px));
    padding: 6px;
    border-radius: 14px;
    border: 1px solid rgba(155, 89, 182, 0.16);
    background: rgba(255, 255, 255, 0.97);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
    box-shadow:
        0 4px 14px rgba(24, 34, 54, 0.08),
        0 18px 40px rgba(24, 34, 54, 0.14),
        0 0 0 1px rgba(255, 255, 255, 0.6) inset;
    z-index: 190;
}

.user-account-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    margin: 2px 0;
    border: none;
    border-radius: 10px;
    background: transparent;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    text-align: start;
    transition: background 0.15s ease, color 0.15s ease;
}

.user-account-menu-item:hover {
    background: var(--accent-bg);
    color: var(--accent);
}

.user-account-menu-item--danger {
    color: var(--error);
}

.user-account-menu-item--danger:hover {
    background: var(--error-bg);
    color: var(--error);
}

.user-account-menu-item--ghost {
    font-weight: 500;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.user-account-dropdown-settings {
    padding: 4px 6px 10px;
}

.user-account-settings-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px 10px;
    margin-bottom: 6px;
    border: none;
    background: transparent;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent);
    cursor: pointer;
    border-radius: 8px;
}

.user-account-settings-back:hover {
    background: var(--accent-bg);
}

.user-account-settings-email {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
    word-break: break-all;
    margin-bottom: 8px;
}

.user-account-settings-hint,
.user-account-settings-oauth {
    font-size: 0.76rem;
    line-height: 1.45;
    margin-bottom: 10px;
    color: var(--text-muted);
}

.user-account-field-label {
    display: block;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 8px 0 4px;
}

.user-account-field-input {
    width: 100%;
    min-height: 36px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 9px;
    font: inherit;
    font-size: 0.84rem;
    background: rgba(255, 255, 255, 0.95);
}

.user-account-field-input:focus {
    outline: none;
    border-color: var(--accent-light);
    box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.1);
}

.user-account-password-submit {
    width: 100%;
    margin-top: 12px;
    min-height: 38px;
    font-size: 0.84rem;
}

.user-account-settings-msg {
    margin-top: 10px;
    font-size: 0.76rem;
    line-height: 1.4;
    color: var(--text-muted);
}

.mini-muted {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.fp-nav-authenticated .user-email-text:not(.user-email-text--chip),
.fp-nav-authenticated .topbar-user:not(.topbar-user--chip) {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 600;
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fp-nav-authenticated .fp-nav-links {
    margin-left: auto;
    margin-right: 10px;
}

/* --- Hero Section --- */
.fp-hero {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(24px, 5vw, 60px);
    max-width: 1200px;
    margin: 0 auto;
    padding: clamp(36px, 8vw, 80px) clamp(16px, 4vw, 32px) clamp(30px, 6vw, 60px);
}

.fp-hero-content {
    flex: 1;
    max-width: 560px;
}

/*
 * Hero badge — a gentle label, not a blinking billboard.
 * Thin border, muted palette, modest presence.
 */
.fp-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    background: rgba(255,255,255,0.6);
    border: 1px solid var(--border);
    border-radius: 100px;
    margin-bottom: 22px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.fp-badge-dot {
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    opacity: 0.7;
}

.fp-hero-title {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 5vw, 3.4rem);
    font-weight: 700;
    line-height: 1.15;
    color: var(--text);
    margin-bottom: clamp(12px, 2vw, 18px);
    letter-spacing: -1px;
}

.fp-gradient-text {
    background: var(--gradient-full);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.fp-hero-subtitle {
    font-size: clamp(0.95rem, 1.5vw, 1.15rem);
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: clamp(18px, 3vw, 28px);
}

.fp-hero-subtitle strong {
    color: var(--accent);
    font-weight: 600;
}

.fp-hero-cta {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 34px;
    flex-wrap: wrap;
}

/*
 * Primary CTA — warm pill with a hand-drawn feel.
 * Thick enough to feel substantial, round enough to feel friendly.
 * Hover: background shifts subtly, the arrow slides right.
 */
.fp-btn-primary-lg {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 15px 34px;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-body);
    letter-spacing: 0.01em;
    color: #fff;
    background: var(--accent);
    border: none;
    border-radius: 100px;
    cursor: pointer;
    transition: background 0.4s ease, padding 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.fp-btn-primary-lg::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(255,255,255,0.12) 0%, transparent 60%);
    pointer-events: none;
}

.fp-btn-primary-lg svg {
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.fp-btn-primary-lg:hover {
    background: var(--accent-hover);
    padding-right: 38px;
}

.fp-btn-primary-lg:hover svg {
    transform: translateX(4px);
}

.fp-btn-primary-lg:active {
    transform: scale(0.97);
}

/*
 * Secondary CTA — a text link with character.
 * No box. Just text + a little arrow that breathes.
 * Feels like a gentle invitation, not a billboard.
 */
.fp-btn-outline-lg {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 6px;
    font-size: 0.95rem;
    font-weight: 500;
    font-family: var(--font-body);
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    position: relative;
    transition: color 0.3s ease;
}

.fp-btn-outline-lg::after {
    content: "\2192";
    display: inline-block;
    font-size: 1.1em;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    opacity: 0.5;
}

.fp-btn-outline-lg:hover {
    color: var(--accent);
}

.fp-btn-outline-lg:hover::after {
    transform: translateX(3px);
    opacity: 1;
}

/* Language pills */
.fp-lang-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.fp-pill {
    padding: 5px 14px;
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: rgba(255,255,255,0.7);
    border: 1px solid var(--border);
    border-radius: 20px;
    transition: all var(--transition);
}

.fp-pill:hover {
    color: var(--accent);
    border-color: var(--accent-light);
    background: var(--accent-bg);
}

/* --- Hero Visual (preview card) --- */
.fp-hero-visual {
    flex: 0 1 420px;
    min-width: 0;
    position: relative;
}

.fp-preview-card {
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: 0 20px 60px rgba(100, 50, 120, 0.12), 0 1px 3px rgba(100,50,120,0.06);
    overflow: hidden;
    animation: fpCardFloat 6s ease-in-out infinite;
}

@keyframes fpCardFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.fp-preview-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #f8f0fc, #fef5f8);
    border-bottom: 1px solid var(--border-light);
}

.fp-preview-dots {
    display: flex;
    gap: 5px;
}

.fp-preview-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.fp-preview-dots span:nth-child(1) { background: #e74c3c; }
.fp-preview-dots span:nth-child(2) { background: #f39c12; }
.fp-preview-dots span:nth-child(3) { background: #2ecc71; }

.fp-preview-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

.fp-preview-body {
    padding: 20px;
}

.fp-preview-poem {
    font-family: var(--font-poetry);
    font-size: 1.1rem;
    line-height: 2.2;
    color: var(--text);
    margin-bottom: 14px;
}

.fp-preview-line {
    opacity: 0;
    animation: fpLineIn 0.8s ease forwards;
}

.fp-anim-line-1 { animation-delay: 0.5s; }
.fp-anim-line-2 { animation-delay: 1.2s; }
.fp-anim-line-3 { animation-delay: 1.9s; }
.fp-anim-line-4 { animation-delay: 2.6s; }

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

.fp-preview-divider {
    height: 1px;
    background: var(--gradient-full);
    opacity: 0.3;
    margin: 14px 0;
}

.fp-preview-meta {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.fp-preview-tag {
    padding: 3px 10px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-bg);
    border-radius: 10px;
}

.fp-preview-explanation {
    font-size: 0.85rem;
    font-style: italic;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Floating decorative elements */
.fp-float {
    position: absolute;
    z-index: 2;
    opacity: 0.7;
}

.fp-float-quill {
    top: -20px;
    right: -15px;
    color: var(--grad-1);
    animation: fpFloatSm 4s ease-in-out infinite;
}

.fp-float-heart {
    bottom: 30px;
    left: -25px;
    color: var(--grad-2);
    animation: fpFloatSm 5s ease-in-out infinite 1s;
}

.fp-float-star {
    top: 40%;
    right: -30px;
    color: var(--grad-3);
    animation: fpFloatSm 3.5s ease-in-out infinite 0.5s;
}

@keyframes fpFloatSm {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(8deg); }
}

/* --- Features Section --- */
.fp-features {
    position: relative;
    z-index: 1;
    max-width: 1100px;
    margin: 0 auto;
    padding: clamp(30px, 6vw, 60px) clamp(16px, 4vw, 32px) clamp(40px, 8vw, 80px);
}

.fp-reviews-section {
    position: relative;
    z-index: 1;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 clamp(16px, 4vw, 32px) clamp(42px, 7vw, 64px);
}

.reviews-carousel {
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
    gap: 16px;
}

.reviews-track-wrap { overflow: hidden; }
.reviews-track {
    display: flex;
    gap: 16px;
    transition: transform 560ms cubic-bezier(0.2, 0.8, 0.2, 1);
    will-change: transform;
    align-items: stretch;
}
.reviews-carousel.static-reviews {
    grid-template-columns: 1fr;
}
.reviews-carousel.static-reviews .reviews-track-wrap {
    overflow: visible;
}
.reviews-carousel.static-reviews .reviews-track {
    justify-content: center;
    transform: none !important;
}
.reviews-carousel.static-reviews .review-card {
    flex: 0 1 420px;
    min-width: min(420px, 100%);
    max-width: 420px;
}
.reviews-carousel.single-review {
    grid-template-columns: 1fr;
}
.reviews-carousel.single-review .reviews-track-wrap {
    overflow: visible;
}
.reviews-carousel.single-review .reviews-track {
    justify-content: center;
    transform: none !important;
}
.review-card {
    min-width: calc((100% - 28px) / 3);
    background: linear-gradient(180deg, #ffffff 0%, #fffcff 100%);
    border: 1px solid #eadff5;
    border-radius: 16px;
    padding: 18px 18px 16px;
    box-shadow: 0 10px 28px rgba(37, 20, 62, 0.08);
    transition: transform 0.28s ease, box-shadow 0.28s ease;
    display: flex;
    flex-direction: column;
    min-height: 214px;
    position: relative;
}
.review-card::before {
    content: "\201C";
    position: absolute;
    top: 12px;
    right: 16px;
    font-size: 2rem;
    line-height: 1;
    color: rgba(123, 67, 167, 0.16);
    font-weight: 700;
}
.reviews-carousel.single-review .review-card {
    min-width: min(680px, 100%);
    max-width: 680px;
    padding: 22px 24px 20px;
    border-radius: 18px;
    box-shadow: 0 16px 34px rgba(37, 20, 62, 0.11);
}
.reviews-carousel.single-review .review-card h3 {
    font-size: 1.12rem;
}
.reviews-carousel.single-review .review-card p {
    font-size: 0.93rem;
    min-height: 0;
    -webkit-line-clamp: 6;
    line-clamp: 6;
}
.reviews-carousel.single-review .review-author {
    font-size: 0.84rem;
}
.review-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 34px rgba(37, 20, 62, 0.12);
}
.review-stars { color: #f39c12; margin-bottom: 8px; letter-spacing: 1.2px; font-size: 0.92rem; }
.review-card h3 { font-size: 1rem; margin-bottom: 8px; color: var(--text); }
.review-card p {
    color: var(--text-secondary);
    font-size: 0.86rem;
    min-height: 82px;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.review-author {
    font-size: 0.79rem;
    color: var(--accent);
    font-weight: 700;
    margin-top: auto;
    padding-top: 12px;
}
.reviews-nav {
    width: 42px; height: 42px; border-radius: 50%;
    border: 1px solid var(--border); background: #fff; color: var(--accent);
    cursor: pointer; font-size: 1.1rem;
    box-shadow: 0 6px 16px rgba(64, 29, 94, 0.08);
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.reviews-nav:hover {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 9px 20px rgba(64, 29, 94, 0.12);
    background: #fff8ff;
}
.reviews-nav:disabled {
    opacity: 0.45;
    cursor: default;
    transform: none;
    box-shadow: none;
}
.reviews-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 14px;
}
.reviews-dot {
    width: 8px;
    height: 8px;
    border: none;
    border-radius: 999px;
    background: #ddcde8;
    cursor: pointer;
    padding: 0;
    transition: all 0.22s ease;
}
.reviews-dot.active {
    width: 22px;
    background: var(--accent);
}

.landing-review-card {
    margin-top: 12px;
    border-top: 1px solid var(--border-light);
    padding-top: 12px;
}
.review-form { display: grid; gap: 10px; }
.review-form-row { display: grid; gap: 5px; }
.review-form-row label { font-size: 0.72rem; text-transform: uppercase; color: var(--text-muted); font-weight: 700; }
.review-form-row input, .review-form-row textarea, .review-form-row select {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    background: #fff;
}

.review-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: rgba(30, 20, 45, 0.42);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
}
.review-modal-card {
    width: min(560px, 100%);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    padding: 14px;
}
.review-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}
.review-modal-title { font-size: 0.95rem; font-weight: 700; color: var(--text); }

/* Signed-in confirmation card — appears when an authenticated user lands on
   the marketing home page (typically via browser Back). */
#signed-in-leave-modal .signed-in-leave-card {
    width: min(440px, 100%);
    padding: clamp(1.1rem, 3vw, 1.5rem);
    border-radius: 18px;
    border: 1px solid rgba(155, 89, 182, 0.22);
    background:
        radial-gradient(120% 90% at 100% -30%, rgba(255, 184, 220, 0.18), transparent 42%),
        radial-gradient(90% 70% at -10% 110%, rgba(176, 144, 255, 0.16), transparent 48%),
        linear-gradient(165deg, rgba(255, 255, 255, 0.99) 0%, rgba(252, 246, 255, 0.97) 55%, rgba(248, 252, 255, 0.96) 100%);
    box-shadow:
        0 22px 56px rgba(24, 34, 54, 0.16),
        0 0 0 1px rgba(255, 255, 255, 0.65) inset;
}

.signed-in-leave-head {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid rgba(155, 89, 182, 0.12);
}

.signed-in-leave-title {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    line-height: 1.3;
}

.signed-in-leave-subtitle {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.55;
    color: rgba(24, 34, 54, 0.66);
    font-weight: 500;
}

.signed-in-leave-greeting {
    font-weight: 700;
    color: var(--text);
}

.signed-in-leave-actions {
    display: flex;
    gap: 10px;
    align-items: stretch;
    flex-wrap: wrap;
}

.signed-in-leave-stay-btn {
    flex: 1 1 180px;
    min-width: 0;
    padding: 10px 16px;
    font-weight: 700;
}

.signed-in-leave-out-btn {
    flex: 0 0 auto;
    padding: 10px 16px;
    font-weight: 600;
}

.signed-in-leave-out-btn[disabled] {
    opacity: 0.6;
    cursor: progress;
}

/* =====================================================================
   Poem-lookup confirmation modal
   ─────────────────────────────────────────────────────────────────────
   Shown when /api/poem/lookup returns found:true. Two side-by-side
   scrollable previews: the user's original input and the fuller poem we
   located. Liquid-glass card matching .signed-in-leave-card.
   ===================================================================== */

#poem-lookup-confirm-modal .poem-lookup-card {
    width: min(720px, 100%);
    padding: clamp(1.1rem, 3vw, 1.5rem);
    border-radius: 18px;
    border: 1px solid rgba(155, 89, 182, 0.22);
    background:
        radial-gradient(120% 90% at 100% -30%, rgba(255, 184, 220, 0.18), transparent 42%),
        radial-gradient(90% 70% at -10% 110%, rgba(176, 144, 255, 0.16), transparent 48%),
        linear-gradient(165deg, rgba(255, 255, 255, 0.99) 0%, rgba(252, 246, 255, 0.97) 55%, rgba(248, 252, 255, 0.96) 100%);
    box-shadow:
        0 22px 56px rgba(24, 34, 54, 0.16),
        0 0 0 1px rgba(255, 255, 255, 0.65) inset;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.poem-lookup-head {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(155, 89, 182, 0.12);
}

.poem-lookup-title {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    line-height: 1.3;
}

.poem-lookup-subtitle {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.55;
    color: rgba(24, 34, 54, 0.7);
    font-weight: 500;
}

.poem-lookup-source {
    margin: 4px 0 0;
    font-size: 0.82rem;
    color: rgba(24, 34, 54, 0.6);
}

.poem-lookup-source a {
    color: var(--accent, #7c3aed);
    text-decoration: none;
    font-weight: 600;
    margin-left: 4px;
    word-break: break-all;
}

.poem-lookup-source a:hover {
    text-decoration: underline;
}

.poem-lookup-compare {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

@media (min-width: 720px) {
    .poem-lookup-compare {
        grid-template-columns: 1fr 1fr;
    }
}

.poem-lookup-col {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.poem-lookup-col-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(24, 34, 54, 0.55);
}

.poem-lookup-col-meta {
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    color: rgba(24, 34, 54, 0.45);
    font-size: 0.78rem;
}

.poem-lookup-preview {
    margin: 0;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(155, 89, 182, 0.15);
    background: rgba(255, 255, 255, 0.6);
    font-family: inherit;
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--text, #182236);
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: clamp(180px, 28vh, 240px);
    backdrop-filter: blur(4px);
}

.poem-lookup-preview:focus {
    outline: 2px solid rgba(155, 89, 182, 0.45);
    outline-offset: 1px;
}

.poem-lookup-actions {
    display: flex;
    gap: 10px;
    align-items: stretch;
    flex-wrap: wrap;
    justify-content: flex-end;
    padding-top: 8px;
    border-top: 1px solid rgba(155, 89, 182, 0.08);
}

.poem-lookup-use-original-btn {
    flex: 0 1 auto;
    padding: 10px 16px;
    font-weight: 600;
}

.poem-lookup-use-full-btn {
    flex: 0 1 auto;
    padding: 10px 18px;
    font-weight: 700;
}

@media (max-width: 480px) {
    .poem-lookup-actions {
        flex-direction: column-reverse;
    }
    .poem-lookup-use-original-btn,
    .poem-lookup-use-full-btn {
        width: 100%;
    }
}

/* Review submit modal (distinct from billing/account which reuse .review-modal shell) */
#review-modal > .review-modal-card--review {
    width: min(520px, 100%);
    padding: clamp(1.15rem, 3vw, 1.55rem);
    border-radius: 20px;
    border: 1px solid rgba(155, 89, 182, 0.22);
    background:
        radial-gradient(120% 90% at 100% -30%, rgba(255, 184, 220, 0.18), transparent 42%),
        radial-gradient(90% 70% at -10% 110%, rgba(176, 144, 255, 0.16), transparent 48%),
        linear-gradient(165deg, rgba(255, 255, 255, 0.99) 0%, rgba(252, 246, 255, 0.97) 55%, rgba(248, 252, 255, 0.96) 100%);
    box-shadow:
        0 22px 56px rgba(24, 34, 54, 0.16),
        0 0 0 1px rgba(255, 255, 255, 0.65) inset;
}

#review-modal .review-modal-head {
    align-items: flex-start;
    margin-bottom: 0;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(155, 89, 182, 0.12);
    gap: 12px;
}

#review-modal .review-modal-head-copy {
    min-width: 0;
    flex: 1;
}

#review-modal .review-modal-title {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
    line-height: 1.25;
}

#review-modal .review-modal-subtitle {
    margin: 6px 0 0;
    font-size: 0.86rem;
    line-height: 1.45;
    color: rgba(24, 34, 54, 0.62);
    font-weight: 500;
}

#review-modal .review-modal-close {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid rgba(155, 89, 182, 0.2);
    background: rgba(255, 255, 255, 0.85);
    color: rgba(86, 44, 120, 0.75);
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

#review-modal .review-modal-close:hover {
    background: rgba(252, 247, 255, 1);
    border-color: rgba(155, 89, 182, 0.35);
    color: var(--accent);
    transform: translateY(-1px);
}

#review-modal .review-form--modal {
    gap: 16px;
}

#review-modal .review-form-row label {
    font-size: 0.7rem;
    letter-spacing: 0.07em;
    color: rgba(86, 44, 120, 0.72);
}

#review-modal .review-form-row input,
#review-modal .review-form-row textarea {
    border-radius: 12px;
    border: 1.5px solid rgba(155, 89, 182, 0.18);
    padding: 11px 13px;
    font-size: 0.9rem;
    box-shadow: inset 0 1px 2px rgba(16, 24, 40, 0.04);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#review-modal .review-form-row input:focus,
#review-modal .review-form-row textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.12), inset 0 1px 2px rgba(16, 24, 40, 0.04);
}

#review-modal .review-form-row--rating {
    gap: 8px;
}

#review-modal .review-rating-label {
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 800;
    color: rgba(86, 44, 120, 0.72);
}

#review-modal .review-star-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 0 2px;
}

#review-modal .review-star {
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: rgba(155, 89, 182, 0.35);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, color 0.15s ease, background 0.15s ease;
}

#review-modal .review-star svg {
    width: 32px;
    height: 32px;
}

#review-modal .review-star svg path {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.35;
    stroke-linejoin: round;
    transition: fill 0.15s ease, stroke 0.15s ease;
}

#review-modal .review-star.is-on {
    color: #e8a317;
}

#review-modal .review-star.is-on svg path {
    fill: currentColor;
    stroke: none;
}

#review-modal .review-star:hover,
#review-modal .review-star:focus-visible {
    transform: scale(1.08);
    color: rgba(232, 163, 23, 0.85);
    background: rgba(255, 248, 230, 0.55);
}

#review-modal .review-star:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.2);
}

#review-modal .review-star.is-on:hover,
#review-modal .review-star.is-on:focus-visible {
    color: #d49412;
}

#review-modal .review-star-caption {
    margin: 4px 0 0;
    min-height: 1.35em;
    font-size: 0.88rem;
    font-weight: 650;
    color: rgba(24, 34, 54, 0.78);
}

#review-modal .review-submit-btn {
    width: 100%;
    margin-top: 4px;
    min-height: 48px;
    border-radius: 14px;
    font-weight: 750;
    font-size: 0.92rem;
}

#review-modal .review-form-msg {
    margin: 0;
    text-align: center;
    min-height: 1.25em;
}

.billing-open-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    min-height: 38px;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid rgba(155, 89, 182, 0.26);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(250, 243, 255, 0.9));
    box-shadow: 0 10px 24px rgba(24, 34, 54, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.fp-nav-blog-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 4px 10px;
    border-radius: 999px;
    white-space: nowrap;
}

.billing-open-label {
    font-size: 0.74rem;
    color: #8b779e;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.billing-open-count {
    min-width: 26px;
    height: 26px;
    padding: 0 7px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(155, 89, 182, 0.2);
    color: #7f3fc3;
    font-size: 0.86rem;
    font-weight: 800;
    line-height: 1;
}

.billing-open-divider {
    width: 1px;
    height: 17px;
    background: rgba(155, 89, 182, 0.24);
}

.billing-open-cta {
    font-size: 0.74rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #fff;
    border-radius: 999px;
    padding: 6px 11px;
    background: linear-gradient(135deg, #8e4ce0, #d4529a);
    box-shadow: 0 8px 18px rgba(155, 89, 182, 0.28);
}

.billing-modal-card {
    width: min(680px, 100%);
    background:
        radial-gradient(circle at 90% -8%, rgba(255, 184, 220, 0.22), transparent 36%),
        radial-gradient(circle at 8% 118%, rgba(176, 144, 255, 0.2), transparent 42%),
        linear-gradient(160deg, rgba(255, 255, 255, 0.98) 0%, rgba(252, 245, 255, 0.95) 100%);
    border: 1px solid rgba(155, 89, 182, 0.26);
    box-shadow: 0 18px 52px rgba(24, 34, 54, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.55) inset;
    padding: 16px;
}

.billing-modal-head {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(155, 89, 182, 0.16);
}

.billing-modal-head-copy {
    display: grid;
    gap: 3px;
}

.billing-modal-title {
    font-size: 1.1rem;
    letter-spacing: -0.02em;
}

.billing-subtitle {
    margin: 0;
    font-size: 0.84rem;
    color: #88749d;
    font-weight: 600;
}

.billing-close-btn {
    border-color: rgba(155, 89, 182, 0.24);
    background: rgba(255, 255, 255, 0.92);
}

.billing-balance-line {
    margin: 0 0 14px;
    display: inline-flex;
    gap: 8px;
    align-items: center;
    font-size: 0.86rem;
    border: 1px solid rgba(155, 89, 182, 0.2);
    border-radius: 999px;
    padding: 6px 12px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(246, 235, 255, 0.82));
    box-shadow: 0 6px 14px rgba(24, 34, 54, 0.08);
}

.billing-balance-label {
    color: #836f98;
    font-weight: 700;
}

#billing-balance-value {
    min-width: 28px;
    text-align: center;
    color: #6d38a7;
    font-size: 0.95rem;
}

.billing-plans-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
}

.billing-plan-card {
    border: 1px solid rgba(155, 89, 182, 0.3);
    border-radius: 14px;
    padding: 12px;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.99), rgba(249, 239, 255, 0.96)),
        linear-gradient(120deg, rgba(155, 89, 182, 0.08), rgba(255, 112, 181, 0.05));
    display: grid;
    gap: 8px;
    box-shadow: 0 10px 22px rgba(24, 34, 54, 0.09), 0 1px 0 rgba(255, 255, 255, 0.65) inset;
    position: relative;
    overflow: hidden;
}

.billing-plan-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), transparent 55%);
    pointer-events: none;
}

.billing-plan-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(155, 89, 182, 0.16), 0 1px 0 rgba(255, 255, 255, 0.75) inset;
    border-color: rgba(155, 89, 182, 0.42);
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.billing-plan-card--free {
    background:
        radial-gradient(circle at 12% 18%, rgba(171, 255, 231, 0.35), transparent 45%),
        radial-gradient(circle at 86% 82%, rgba(255, 210, 250, 0.28), transparent 50%),
        linear-gradient(140deg, rgba(248, 255, 253, 0.98), rgba(246, 238, 255, 0.96));
}

.billing-plan-card--custom {
    background:
        radial-gradient(circle at 90% 16%, rgba(216, 175, 255, 0.34), transparent 46%),
        linear-gradient(150deg, rgba(255, 255, 255, 0.99), rgba(247, 240, 255, 0.97));
}

.billing-plan-card--enterprise {
    background:
        radial-gradient(circle at 88% 16%, rgba(255, 210, 138, 0.22), transparent 48%),
        radial-gradient(circle at 14% 84%, rgba(205, 168, 255, 0.2), transparent 50%),
        linear-gradient(150deg, rgba(255, 255, 255, 0.99), rgba(251, 246, 238, 0.95));
}

.billing-plan-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.billing-plan-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
}

.billing-plan-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: #fff;
    border: 1px solid rgba(155, 89, 182, 0.45);
    background: linear-gradient(135deg, rgba(155, 89, 182, 0.88), rgba(217, 83, 153, 0.84));
    box-shadow: 0 6px 14px rgba(155, 89, 182, 0.24);
}

.billing-plan-badge--base {
    color: #745f84;
    border-color: rgba(155, 89, 182, 0.2);
    background: rgba(255, 255, 255, 0.88);
    box-shadow: none;
}

.billing-plan-badge--free {
    background: linear-gradient(135deg, #2fbf9b, #7fdd9f);
    border-color: rgba(43, 161, 127, 0.35);
}

.billing-plan-badge--custom {
    background: linear-gradient(135deg, #7f56d9, #b56af5);
}

.billing-plan-prices {
    display: grid;
    gap: 5px;
}

.billing-plan-price-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.billing-plan-price {
    font-size: 1.22rem;
    font-weight: 800;
    color: #7f3fc3;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}

.billing-plan-original {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: line-through;
}

.billing-plan-meta {
    font-size: 0.76rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.billing-plan-divider {
    opacity: 0.45;
}

.billing-plan-savings {
    font-size: 0.74rem;
    color: #7f3fc3;
    font-weight: 800;
}

.billing-buy-btn {
    min-height: 36px;
    border: 1px solid rgba(155, 89, 182, 0.34);
    border-radius: 9px;
    background: linear-gradient(135deg, #a55ad4 0%, #d4529a 100%);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 16px rgba(155, 89, 182, 0.26);
    transition: transform var(--transition), box-shadow var(--transition), filter var(--transition), border-color var(--transition);
}

.billing-buy-btn:hover {
    border-color: rgba(155, 89, 182, 0.48);
    filter: saturate(1.08) brightness(1.02);
    box-shadow: 0 12px 20px rgba(155, 89, 182, 0.31);
    transform: translateY(-2px);
}

.billing-buy-btn--ghost {
    background: rgba(255, 255, 255, 0.75);
    border-color: rgba(94, 120, 146, 0.25);
    color: #6d7691;
    box-shadow: none;
    cursor: default;
}

.billing-custom-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #8a6fb0;
}

.billing-custom-input {
    width: 100%;
    min-height: 36px;
    border: 1px solid rgba(155, 89, 182, 0.28);
    border-radius: 10px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--text);
    font: inherit;
    font-weight: 650;
}

.billing-modal-msg {
    min-height: 18px;
    margin: 10px 0 0;
}

#account-settings-modal .account-settings-modal-card.review-modal-card {
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    width: min(720px, calc(100vw - 28px));
    height: min(560px, 72vh);
    min-height: min(560px, 72vh);
    max-height: min(560px, 72vh);
    overflow: hidden;
    padding: 14px;
    background: linear-gradient(155deg, rgba(255, 255, 255, 0.98), rgba(249, 241, 255, 0.96));
    border: 1px solid rgba(155, 89, 182, 0.25);
}

.account-settings-head {
    flex-shrink: 0;
    margin-bottom: 12px;
}

.account-settings-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.account-settings-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-right: 4px;
    margin-right: -2px;
}

.account-settings-scroll .account-activity-list {
    max-height: none;
    padding-right: 0;
}

.account-settings-tab {
    border: 1px solid rgba(155, 89, 182, 0.24);
    background: rgba(255, 255, 255, 0.82);
    color: #7b6093;
    font-weight: 700;
    border-radius: 999px;
    padding: 6px 12px;
    cursor: pointer;
}

.account-settings-tab.is-active {
    background: linear-gradient(135deg, #a55ad4, #d4529a);
    color: #fff;
    border-color: transparent;
}

.account-settings-panel {
    display: grid;
    gap: 8px;
}

.account-settings-panel .btn-primary {
    width: max-content;
    min-width: 150px;
}

.account-settings-msg {
    flex-shrink: 0;
    margin-top: 10px;
    min-height: 18px;
}

.account-settings-profile-email {
    margin: 0 0 6px;
    word-break: break-word;
}

.account-settings-profile-divider {
    margin: 14px 0 12px;
    border: 0;
    border-top: 1px solid rgba(155, 89, 182, 0.16);
}

.account-settings-subheading {
    margin: 0 0 4px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(86, 44, 120, 0.75);
}

.account-settings-ghost-btn {
    align-self: start;
    margin-top: 4px;
    justify-self: start;
}

.account-activity-list {
    width: 100%;
    overflow-x: auto;
}

.account-activity-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid rgba(155, 89, 182, 0.18);
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.88);
    font-size: 0.82rem;
}

.account-activity-table thead th {
    text-align: left;
    padding: 9px 10px;
    background: rgba(155, 89, 182, 0.09);
    color: rgba(86, 44, 120, 0.9);
    border-bottom: 1px solid rgba(155, 89, 182, 0.2);
    font-weight: 700;
    letter-spacing: 0.01em;
}

.account-activity-table tbody td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(155, 89, 182, 0.1);
    color: var(--text-muted);
    vertical-align: top;
}

.account-activity-table tbody td:nth-child(2),
.account-activity-table tbody td:first-child {
    color: var(--text);
    font-weight: 600;
}

.account-activity-table tbody tr:last-child td {
    border-bottom: none;
}

@media (max-width: 560px) {
    .billing-plans-list {
        grid-template-columns: 1fr;
    }
}

/* Vision banner — motto + shared analysis description */
.fp-vision {
    max-width: 720px;
    margin: 0 auto clamp(2.5rem, 5vw, 4rem);
    padding: clamp(1.25rem, 3vw, 2rem) clamp(1.5rem, 4vw, 2.5rem);
    background: linear-gradient(135deg, rgba(245, 235, 250, 0.9) 0%, rgba(253, 248, 255, 0.95) 100%);
    border: 1px solid var(--accent-light);
    border-radius: 16px;
    text-align: center;
}

.fp-vision-motto {
    font-family: var(--font-display);
    font-size: clamp(1.2rem, 3vw, 1.5rem);
    font-weight: 700;
    color: var(--text);
    margin: 0 0 0.75rem;
    line-height: 1.4;
    letter-spacing: -0.3px;
}

.fp-vision-desc {
    font-size: clamp(0.9rem, 1.5vw, 1rem);
    color: var(--text-secondary);
    line-height: 1.65;
    margin: 0;
    max-width: 580px;
    margin-left: auto;
    margin-right: auto;
}

.fp-section-header {
    text-align: center;
    margin-bottom: 48px;
}

.fp-section-title {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.fp-section-desc {
    font-size: 1.05rem;
    color: var(--text-secondary);
    max-width: 550px;
    margin: 0 auto;
    line-height: 1.6;
}

.fp-pricing-highlight {
    background: linear-gradient(135deg, rgba(155, 89, 182, 0.1), rgba(230, 126, 34, 0.1));
    padding: 16px 24px;
    border-radius: 12px;
    border: 2px solid var(--accent-light);
    font-weight: 600;
    color: var(--accent);
    font-size: 1.1rem;
    letter-spacing: 0.3px;
}

.fp-features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
    gap: clamp(12px, 2vw, 20px);
}

/*
 * Feature cards — left-border accent for personality.
 * No lift. Hover warms the border and tints the background.
 * Each card has its own left-stripe color via nth-child.
 */
.fp-feature-card {
    background: rgba(255,255,255,0.75);
    border: 1px solid var(--border-light);
    border-left: 3px solid var(--border);
    border-radius: 4px 14px 14px 4px;
    padding: clamp(18px, 3vw, 26px) clamp(16px, 2.5vw, 24px);
    transition: border-color 0.4s ease, background 0.4s ease, box-shadow 0.4s ease;
}

.fp-feature-card:nth-child(1) { --card-hue: #9b59b6; }
.fp-feature-card:nth-child(2) { --card-hue: #e74c8b; }
.fp-feature-card:nth-child(3) { --card-hue: #e67e22; }
.fp-feature-card:nth-child(4) { --card-hue: #3498db; }
.fp-feature-card:nth-child(5) { --card-hue: #27ae60; }
.fp-feature-card:nth-child(6) { --card-hue: #e74c3c; }

.fp-feature-card:hover {
    border-left-color: var(--card-hue);
    background: rgba(255,255,255,0.95);
    box-shadow: 0 2px 20px rgba(0,0,0,0.04);
}

.fp-feature-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    transition: transform 0.3s ease;
}

.fp-feature-card:hover .fp-feature-icon {
    transform: rotate(-4deg) scale(1.05);
}

.fp-fi-translate { background: #f3e8fb; color: #7b2d8e; }
.fp-fi-search { background: #fce4ec; color: #c2185b; }
.fp-fi-book { background: #fff3e0; color: #e65100; }
.fp-fi-chat { background: #e3f2fd; color: #0277bd; }
.fp-fi-palette { background: #e8f5e9; color: #2e7d32; }
.fp-fi-history { background: #fbe9e7; color: #bf360c; }

.fp-feature-card h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
    letter-spacing: -0.2px;
}

.fp-feature-card p {
    font-size: 0.86rem;
    color: var(--text-secondary);
    line-height: 1.65;
}

/* --- Analyze Section (keyword grid) --- */
.fp-analyze-section {
    position: relative;
    z-index: 1;
    padding: clamp(30px, 5vw, 60px) clamp(16px, 4vw, 32px);
    max-width: 1100px;
    margin: 0 auto;
}

.fp-analyze-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.fp-analyze-col h3 {
    font-family: var(--heading-font);
    font-size: 1.15rem;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--accent);
    display: inline-block;
}

.fp-analyze-col ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.fp-analyze-col li {
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--text-secondary);
    padding: 0.3rem 0;
}

.fp-analyze-col li strong {
    color: var(--text-primary);
}

/* --- Pricing Section --- */
.fp-pricing-section {
    position: relative;
    z-index: 1;
    padding: clamp(40px, 5vw, 80px) clamp(16px, 4vw, 32px);
    max-width: 1100px;
    margin: 0 auto;
    background: linear-gradient(135deg, rgba(155, 89, 182, 0.04), rgba(230, 126, 34, 0.04));
    border-radius: 20px;
    margin-bottom: clamp(30px, 5vw, 60px);
}

.fp-pricing-benefits {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: clamp(0.85rem, 2vw, 1.15rem);
    align-items: stretch;
}

.fp-pricing-highlight-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 11px;
    min-width: 0;
    padding: 10px 12px;
    text-align: left;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(155, 89, 182, 0.14);
    border-radius: 11px;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 2px 10px rgba(24, 34, 54, 0.04);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.fp-pricing-highlight-card:hover {
    border-color: rgba(155, 89, 182, 0.26);
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.95) inset, 0 4px 16px rgba(155, 89, 182, 0.08);
}

.fp-pricing-highlight-card--lead {
    border-color: rgba(155, 89, 182, 0.22);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.94) 0%, rgba(252, 248, 255, 0.9) 100%);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.95) inset,
        0 2px 12px rgba(86, 44, 120, 0.06);
}

.fp-pricing-highlight-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1 1 auto;
}

.fp-pricing-highlight-kicker {
    margin: 0;
    font-size: 0.6rem;
    font-weight: 750;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(86, 44, 120, 0.62);
}

.fp-pricing-highlight-digit {
    flex-shrink: 0;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 1.65em;
    padding: 0 0.2rem 0 0;
    font-family: var(--font-body);
    font-size: clamp(1.45rem, 2.8vw, 1.7rem);
    font-weight: 700;
    font-variant-numeric: lining-nums tabular-nums;
    line-height: 1;
    letter-spacing: 0;
    color: var(--text);
    background: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
    text-shadow: none;
}

.fp-pricing-highlight-card-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(0.82rem, 1.35vw, 0.92rem);
    font-weight: 750;
    letter-spacing: -0.02em;
    line-height: 1.28;
    color: var(--text);
}

.fp-pricing-highlight-title-accent {
    display: inline;
    margin-left: 0.2em;
    color: #a65f0c;
    font-weight: 800;
}

.fp-pricing-highlight-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.35rem;
    height: 2.35rem;
    flex-shrink: 0;
    border-radius: 9px;
    background: rgba(155, 89, 182, 0.1);
    color: #6b2d86;
    font-size: 1rem;
}

.fp-pricing-highlight-icon--svg {
    font-size: 0;
}

.fp-pricing-highlight-icon--svg svg {
    display: block;
}

.fp-pricing-highlight-card strong {
    flex: 1 1 auto;
    min-width: 0;
    font-weight: 650;
    font-size: clamp(0.8rem, 1.25vw, 0.88rem);
    color: var(--text);
    line-height: 1.35;
}

.fp-pricing-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: clamp(14px, 1.5vw, 20px);
    margin-top: 2rem;
    padding-top: 24px;
    align-items: stretch;
}

.fp-pricing-card {
    position: relative;
    background: var(--bg-card);
    border: 2px solid var(--border-light);
    border-radius: 14px;
    padding: clamp(24px, 3vw, 32px);
    transition: all 0.4s ease;
    display: flex;
    flex-direction: column;
}

.fp-pricing-card:nth-child(2),
.fp-pricing-card:nth-child(3) {
    padding-top: clamp(50px, 6vw, 60px);
}

.fp-pricing-card:hover {
    border-color: var(--accent);
    box-shadow: 0 12px 32px rgba(155, 89, 182, 0.12);
    transform: translateY(-4px);
}

.fp-pricing-featured {
    border-color: var(--accent);
    box-shadow: 0 12px 32px rgba(155, 89, 182, 0.12);
    transform: scale(1.02);
}

.fp-pricing-badge {
    position: absolute;
    top: -18px;
    left: 24px;
    background: var(--accent);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 10;
    white-space: nowrap;
}

.fp-pricing-badge--best {
    background: linear-gradient(135deg, var(--grad-2), var(--grad-3));
}

.fp-pricing-enterprise {
    background: var(--bg-card);
    border: 2px solid var(--border-light);
}

.fp-pricing-enterprise:hover {
    border-color: var(--accent);
    box-shadow: 0 12px 32px rgba(155, 89, 182, 0.12);
}

.pricing-contact-btn {
    background: var(--gradient-main);
    color: white;
    border: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.pricing-contact-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(155, 89, 182, 0.3);
}

.fp-pricing-card h3 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
    margin-top: clamp(8px, 1vw, 12px);
}

.fp-price {
    font-size: clamp(1.8rem, 4vw, 2.2rem);
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 4px;
}

.fp-price-detail {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.fp-discount-badge {
    background: #e8f5e9;
    color: #27ae60;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.8rem;
    margin-right: 6px;
}

.fp-pricing-card button {
    margin-bottom: 20px;
    white-space: nowrap;
}

.fp-pricing-features {
    list-style: none;
    padding: 0;
    margin: 0;
    flex-grow: 1;
}

.fp-pricing-features li {
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding: 8px 0;
    display: flex;
    align-items: center;
    line-height: 1.5;
}

.fp-pricing-features li::before {
    content: "✓";
    display: inline-block;
    width: 20px;
    height: 20px;
    background: #e8f5e9;
    color: #27ae60;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    flex-shrink: 0;
}

.fp-pricing-note {
    margin-top: 32px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

/* --- Languages Section --- */
.fp-languages-section {
    position: relative;
    z-index: 1;
    padding: clamp(30px, 5vw, 60px) clamp(16px, 4vw, 32px);
    max-width: 1100px;
    margin: 0 auto;
}

.fp-lang-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 0.75rem;
    margin-top: 2rem;
}

.fp-lang-tile {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 1rem 0.9rem;
    cursor: default;
    overflow: hidden;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-height: 88px;
}

.fp-lang-tile:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
    box-shadow: 0 6px 20px rgba(155, 89, 182, 0.12);
}

.fp-lang-name {
    font-family: var(--heading-font);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    transition: opacity 0.2s;
}

.fp-lang-native {
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 500;
    opacity: 0.85;
    transition: opacity 0.2s;
}

.fp-lang-poets {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin-top: auto;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.25s, transform 0.25s;
}

.fp-lang-tile:hover .fp-lang-poets {
    opacity: 1;
    transform: translateY(0);
}

.fp-lang-tile.fp-lang-more {
    background: linear-gradient(135deg, rgba(155,89,182,0.06), rgba(155,89,182,0.12));
    border-style: dashed;
}

.fp-lang-tile.fp-lang-more .fp-lang-name {
    color: var(--accent);
}

.fp-lang-tile.fp-lang-more .fp-lang-poets {
    opacity: 0.7;
    transform: translateY(0);
}

/* --- FAQ Section --- */
.fp-faq-section {
    position: relative;
    z-index: 1;
    padding: clamp(30px, 5vw, 60px) clamp(16px, 4vw, 32px);
    max-width: 800px;
    margin: 0 auto;
}

.fp-faq-list {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.fp-faq-item {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.fp-faq-item[open] {
    border-color: var(--accent);
}

.fp-faq-item summary {
    cursor: pointer;
    padding: 1rem 1.25rem;
    font-family: var(--heading-font);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.fp-faq-item summary::after {
    content: "+";
    font-size: 1.3rem;
    font-weight: 400;
    color: var(--accent);
    flex-shrink: 0;
    transition: transform 0.2s;
}

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

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

.fp-faq-item p {
    padding: 0 1.25rem 1rem;
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

/* --- Quote Section --- */
.fp-quote-section {
    position: relative;
    z-index: 1;
    padding: clamp(30px, 5vw, 50px) clamp(16px, 4vw, 32px);
    background: linear-gradient(135deg, rgba(155,89,182,0.06), rgba(231,76,139,0.04));
}

.fp-quote-inner {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
    position: relative;
}

.fp-quote-mark {
    color: var(--accent);
    margin-bottom: 10px;
}

.fp-quote-text {
    font-family: var(--font-display);
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    font-style: italic;
    font-weight: 400;
    color: var(--text);
    line-height: 1.5;
    margin-bottom: 16px;
    border: none;
}

.fp-quote-author {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--accent);
    font-style: normal;
}

/* --- Bottom CTA --- */
.fp-bottom-cta {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: clamp(40px, 7vw, 70px) clamp(16px, 4vw, 32px) clamp(36px, 6vw, 60px);
}

.fp-bottom-cta h2 {
    font-family: var(--font-display);
    font-size: clamp(1.4rem, 3.5vw, 2rem);
    font-weight: 600;
    font-style: italic;
    color: var(--text);
    margin-bottom: 12px;
    letter-spacing: -0.3px;
}

.fp-bottom-cta p {
    font-size: 1rem;
    color: var(--text-muted);
    max-width: 440px;
    margin: 0 auto 32px;
    line-height: 1.65;
}

/* --- Footer --- */
.fp-footer {
    position: relative;
    z-index: 1;
    padding: clamp(16px, 3vw, 24px) clamp(16px, 4vw, 32px);
    border-top: 1px solid var(--border-light);
    background: rgba(255,255,255,0.4);
}

.fp-footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.fp-footer-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent);
    font-weight: 700;
    font-size: 0.9rem;
}

.fp-footer-text {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.fp-footer-expanded {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
}

.fp-footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    width: 100%;
}

.fp-footer-col {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.fp-footer-col h4 {
    font-family: var(--heading-font);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.3rem 0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.fp-footer-col a {
    font-size: 0.82rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.15s;
}

.fp-footer-col a:hover {
    color: var(--accent);
}

.pe-social-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    text-decoration: none;
}

.pe-social-link .pe-social-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pe-social-link .pe-social-icon svg {
    width: 18px;
    height: 18px;
    display: block;
}

.fp-footer-col span {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.fp-footer-tagline {
    width: 100%;
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
    margin-top: 0.5rem;
}

/* --- Front Page Responsive --- */
@media (max-width: 1024px) {
    .fp-hero {
        flex-direction: column;
        text-align: center;
    }

    .fp-hero-content { max-width: 100%; text-align: center; }
    .fp-hero-badge { margin-left: auto; margin-right: auto; }
    .fp-hero-cta { justify-content: center; }
    .fp-lang-pills { justify-content: center; }

    .fp-hero-visual {
        flex: none;
        width: 100%;
        max-width: 400px;
    }

    .fp-pricing-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .fp-hero-cta {
        flex-direction: column;
        align-items: stretch;
    }

    .fp-btn-primary-lg {
        justify-content: center;
        width: 100%;
    }

    .fp-hero-visual { max-width: 100%; }

    .fp-lang-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 0.6rem;
    }
    .fp-lang-tile {
        padding: 0.75rem 0.7rem;
        min-height: 74px;
    }
    .fp-lang-poets {
        opacity: 0.6;
        transform: translateY(0);
        font-size: 0.68rem;
    }
    .fp-analyze-grid {
        grid-template-columns: 1fr;
    }

    .fp-pricing-grid {
        grid-template-columns: 1fr;
    }

    .fp-pricing-featured {
        transform: scale(1);
    }

    .fp-pricing-card:nth-child(2),
    .fp-pricing-card:nth-child(3) {
        padding-top: clamp(50px, 6vw, 60px);
    }

    .fp-pricing-highlight {
        padding: 12px 16px;
        font-size: 0.95rem;
    }

    .fp-pricing-benefits {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .fp-pricing-highlight-card {
        padding: 0.95rem 0.85rem;
    }

    .fp-footer-inner {
        flex-direction: column;
        gap: 12px;
        text-align: center;
        align-items: center;
    }
    .fp-footer-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .fp-float { display: none; }
}

/* ============================================
   AUTH SCREEN
   ============================================ */
.auth-screen {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 2.5rem 1.5rem 3rem;
    animation: landingIn 0.4s ease;
    background: linear-gradient(160deg, #fdf8ff 0%, #faf5f0 40%, #fff5f8 100%);
    position: relative;
    overflow: hidden;
}

.auth-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    font-size: 0.8rem;
    font-weight: 500;
    font-family: var(--font-body);
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(155, 89, 182, 0.12);
    border-radius: 999px;
    cursor: pointer;
    transition: color 0.25s ease, background 0.25s ease, border-color 0.25s ease;
    margin-bottom: 18px;
}

.auth-back-btn svg {
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-back-btn:hover {
    color: var(--accent);
}

.auth-back-btn:hover svg {
    transform: translateX(-3px);
}

.auth-card {
    width: 100%;
    max-width: 600px;
    background: rgba(255, 255, 255, 0.86);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 24px 60px rgba(16, 24, 40, 0.16), 0 8px 22px rgba(16, 24, 40, 0.08);
    padding: clamp(1.5rem, 4vw, 2.8rem) clamp(1.2rem, 4vw, 3.2rem) clamp(1.4rem, 3vw, 2.4rem);
    margin-top: clamp(1.5rem, 6vh, 3.5rem);
    position: relative;
    z-index: 1;
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
    justify-content: center;
}

.auth-brand h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.auth-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    max-width: 420px;
    margin: 0 auto 1.6rem;
}

/* Auth tabs — segmented pill toggle */
.auth-tabs {
    display: flex;
    background: rgba(155, 89, 182, 0.08);
    border: 1.5px solid rgba(155, 89, 182, 0.15);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 1.4rem;
    gap: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(6px) saturate(140%);
}

.auth-tab {
    flex: 1;
    padding: 10px 0;
    font-size: 0.84rem;
    font-weight: 600;
    font-family: var(--font-body);
    color: var(--text-muted);
    background: none;
    border: none;
    border-radius: 9px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.01em;
}

.auth-tab::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(155, 89, 182, 0.1);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: -1;
}

.auth-tab:hover {
    color: var(--text-secondary);
    transform: translateY(-1px);
}

.auth-tab:hover::before {
    transform: scaleX(1);
}

.auth-tab.active {
    color: var(--accent);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.8));
    box-shadow: 0 6px 16px rgba(155, 89, 182, 0.18);
    font-weight: 700;
    transform: translateY(-1px);
}

.auth-tab.active::before {
    opacity: 0;
    transform: scaleX(0);
}

.auth-tab.active:hover {
    color: var(--accent);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.8));
    box-shadow: 0 6px 16px rgba(155, 89, 182, 0.18);
    transform: translateY(-1px);
}

/* Auth alert messages */
.auth-alert {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 500;
    margin-bottom: 1rem;
    line-height: 1.45;
}

.auth-alert-error {
    background: var(--error-bg);
    color: var(--error);
    border: 1px solid #f5c6cb;
}

.auth-alert-success {
    background: #eaf7ec;
    color: #2d6a3f;
    border: 1px solid #b8dfc3;
}

/* Auth forms */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-size: 0.74rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-secondary);
}

.form-group input {
    width: 100%;
    padding: 13px 16px;
    font-size: 0.9rem;
    font-family: var(--font-body);
    border: 1.5px solid var(--border-light);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.form-group input:hover {
    border-color: rgba(155, 89, 182, 0.2);
    background: rgba(255, 255, 255, 0.95);
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.15), inset 0 2px 4px rgba(0, 0, 0, 0.02);
    background: rgba(255, 255, 255, 1);
    transform: translateY(-1px);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.auth-help {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: -4px;
}

.auth-link {
    background: none;
    border: none;
    padding: 0;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: color var(--transition), text-decoration-color var(--transition);
    text-decoration: none;
}

.auth-link:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.auth-btn {
    margin-top: 10px;
    width: 100%;
    min-height: 60px;
    padding: 12px 28px;
    font-size: 1.08rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    background: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 12px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 12px 24px rgba(155, 89, 182, 0.22), 0 4px 10px rgba(16, 24, 40, 0.12);
    position: relative;
    overflow: hidden;
}

.auth-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0));
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-btn:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    box-shadow: 0 16px 30px rgba(155, 89, 182, 0.3), 0 6px 14px rgba(16, 24, 40, 0.14);
    transform: translateY(-2px);
}

.auth-btn:active {
    transform: translateY(0);
    box-shadow: 0 10px 18px rgba(155, 89, 182, 0.22);
}

.auth-btn:hover::before {
    opacity: 1;
}

.auth-social-wrap {
    margin-top: 4px;
}

.auth-or-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 0.78rem;
    margin: 2px 0 4px;
}

.auth-or-divider::before,
.auth-or-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border-light);
}

.auth-form .auth-google-btn {
    appearance: none;
    -webkit-appearance: none;
    outline: none;
    margin-top: 10px;
    width: 100%;
    min-height: 46px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.92);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.94rem;
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition), background var(--transition);
}

.auth-form .auth-google-btn:hover {
    border-color: var(--accent-light);
    box-shadow: 0 8px 18px rgba(16, 24, 40, 0.08), 0 0 0 3px rgba(155, 89, 182, 0.08);
    background: #fff;
    transform: translateY(-1px);
}

.auth-form .auth-google-btn:focus-visible {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(109, 74, 255, 0.14);
}

.auth-form .auth-google-btn:active {
    transform: translateY(0);
}

.auth-form .auth-google-btn:disabled {
    opacity: 0.75;
    cursor: wait;
}

.auth-google-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.auth-google-label {
    line-height: 1;
}

/* Auth switch link */
.auth-switch {
    text-align: center;
    margin-top: 1.2rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.auth-switch a {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
    margin-left: 4px;
    transition: color var(--transition), text-decoration-color var(--transition);
}

.auth-switch a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* ============================================
   USER BAR (landing page top-right)
   ============================================ */
.landing-user-bar {
    position: absolute;
    top: 16px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 10;
    flex-wrap: wrap;
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    flex-shrink: 0;
    text-transform: uppercase;
}

.user-email-text {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 500;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.signout-link {
    background: transparent;
    border: 1px solid rgba(155, 89, 182, 0.22);
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    min-height: 36px;
    padding: 0.42rem 0.86rem;
    border-radius: 7px;
    transition: color var(--transition), background var(--transition), border-color var(--transition);
}

.signout-link:hover {
    color: var(--accent);
    background: var(--accent-bg);
    border-color: rgba(155, 89, 182, 0.34);
}

/* Top bar user & signout */
.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-user {
    font-size: 0.76rem;
    color: var(--text-muted);
    font-weight: 500;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.signout-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition), border-color var(--transition), background var(--transition);
}

.signout-btn:hover {
    color: var(--error);
    border-color: var(--error);
    background: var(--error-bg);
}

/* ============================================
   PHASE 1: LANDING
   ============================================ */
.landing {
    position: relative;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 0 0 2rem;
    /* Space for fixed authenticated nav (--pe-landing-nav-h matches nav footprint; tuned for wrapped rows). */
    --pe-landing-nav-h: clamp(4.25rem, 10vw + 2.85rem, 6.25rem);
    /* One frosted “card” recipe for every panel on #landing (compose, explore, support, results, sidebar). */
    --landing-card-frost: linear-gradient(
        155deg,
        rgba(255, 255, 255, 0.82) 0%,
        rgba(255, 255, 255, 0.5) 38%,
        rgba(252, 248, 255, 0.44) 100%
    );
    --landing-card-border: 1px solid rgba(255, 255, 255, 0.62);
    --landing-card-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.98),
        inset 0 -1px 0 rgba(24, 34, 54, 0.06),
        0 3px 8px rgba(24, 34, 54, 0.06),
        0 14px 32px rgba(24, 34, 54, 0.11),
        0 28px 56px rgba(24, 34, 54, 0.14),
        0 48px 96px rgba(155, 89, 182, 0.11),
        0 0 0 1px rgba(155, 89, 182, 0.07);
    --landing-card-blur: blur(80px) saturate(200%) brightness(1.02);
    padding-top: calc(env(safe-area-inset-top, 0px) + var(--pe-landing-nav-h));
    animation: landingIn 0.4s ease;
    background: linear-gradient(160deg, #fdf8ff 0%, #faf5f0 40%, #fff5f8 100%);
    /* Pin wash to the viewport so long pages keep the same backdrop while scrolling */
    background-attachment: fixed;
    overflow: visible;
}

/* Pinned top bar — stays on screen while the rest of landing scrolls. */
#landing > nav.fp-nav.fp-nav-authenticated {
    position: fixed;
    top: env(safe-area-inset-top, 0px);
    left: 0;
    right: 0;
    z-index: 200;
    width: 100%;
    box-sizing: border-box;
    /* Match landing card frosted language so the bar doesn’t read as a different surface */
    background: var(--landing-card-frost);
    border-bottom: var(--landing-card-border);
    box-shadow: var(--landing-card-shadow);
    -webkit-backdrop-filter: var(--landing-card-blur);
    backdrop-filter: var(--landing-card-blur);
}

.landing-layout {
    --landing-gutter: clamp(1rem, 3vw, 2.5rem);
    --sidebar-handle-gap: 16px;
    --sidebar-collapsed-width: 60px;
    flex: 1 1 auto;
    display: grid;
    width: 100%;
    max-width: none;
    box-sizing: border-box;
    /* First track matches fixed sidebar + spacer; keep max modest so main column isn’t pushed too far right */
    grid-template-columns: minmax(210px, 280px) minmax(0, 1fr);
    gap: clamp(0.65rem, 1.75vw, 1.15rem);
    padding: 0 var(--landing-gutter) 2rem;
    margin-top: 0;
    align-items: start;
    justify-items: stretch;
    min-height: calc(100vh - 120px);
}

/* Reserves column width when sidebar is position:fixed (desktop). Hidden on narrow layouts. */
.landing-sidebar-spacer {
    display: none;
}

.landing-sidebar {
    position: relative;
    z-index: 55;
    align-self: start;
}

.landing-sidebar-card {
    border-radius: 18px;
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 0;
    background: var(--landing-card-frost);
    border: var(--landing-card-border);
    box-shadow: var(--landing-card-shadow);
    -webkit-backdrop-filter: var(--landing-card-blur);
    backdrop-filter: var(--landing-card-blur);
    isolation: isolate;
    transform: translateZ(0);
    height: calc(100dvh - env(safe-area-inset-top, 0px) - var(--pe-landing-nav-h, 4.5rem) - 2rem);
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - var(--pe-landing-nav-h, 4.5rem) - 2rem);
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    transform-origin: left top;
    transition: padding 0.25s ease, box-shadow 0.25s ease;
}

.landing-sidebar-card-header {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    flex-shrink: 0;
    gap: 0;
}

.landing-sidebar-toolbar {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin-bottom: 12px;
}

.landing-sidebar-search-wrap {
    flex: 1;
    min-width: 0;
}

.landing-sidebar-search-input {
    width: 100%;
    min-height: 34px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0 10px;
    font-size: 0.82rem;
    color: var(--text);
    background: rgba(255, 255, 255, 0.95);
}

.landing-sidebar-search-input::placeholder {
    color: var(--text-muted);
}

.landing-sidebar-search-input:focus {
    outline: none;
    border-color: var(--accent-light);
    box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.08);
}

.landing-layout.sidebar-collapsed .landing-sidebar-toolbar {
    margin-bottom: 0;
    justify-content: center;
}

.landing-layout.sidebar-collapsed .landing-sidebar-search-wrap {
    display: none;
}

.landing-sidebar-card-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    min-height: 0;
    min-width: 0;
    overflow-x: hidden;
}

.landing-sidebar-collapsed-btn {
    display: none;
    align-self: center;
    box-sizing: border-box;
    width: var(--rail-hit, 40px);
    height: var(--rail-hit, 40px);
    min-width: var(--rail-hit, 40px);
    min-height: var(--rail-hit, 40px);
    border-radius: 12px;
    border: 1px solid var(--accent-light);
    background: rgba(255, 255, 255, 0.92);
    color: var(--accent);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: none;
    flex-shrink: 0;
    transition: box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.landing-sidebar-collapsed-btn:hover {
    box-shadow: var(--shadow);
    background: var(--accent-bg);
    border-color: var(--accent);
    color: var(--accent);
}

/*
 * Collapsed nav icons: filled gradient only when JS sets data-primary-accent to compose-nav / explore-nav
 * (never at the same time as history chip, support, or review — see syncLandingPrimaryAccent).
 */
#landing[data-primary-accent="compose-nav"] .landing-layout.sidebar-collapsed #landing-sidebar-analyze-collapsed,
#landing[data-primary-accent="explore-nav"] .landing-layout.sidebar-collapsed #landing-sidebar-explore-collapsed {
    background: var(--gradient-main);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.35);
    box-shadow: var(--shadow-sm);
}

#landing[data-primary-accent="compose-nav"] .landing-layout.sidebar-collapsed #landing-sidebar-analyze-collapsed:hover,
#landing[data-primary-accent="explore-nav"] .landing-layout.sidebar-collapsed #landing-sidebar-explore-collapsed:hover {
    background: var(--gradient-main);
    border-color: rgba(255, 255, 255, 0.35);
    color: #fff;
    box-shadow: var(--shadow-sm);
    transform: none;
}

.landing-sidebar-collapsed-btn svg {
    width: 18px;
    height: 18px;
}

.landing-sidebar-action {
    width: 100%;
    min-height: 44px;
    padding: 10px 16px;
    margin: 0 0 8px;
    border-radius: 12px;
    border: 1px solid transparent;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font-body);
    letter-spacing: 0.01em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.landing-sidebar-action:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.landing-sidebar-action-icon {
    width: 18px;
    height: 18px;
    display: none;
}

.landing-sidebar-action.variant-pill {
    background: var(--gradient-main);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.25);
}

.landing-sidebar-action.variant-pill .landing-sidebar-action-icon {
    display: inline-flex;
}

.landing-sidebar-action.variant-pill:hover {
    background: var(--gradient-main);
    transform: none;
}

.landing-sidebar-action.variant-outline {
    background: rgba(255, 255, 255, 0.92);
    color: var(--accent);
    border-color: var(--accent-light);
    box-shadow: none;
}

.landing-sidebar-action.variant-outline:hover {
    background: var(--accent-bg);
    border-color: var(--accent);
}

.landing-sidebar-action.variant-icon {
    width: 44px;
    min-height: 44px;
    padding: 0;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--accent);
    border-color: var(--accent-light);
    justify-content: center;
    gap: 0;
    align-self: flex-start;
}

.landing-sidebar-action.variant-icon .landing-sidebar-action-icon {
    display: inline-flex;
}

.landing-layout.sidebar-collapsed .landing-sidebar-collapsed-btn {
    display: inline-flex;
}

.landing-layout.sidebar-collapsed .landing-sidebar-card-header {
    gap: 8px;
    align-items: center;
    justify-content: flex-start;
    flex-direction: column;
}

.landing-layout.sidebar-collapsed .landing-sidebar-card-body {
    display: none;
}

.landing-layout.sidebar-collapsed .landing-sidebar-card {
    /*
     * Viewport height only: the grid row can be taller than the screen (main column),
     * so never use height: 100% of the stretched sidebar track.
     */
    --landing-sidebar-card-vh: calc(
        100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) -
            var(--pe-landing-nav-h, 4.5rem) - 2rem
    );
    /*
     * Collapsed rail geometry: 60px track − 6px horizontal padding each side = 48px
     * inner. All hit targets use the same --rail-hit so icons stay aligned and
     * never overflow the frosted card (overflow:hidden clips hover lifts).
     */
    --rail-pad-x: 6px;
    --rail-inner: calc(var(--sidebar-collapsed-width) - 2 * var(--rail-pad-x));
    --rail-hit: min(40px, var(--rail-inner));
    height: var(--landing-sidebar-card-vh);
    max-height: var(--landing-sidebar-card-vh);
    min-height: 0;
    overflow: hidden;
    /* Tighter inset than expanded rail so 40×40 controls breathe in the 60px track */
    padding: 10px var(--rail-pad-x) 12px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.landing-sidebar-card-footer {
    flex-shrink: 0;
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid var(--border-light);
    min-width: 0;
    overflow-x: hidden;
}

.landing-sidebar-footer-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    min-width: 0;
}

.landing-sidebar-support-btn {
    width: 100%;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 38px;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid var(--accent-light);
    background: rgba(255, 255, 255, 0.95);
    color: var(--accent);
    font-size: 0.88rem;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition), background var(--transition);
    min-width: 0;
    overflow: hidden;
}

.landing-sidebar-support-btn:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
    background: var(--accent-bg);
}

.landing-sidebar-support-icon {
    flex-shrink: 0;
}

.landing-sidebar-review-btn {
    min-height: 38px;
    padding-inline: 10px;
    font-size: 0.82rem;
    letter-spacing: 0.01em;
    border-color: rgba(155, 89, 182, 0.32);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(252, 247, 255, 0.92));
}

.landing-sidebar-support-btn span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.landing-sidebar-review-btn .landing-sidebar-support-icon {
    width: 16px;
    height: 16px;
}

.landing-sidebar-review-btn:hover {
    border-color: rgba(155, 89, 182, 0.55);
    background: rgba(255, 255, 255, 0.98);
}

.landing-layout.sidebar-collapsed .landing-sidebar-card-footer {
    display: block;
    margin-top: 8px;
    padding-top: 6px;
    border-top: none;
}

.landing-layout.sidebar-collapsed .landing-sidebar-footer-actions {
    grid-template-columns: 1fr;
    gap: 6px;
    justify-items: center;
}

.landing-layout.sidebar-collapsed .landing-sidebar-support-btn {
    box-sizing: border-box;
    width: var(--rail-hit, 40px);
    min-width: var(--rail-hit, 40px);
    min-height: var(--rail-hit, 40px);
    height: var(--rail-hit, 40px);
    padding: 0;
    border-radius: 12px;
    gap: 0;
    /* Default overflow:hidden clips headphone paths at the viewBox edge in a 40×40 hit target */
    overflow: visible;
}

.landing-layout.sidebar-collapsed .landing-sidebar-support-btn:hover {
    transform: none;
}

.landing-layout.sidebar-collapsed .landing-sidebar-support-btn span {
    display: none;
}

.landing-layout.sidebar-collapsed .landing-sidebar-support-icon {
    width: 20px;
    height: 20px;
    display: block;
}

.landing-layout.sidebar-collapsed .landing-sidebar-review-btn .landing-sidebar-support-icon {
    width: 18px;
    height: 18px;
}

/* Support + Review: gradient only when they are the sole primary accent */
#landing[data-primary-accent="support"] #landing-support-btn,
#landing[data-primary-accent="review"] #landing-review-btn.landing-sidebar-review-btn {
    background: var(--gradient-main);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.35);
    box-shadow: var(--shadow-sm);
}

#landing[data-primary-accent="support"] #landing-support-btn:hover,
#landing[data-primary-accent="review"] #landing-review-btn.landing-sidebar-review-btn:hover {
    background: var(--gradient-main);
    border-color: rgba(255, 255, 255, 0.35);
    color: #fff;
    box-shadow: var(--shadow-sm);
    transform: none;
}

#landing[data-primary-accent="support"] #landing-support-btn .landing-sidebar-support-icon,
#landing[data-primary-accent="review"] #landing-review-btn .landing-sidebar-support-icon {
    color: inherit;
}

/* Collapsed-only: divider + history chip rail (hidden when sidebar expanded) */
.landing-sidebar-collapsed-rail {
    display: none;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    align-items: stretch;
    gap: 0;
    margin-top: 0;
    /* Same space above and below the divider line (between nav icons and history) */
    padding-top: 8px;
}

.landing-layout.sidebar-collapsed .landing-sidebar-collapsed-rail {
    display: flex;
}

.landing-sidebar-collapsed-divider {
    flex-shrink: 0;
    width: 100%;
    height: 1px;
    border: 0;
    margin: 0 0 8px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(155, 89, 182, 0.28) 35%,
        rgba(155, 89, 182, 0.28) 65%,
        transparent 100%
    );
}

.landing-sidebar-collapsed-history-shell {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    position: relative;
}

.landing-sidebar-collapsed-history-scroll {
    flex: 1 1 auto;
    min-height: 48px;
    max-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 2px 0 2px;
    scrollbar-width: thin;
}

.landing-sidebar-collapsed-history-scroll::-webkit-scrollbar {
    width: 4px;
}

.landing-sidebar-collapsed-history-scroll::-webkit-scrollbar-thumb {
    background: rgba(155, 89, 182, 0.25);
    border-radius: 4px;
}

.landing-history-collapsed-chip {
    flex-shrink: 0;
    position: relative;
    box-sizing: border-box;
    width: var(--rail-hit, 40px);
    height: var(--rail-hit, 40px);
    min-width: var(--rail-hit, 40px);
    min-height: var(--rail-hit, 40px);
    padding: 0;
    border: 1px solid var(--accent-light);
    border-radius: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(
        145deg,
        rgba(255, 255, 255, 0.9) 0%,
        rgba(252, 248, 255, 0.72) 100%
    );
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.92),
        0 1px 3px rgba(24, 34, 54, 0.08);
    transition: box-shadow 0.2s ease, border-color 0.2s ease, filter 0.2s ease;
}

.landing-history-collapsed-chip__num {
    font-family: var(--font-body);
    font-variant-numeric: tabular-nums;
    font-weight: 800;
    font-size: clamp(0.78rem, 2.6vw, 0.95rem);
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--accent-hover);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.85);
    pointer-events: none;
    user-select: none;
}

.landing-history-collapsed-chip--double .landing-history-collapsed-chip__num {
    font-size: clamp(0.68rem, 2.2vw, 0.82rem);
    letter-spacing: -0.04em;
}

.landing-history-collapsed-chip:hover {
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 1),
        0 2px 10px rgba(155, 89, 182, 0.14);
    border-color: var(--accent);
    filter: brightness(1.03);
}

.landing-history-collapsed-chip--tone-0 {
    background: linear-gradient(145deg, rgba(248, 242, 255, 0.96) 0%, rgba(232, 220, 255, 0.88) 100%);
    border-color: rgba(155, 89, 182, 0.32);
}

.landing-history-collapsed-chip--tone-1 {
    background: linear-gradient(145deg, rgba(255, 248, 245, 0.96) 0%, rgba(255, 228, 235, 0.84) 100%);
    border-color: rgba(200, 120, 140, 0.32);
}

.landing-history-collapsed-chip--tone-2 {
    background: linear-gradient(145deg, rgba(244, 252, 248, 0.96) 0%, rgba(220, 245, 235, 0.86) 100%);
    border-color: rgba(90, 160, 130, 0.3);
}

.landing-history-collapsed-chip--tone-3 {
    background: linear-gradient(145deg, rgba(242, 248, 255, 0.96) 0%, rgba(218, 232, 255, 0.88) 100%);
    border-color: rgba(100, 130, 200, 0.32);
}

.landing-history-collapsed-chip--empty {
    cursor: default;
    min-height: var(--rail-hit, 40px);
    height: var(--rail-hit, 40px);
    min-width: var(--rail-hit, 40px);
    width: var(--rail-hit, 40px);
    border-style: dashed;
    border-color: var(--accent-light);
    background: rgba(255, 255, 255, 0.38);
    box-shadow: none;
    filter: none;
}

.landing-history-collapsed-chip--empty .landing-history-collapsed-chip__num {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-muted);
    text-shadow: none;
}

.landing-history-collapsed-chip--empty:hover {
    transform: none;
    box-shadow: none;
    filter: none;
}

/* Active: inset ring; tone gradient stays visible unless history is primary accent */
.landing-layout.sidebar-collapsed .landing-history-collapsed-chip.is-active {
    box-shadow: inset 0 0 0 2px rgba(155, 89, 182, 0.72), 0 1px 3px rgba(24, 34, 54, 0.08);
    border-color: var(--accent);
}

.landing-layout.sidebar-collapsed .landing-history-collapsed-chip.is-active:hover {
    transform: none;
    box-shadow: inset 0 0 0 2px rgba(155, 89, 182, 0.72), 0 1px 3px rgba(24, 34, 54, 0.08);
    border-color: var(--accent);
    filter: brightness(1.03);
}

#landing[data-primary-accent="history"] .landing-layout.sidebar-collapsed .landing-history-collapsed-chip.is-active {
    background: var(--gradient-main);
    border-color: rgba(255, 255, 255, 0.35);
    box-shadow: var(--shadow-sm);
}

#landing[data-primary-accent="history"] .landing-layout.sidebar-collapsed .landing-history-collapsed-chip.is-active .landing-history-collapsed-chip__num {
    color: #fff;
    text-shadow: 0 1px 2px rgba(24, 34, 54, 0.35);
}

#landing[data-primary-accent="history"] .landing-layout.sidebar-collapsed .landing-history-collapsed-chip.is-active:hover {
    background: var(--gradient-main);
    border-color: rgba(255, 255, 255, 0.35);
    box-shadow: var(--shadow-sm);
    transform: none;
    filter: none;
}

/* Collapsed rail: no translateY — parent uses overflow:hidden and clips shadows */
.landing-layout.sidebar-collapsed .landing-sidebar-collapsed-btn:hover {
    transform: none;
}

.landing-sidebar-collapsed-history-more {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 0 2px;
    pointer-events: none;
}

.landing-sidebar-collapsed-history-more-dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: rgba(86, 44, 120, 0.45);
}

.landing-sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.landing-sidebar-title {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.landing-sidebar-toggle {
    position: relative;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid var(--border-light);
    background: rgba(255, 255, 255, 0.92);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
    transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.landing-sidebar-toggle:hover {
    border-color: var(--accent-light);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

/* Collapsed: match nav icon hit target to the rail so the handle lines up */
.landing-layout.sidebar-collapsed .landing-sidebar-toggle {
    width: var(--rail-hit, 40px);
    height: var(--rail-hit, 40px);
    min-width: var(--rail-hit, 40px);
    min-height: var(--rail-hit, 40px);
    border-radius: 12px;
    box-sizing: border-box;
}

.landing-layout.sidebar-collapsed .landing-sidebar-toggle:hover {
    transform: none;
}

.landing-sidebar-divider {
    height: 1px;
    background: var(--border-light);
    margin: 6px 0 2px;
}

.sidebar-handle-bars {
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-handle-bars span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.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;
}

.landing-layout.sidebar-collapsed {
    grid-template-columns: var(--sidebar-collapsed-width) minmax(0, 1fr);
    column-gap: var(--sidebar-handle-gap);
}

/* Wide screens: pin sidebar to viewport (same idea as fixed nav). Spacer holds grid column width. */
@media (min-width: 1025px) {
    #landing.landing .landing-layout {
        /* Rail width drives both spacer + fixed sidebar; auto column avoids a “phantom” 280px track */
        --landing-sidebar-track: clamp(200px, 19vw, 268px);
        --landing-gutter: clamp(0.5rem, 1vw, 0.9rem);
        grid-template-columns: auto minmax(0, 1fr);
        /* Same horizontal rhythm as outer padding (--landing-gutter on the right) */
        column-gap: var(--landing-gutter);
        align-items: stretch;
    }

    /*
     * Collapsed rail: must win over the rule above (#landing beats .landing-layout specificity).
     */
    #landing.landing .landing-layout.sidebar-collapsed {
        grid-template-columns: var(--sidebar-collapsed-width) minmax(0, 1fr);
        column-gap: var(--sidebar-handle-gap);
    }

    #landing.landing .landing-sidebar-spacer {
        display: block;
        visibility: hidden;
        grid-column: 1;
        grid-row: 1;
        width: var(--landing-sidebar-track);
        box-sizing: border-box;
        min-height: 40vh;
        align-self: stretch;
        justify-self: stretch;
        pointer-events: none;
    }

    #landing.landing .landing-sidebar {
        position: fixed;
        grid-column: 1;
        grid-row: 1;
        justify-self: start;
        box-sizing: border-box;
        top: calc(env(safe-area-inset-top, 0px) + var(--pe-landing-nav-h) + 12px);
        bottom: max(14px, env(safe-area-inset-bottom, 0px));
        left: max(env(safe-area-inset-left, 0px), var(--landing-gutter));
        width: var(--landing-sidebar-track);
        z-index: 60;
        display: flex;
        flex-direction: column;
        min-height: 0;
        align-self: auto;
        height: auto;
    }

    html[dir="rtl"] #landing.landing .landing-sidebar {
        left: auto;
        right: max(env(safe-area-inset-right, 0px), var(--landing-gutter));
    }

    #landing.landing .landing-main-column {
        grid-column: 2;
        grid-row: 1;
        min-width: 0;
        width: 100%;
        max-width: none;
        justify-self: stretch;
    }

    #landing.landing .landing-sidebar-card {
        flex: 1 1 auto;
        min-height: 0;
        height: auto;
        max-height: none;
        /* Trim horizontal inset so frosted chrome doesn’t read as empty space beside main column */
        padding: 13px 12px 15px;
    }

    #landing.landing .landing-layout.sidebar-collapsed .landing-sidebar-spacer {
        width: var(--sidebar-collapsed-width);
        max-width: var(--sidebar-collapsed-width);
    }

    #landing.landing .landing-layout.sidebar-collapsed .landing-sidebar {
        width: var(--sidebar-collapsed-width);
        max-width: var(--sidebar-collapsed-width);
    }

    /*
     * Collapsed card on wide screens: #landing .landing-sidebar-card padding would
     * otherwise win (12px inset) and squeeze 40px controls inside 36px — icons
     * overflow. Force the same rail math as the global collapsed rules.
     */
    #landing.landing .landing-layout.sidebar-collapsed .landing-sidebar-card {
        --rail-pad-x: 6px;
        --rail-inner: calc(var(--sidebar-collapsed-width) - 2 * var(--rail-pad-x));
        --rail-hit: min(40px, var(--rail-inner));
        padding: 10px var(--rail-pad-x) 12px;
    }
}

.landing-history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Sidebar history rows: calmer cards, readable title + meta */
.landing-history-list .drawer-item {
    padding: 12px 12px 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.42);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.65) inset;
    gap: 8px;
    align-items: stretch;
}

.landing-history-list .drawer-item:hover {
    background: rgba(255, 255, 255, 0.72);
    border-color: rgba(155, 89, 182, 0.28);
}

.landing-history-list .drawer-item.active {
    border-color: rgba(155, 89, 182, 0.55);
    background: rgba(252, 245, 255, 0.92);
    box-shadow: inset 0 0 0 1px rgba(155, 89, 182, 0.2);
}

.landing-history-list .drawer-item.active:hover {
    background: rgba(252, 245, 255, 0.92);
    border-color: rgba(155, 89, 182, 0.55);
    box-shadow: inset 0 0 0 1px rgba(155, 89, 182, 0.2);
}

.landing-history-list .drawer-item-title {
    font-size: 0.84rem;
    font-weight: 650;
    line-height: 1.35;
    white-space: normal;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    margin-bottom: 6px;
}

.landing-history-list .drawer-item-meta {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 6px 8px;
    min-width: 0;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.landing-history-list .drawer-item-dateline {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
    opacity: 0.92;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.landing-history-list .drawer-item-lang {
    flex-shrink: 0;
    font-size: 0.62rem;
    padding: 2px 8px;
    border-radius: 999px;
}

.landing-history-list .drawer-item-meta .drawer-item-pin,
.landing-history-list .drawer-item-meta .drawer-item-delete {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    margin: 0;
    opacity: 1;
}

.landing-history-list .drawer-item-meta .drawer-item-pin {
    font-size: 0.76rem;
    line-height: 1;
}

.landing-history-list .drawer-item-meta .drawer-item-pin:not(:hover) {
    opacity: 0.82;
}

.landing-history-list .drawer-item.pinned .drawer-item-meta .drawer-item-pin {
    opacity: 1;
}

/* Floating background elements for login page - matching home page style */

.landing::before {
    content: '';
    position: fixed;
    width: 500px;
    height: 500px;
    background: var(--grad-1);
    border-radius: 50%;
    top: -120px;
    right: -100px;
    left: auto;
    bottom: auto;
    opacity: 0.25;
    animation: fpFloat 20s ease-in-out infinite;
    z-index: 0;
    pointer-events: none;
}

.landing::after {
    content: '';
    position: fixed;
    width: 350px;
    height: 350px;
    background: var(--grad-2);
    border-radius: 50%;
    /* Viewport-relative so the wash doesn’t “slide” when #landing grows taller */
    bottom: max(8vh, 32px);
    left: -80px;
    top: auto;
    right: auto;
    opacity: 0.25;
    animation: fpFloat 25s ease-in-out infinite reverse;
    z-index: 0;
    pointer-events: none;
}

.landing-inner::before {
    content: '';
    position: absolute;
    width: 250px;
    height: 250px;
    background: var(--grad-3);
    border-radius: 50%;
    top: 50%;
    right: 20%;
    opacity: 0.25;
    animation: fpFloat 18s ease-in-out infinite 3s;
    z-index: 0;
    pointer-events: none;
}

.landing-inner::after {
    content: '';
    position: absolute;
    width: 600px;
    height: 400px;
    background: var(--gradient-full);
    border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
    top: 15%;
    left: 10%;
    opacity: 0.2;
    animation: fpMorph 30s ease-in-out infinite;
    z-index: 0;
    pointer-events: none;
}

/* Second blob for login page background */
.landing-brand::before {
    content: '';
    position: absolute;
    width: 400px;
    height: 300px;
    background: var(--gradient-warm);
    border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
    bottom: 5%;
    right: 5%;
    opacity: 0.2;
    animation: fpMorph 25s ease-in-out infinite reverse;
    z-index: 0;
    pointer-events: none;
}

@keyframes landingIn {
    /* Avoid transform here: non-none transform on an ancestor breaks viewport-fixed pinning (sidebar / nav quirks). */
    from { opacity: 0; }
    to { opacity: 1; }
}

.landing-inner {
    width: 100%;
    max-width: none;
    margin: 0;
    position: relative;
    z-index: 10;
    background: var(--landing-card-frost);
    border: var(--landing-card-border);
    border-radius: 20px;
    box-shadow: var(--landing-card-shadow);
    -webkit-backdrop-filter: var(--landing-card-blur);
    backdrop-filter: var(--landing-card-blur);
    isolation: isolate;
    transform: translateZ(0);
    padding: clamp(1rem, 2.4vw, 1.5rem);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Main column: compose card + analysis grid below (same landing chrome) */
.landing-main-column {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: clamp(1rem, 2.4vw, 1.5rem);
    min-width: 0;
    width: 100%;
    max-width: none;
}

/* Compose + Explore: full width of the main column; do not flex-grow to viewport/sidebar height
   (that caused empty vertical space + spurious scroll with inner decorative layers). */
#landing-compose.landing-inner,
#landing-explore.landing-inner {
    flex: 0 0 auto;
    width: 100%;
    max-width: none;
    min-width: 0;
    align-self: stretch;
    box-sizing: border-box;
    overflow-x: hidden;
    overflow-y: visible;
}

/* Decorative blobs can extend past short cards; hide on compose like explore (avoids micro-scroll). */
#landing-compose.landing-inner::before,
#landing-compose.landing-inner::after {
    display: none;
}

/*
 * Compose-only: stretch the card to remaining viewport height so the poem area
 * scales with the window (not a fixed content-height block).
 */
.landing-main-column:has(#landing-compose:not(.hidden)) {
    min-height: max(
        0px,
        calc(
            100dvh - env(safe-area-inset-top, 0px) - var(--pe-landing-nav-h, 4.5rem) -
                env(safe-area-inset-bottom, 0px) - 3.5rem
        )
    );
}

.landing-main-column:has(#landing-compose:not(.hidden)) #landing-compose.landing-inner {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.landing-main-column:has(#landing-compose:not(.hidden)) #landing-compose .landing-form {
    flex: 1 1 auto;
    min-height: 0;
}

.landing-main-column:has(#landing-compose:not(.hidden)) #landing-compose #poetry-text {
    flex: 1 1 auto;
    min-height: clamp(8.5rem, 18dvh, 14rem);
}

.landing-main-column:has(.landing-results:not(.hidden)) {
    gap: clamp(1.1rem, 2.8vw, 1.75rem);
}

.landing-results {
    width: 100%;
    min-width: 0;
    border-radius: 20px;
    border: var(--landing-card-border);
    background: var(--landing-card-frost);
    box-shadow: var(--landing-card-shadow);
    -webkit-backdrop-filter: var(--landing-card-blur);
    backdrop-filter: var(--landing-card-blur);
    overflow: hidden;
    scroll-margin-top: 88px;
    animation: landingResultsReveal 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}

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

.landing-results-header {
    padding: 18px 20px 16px;
    border-bottom: 1px solid rgba(24, 34, 54, 0.07);
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.55) 0%,
        rgba(255, 255, 255, 0.12) 100%
    );
}

.landing-results-head-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.landing-results-title {
    margin: 0 0 6px;
    font-size: clamp(1.05rem, 2.4vw, 1.22rem);
    font-weight: 750;
    letter-spacing: -0.03em;
    color: var(--text);
    line-height: 1.2;
}

.landing-results-back-btn {
    border: 1px solid rgba(155, 89, 182, 0.22);
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.78),
        rgba(255, 255, 255, 0.45)
    );
    color: var(--accent);
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.95),
        0 1px 2px rgba(24, 34, 54, 0.05),
        0 4px 12px rgba(155, 89, 182, 0.08);
    -webkit-backdrop-filter: blur(8px) saturate(160%);
    backdrop-filter: blur(8px) saturate(160%);
    transition:
        background var(--transition),
        border-color var(--transition),
        box-shadow var(--transition),
        transform var(--transition);
}

.landing-results-back-btn:hover {
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.92),
        var(--accent-bg)
    );
    border-color: var(--accent);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 1),
        0 2px 4px rgba(24, 34, 54, 0.05),
        0 8px 18px rgba(155, 89, 182, 0.14);
    transform: translateY(-1px);
}

/* Blog visibility + link (below analysis header, not in global nav) */
.landing-blog-toolbar {
    padding: 12px 20px 16px;
}

.landing-results #settings-dropdown.landing-blog-toolbar-inner {
    position: static;
    top: auto;
    right: auto;
    width: auto;
    max-width: none;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    z-index: auto;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 16px 24px;
    animation: none;
}

.landing-blog-toolbar .settings-section {
    padding: 0;
    flex: 1 1 240px;
    min-width: min(100%, 200px);
}

.landing-blog-toolbar .settings-section + .settings-section {
    border-top: none;
}

/* Narrative layout: poem | translation → explanation → dictionary → poet | themes */
.landing-results .landing-dashboard-grid {
    flex: none;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
        "poetry translation"
        "explanation explanation"
        "dictionary dictionary"
        "poet themes";
    grid-template-rows: auto;
    grid-auto-rows: minmax(min-content, auto);
    align-content: start;
    min-height: 0;
    max-width: 100%;
    gap: 14px;
    padding: 14px 14px 18px;
}

.landing-results .landing-dashboard-grid > #tile-poetry {
    grid-area: poetry;
    min-height: 0;
}

.landing-results .landing-dashboard-grid > #tile-translation {
    grid-area: translation;
    min-height: 0;
}

.landing-results .landing-dashboard-grid > #tile-explanation {
    grid-area: explanation;
}

.landing-results .landing-dashboard-grid > #tile-dictionary {
    grid-area: dictionary;
}

.landing-results .landing-dashboard-grid > #tile-poet-context {
    grid-area: poet;
}

.landing-results .landing-dashboard-grid > #tile-themes {
    grid-area: themes;
}

html[dir="rtl"] .landing-results .landing-dashboard-grid {
    grid-template-areas:
        "translation poetry"
        "explanation explanation"
        "dictionary dictionary"
        "themes poet";
}

/* When the sidebar is collapsed there's enough horizontal room to lay the
   six analysis tiles out as a true 3-column dashboard (poetry / translation
   / explanation on top, dictionary / poet / themes on the bottom). This
   matches the wide-screen reading layout shown in the design mock and gives
   the eye three parallel "columns of thought" instead of stacked rows.

   Only apply at viewports that can actually fit three readable columns. */
@media (min-width: 900px) {
    .landing-layout.sidebar-collapsed .landing-results .landing-dashboard-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        grid-template-areas:
            "poetry translation explanation"
            "dictionary poet themes";
    }

    html[dir="rtl"] .landing-layout.sidebar-collapsed .landing-results .landing-dashboard-grid {
        grid-template-areas:
            "explanation translation poetry"
            "themes poet dictionary";
    }
}

/* Tiles inside the results panel inherit the global liquid-glass treatment;
   only layout-specific tweaks live here. */
/* Cap the analysis tiles so each box shows ~10 lines and scrolls within
   itself instead of the whole grid stretching to the longest content.
   Poetry/translation use line-height 1.9 (≈30px/line) and explanation
   uses line-height 1.72 (≈26px/line); 300px ≈ 10 lines for both. */
.landing-results .tile-body {
    overflow-y: auto;
    overflow-x: hidden;
    max-height: clamp(260px, 32vh, 320px);
    scrollbar-width: thin;
    scrollbar-color: rgba(155, 89, 182, 0.25) transparent;
}

.landing-results .tile-body::-webkit-scrollbar { width: 6px; }
.landing-results .tile-body::-webkit-scrollbar-track { background: transparent; }
.landing-results .tile-body::-webkit-scrollbar-thumb {
    background: rgba(155, 89, 182, 0.25);
    border-radius: 6px;
}
.landing-results .tile-body::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

.landing-results #explanation-text {
    max-width: min(72ch, 100%);
    margin-inline: 0;
}

.landing-results .poetry-block {
    font-size: 0.98rem;
    line-height: 1.9;
}

.landing-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    position: relative;
}

.landing-icon {
    width: 32px;
    height: 32px;
    color: var(--accent);
}

.landing-brand h1 {
    font-size: clamp(1.3rem, 3vw, 1.8rem);
    font-weight: 700;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.landing-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.landing-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.landing-form textarea {
    width: 100%;
    padding: 14px 16px;
    font-family: var(--font-poetry);
    font-size: 1.05rem;
    line-height: 1.8;
    border: 1.5px solid var(--border-light);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.8);
    color: var(--text);
    resize: vertical;
    /* Default when not in flex stretch context (#landing-compose compose-only rules above win there) */
    min-height: clamp(8.75rem, 22dvh, 15rem);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.landing-form textarea:hover {
    border-color: rgba(155, 89, 182, 0.2);
    background: rgba(255, 255, 255, 0.95);
}

.landing-form textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.15), inset 0 2px 4px rgba(0, 0, 0, 0.02);
    background: rgba(255, 255, 255, 1);
}

.landing-form textarea::placeholder { color: var(--text-muted); }

#landing-explore.landing-inner {
    background: var(--landing-card-frost);
    border: var(--landing-card-border);
    box-shadow: var(--landing-card-shadow);
    -webkit-backdrop-filter: var(--landing-card-blur);
    backdrop-filter: var(--landing-card-blur);
}

#landing-explore.landing-inner::before,
#landing-explore.landing-inner::after {
    opacity: 0;
    display: none;
}

#landing-explore .landing-subtitle,
#landing-explore .explore-filter-group label,
#landing-explore .explore-poetry-item-snippet,
#landing-explore .explore-poetry-item-tags {
    color: rgba(24, 34, 54, 0.78);
}

.explore-poetry-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 14px;
    padding: clamp(0.85rem, 1.8vw, 1.1rem);
    border-radius: 14px;
    border: 1px solid rgba(155, 89, 182, 0.14);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(255, 255, 255, 0.72) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.9),
        0 1px 3px rgba(24, 34, 54, 0.04);
}

.explore-filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.explore-filter-group--search {
    grid-column: 1 / -1;
}

.explore-filter-group label {
    font-size: 0.66rem;
    font-weight: 750;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(86, 44, 120, 0.72);
    padding-left: 2px;
}

.explore-filter-group input,
.explore-filter-group select {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1.5px solid rgba(155, 89, 182, 0.18);
    background: rgba(255, 255, 255, 0.95);
    color: var(--text);
    font-size: 0.88rem;
    font-family: var(--font-body);
    box-shadow: inset 0 1px 2px rgba(16, 24, 40, 0.04);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.explore-filter-group--search input {
    padding-left: 42px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%239b59b6' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4.3-4.3'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 14px center;
    background-size: 18px 18px;
}

.explore-filter-group select {
    appearance: none;
    padding-right: 36px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='%238b6fa8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.explore-filter-group input:hover,
.explore-filter-group select:hover {
    border-color: rgba(155, 89, 182, 0.28);
    background: #fff;
}

.explore-filter-group input:focus,
.explore-filter-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow:
        0 0 0 3px rgba(155, 89, 182, 0.14),
        inset 0 1px 2px rgba(16, 24, 40, 0.04);
    background: #fff;
}

.explore-poetry-list {
    margin-top: clamp(1rem, 2vw, 1.35rem);
    padding-top: clamp(0.85rem, 1.6vw, 1.1rem);
    border-top: 1px solid rgba(155, 89, 182, 0.12);
    display: grid;
    gap: 10px;
    max-height: none;
    overflow: visible;
    padding-right: 2px;
}

.explore-poetry-item {
    width: 100%;
    text-align: left;
    display: block;
    text-decoration: none;
    color: inherit;
    border: 1px solid rgba(155, 89, 182, 0.16);
    border-radius: 14px;
    padding: 14px 14px 14px 16px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(252, 248, 255, 0.92) 100%);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.85) inset;
    transition: transform 0.16s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    cursor: pointer;
    border-left: 3px solid transparent;
}

.explore-poetry-item:hover {
    transform: translateY(-2px);
    border-color: rgba(155, 89, 182, 0.32);
    border-left-color: var(--accent);
    box-shadow:
        0 10px 26px rgba(155, 89, 182, 0.14),
        0 1px 0 rgba(255, 255, 255, 0.9) inset;
    background: linear-gradient(135deg, #fff 0%, rgba(252, 247, 255, 0.98) 100%);
}

.explore-poetry-item.is-disabled {
    opacity: 0.55;
    cursor: default;
    transform: none;
    box-shadow: none;
}

.explore-poetry-item-title {
    font-size: 0.94rem;
    font-weight: 750;
    color: var(--text);
    line-height: 1.35;
    letter-spacing: -0.01em;
}

.explore-poetry-item-snippet {
    margin-top: 4px;
    font-size: 0.83rem;
    color: rgba(24, 34, 54, 0.68);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.explore-poetry-item-meta {
    margin-top: 8px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: rgba(86, 44, 120, 0.72);
}

.explore-poetry-item-tags {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 8px;
    align-items: center;
}

.explore-tag {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    max-width: 100%;
    padding: 4px 9px 5px;
    border-radius: 999px;
    font-size: 0.68rem;
    line-height: 1.25;
    border: 1px solid rgba(155, 89, 182, 0.2);
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset;
}

.explore-tag__lab {
    font-weight: 750;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-size: 0.58rem;
    color: rgba(86, 44, 120, 0.62);
    flex-shrink: 0;
}

.explore-tag__val {
    font-weight: 650;
    color: rgba(24, 34, 54, 0.88);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.explore-tag--poet {
    border-color: rgba(155, 89, 182, 0.35);
    background: linear-gradient(135deg, rgba(252, 247, 255, 0.98), rgba(248, 252, 255, 0.92));
}

.explore-tag--country {
    border-color: rgba(52, 152, 219, 0.28);
    background: linear-gradient(135deg, rgba(240, 249, 255, 0.95), rgba(255, 255, 255, 0.9));
}

.explore-tag--form {
    border-color: rgba(241, 196, 15, 0.35);
    background: linear-gradient(135deg, rgba(255, 251, 235, 0.96), rgba(255, 255, 255, 0.9));
}

.explore-tag--lang {
    border-color: rgba(46, 204, 113, 0.28);
    background: linear-gradient(135deg, rgba(236, 255, 244, 0.95), rgba(255, 255, 255, 0.9));
}

.explore-tag--explain {
    border-color: rgba(155, 89, 182, 0.28);
    background: linear-gradient(135deg, rgba(255, 245, 252, 0.96), rgba(252, 248, 255, 0.92));
}

.explore-tag--date {
    border-color: rgba(149, 165, 166, 0.35);
    background: rgba(248, 249, 250, 0.95);
}

.explore-tag--muted {
    border-style: dashed;
    opacity: 0.85;
}

.explore-poetry-footer {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(155, 89, 182, 0.1);
    display: flex;
    justify-content: center;
}

.explore-poetry-load-more {
    min-height: 44px;
    padding: 10px 22px;
    border-radius: 12px;
    border: 1.5px solid rgba(155, 89, 182, 0.35);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(252, 247, 255, 0.94));
    color: rgba(86, 44, 120, 0.95);
    font-size: 0.88rem;
    font-weight: 700;
    font-family: var(--font-body);
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.explore-poetry-load-more:hover:not(:disabled) {
    border-color: var(--accent);
    box-shadow: 0 6px 18px rgba(155, 89, 182, 0.18);
    transform: translateY(-1px);
}

.explore-poetry-load-more:disabled {
    opacity: 0.55;
    cursor: default;
    transform: none;
    box-shadow: none;
}

@keyframes explore-skel-shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

.explore-poetry-item--skeleton {
    pointer-events: none;
    cursor: default;
    border-left-color: transparent !important;
}

.explore-poetry-item--skeleton:hover {
    transform: none;
    border-color: rgba(155, 89, 182, 0.16);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.85) inset;
}

.explore-skel {
    border-radius: 8px;
    background: linear-gradient(
        110deg,
        rgba(232, 226, 242, 0.55) 0%,
        rgba(245, 240, 252, 0.95) 42%,
        rgba(232, 226, 242, 0.55) 84%
    );
    background-size: 200% 100%;
    animation: explore-skel-shimmer 1.35s ease-in-out infinite;
}

.explore-skel--title {
    height: 16px;
    width: 72%;
    margin-bottom: 10px;
}

.explore-skel--line {
    height: 11px;
    width: 100%;
    margin-bottom: 8px;
}

.explore-skel--short {
    width: 58%;
    margin-bottom: 12px;
}

.explore-poetry-item-tags--skeleton {
    margin-top: 10px;
    gap: 8px;
}

.explore-skel--tag {
    display: inline-block;
    width: 64px;
    height: 22px;
    border-radius: 999px;
}

#landing-explore #explore-poetry-empty:not(.hidden) {
    margin-top: 1rem;
    padding: 1rem 1.1rem;
    text-align: center;
    border-radius: 12px;
    border: 1px dashed rgba(155, 89, 182, 0.28);
    background: rgba(255, 255, 255, 0.65);
    color: rgba(24, 34, 54, 0.65);
    font-size: 0.88rem;
}

.landing-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    padding: 12px 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(155, 89, 182, 0.12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 10px 24px rgba(16, 24, 40, 0.08);
    backdrop-filter: blur(10px) saturate(150%);
}

.landing-controls .select-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 180px;
}

.landing-controls .select-group label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding-left: 2px;
}

.landing-controls select {
    min-width: 180px;
    padding: 10px 34px 10px 12px;
    font-size: 0.9rem;
    font-family: var(--font-body);
    border: 1.5px solid rgba(155, 89, 182, 0.15);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='%23999' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
    box-shadow: inset 0 1px 2px rgba(16, 24, 40, 0.04);
}

.landing-controls select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.12);
    background: #fff;
}

.landing-controls .btn-primary {
    min-height: 50px;
    background: linear-gradient(135deg, var(--grad-1), var(--grad-2));
    box-shadow: 0 12px 24px rgba(155, 89, 182, 0.25);
}

.landing-controls .btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-hover), var(--grad-2));
    transform: translateY(-1px);
}

.btn-primary {
    flex: 1;
    min-height: 48px;
    padding: 10px 28px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: var(--font-body);
    letter-spacing: 0.01em;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 100px;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 50%);
    pointer-events: none;
}

.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }


.landing-recent {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
}

.landing-recent-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.landing-recent-head h3 {
    font-size: 0.84rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.history-link-btn {
    border: none;
    background: transparent;
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.landing-recent-list {
    display: grid;
    gap: 8px;
}

.landing-recent-item {
    width: 100%;
    border: 1px solid var(--border-light);
    background: #fff;
    border-radius: 10px;
    padding: 10px 12px;
    text-align: left;
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.landing-recent-item:hover {
    border-color: var(--accent-light);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.landing-recent-title {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.landing-recent-meta {
    display: block;
    margin-top: 3px;
    font-size: 0.76rem;
    color: var(--text-muted);
}

.landing-recent-empty {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* ============================================
   LOADER OVERLAY
   ============================================ */
.loader-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(30,25,20,0.45);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.loader-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 2.5rem 3rem;
    text-align: center;
    box-shadow: var(--shadow-lg);
    max-width: 380px;
    width: 90%;
}

.loader-ring {
    display: inline-block;
    position: relative;
    width: 36px;
    height: 36px;
    margin-bottom: 0.9rem;
}

.loader-ring div {
    box-sizing: border-box;
    display: block;
    position: absolute;
    width: 30px;
    height: 30px;
    margin: 3px;
    border: 3.5px solid var(--accent);
    border-radius: 50%;
    animation: ring 1.2s cubic-bezier(0.5,0,0.5,1) infinite;
    border-color: var(--accent) transparent transparent transparent;
}

.loader-ring div:nth-child(1) { animation-delay: -0.45s; }
.loader-ring div:nth-child(2) { animation-delay: -0.3s; }
.loader-ring div:nth-child(3) { animation-delay: -0.15s; }

@keyframes ring { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.loader-status {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.8rem;
    min-height: 1.4em;
}

.loader-content { }

.loader-error-content {
    text-align: center;
}
.loader-error-text {
    font-size: 1rem;
    font-weight: 600;
    color: var(--error);
    margin: 0 0 1rem 0;
    line-height: 1.4;
}

.loader-close-btn {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0.5rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--bg-card);
    background: var(--accent);
    border: none;
    border-radius: 8px;
    cursor: pointer;
}
.loader-close-btn:hover { opacity: 0.9; }

.loader-progress-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
    width: 100%;
}

.loader-percent {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--accent);
    min-width: 2.8em;
}

.loader-progress-wrap {
    flex: 1;
    height: 10px;
    background: var(--border-light);
    border-radius: 5px;
    overflow: hidden;
}

.loader-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent) 0%, var(--accent-hover) 100%);
    border-radius: 5px;
    transition: width 0.35s ease;
}

/* ============================================
   ERROR BANNER
   ============================================ */
.error-msg {
    background: var(--error-bg);
    color: var(--error);
    padding: 10px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    border-bottom: 1px solid #f5c6cb;
}

/* --- Spinner --- */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================
   PHASE 2: APP SHELL (top-bar + dashboard)
   ============================================ */
.app {
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: dashIn 0.35s ease;
}

@keyframes dashIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* --- Top Bar --- */
.top-bar {
    height: 54px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    z-index: 50;
}

.top-bar.fp-nav-authenticated {
    height: auto;
    padding-top: 0.72rem;
    padding-bottom: 0.72rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: var(--accent);
    flex-shrink: 0;
}

.brand-icon { width: 18px; height: 18px; }

.brand span {
    font-size: 0.96rem;
    font-weight: 700;
    letter-spacing: -0.2px;
    white-space: nowrap;
}

.new-analysis-btn {
    height: 34px;
    padding: 0 14px;
    font-size: 0.76rem;
    font-weight: 600;
    font-family: var(--font-body);
    background: var(--accent-bg);
    color: var(--accent);
    border: 1.5px solid var(--accent-light);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.new-analysis-btn:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.new-analysis-btn:active { transform: scale(0.97); }

/* Settings gear button + dropdown */
.settings-wrapper {
    position: relative;
}

.settings-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition), border-color var(--transition), background var(--transition);
}

.settings-btn:hover {
    color: var(--accent);
    border-color: var(--accent-light);
    background: var(--accent-bg);
}

.settings-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 280px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(100,50,120,0.14), 0 2px 6px rgba(0,0,0,0.06);
    z-index: 200;
    padding: 8px 0;
    animation: settingsIn 0.15s ease;
}

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

.settings-section {
    padding: 10px 14px;
}

.settings-section + .settings-section {
    border-top: 1px solid var(--border-light);
}

.settings-section-label {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.settings-privacy-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    background: var(--bg);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease;
    text-align: left;
    font-family: var(--font-body);
}

.settings-privacy-row:hover {
    background: var(--accent-bg);
}

.settings-privacy-icons {
    flex-shrink: 0;
    display: flex;
    color: var(--accent);
}

.privacy-icon { flex-shrink: 0; }

.settings-privacy-text {
    flex: 1;
    min-width: 0;
}

.settings-privacy-text #privacy-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}

.settings-sublabel {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 1px;
}

/* Toggle switch */
.toggle-switch {
    width: 36px;
    height: 20px;
    border-radius: 10px;
    position: relative;
    flex-shrink: 0;
    transition: background 0.2s ease;
}

.toggle-switch.on {
    background: #27ae60;
}

.toggle-switch.off {
    background: var(--border);
}

.toggle-knob {
    position: absolute;
    top: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: left 0.2s ease;
}

.toggle-switch.on .toggle-knob { left: 18px; }
.toggle-switch.off .toggle-knob { left: 2px; }

/* Blog link row inside settings */
.settings-blog-link-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-blog-url {
    flex: 1;
    font-size: 0.78rem;
    color: var(--accent);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.settings-blog-url:hover { text-decoration: underline; }

.settings-copy-btn {
    flex-shrink: 0;
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 6px;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    transition: color 0.2s, border-color 0.2s;
}

.settings-copy-btn:hover {
    color: var(--accent);
    border-color: var(--accent-light);
}

/* Blog published toast notification */
.blog-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    border: 1px solid var(--accent-light);
    border-radius: 12px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 32px rgba(100,50,120,0.15);
    z-index: 900;
    font-size: 0.82rem;
    color: var(--text);
    max-width: 90vw;
    animation: toastIn 0.3s ease;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(12px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.blog-toast-copy {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 6px;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    transition: color 0.2s, border-color 0.2s;
}

.blog-toast-copy:hover {
    color: var(--accent);
    border-color: var(--accent-light);
}

.blog-toast-close {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0 2px;
    line-height: 1;
}

.blog-toast-close:hover { color: var(--text); }

/* ============================================
   DASHBOARD GRID
   ============================================ */
.dashboard-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: 1fr 1fr;
    gap: var(--gap);
    padding: var(--gap);
    min-height: 0;
}

/* ============================================
   TILES — Liquid Glass
   ============================================ */
.tile {
    background: var(--tile-bg);
    border-radius: var(--tile-radius);
    border: var(--tile-border);
    box-shadow: var(--tile-shadow);
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    isolation: isolate;
    transform: translateZ(0);
    transition: box-shadow var(--transition), transform var(--transition);
}

.tile:hover {
    box-shadow: var(--tile-shadow-hover);
}

.tile-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 14px;
    border-bottom: 1px solid var(--tile-divider);
    background: var(--tile-header-bg);
}

.tile-header h3 {
    font-size: var(--label-size);
    font-weight: var(--label-weight);
    text-transform: uppercase;
    letter-spacing: var(--label-letter);
    color: var(--accent);
    line-height: 1;
}

.tile-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 14px 14px;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(155, 89, 182, 0.25) transparent;
}

.tile-body::-webkit-scrollbar { width: 4px; }
.tile-body::-webkit-scrollbar-track { background: transparent; }
.tile-body::-webkit-scrollbar-thumb {
    background: rgba(155, 89, 182, 0.25);
    border-radius: 4px;
}
.tile-body::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ============================================
   POETRY BLOCK + WORD TOOLTIPS
   ============================================ */
.poetry-block {
    font-family: var(--font-poetry);
    font-size: 0.98rem;
    line-height: 1.9;
    color: var(--text);
}

.poetry-block[dir="rtl"] { text-align: right; font-size: 1.04rem; }

.poetry-line {
    padding: 1px 5px;
    cursor: default;
}

.stanza-break {
    height: 0.7em;
}

/* Difficult word: underlined, hoverable */
.dict-word {
    display: inline;
    border-bottom: 1.5px dashed var(--accent-light);
    cursor: help;
    transition: border-color 0.15s, background 0.15s;
}

.dict-word:hover {
    border-bottom-color: var(--accent);
    background: rgba(155, 89, 182, 0.07);
    border-radius: 2px;
}

/* Global floating tooltip (appended to body, never clipped) */
.word-tooltip-global {
    position: fixed;
    z-index: 9999;
    background: #302520;
    color: #f5f0eb;
    font-family: var(--font-body);
    font-size: 0.74rem;
    line-height: 1.45;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    text-align: center;
    pointer-events: none;
    box-shadow: 0 4px 14px rgba(0,0,0,0.22);
    max-width: 260px;
    white-space: normal;
    word-wrap: break-word;
    animation: tooltipIn 0.12s ease;
}

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

/* Arrow (added dynamically via data-arrow attribute) */
.word-tooltip-global::before {
    content: "";
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
}

.word-tooltip-global[data-arrow="up"]::before {
    bottom: 100%;
    border-bottom-color: #302520;
}

.word-tooltip-global[data-arrow="down"]::before {
    top: 100%;
    border-top-color: #302520;
}

.word-tooltip-global .wt-easy {
    display: block;
    font-weight: 600;
    margin-bottom: 2px;
}

.word-tooltip-global .wt-secondary {
    display: block;
    opacity: 0.8;
    font-size: 0.7rem;
}

[dir="rtl"] .word-tooltip-global { text-align: right; }

/* ============================================
   TRANSLATION & EXPLANATION
   ============================================ */
#translation-text { white-space: pre-wrap; }

#explanation-text {
    font-size: 0.94rem;
    line-height: 1.72;
    color: var(--text);
}

#explanation-text .explanation-paragraph {
    margin: 0 0 0.85em;
}

#explanation-text .explanation-paragraph:last-child {
    margin-bottom: 0;
}

/* ============================================
   DICTIONARY TABLE — Liquid Glass
   ============================================ */
table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }

thead {
    position: sticky;
    top: -1px;
    z-index: 2;
}

th {
    font-weight: var(--label-weight);
    color: var(--accent);
    font-size: var(--label-size);
    text-transform: uppercase;
    letter-spacing: var(--label-letter);
    padding: 10px 8px;
    background: var(--tile-header-bg);
    -webkit-backdrop-filter: blur(10px) saturate(160%);
    backdrop-filter: blur(10px) saturate(160%);
    border-bottom: 1px solid var(--tile-divider);
    text-align: left;
}

td {
    padding: 9px 8px;
    border-bottom: 1px solid var(--tile-divider);
    text-align: left;
    vertical-align: top;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--tile-row-hover); }
td[dir="rtl"] { text-align: right; font-family: var(--font-poetry); }

/* ============================================
   POET & CONTEXT — Liquid Glass
   ============================================ */
.info-row {
    display: flex;
    gap: 10px;
    margin-bottom: 6px;
    font-size: 0.84rem;
    line-height: 1.55;
    color: var(--text);
}

.info-label {
    font-weight: var(--label-weight);
    color: var(--accent);
    min-width: 42px;
    flex-shrink: 0;
    font-size: var(--label-size);
    text-transform: uppercase;
    letter-spacing: var(--label-letter);
    padding-top: 3px;
}

.bio-text {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 6px 0;
}

.wiki-link {
    display: inline-block;
    font-size: 0.78rem;
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px dashed rgba(155, 89, 182, 0.45);
    margin-bottom: 6px;
    transition: color var(--transition), border-color var(--transition);
}

.wiki-link:hover {
    color: var(--accent-hover);
    border-bottom-color: var(--accent);
}

.tile-divider {
    border: none;
    border-top: 1px solid var(--tile-divider);
    margin: 10px 0;
}

/* ============================================
   THEMES, DEVICES & SOURCES — Liquid Glass
   ============================================ */
.section-label {
    font-size: var(--label-size);
    font-weight: var(--label-weight);
    text-transform: uppercase;
    letter-spacing: var(--label-letter);
    color: var(--accent);
    margin-top: 12px;
    margin-bottom: 6px;
}

.section-label:first-child { margin-top: 0; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }

.tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    background: var(--tile-chip-bg);
    border: var(--tile-chip-border);
    color: var(--accent-hover);
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: var(--label-weight);
    line-height: 1.5;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.85),
        0 1px 2px rgba(24, 34, 54, 0.04);
}

.source-links { list-style: none; padding: 0; }
.source-links li { margin-bottom: 4px; }

.source-links a {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.78rem;
    line-height: 1.55;
    word-break: break-all;
    border-bottom: 1px solid rgba(155, 89, 182, 0.22);
    transition: color var(--transition), border-color var(--transition);
}

.source-links a:hover {
    color: var(--accent-hover);
    border-bottom-color: var(--accent);
}

/* ============================================
   CHAT WIDGET
   ============================================ */

/* Floating bubble */
.chat-bubble {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 500;
    min-width: 52px;
    height: 52px;
    padding: 0 14px 0 12px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    border: 2px solid rgba(255,255,255,0.3);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 16px rgba(155, 89, 182, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-bubble-label {
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

.chat-bubble:hover {
    background: var(--accent-hover);
    border-color: rgba(255,255,255,0.5);
    transform: rotate(-8deg) scale(1.06);
}

.chat-bubble:active { transform: scale(0.95); }

/* Chat panel */
.chat-panel {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 500;
    width: 380px;
    height: 520px;
    max-height: calc(100dvh - 40px);
    background: var(--bg-card);
    border-radius: 14px;
    border: 1px solid var(--border);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.16);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: chatPanelIn 0.25s ease;
}

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

/* Header */
.chat-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--accent);
    color: #fff;
}

.chat-title {
    font-size: 0.86rem;
    font-weight: 600;
    letter-spacing: -0.2px;
}

.chat-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.3rem;
    cursor: pointer;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.15s;
    padding: 0 2px;
}

.chat-close:hover { opacity: 1; }

/* Messages area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Message bubbles */
.chat-msg {
    display: flex;
    max-width: 88%;
}

.chat-msg.user {
    align-self: flex-end;
}

.chat-msg.assistant {
    align-self: flex-start;
}

.chat-msg-body {
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 0.86rem;
    line-height: 1.55;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.chat-msg.user .chat-msg-body {
    background: var(--accent);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-msg.assistant .chat-msg-body {
    background: var(--accent-bg);
    color: var(--text);
    border-bottom-left-radius: 4px;
}

/* Typing indicator */
.chat-msg.assistant .chat-msg-body.typing {
    color: var(--text-muted);
    font-style: italic;
}

/* Input area */
.chat-input-area {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-top: 1px solid var(--border-light);
    background: #fdfbf9;
}

.chat-input-area input {
    flex: 1;
    height: 38px;
    padding: 0 10px;
    font-size: 0.86rem;
    font-family: var(--font-body);
    border: 1.5px solid var(--border);
    border-radius: 18px;
    background: var(--bg-card);
    color: var(--text);
    outline: none;
    transition: border-color var(--transition);
}

.chat-input-area input:focus {
    border-color: var(--accent-light);
}

.chat-input-area input::placeholder { color: var(--text-muted); }

.chat-input-area button {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.25s ease, transform 0.15s ease;
}

.chat-input-area button:hover { background: var(--accent-hover); }
.chat-input-area button:active { transform: scale(0.92); }
.chat-input-area button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============================================
   HAMBURGER BUTTON
   ============================================ */
.hamburger-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition), border-color var(--transition), background var(--transition);
}

.hamburger-btn:hover {
    color: var(--accent);
    border-color: var(--accent-light);
    background: var(--accent-bg);
}

.history-btn {
    width: auto;
    padding: 0 9px;
    gap: 5px;
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--accent);
    border-color: var(--accent-light);
    background: var(--accent-bg);
}

.history-btn span {
    display: inline;
    line-height: 1;
}

.landing-history-btn {
    display: none;
}

/* ============================================
   HISTORY DRAWER
   ============================================ */
.drawer-overlay {
    position: fixed;
    inset: 0;
    z-index: 600;
    background: rgba(30, 25, 20, 0.4);
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.drawer-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.drawer-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 650;
    width: 420px;
    max-width: 90vw;
    background: var(--bg-card);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
    border-left: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.drawer-panel.open {
    transform: translateX(0);
}

/* ============================================
   LANDING SIDEBAR (MOBILE)
   ============================================ */
.landing-sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(20, 18, 30, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.landing-sidebar-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

body.landing-sidebar-open {
    overflow: hidden;
}

@media (max-width: 1024px) {
    .landing-history-btn {
        display: none;
    }

    .landing-layout {
        grid-template-columns: var(--sidebar-collapsed-width) minmax(0, 1fr);
        padding: 0 clamp(0.9rem, 3.6vw, 1.2rem) 2rem;
    }

    html[dir="rtl"] .landing-layout {
        grid-template-columns: minmax(0, 1fr) var(--sidebar-collapsed-width);
    }

    .landing-sidebar-spacer {
        display: none;
    }

    .landing-sidebar {
        position: sticky;
        top: calc(env(safe-area-inset-top, 0px) + var(--pe-landing-nav-h) + 12px);
        left: auto;
        right: auto;
        width: var(--sidebar-collapsed-width);
        z-index: 65;
        transition: width 0.25s ease, top 0.25s ease;
        padding: 0;
        align-self: start;
    }

    html[dir="rtl"] .landing-sidebar {
        left: auto;
        right: auto;
    }

    /* Collapsed rail: do not stretch with the main column — card height is viewport-based (see above). */
    .landing-layout.sidebar-collapsed .landing-sidebar {
        display: flex;
        flex-direction: column;
        align-self: start;
    }

    body.landing-sidebar-open .landing-sidebar {
        position: fixed;
        inset: 0;
        width: auto;
        z-index: 350;
    }

    html[dir="rtl"] body.landing-sidebar-open .landing-sidebar {
        inset: 0;
    }

    /*
     * Full-bleed sheet only while the drawer is open. Collapsed rail keeps the same
     * card chrome as desktop (see .landing-sidebar-card + .sidebar-collapsed rules above).
     */
    body.landing-sidebar-open .landing-sidebar-card {
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0 16px 16px 0;
        padding: 14px 14px 18px;
    }

    html[dir="rtl"] body.landing-sidebar-open .landing-sidebar-card {
        border-radius: 16px 0 0 16px;
    }
}

/* Support: lives in #landing main column (sidebar stays visible) */
.landing-support {
    padding-bottom: 2rem;
    animation: supportFadeIn 280ms ease-out;
}

#landing-support.landing-inner {
    flex: 0 0 auto;
    width: 100%;
    max-width: none;
    min-width: 0;
    align-self: stretch;
    box-sizing: border-box;
    overflow-x: hidden;
    overflow-y: visible;
    background: var(--landing-card-frost);
    border: var(--landing-card-border);
    box-shadow: var(--landing-card-shadow);
    -webkit-backdrop-filter: var(--landing-card-blur);
    backdrop-filter: var(--landing-card-blur);
}

#landing-support.landing-inner::before,
#landing-support.landing-inner::after {
    display: none;
}

.landing-support-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
    gap: clamp(1rem, 2.5vw, 1.5rem);
    align-items: start;
}

.landing-support-main {
    min-width: 0;
}

.landing-support-aside {
    min-width: 0;
    position: sticky;
    top: 12px;
}

.landing-support-head {
    margin-bottom: clamp(0.85rem, 2vw, 1.15rem);
}

.landing-support-title {
    margin: 0;
    font-size: clamp(1.35rem, 2.4vw, 1.75rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.2;
    color: var(--text);
}

.landing-support-subtitle {
    margin: 6px 0 0;
    font-size: 0.9rem;
    line-height: 1.45;
    color: rgba(24, 34, 54, 0.65);
    font-weight: 500;
}

.support-panel-card {
    background:
        radial-gradient(120% 80% at 100% -20%, rgba(255, 184, 220, 0.12), transparent 42%),
        linear-gradient(165deg, rgba(255, 255, 255, 0.99) 0%, rgba(252, 246, 255, 0.96) 100%);
    border: 1px solid rgba(155, 89, 182, 0.2);
    border-radius: 18px;
    box-shadow:
        0 14px 36px rgba(24, 34, 54, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    padding: clamp(1rem, 2.2vw, 1.35rem);
}

.support-panel-card--aside {
    max-height: min(70vh, 640px);
    display: flex;
    flex-direction: column;
    min-height: 200px;
}

#landing-support .form-group label {
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-size: 0.7rem;
    color: rgba(86, 44, 120, 0.72);
    font-weight: 800;
}

#landing-support .form-group input,
#landing-support .form-group select,
#landing-support textarea {
    border: 1.5px solid rgba(155, 89, 182, 0.2);
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

#landing-support .form-group input:focus,
#landing-support .form-group select:focus,
#landing-support textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.14);
    background: #fff;
    outline: none;
}

#landing-support textarea {
    width: 100%;
    min-height: 160px;
    padding: 12px;
    font-family: var(--font-body);
    line-height: 1.5;
}

#landing-support .support-submit-btn {
    width: 100%;
    margin-top: 6px;
    min-height: 48px;
    border-radius: 14px;
    font-size: 0.95rem;
    font-weight: 750;
    background: linear-gradient(100deg, #8e4ce0 0%, var(--accent) 48%, #7d3fc7 100%);
    box-shadow: 0 12px 28px rgba(155, 89, 182, 0.25);
}

#landing-support .support-submit-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 16px 34px rgba(155, 89, 182, 0.3);
}

#landing-support .support-submit-btn:disabled {
    box-shadow: none;
    transform: none;
}

#landing-support #support-form-view .form-group {
    margin-bottom: 14px;
}

#landing-support #support-form-view .form-group:last-of-type {
    margin-bottom: 10px;
}

#landing-support #support-form-view .form-group label {
    display: block;
    margin-bottom: 6px;
}

#landing-support .support-result-alert {
    border-radius: 14px;
    border: 1px solid rgba(155, 89, 182, 0.22);
    background: linear-gradient(135deg, rgba(243, 239, 255, 0.92) 0%, rgba(255, 255, 255, 0.97) 100%);
    margin-bottom: 12px;
}

#landing-support .support-user-msg {
    text-align: center;
    min-height: 1.25em;
    margin-top: 8px;
}

.support-history-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.support-history-head h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
}

.support-refresh-btn {
    flex-shrink: 0;
    font-weight: 650;
}

.support-history-msg {
    flex-shrink: 0;
    margin: 0 0 10px;
    font-size: 0.82rem;
}

.support-history-list {
    display: grid;
    gap: 8px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    padding-right: 2px;
}

.support-history-item {
    border: 1px solid rgba(155, 89, 182, 0.18);
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 11px 13px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.support-history-item:hover {
    border-color: rgba(155, 89, 182, 0.32);
    box-shadow: 0 6px 16px rgba(155, 89, 182, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.support-history-item-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.support-history-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: #2f235d;
}

.support-history-meta {
    font-size: 0.76rem;
    color: #6d6789;
}

.support-status-pill {
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: capitalize;
}

.support-status-pill.open { background: #fff1f1; color: #c0392b; }
.support-status-pill.in_progress { background: #fff7e6; color: #b9770e; }
.support-status-pill.resolved { background: #eaf7ec; color: #1e8449; }
.support-status-pill.closed { background: #edf1f7; color: #566573; }

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

#landing-support select#support-type {
    min-height: 48px;
    padding: 0 42px 0 14px;
    font-weight: 600;
    color: #2e2852;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, #9b59b6 50%),
        linear-gradient(135deg, #9b59b6 50%, transparent 50%),
        linear-gradient(90deg, #e3dcff, #e3dcff);
    background-position:
        calc(100% - 18px) calc(50% - 3px),
        calc(100% - 12px) calc(50% - 3px),
        calc(100% - 34px) 50%;
    background-size:
        6px 6px,
        6px 6px,
        1px 22px;
    background-repeat: no-repeat;
}

#landing-support select#support-type:hover {
    border-color: rgba(155, 89, 182, 0.35);
    background-color: #fff;
}

#landing-support .form-group input#support-title {
    min-height: 46px;
}

@media (max-width: 900px) {
    .landing-support-layout {
        grid-template-columns: 1fr;
    }

    .landing-support-aside {
        position: static;
        max-height: none;
    }

    .support-panel-card--aside {
        max-height: none;
    }
}

@media (max-width: 700px) {
    #landing-support #support-form-view .form-group {
        margin-bottom: 12px;
    }

    .support-panel-card {
        padding: 14px;
    }
}

.drawer-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    background: #fdfbf9;
}

.drawer-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -0.3px;
}

.drawer-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 2px 4px;
    border-radius: var(--radius-sm);
    transition: color var(--transition), background var(--transition);
}

.drawer-close:hover {
    color: var(--text);
    background: var(--accent-bg);
}

.drawer-search-row {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-light);
    background: #fff;
}

.drawer-search-input {
    width: 100%;
    min-height: 38px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0 10px;
    font-size: 0.84rem;
    color: var(--text);
    background: var(--bg);
}

.drawer-search-input:focus {
    outline: none;
    border-color: var(--accent-light);
    box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.08);
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.drawer-body::-webkit-scrollbar { width: 4px; }
.drawer-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Empty state */
.drawer-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.drawer-empty svg {
    margin-bottom: 12px;
    opacity: 0.4;
}

.drawer-empty p {
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.drawer-empty-sub {
    font-size: 0.76rem;
    font-weight: 400 !important;
    opacity: 0.7;
}

/* Loading state */
.drawer-loading {
    text-align: center;
    padding: 2rem 1rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.drawer-loading .spinner {
    border-color: rgba(155, 89, 182, 0.2);
    border-top-color: var(--accent);
}

/* History list */
.drawer-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.drawer-item {
    display: flex;
    align-items: stretch;
    gap: 0;
    padding: 10px 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    background: var(--bg);
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.drawer-item:hover {
    border-color: var(--accent-light);
    box-shadow: var(--shadow-sm);
    background: var(--bg-card);
}

.drawer-item.active {
    border-color: rgba(155, 89, 182, 0.55);
    background: rgba(252, 245, 255, 0.92);
    box-shadow: inset 0 0 0 1px rgba(155, 89, 182, 0.2);
}

.drawer-item.active:hover {
    background: rgba(252, 245, 255, 0.92);
    border-color: rgba(155, 89, 182, 0.55);
    box-shadow: inset 0 0 0 1px rgba(155, 89, 182, 0.2);
}

.drawer-item-body {
    flex: 1;
    min-width: 0;
}

.drawer-item-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
    line-height: 1.3;
}

.drawer-item-meta {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px 8px;
    min-width: 0;
    font-size: 0.68rem;
    color: var(--text-muted);
}

.drawer-item-dateline {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.drawer-item-meta .drawer-item-delete {
    opacity: 0.92;
}

.drawer-item:hover .drawer-item-meta .drawer-item-delete {
    opacity: 1;
}

.drawer-item-meta .drawer-item-pin {
    opacity: 0.55;
}

.drawer-item:hover .drawer-item-meta .drawer-item-pin,
.drawer-item.pinned .drawer-item-meta .drawer-item-pin {
    opacity: 1;
}

.drawer-item-lang {
    display: inline-block;
    padding: 1px 6px;
    background: var(--accent-bg);
    color: var(--accent);
    border-radius: 8px;
    font-size: 0.64rem;
    font-weight: 600;
}

.drawer-item-delete {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    opacity: 0.92;
    transition: opacity 0.15s, color var(--transition), background var(--transition);
}

.drawer-item-delete:hover {
    color: var(--error);
    background: var(--error-bg);
}

.drawer-item-pin {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.82rem;
    line-height: 1;
    opacity: 0.55;
    transition: opacity 0.15s, color var(--transition), background var(--transition);
}

.drawer-item-pin:hover {
    color: #c18f00;
    background: #fff8db;
}

.drawer-item.pinned .drawer-item-pin {
    color: #c18f00;
}

.landing-recent-item.pinned {
    border-color: #ead8a0;
    background: #fffdf3;
}

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

html[dir="rtl"] body {
    text-align: right;
}

html[dir="rtl"] .fp-nav,
html[dir="rtl"] .fp-nav-actions,
html[dir="rtl"] .fp-nav-links,
html[dir="rtl"] .fp-nav-auth,
html[dir="rtl"] .top-bar-actions,
html[dir="rtl"] .landing-controls,
html[dir="rtl"] .info-row,
html[dir="rtl"] .drawer-item,
html[dir="rtl"] .drawer-item-meta {
    direction: rtl;
}

html[dir="rtl"] .drawer-panel {
    right: auto;
    left: 0;
    border-left: none;
    border-right: 1px solid var(--border-light);
    transform: translateX(-100%);
}

/* Touch-friendly tap targets on mobile */
@media (pointer: coarse) {
    .fp-btn-ghost,
    .fp-btn-solid,
    .signout-link,
    .signout-btn,
    .hamburger-btn,
    .new-analysis-btn,
    .auth-tab {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* ============================================
   RESPONSIVE — TABLET (<=900px)
   ============================================ */
@media (max-width: 1024px) {
    :root { --gap: 6px; }

    .dashboard-grid {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 1fr 1fr 1fr;
    }

    .new-analysis-btn span { display: none; }
    .review-card { min-width: calc((100% - 16px) / 2); min-height: 200px; }
    .reviews-carousel.static-reviews .review-card {
        min-width: min(360px, 100%);
        max-width: 360px;
    }

    #landing.landing {
        --pe-landing-nav-h: clamp(5.25rem, 16vw + 2.75rem, 7.75rem);
    }

    #landing.landing .landing-layout {
        grid-template-columns: var(--sidebar-collapsed-width) minmax(0, 1fr);
        min-height: auto;
    }

    .fp-nav {
        flex-direction: row;
        align-items: center;
        gap: 8px;
        flex-wrap: nowrap;
    }

    .fp-nav-brand {
        min-width: 0;
        max-width: 42vw;
        flex: 0 1 auto;
    }

    .fp-nav-brand-title {
        font-size: 0.92rem;
    }

    .fp-nav-brand-subtitle {
        display: block;
    }

    .fp-nav-actions {
        flex: 1 1 auto;
        min-width: 0;
        justify-content: flex-end;
        flex-wrap: nowrap;
        gap: 6px;
    }

    .fp-nav-links {
        display: none;
    }

    .fp-nav-auth {
        padding-left: 8px;
        border-left: 1px solid rgba(155, 89, 182, 0.12);
        gap: 6px;
    }

    .fp-nav-authenticated .top-bar-actions {
        width: auto;
        justify-content: flex-end;
        gap: 6px;
        flex-wrap: nowrap;
    }

    .lang-select-wrap--nav {
        max-width: none;
    }

    .lang-select-face {
        min-width: 40px;
        padding-inline: 8px;
        justify-content: center;
    }

    .lang-select-face-chevron-svg {
        width: 10px;
        height: 10px;
    }

    .user-account-chip {
        max-width: none;
        padding: 5px 8px;
        gap: 0;
    }

    button.user-account-chip--trigger {
        width: auto;
        max-width: none;
    }

    .user-avatar--chip {
        width: 30px;
        height: 30px;
        font-size: 0.76rem;
    }

    .billing-open-btn {
        min-height: 34px;
        padding: 4px 8px;
    }
}

@media (max-width: 900px) {
    .billing-open-cta {
        display: none;
    }
}

@media (max-width: 780px) {
    .fp-nav-brand-subtitle {
        display: none;
    }

    .lang-select-face-label {
        display: none;
    }

    .user-email-text--chip,
    .topbar-user--chip,
    .user-account-chevron {
        display: none;
    }

    .billing-open-cta {
        display: none;
    }

    .billing-open-btn {
        min-height: 32px;
        padding: 4px 6px;
        gap: 5px;
    }

    .billing-open-label {
        font-size: 0.7rem;
    }

    .user-account-chip {
        width: 38px;
        min-width: 38px;
        padding: 4px;
        gap: 0;
        justify-content: center;
    }

    .user-avatar--chip {
        width: 30px;
        height: 30px;
        font-size: 0.76rem;
    }
}

@media (max-width: 620px) {
    .fp-nav-brand-title {
        font-size: 0.86rem;
    }

    .fp-nav {
        gap: 6px;
    }

    .fp-nav-actions,
    .fp-nav-authenticated .top-bar-actions {
        gap: 5px;
    }

    .lang-select-face {
        min-width: 36px;
        padding-inline: 7px;
    }

    .billing-open-count {
        min-width: 24px;
        height: 24px;
        padding: 0 6px;
        font-size: 0.8rem;
    }
}

/* ============================================
   RESPONSIVE — TABLET PORTRAIT (<=768px)
   ============================================ */
@media (max-width: 400px) {
    .fp-nav {
        width: 100%;
    }
    .fp-nav-brand-title {
        font-size: 0.84rem;
    }
    .dashboard-grid {
        grid-template-columns: 1fr 1fr;
    }

    .landing {
        padding: 0 0 1.2rem;
        min-height: 100dvh;
    }

    .landing-layout {
        padding: 0 1rem 1.5rem;
    }

    .landing-user-bar {
        position: relative;
        top: auto;
        right: auto;
        justify-content: center;
        margin-bottom: 0.25rem;
        padding: 0.75rem 0;
        width: 100%;
    }

    .landing-inner {
        max-width: 100%;
        width: 100%;
        margin-top: 0;
        padding: 0.9rem;
        border-radius: 12px;
    }

    .landing-results-header {
        padding: 14px 14px 12px;
    }

    .landing-blog-toolbar {
        padding: 10px 14px 14px;
    }

    .landing-results .landing-dashboard-grid {
        padding: 10px 10px 14px;
        gap: 10px;
        grid-template-columns: 1fr;
        grid-template-areas:
            "poetry"
            "translation"
            "explanation"
            "dictionary"
            "poet"
            "themes";
    }

    .landing-results .landing-dashboard-grid > #tile-poetry,
    .landing-results .landing-dashboard-grid > #tile-translation {
        min-height: unset;
    }

    html[dir="rtl"] .landing-results .landing-dashboard-grid {
        grid-template-areas:
            "poetry"
            "translation"
            "explanation"
            "dictionary"
            "poet"
            "themes";
    }

    .landing-controls {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }
    .landing-controls .select-group {
        width: 100%;
        min-width: 0;
    }
    .landing-controls .select-group label {
        display: none;
    }
    .landing-controls select {
        display: block;
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }
    .btn-primary { width: 100%; }
    .explore-poetry-filters { grid-template-columns: 1fr; }

    /* Auth screen mobile */
    .auth-screen {
        padding: 1rem 0.75rem;
    }

    .auth-card {
        max-width: 100%;
        padding: 1.5rem 1rem 1.2rem;
        border-radius: 12px;
    }

    .chat-panel {
        width: calc(100vw - 24px);
        height: calc(100dvh - 84px);
        bottom: 12px;
        right: 12px;
    }
}

/* ============================================
   RESPONSIVE — MOBILE (<=600px)
   ============================================ */
@media (max-width: 600px) {
    .app {
        height: auto;
        overflow: auto;
    }

    .top-bar { position: sticky; top: 0; z-index: 100; }

    .dashboard-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        flex: none;
        padding: 6px;
        gap: 6px;
    }

    .tile { min-height: 140px; max-height: 300px; }
    .tile-header { padding: 6px 10px; }
    .tile-body { padding: 6px 10px 8px; }

    /* Landing page mobile overrides */
    .landing {
        padding: calc(env(safe-area-inset-top, 0px) + var(--pe-landing-nav-h)) 0 1rem;
    }
    .landing {
        padding: calc(env(safe-area-inset-top, 0px) + var(--pe-landing-nav-h)) 0 1rem;
    }

    .landing-user-bar {
        gap: 6px;
    }

    .user-email-text {
        max-width: 120px;
        font-size: 0.72rem;
    }

    .landing-brand { justify-content: center; }
    .landing-subtitle { text-align: center; font-size: 0.88rem; }

    .landing-form textarea {
        min-height: clamp(7.5rem, 20dvh, 13rem);
        font-size: 0.95rem;
        padding: 12px;
    }

    /* Auth screen mobile */
    .auth-screen {
        padding: 1rem 0.5rem;
        align-items: flex-start;
    }

    .auth-card {
        max-width: 100%;
        padding: 1.2rem 0.8rem 1rem;
        border-radius: 10px;
    }

    .top-bar-actions { gap: 6px; }
    .topbar-user { display: none; }

    .loader-card { padding: 1.8rem; max-width: 300px; }

    /* Auth card mobile */
    .auth-brand h1 { font-size: 1.2rem; }
    .auth-subtitle { font-size: 0.82rem; }

    .chat-panel {
        width: calc(100vw - 16px);
        height: calc(100dvh - 80px);
        bottom: 8px;
        right: 8px;
        border-radius: 12px;
    }

    .chat-bubble {
        bottom: 14px;
        right: 14px;
        min-width: 46px;
        height: 46px;
        padding: 0 10px;
        gap: 6px;
    }

    .chat-bubble-label {
        font-size: 0.72rem;
    }

    .drawer-panel { width: 100%; max-width: 100vw; }
    .drawer-item-delete { opacity: 1; }
    .reviews-carousel { grid-template-columns: 1fr; }
    .reviews-nav { display: none; }
    .review-card { min-width: 100%; min-height: 0; }
    .reviews-dots { margin-top: 12px; }
}

/* ============================================
   RESPONSIVE — SMALL MOBILE (<=400px)
   ============================================ */
@media (max-width: 400px) {
    .fp-nav {
        width: 100%;
        gap: 0.5rem;
    }
    .fp-nav-brand-title {
        font-size: 0.85rem;
    }
    .fp-nav-brand-subtitle {
        display: none;
    }
    .fp-nav-actions { gap: 4px; }
    .fp-nav-links { display: none; }
    .fp-nav-auth {
        border-left: none;
        padding-left: 0;
    }
    .fp-nav-authenticated .top-bar-actions {
        width: auto;
        gap: 4px;
        border: none;
        background: transparent;
        padding: 0;
        justify-content: flex-end;
        flex-wrap: nowrap;
    }
    .fp-nav-blog-btn {
        min-height: 32px;
        padding: 4px 9px;
        font-size: 0.74rem;
        display: none;
    }
    .fp-btn-ghost { padding: 6px 7px; font-size: 0.76rem; }
    .fp-btn-solid { padding: 6px 9px; font-size: 0.74rem; }
    .billing-open-btn {
        min-height: 32px;
        padding: 4px 6px;
        gap: 5px;
        display: none;
    }
    .billing-open-label {
        font-size: 0.7rem;
    }
    .user-account-chip {
        width: 36px;
        min-width: 36px;
        padding: 3px;
        gap: 0;
        justify-content: center;
    }

    .billing-open-count {
        min-width: 24px;
        height: 24px;
        padding: 0 6px;
        font-size: 0.8rem;
    }

    .fp-nav-blog-btn {
        min-height: 30px;
        padding: 4px 8px;
        font-size: 0.72rem;
    }

    .fp-preview-body { padding: 14px; }
    .fp-preview-poem { font-size: 0.95rem; }

    .auth-tabs { font-size: 0.8rem; }
    .brand span { font-size: 0.78rem; }

    .landing {
        padding: calc(env(safe-area-inset-top, 0px) + var(--pe-landing-nav-h)) 0 1rem;
    }

    .landing-brand h1 { font-size: 1.2rem; }
    .landing-icon { width: 26px; height: 26px; }
    .landing-subtitle { font-size: 0.82rem; margin-bottom: 1rem; }

    .landing-form textarea {
        min-height: clamp(6.5rem, 18dvh, 11rem);
        padding: 10px;
        font-size: 0.9rem;
    }

    .user-avatar--chip {
        width: 28px;
        height: 28px;
        font-size: 0.72rem;
    }

    .signout-link { font-size: 0.7rem; }
    .user-email-text:not(.user-email-text--chip) {
        max-width: 100px;
        font-size: 0.68rem;
    }
    .hamburger-btn { width: 32px; height: 32px; }
    .history-btn span { display: none; }
}
