@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;700;800&display=swap');

/* =========================================
   GOLDEN MINUTE - PREMIUM AI DESIGN SYSTEM (v10)
   ========================================= */

/* CRITICAL: Utility class for hiding elements */
.hidden {
    display: none !important;
}

:root {
    /* TYPOGRAPHY */
    --gm-font: 'Plus Jakarta Sans', sans-serif;
    --gm-line-height: 1.6;

    /* PALETTE: DARK MODE ("Deep Space" - Default) */
    --gm-bg: #0B1120;
    --gm-surface: #1E293B;
    --gm-border: rgba(255, 255, 255, 0.1);
    --gm-text-main: #F8FAFC;
    --gm-text-sec: #94A3B8;

    /* ACCENTS ("Aura") */
    --gm-primary-start: #6366f1;
    /* Indigo */
    --gm-primary-end: #06b6d4;
    /* Cyan */
    --gm-success: #10B981;
    /* Emerald */
    --gm-warning: #F59E0B;
    /* Amber */
    --gm-danger: #ef4444;
    /* Red */

    /* Variables for backward compatibility with v8 structure */
    --primary: #06b6d4;
    --secondary: #6366f1;
    --accent: #10B981;
    --danger: #ef4444;
    --bg: #0B1120;
    --surface: #1E293B;

    /* SHADOWS & EFFECTS */
    --gm-shadow-hover: 0 10px 15px -3px rgba(99, 102, 241, 0.3);
    --gm-card-shadow: none;
    --gm-radius: 20px;
}

#gm-layout-wrapper {
    width: 100%;
    margin: 0;
    padding: 0;
    text-align: center;
    /* Traditional centering trick */
}

#gm-app {
    font-family: var(--gm-font);
    color: var(--gm-text-main);
    background: var(--gm-bg);
    line-height: var(--gm-line-height);
    padding: 2rem;
    border-radius: var(--gm-radius);
    position: relative;
    overflow: hidden;
    overflow-x: hidden;
    width: 100%;
    margin: 0 auto;
    /* Primary Centering */
    text-align: left;
    /* Reset text-align from wrapper */
    display: block;
    /* Force block behavior */
    box-sizing: border-box;
    max-width: 100vw;
    min-width: 0;
    /* CRITICAL FLEX/BLOCK FIX */
    transition: background 0.3s ease, color 0.3s ease;
}

/* PALETTE: LIGHT MODE ("Bone White" - Premium) */
#gm-app.gm-theme-light {
    --gm-bg: #F9F9F7;
    /* Bone White */
    --gm-surface: #F1F5F9;
    /* Light Gray (Slate-100) */
    --gm-border: #CBD5E1;
    /* Slate-300 */
    --gm-text-main: #1E293B;
    /* Slate-800 */
    --gm-text-sec: #64748B;
    /* Slate-500 */
    --gm-shadow-hover: 0 10px 15px -3px rgba(100, 116, 139, 0.15);
    --gm-card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.03), 0 2px 4px -1px rgba(0, 0, 0, 0.02);

    /* Compatibility overrides */
    --gm-warning: #D97706;
    /* Darker Amber for contrast on light */
    --bg: #F9F9F7;
    --surface: #F1F5F9;
    background: #F9F9F7;
    color: #1E293B;
}

/* Light Mode: Analysis Cards - Better visibility */
#gm-app.gm-theme-light .gm-stat-card,
#gm-app.gm-theme-light .gm-lexi-card-metric,
#gm-app.gm-theme-light .gm-lexi-metric-box,
#gm-app.gm-theme-light .gm-lingo-card,
#gm-app.gm-theme-light .gm-lingo-cefr-card,
#gm-app.gm-theme-light .gm-lingo-mini-stat {
    background: #FFFFFF;
    border: 1px solid #CBD5E1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Light Mode: Score numbers - Dark color for visibility */
#gm-app.gm-theme-light .gm-mini-score {
    color: #1E293B !important;
    font-weight: 700;
}

#gm-app.gm-theme-light .gm-card-feedback {
    color: #475569;
}

/* Light Mode: Progress bars - Solid background for visibility */
#gm-app.gm-theme-light .gm-bar {
    background: #E2E8F0;
    border: 1px solid #CBD5E1;
}

#gm-app.gm-theme-light .gm-bar>div {
    background: linear-gradient(90deg, #6366f1, #06b6d4) !important;
}

#gm-app * {
    box-sizing: border-box;
    font-family: var(--gm-font);
}

/* =========================================
   TYPOGRAPHY
   ========================================= */
#gm-app h1,
#gm-app h2,
#gm-app h3 {
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-top: 0;
}

#gm-app h1 {
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--gm-primary-start), var(--gm-primary-end));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0 0 1rem 0;
    text-align: center;
}

/* Section titles (Transcripción en vivo, Correcciones de Repeticiones) */
#gm-app .gm-section-title {
    background: linear-gradient(135deg, var(--gm-primary-start), var(--gm-primary-end));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

#gm-app .gm-header {
    text-align: center;
    margin-bottom: 2rem;
}

#gm-app .gm-app-logo-inline {
    width: 1em;
    height: 1em;
    vertical-align: middle;
    margin-left: 0.2em;
    filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.4));
    position: relative;
    top: -0.05em;
}

/* =========================================
   COMPONENTS & CONTAINERS
   ========================================= */

/* Common Card Style */
#gm-app .gm-topic-box,
#gm-app .gm-visualizer-container,
#gm-app .gm-transcript-section,
#gm-app .gm-analysis-box,
/* Assuming class exists or mapping existing IDs */
#gm-app .gm-card,
#gm-practice-summary {
    background: var(--gm-surface);
    border: 1px solid var(--gm-border);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--gm-card-shadow);
    margin-bottom: 1.5rem;
}

/* Specific Adjustments */
#gm-app .gm-topic-box {
    margin-bottom: 1rem;
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.1);
    /* Subtle Cyan glow */
}

#gm-app #gm-current-topic {
    font-size: 2rem;
    color: var(--gm-primary-end);
    margin: 0.5rem 0 0 0;
    text-transform: capitalize;
    font-weight: 700;
}

/* Visualizer & Timer */
#gm-app .gm-visualizer-container {
    height: 180px;
    /* Slightly taller */
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-bottom: 2rem;
}

#gm-app canvas {
    width: 100%;
    height: 100%;
}

#gm-app #gm-timer {
    position: absolute;
    font-size: 3rem;
    font-weight: 800;
    color: var(--gm-success);
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

/* Buttons (Premium AI "Aura") */
#gm-app .gm-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

#gm-app .gm-btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: 50px;
    background: linear-gradient(135deg, var(--gm-primary-start), var(--gm-primary-end));
    color: white;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#gm-app .gm-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--gm-shadow-hover);
    filter: brightness(1.1);
}

#gm-app .gm-btn:active {
    transform: translateY(0);
}

/* Secondary Buttons */
#gm-app .gm-btn-secondary {
    background: transparent;
    border: 1px solid var(--gm-border);
    color: var(--gm-text-sec);
    box-shadow: none;
}

#gm-app .gm-btn-secondary:hover {
    border-color: var(--gm-primary-start);
    color: var(--gm-primary-start);
    background: rgba(99, 102, 241, 0.05);
    /* Subtle Indigo tint */
    box-shadow: none;
}

/* Neon classes legacy mapping */
#gm-app .neon-blue {
    /* Maps to Primary Gradient now */
}

#gm-app .neon-red {
    background: var(--gm-danger);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

#gm-app .neon-green {
    background: var(--gm-success);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}

/* Inputs & Forms (Critical for Teleprompter) */
.gm-input-text,
.gm-input-area,
#gm-tp-input-main {
    width: 100%;
    background: var(--gm-bg);
    /* Inset look */
    border: 1px solid var(--gm-border);
    border-radius: 8px;
    padding: 1rem;
    color: var(--gm-text-main);
    font-size: 1rem;
    margin-bottom: 1rem;
    transition: border 0.3s;
    font-family: inherit;
}

.gm-input-text:focus,
.gm-input-area:focus,
#gm-tp-input-main:focus {
    outline: none;
    border-color: var(--gm-primary-start);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.gm-input-area,
#gm-tp-input-main {
    resize: vertical;
    min-height: 100px;
}

/* Teleprompter Display */
#gm-tp-display-main {
    width: 100%;
    height: 250px;
    max-height: 250px;
    background: #000;
    /* Keep black for contrast */
    border: 2px solid var(--gm-primary-end);
    border-radius: 8px;
    padding: 0 2rem;
    overflow: hidden;
    position: relative;
    margin-bottom: 1rem;
}

#gm-tp-scroller-main {
    font-size: 2.2rem;
    line-height: 1.6;
    color: #ffeb3b;
    /* Yellow for reading readability remains best */
    font-weight: bold;
    text-align: center;
    padding-top: 120px;
    padding-bottom: 300px;
}

/* Teleprompter Focus Mode - Active during recording */
#gm-app.gm-tp-focus-active {
    /* Keep normal layout, teleprompter just expands */
}

#gm-app.gm-tp-focus-active #gm-tp-display-main {
    height: 350px;
    max-height: 350px;
}

/* Line highlight styles for karaoke effect */
.gm-tp-line {
    transition: all 0.3s ease;
    opacity: 0.5;
}

.gm-tp-line.active-focus {
    opacity: 1;
    color: #00ff88;
    font-size: 2.5rem;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

/* Tab System */
.gm-topic-tabs {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--gm-border);
    padding-bottom: 1rem;
}

.gm-tab {
    background: transparent;
    border: none;
    color: var(--gm-text-sec);
    font-size: 1rem;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    border-radius: 8px;
}

.gm-tab:hover {
    color: var(--gm-text-main);
}

.gm-tab.active {
    color: #ffaa00;
    /* Gold text */
    background: linear-gradient(135deg, var(--gm-primary-start), var(--gm-primary-end));
    font-weight: 700;
}

/* Transcript Box */
#gm-transcript-box {
    background: var(--gm-bg);
    border: 1px solid var(--gm-border);
    color: var(--gm-text-main);
    padding: 1rem;
    border-radius: 8px;
    height: 150px;
    overflow-y: auto;
    font-family: monospace;
    font-size: 0.95rem;
    line-height: 1.8;
}

/* Config Modal (Floating) */
#gm-app .gm-config-trigger {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: var(--gm-surface);
    border: 1px solid var(--gm-border);
    color: var(--gm-text-sec);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 50;
    transition: all 0.3s ease;
}

#gm-app .gm-config-trigger:hover {
    color: var(--gm-primary-start);
    transform: rotate(90deg);
}

#gm-app .gm-modal {
    position: absolute;
    top: 60px;
    right: 1.5rem;
    left: auto;
    /* Allow auto width */
    width: 320px;
    /* Fixed width for config */
    background: var(--gm-surface);
    /* Use surface color */
    border: 1px solid var(--gm-border);
    border-radius: 16px;
    z-index: 60;
    backdrop-filter: blur(15px);
    /* Keep glass effect */
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.gm-modal-header {
    background: rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid var(--gm-border);
}

.gm-setting-label {
    color: var(--gm-text-sec);
}

.gm-toggle-btn {
    background: var(--gm-bg);
    border-color: var(--gm-border);
    color: var(--gm-text-sec);
}

.gm-toggle-btn.active {
    background: var(--gm-primary-start);
    color: #fff;
    border-color: var(--gm-primary-start);
}

/* Monetization / Credits */
#gm-credit-counter {
    background: var(--gm-surface);
    color: var(--gm-text-main);
    border: 1px solid var(--gm-border);
}

#gm-credit-value {
    color: var(--gm-success);
}

.gm-recharge-btn {
    background: var(--gm-warning);
    border: none;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
}

.gm-recharge-btn:hover {
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.6);
}

/* Ad Modal (Overlay) */
.gm-ad-modal {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(8px);
}

.gm-ad-modal-content {
    background: var(--gm-surface);
    border: 1px solid var(--gm-border);
    color: var(--gm-text-main);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

#gm-countdown-number {
    color: var(--gm-primary-end);
}

/* Analysis Stats */
.gm-score-ring {
    transform: scale(0.9);
}

.circular-chart .circle {
    stroke: var(--gm-primary-end);
}

.percentage {
    fill: var(--gm-text-main);
}

.gm-stat-val {
    color: var(--gm-text-main);
    font-variant-numeric: tabular-nums;
}

.gm-stat-label {
    color: var(--gm-text-sec);
    text-transform: uppercase;
    font-size: 0.8rem;
}

#gm-app .gm-bar {
    background: var(--gm-border);
}

#gm-app .gm-bar div {
    background: var(--gm-primary-start);
}

/* Utilities */
.hidden {
    display: none !important;
}

.gm-highlight-filler {
    color: var(--gm-danger);
    text-decoration: underline wavy;
    font-weight: 700;
}

.gm-highlight-repeat {
    color: var(--gm-warning);
    background: rgba(245, 158, 11, 0.1);
    cursor: help;
}

/* Responsive */
@media (max-width: 600px) {
    #gm-app {
        padding: 1rem;
    }

    #gm-app h1 {
        font-size: 2rem;
    }

    .gm-controls {
        flex-direction: column;
    }

    #gm-timer {
        font-size: 2rem;
    }

    #gm-app .gm-modal {
        left: 1rem;
        right: 1rem;
        width: auto;
    }

    /* Mode tabs - larger touch targets for mobile */
    .gm-topic-tabs {
        flex-wrap: wrap;
        gap: 0.5rem;
        padding-bottom: 1rem;
    }

    .gm-tab {
        font-size: 0.9rem;
        padding: 0.75rem 1rem;
        min-height: 44px;
        flex: 1 1 calc(50% - 0.5rem);
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
    }
}


/* Disabled Button Tooltip */
.gm-btn-disabled {
    background: var(--gm-surface) !important;
    color: var(--gm-text-sec) !important;
    border: 1px solid var(--gm-border) !important;
    opacity: 0.6;
    pointer-events: none !important;
}

.gm-btn-disabled:hover::after {
    background-color: var(--gm-surface);
    color: var(--gm-warning);
    border: 1px solid var(--gm-warning);
}

/* Header */
#gm-app .gm-header {
    text-align: center;
    margin-bottom: 2rem;
}

#gm-app h1 {
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--gm-primary-start), var(--gm-primary-end));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0 0 1rem 0;
}

#gm-app .gm-topic-box {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 1rem;
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.1);
}

#gm-app #gm-current-topic {
    font-size: 2rem;
    color: var(--primary);
    margin: 0.5rem 0 0 0;
    text-transform: capitalize;
}

/* Visualizer & Timer */
#gm-app .gm-visualizer-container {
    position: relative;
    height: 150px;
    background: var(--surface);
    border-radius: 12px;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

#gm-app canvas {
    width: 100%;
    height: 100%;
}

#gm-app #gm-timer {
    position: absolute;
    font-size: 3rem;
    font-weight: bold;
    color: var(--accent);
    text-shadow: 0 0 10px rgba(0, 255, 157, 0.5);
}

/* Controls */
#gm-app .gm-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

#gm-app .gm-btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#gm-app .neon-blue {
    background: var(--primary);
    color: #000;
    box-shadow: 0 0 15px var(--primary);
}

#gm-app .neon-red {
    background: var(--danger);
    color: #fff;
    box-shadow: 0 0 15px var(--danger);
}

#gm-app .neon-green {
    background: var(--accent);
    color: #000;
    box-shadow: 0 0 15px var(--accent);
}

#gm-app .gm-btn:hover {
    transform: scale(1.05);
    filter: brightness(1.2);
}

/* Transcript */
#gm-app .gm-transcript-section {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
}

#gm-app #gm-transcript-box {
    min-height: 100px;
    max-height: 300px;
    overflow-y: auto;
    font-size: 1.1rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.8);
}

#gm-app.gm-theme-light #gm-transcript-box {
    color: #333;
}

/* Highlighting */
.gm-highlight-filler {
    color: var(--danger);
    font-weight: bold;
    text-decoration: underline wavy;
}

.gm-highlight-repeat {
    color: #ffd700;
    /* Yellow */
    font-weight: bold;
    background: rgba(255, 215, 0, 0.1);
    cursor: help;
}

/* Config Modal */
#gm-app .gm-config-trigger {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 24px;
    /* Reduced from 40px */
    height: 24px;
    cursor: pointer;
    z-index: 10;
    transition: transform 0.3s ease;
}

#gm-app .gm-config-trigger:hover {
    color: var(--primary);
    transform: rotate(90deg);
}

/* Fixed Width for Desktop */
@media (min-width: 768px) {
    #gm-app {
        width: 800px;
        /* Fixed width */
        margin: 40px auto;
        /* Centered */
    }
}

#gm-app .gm-modal {
    position: absolute;
    top: 60px;
    right: 1rem;
    left: 1rem;
    background: linear-gradient(145deg, rgba(30, 30, 35, 0.98), rgba(20, 20, 25, 0.98));
    border: 1px solid rgba(0, 243, 255, 0.3);
    border-radius: 16px;
    z-index: 20;
    backdrop-filter: blur(15px);
    width: auto;
    max-width: 320px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 243, 255, 0.1);
    overflow: hidden;
}

.gm-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

.gm-modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--primary);
}

.gm-modal-close {
    background: none;
    border: none;
    color: #888;
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s;
}

.gm-modal-close:hover {
    color: var(--danger);
}

.gm-modal-body {
    padding: 1.2rem;
}

.gm-setting-group {
    margin-bottom: 1.2rem;
}

.gm-setting-group:last-child {
    margin-bottom: 0;
}

.gm-setting-label {
    display: block;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.gm-toggle-buttons {
    display: flex;
    gap: 0.5rem;
}

.gm-toggle-btn {
    flex: 1;
    padding: 0.6rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
    color: #aaa;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
}

.gm-toggle-btn:hover {
    border-color: var(--primary);
    color: #fff;
}

.gm-toggle-btn.active {
    background: var(--primary);
    color: #000;
    border-color: var(--primary);
    font-weight: bold;
}

.gm-select {
    width: 100%;
    padding: 0.7rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #fff;
    font-size: 0.9rem;
    cursor: pointer;
}

.gm-select:focus {
    outline: none;
    border-color: var(--primary);
}

.gm-select option {
    background: #1a1a1a;
}

.gm-switch-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gm-switch-desc {
    font-size: 0.8rem;
    color: #888;
}

/* Toggle Switch */
.gm-switch {
    position: relative;
    width: 50px;
    height: 26px;
}

.gm-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.gm-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 26px;
    transition: 0.3s;
}

.gm-slider:before {
    content: "";
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
}

.gm-switch input:checked+.gm-slider {
    background: var(--accent);
}

.gm-switch input:checked+.gm-slider:before {
    transform: translateX(24px);
}

#gm-app .hidden {
    display: none !important;
}

/* Analysis Results */
#gm-app .gm-score-ring {
    width: 100px;
    margin: 0 auto;
}

/* Transcript Box Scrollable */
#gm-transcript-box {
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 8px;
    min-height: 100px;
    max-height: 250px;
    /* Fixed height Limit */
    overflow-y: auto;
    /* Scrollable */
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    line-height: 1.6;
    border: 1px solid rgba(255, 255, 255, 0.1);
    white-space: pre-wrap;
    /* Preserve line breaks */
}

/* Topic Tabs */
.gm-topic-tabs {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.gm-tab {
    background: transparent;
    border: none;
    color: #888;
    font-size: 1rem;
    padding: 0.5rem 1rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

.gm-tab:hover {
    color: #fff;
}

.gm-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: bold;
}

/* Custom Topic Inputs */
.gm-input-text,
.gm-input-area {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 1rem;
    color: #fff;
    font-size: 1rem;
    margin-bottom: 1rem;
    font-family: inherit;
}

.gm-input-text:focus,
.gm-input-area:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.1);
}

.gm-input-area {
    min-height: 80px;
    resize: vertical;
}

/* Range Slider */
.gm-range {
    width: 100%;
    margin-top: 0.5rem;
    accent-color: var(--primary);
}

.circular-chart {
    display: block;
    margin: 10px auto;
    max-width: 80%;
    max-height: 250px;
}

.circle-bg {
    fill: none;
    stroke: #eee;
    stroke-width: 3.8;
}

.circle {
    fill: none;
    stroke-width: 2.8;
    stroke-linecap: round;
    animation: progress 1s ease-out forwards;
    stroke: var(--secondary);
}

.percentage {
    fill: #fff;
    font-family: sans-serif;
    font-weight: bold;
    font-size: 0.5em;
    text-anchor: middle;
}

#gm-app.gm-theme-light .percentage {
    fill: #333;
}

@keyframes progress {
    0% {
        stroke-dasharray: 0 100;
    }
}

#gm-app .gm-grid-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    /* Increased width for text readability */
    gap: 1.5rem;
    margin-top: 2rem;
}

#gm-app .gm-stat-card,
#gm-app .gm-lexi-card-metric,
#gm-app .gm-lexi-metric-box,
#gm-app .gm-lingo-card,
#gm-app .gm-lingo-cefr-card,
#gm-app .gm-lingo-mini-stat {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

#gm-app .gm-stat-card {
    padding: 1.5rem;
    border-radius: 12px;
}

.gm-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.gm-card-header h4 {
    margin: 0;
    color: var(--primary);
}

.gm-mini-score {
    font-weight: bold;
    color: #fff;
}

#gm-app .gm-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
}

#gm-app .gm-bar div {
    height: 100%;
    background: var(--primary);
    transition: width 1s ease;
}

.gm-card-feedback {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.4;
    margin: 0;
    min-height: 3rem;
    /* Align cards somewhat */
}

#gm-app.gm-theme-light .gm-card-feedback {
    color: #555;
}

/* Responsiveness */
@media (max-width: 600px) {
    #gm-app {
        padding: 1rem;
    }

    #gm-app h1 {
        font-size: 1.8rem;
    }

    #gm-app #gm-timer {
        font-size: 2rem;
    }

    #gm-app .gm-controls {
        flex-direction: column;
    }
}

/* Animation for loading text */
.blinking-text {
    animation: blinker 1s linear infinite;
}

@keyframes blinker {
    50% {
        opacity: 0.5;
    }
}

/* Loading Overlay */
#gm-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 10, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: 20px;
}

#gm-loading-overlay p {
    margin-top: 1.5rem;
    font-size: 1.2rem;
    color: var(--primary);
    animation: blinker 1.5s ease-in-out infinite;
}

/* Spinner */
.gm-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Practice Mode Summary */
#gm-practice-summary {
    background: rgba(255, 255, 255, 0.05);
    padding: 1.5rem;
    border-radius: 12px;
    margin-top: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.gm-practice-stats {
    display: flex;
    justify-content: space-around;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.gm-stat-item {
    text-align: center;
}

.gm-stat-val {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary);
}

.gm-stat-label {
    font-size: 0.9rem;
    color: #aaa;
    margin-top: 0.3rem;
}

.gm-practice-note {
    color: #666;
    font-size: 0.9rem;
    font-style: italic;
    margin-top: 0.5rem;
}

/* Teleprompter Box (Tab Mode) */
.gm-teleprompter-box {
    text-align: left;
    min-height: 300px;
    /* Use min-height instead */
    display: flex;
    flex-direction: column;
}

#gm-tp-input-main {
    flex: 1;
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 1rem;
    color: #fff;
    font-size: 1.1rem;
    resize: none;
    font-family: inherit;
    outline: none;
}

#gm-tp-display-main {
    flex: 1;
    width: 100%;
    /* Fixed height is CRITICAL for scrolling window effect */
    height: 250px;
    max-height: 250px;
    background: #000;
    border: 2px solid var(--primary);
    border-radius: 8px;
    padding: 0 2rem;
    /* Side padding */
    overflow-y: auto;
    overflow-x: hidden;
    /* Programmatic Scroll */
    position: relative;
    /* High contrast for reading */
    margin-bottom: 0;
    /* Align perfectly */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#gm-tp-display-main::-webkit-scrollbar {
    display: none;
}

#gm-tp-scroller-main {
    font-size: 1.4rem;
    line-height: 1.6;
    color: #ffeb3b;
    /* Yellow for reading */
    font-weight: bold;
    text-align: center;
    padding-top: 40px;
    /* Start near top */
    padding-bottom: 300px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.gm-tp-controls-row {
    display: flex;
    align-items: center;
    margin-top: 1rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.5rem;
    border-radius: 8px;
}

#gm-btn-tp-play {
    width: 44px;
    /* Slightly larger */
    height: 44px;
    font-size: 1.4rem;
    color: #000;
    /* Dark text for neon green */
    font-weight: bold;
}

/* Custom Start Button Adjustment (Desktop only defaults, Mobile overrides below) */
#gm-btn-custom-start {
    width: auto !important;
    /* Override inline style width:100% via CSS if possible, or remove inline */
    display: block;
    margin: 1rem auto !important;
    /* Center */
    padding: 0.8rem 3rem;
    max-width: 400px;
}

/* ===== Teleprompter Control Buttons ===== */
.gm-tp-controls-row .gm-btn-small {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gm-tp-controls-row .gm-btn-small:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.gm-tp-controls-row .gm-btn-small.neon-red {
    background: rgba(255, 0, 85, 0.2);
    border-color: var(--danger);
    color: var(--danger);
}

.gm-tp-controls-row .gm-btn-small.neon-red:hover {
    background: var(--danger);
    color: #fff;
    box-shadow: 0 0 10px var(--danger);
}

/* ===== RESPONSIVE MOBILE STYLES ===== */
@media (max-width: 768px) {
    #gm-app {
        max-width: 100%;
        width: 100%;
        padding: 0.8rem;
        border-radius: 0;
        margin: 0;
    }

    #gm-app h1 {
        font-size: 1.8rem;
    }

    #gm-app #gm-current-topic {
        font-size: 1.4rem;
    }

    /* Visualizer */
    #gm-app .gm-visualizer-container {
        height: 100px;
        margin-bottom: 1rem;
    }

    #gm-app #gm-timer {
        font-size: 2rem;
    }

    /* Controls */
    #gm-app .gm-controls {
        flex-direction: column;
        gap: 0.5rem;
    }

    #gm-app .gm-btn {
        padding: 0.8rem 1.5rem;
        font-size: 0.95rem;
        width: 100%;
    }

    /* Tabs */
    .gm-tab-row {
        flex-wrap: wrap;
        gap: 0.3rem;
    }

    .gm-tab {
        flex: 1 1 45%;
        padding: 0.6rem;
        font-size: 0.85rem;
    }

    /* Topic Box */
    #gm-app .gm-topic-box {
        padding: 1rem;
    }

    /* Teleprompter */
    .gm-teleprompter-box {
        min-height: 250px;
    }

    #gm-tp-input-main {
        min-height: 150px !important;
        font-size: 1rem;
    }

    #gm-tp-display-main {
        height: 200px;
        max-height: 200px;
    }

    #gm-tp-scroller-main {
        font-size: 1.5rem;
        padding-top: 80px;
    }

    .gm-tp-controls-row {
        flex-wrap: nowrap !important;
        gap: 0.5rem;
        padding: 0.5rem;
        overflow-x: auto;
    }

    /* Center buttons on mobile */
    .gm-btn {
        display: flex;
        justify-content: center;
        align-items: center;
        text-align: center;
    }

    .gm-tp-controls-row .gm-btn-small {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }

    /* Analysis Results */
    .gm-grid-stats {
        grid-template-columns: 1fr;
    }

    .gm-stat-card {
        padding: 0.8rem;
    }

    .gm-score-ring {
        transform: scale(0.8);
    }

    /* Transcript */
    #gm-app #gm-transcript-box {
        min-height: 80px;
        font-size: 1rem;
    }

    /* Modal */
    .gm-modal {
        width: 95%;
        max-height: 90vh;
        overflow-y: auto;
    }

    .gm-toggle-buttons {
        flex-direction: column;
    }

    .gm-toggle-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    #gm-app {
        padding: 0.8rem;
    }

    #gm-app h1 {
        font-size: 1.5rem;
    }

    #gm-app #gm-current-topic {
        font-size: 1.2rem;
    }

    #gm-app #gm-timer {
        font-size: 1.5rem;
    }

    .gm-tab {
        flex: 1 1 100%;
        font-size: 0.8rem;
    }

    #gm-tp-scroller-main {
        font-size: 1.2rem;
    }

    .gm-tp-controls-row {
        justify-content: center;
    }
}

/* =========================================
   MONETIZATION & CREDIT SYSTEM
   ========================================= */

/* Credit Counter Info */
#gm-credit-counter {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 8px 15px;
    border-radius: 50px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 1rem;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
    transition: all 0.3s ease;
}

#gm-credit-counter.gm-credits-empty {
    background: rgba(255, 77, 77, 0.15);
    border-color: #ff4d4d;
    color: #ff8888;
}

.gm-credit-icon {
    font-size: 1.1rem;
}

#gm-credit-value {
    font-weight: bold;
    color: var(--primary);
}

/* Recharge Button */
.gm-recharge-btn {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #000;
    font-weight: bold;
    border: none;
    padding: 12px 24px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 1rem;
    margin: 10px auto;
    display: block;
    box-shadow: 0 4px 15px rgba(255, 165, 0, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
    width: 100%;
    max-width: 300px;
}

.gm-recharge-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 165, 0, 0.6);
}

.gm-recharge-btn.hidden {
    display: none !important;
}

/* Pulse Animation for Attention */
@keyframes gm-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 165, 0, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(255, 165, 0, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 165, 0, 0);
    }
}

.gm-pulse {
    animation: gm-pulse 2s infinite;
}

/* Centered Ad Banner (Policy Compliant & Aggressive) */
.gm-ad-banner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    /* Dark background to focus on banner */
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(8px);
}

.gm-ad-banner-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    cursor: pointer;
    /* Interaction hint: Clicking re-opens ad */
}

.gm-ad-banner-content {
    background: #000;
    width: 90%;
    max-width: 400px;
    /* Centered banner occupies ~30% of typical area */
    padding: 40px 20px;
    border: 2px solid var(--primary);
    border-radius: 20px;
    text-align: center;
    position: relative;
    box-shadow: 0 0 50px rgba(0, 255, 157, 0.3);
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    z-index: 100000;
    animation: gm-zoomIn 0.3s ease-out;
}

@keyframes gm-zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.gm-ad-banner-icon {
    font-size: 3rem;
    animation: bounce 2s infinite;
}

.gm-ad-banner-body h3 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--primary);
}

.gm-ad-banner-body p {
    font-size: 0.9rem;
    color: #ccc;
    margin: 10px 0;
}

.gm-banner-timer-wrap {
    font-size: 2rem;
    font-weight: bold;
    color: #fff;
    margin: 10px 0;
}

#gm-banner-timer {
    color: var(--primary);
}

.gm-ad-banner-actions {
    width: 100%;
}

.gm-ad-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    z-index: 2;
}

.gm-ad-close:hover {
    color: #ff4d4d;
}

.gm-ad-banner.hidden {
    display: none !important;
}

@keyframes gm-bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-10px);
    }

    60% {
        transform: translateY(-5px);
    }
}

/* =========================================
   DISABLED BUTTON STYLES & TOOLTIP
   ========================================= */
.gm-btn-disabled {
    background-color: #666 !important;
    background-image: none !important;
    color: #aeaeae !important;
    cursor: not-allowed !important;
    box-shadow: none !important;
    transform: none !important;
    opacity: 0.7;
    position: relative;
    /* For tooltip positioning */
}

/* Tooltip on Hover */
.gm-btn-disabled:active {
    transform: none !important;
}

.gm-btn-disabled:hover::after {
    content: "⚠️ Sin créditos. Mira un anuncio para recargar.";
    position: absolute;
    bottom: 110%;
    /* Above the button */
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    z-index: 10000;
    pointer-events: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    border: 1px solid #444;
}

.gm-btn-disabled:hover::before {
    /* Arrow for the tooltip */
    content: "";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: rgba(0, 0, 0, 0.9) transparent transparent transparent;
    z-index: 10000;
}

/* =========================================
   LIGHT MODE REFINEMENTS (User Request v11)
   ========================================= */

#gm-app.gm-theme-light {
    /* Refinements handled in main variables */
}

/* 2. Resaltar Tabs (Botones de modo) en Modo Claro */
#gm-app.gm-theme-light .gm-tab {
    color: #475569;
    /* Slate 600 - darker for visibility */
    background: rgba(255, 255, 255, 0.6);
    /* Semi-transparent white */
    border: 1px solid rgba(255, 255, 255, 0.8);
    margin: 0 4px;
    font-weight: 600;
}

#gm-app.gm-theme-light .gm-tab.active {
    background: linear-gradient(135deg, var(--gm-primary-start), var(--gm-primary-end)) !important;
    color: #ffffff !important;
    /* Force white text */
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    /* Enhance legibility against gradient */
    border-color: transparent;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

/* 3. Inputs Personalizados en Modo Claro */
#gm-app.gm-theme-light .gm-input-text,
#gm-app.gm-theme-light .gm-input-area,
#gm-app.gm-theme-light #gm-tp-input-main {
    background-color: #ffffff !important;
    /* Fondo blanco puro */
    color: #1e293b !important;
    /* Texto oscuro */
    border: 2px solid #cbd5e1 !important;
    /* Borde resaltado */
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

#gm-app.gm-theme-light .gm-input-text:focus,
#gm-app.gm-theme-light .gm-input-area:focus,
#gm-app.gm-theme-light #gm-tp-input-main:focus {
    border-color: var(--gm-primary-start) !important;
    background-color: #fff !important;
}

#gm-app.gm-theme-light ::placeholder {
    color: #94a3b8;
    opacity: 1;
}

/* 4. Barra de tiempo (Slider) en Modo Claro */
#gm-app.gm-theme-light .gm-range {
    background: #94a3b8;
    /* Darker track for visibility */
    height: 6px;
    border-radius: 5px;
    appearance: none;
}

#gm-app.gm-theme-light .gm-range::-webkit-slider-thumb {
    appearance: none;
    background: var(--gm-primary-end);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* 5. Centrar boton Generate en Aleatorio */
#gm-mode-random {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    /* Allow full width for title alignment */
}

#gm-mode-random .gm-topic-box {
    width: 100%;
    /* Context box full width */
}

#gm-btn-topic {
    width: fit-content;
    padding-left: 3rem;
    padding-right: 3rem;
}

/* Fix Labels contrast */
#gm-app.gm-theme-light .gm-setting-label,
#gm-app.gm-theme-light label {
    color: #334155 !important;
    font-weight: 700;
}

/* Button borders for light mode */
#gm-app.gm-theme-light .gm-btn {
    border: 2px solid rgba(0, 0, 0, 0.15) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#gm-app.gm-theme-light .gm-btn:hover {
    border-color: rgba(0, 0, 0, 0.25) !important;
}

#gm-app.gm-theme-light .neon-red {
    border-color: rgba(239, 68, 68, 0.5) !important;
}

#gm-app.gm-theme-light .neon-green {
    border-color: rgba(16, 185, 129, 0.5) !important;
}

/* Unlimited time toggle in light mode */
#gm-app.gm-theme-light .gm-toggle-btn {
    border: 2px solid #cbd5e1 !important;
    background: #f8fafc !important;
    color: #475569 !important;
}

#gm-app.gm-theme-light .gm-toggle-btn.active {
    background: var(--gm-primary-start) !important;
    border-color: var(--gm-primary-start) !important;
    color: #fff !important;
}


/* =========================================
   LOKENT SEO REBRAND (v1)
   ========================================= */

/* Info Icons & Tooltips */
.gm-mode-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.gm-mode-info h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--gm-primary-end);
}

/* Rounded Info Icon (User Request) */
.gm-info-round {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: 2px solid currentColor;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    font-family: "Georgia", serif;
    font-style: italic;
    cursor: help;
    opacity: 0.7;
    margin-left: 6px;
    vertical-align: middle;
    transition: all 0.2s ease;
}

.gm-info-round:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

/* Highlights */
.gm-highlight-repeat {
    color: #ef4444;
    /* Red for repeats */
    font-weight: bold;
    text-decoration: underline wavy rgba(239, 68, 68, 0.5);
}

.gm-highlight-filler {
    color: #f59e0b;
    /* Amber for fillers */
    font-weight: bold;
    border-bottom: 2px dotted #f59e0b;
}

.gm-tooltip {
    position: relative;
    display: inline-block;
}

.gm-tooltip-text {
    visibility: hidden;
    width: 250px;
    background-color: var(--gm-surface);
    color: var(--gm-text-main);
    text-align: left;
    border-radius: 8px;
    padding: 10px;
    position: absolute;
    z-index: 100;
    bottom: 135%;
    /* Position above */
    left: 50%;
    margin-left: -125px;
    opacity: 0;
    transition: opacity 0.3s;
    border: 1px solid var(--gm-border);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    font-size: 0.85rem;
    line-height: 1.4;
    font-weight: normal;
}

.gm-tooltip:hover .gm-tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Arrow for Tooltip */
.gm-tooltip-text::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--gm-border) transparent transparent transparent;
}

/* Subtitle Style */
.gm-subtitle {
    font-size: 1.2rem;
    color: var(--gm-text-sec);
    margin-top: -0.5rem;
    margin-bottom: 2rem;
    font-weight: 400;
    text-align: center;
}

/* Ensure Tooltips are visible on Light Mode too */
#gm-app.gm-theme-light .gm-tooltip-text {
    background-color: #ffffff;
    color: #334155;
    border-color: #cbd5e1;
}

/* =========================================
   IDEAL SPEECH SECTION (NEW Feature)
   ========================================= */
.gm-ideal-speech {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(6, 182, 212, 0.1));
    border: 1px solid var(--primary);
    border-radius: var(--gm-radius);
    padding: 20px;
    margin-top: 25px;
    text-align: left;
}

.gm-ideal-speech h4 {
    color: var(--primary);
    font-size: 1.3rem;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.gm-ideal-speech p {
    color: var(--gm-text-main);
    line-height: 1.8;
    font-size: 1rem;
    white-space: pre-wrap;
}

/* Analysis Header Color Override */
#gm-analysis-result>h3 {
    color: var(--primary) !important;
    text-align: center;
    margin-bottom: 1.5rem;
}

/* =========================================
   HAMBURGER MENU BUTTON (Internal)
   ========================================= */
.gm-menu-trigger {
    position: relative;
    /* Changed from fixed */
    width: 44px;
    height: 44px;
    background: var(--gm-surface);
    border: 1px solid var(--gm-border);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.gm-menu-trigger:hover {
    background: var(--primary);
    border-color: var(--primary);
}

.gm-icon-menu {
    width: 24px;
    height: 24px;
    color: var(--gm-text-main);
}

.gm-menu-trigger:hover .gm-icon-menu {
    color: #000;
}

/* =========================================
   CONTROLS ROW (Menu + Credits)
   ========================================= */
.gm-controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    margin-bottom: 2rem;
    padding: 0 10px;
}

.gm-controls-right {
    display: flex;
    align-items: center;
    gap: 10px;
}


.gm-credit-counter {
    display: flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(6, 182, 212, 0.2));
    border: 1px solid var(--primary);
    border-radius: 50px;
    padding: 8px 16px;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary);
}

.gm-credit-icon {
    font-size: 1.2rem;
}

/* Recharge Button (Modern & Text Only - Orange/Yellow) */
.gm-recharge-btn {
    background: linear-gradient(135deg, #f59e0b, #fcd34d);
    /* Amber-500 to Amber-300 */
    color: #374151;
    /* Gray-700 for contrast */
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
    transition: all 0.3s ease;
    animation: gm-pulse-flash 2s infinite;
    /* Flashy Pulse */
    display: inline-block;
    /* Ensure width is respected */
}

.gm-recharge-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.7);
    filter: brightness(1.1);
}

.gm-recharge-btn.hidden {
    display: none !important;
}

@keyframes gm-pulse-flash {
    0% {
        transform: scale(1);
        box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 0 25px rgba(245, 158, 11, 0.8);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
    }
}

/* Mobile Adjustments for Header/Recharge */
@media (max-width: 600px) {
    .gm-controls-row {
        flex-direction: column;
        gap: 15px;
    }

    .gm-menu-trigger {
        position: relative;
        align-self: flex-start;
    }

    .gm-header-row h1 {
        margin-top: 0;
        margin-left: 50px;
        /* Make space for hamburger */
    }

    /* Override plan: keep menu in flow but better align */
    .gm-controls-row {
        margin-top: 0;
    }

    .gm-controls-right {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .gm-recharge-btn {
        width: 100%;
        /* Full width on mobile */
        text-align: center;
        font-size: 0.95rem;
        padding: 12px;
    }
}

/* Teleprompter Buttons (Transparent & Visible) */
.gm-tp-controls-row .gm-btn-small {
    background: transparent !important;
    border: 1px solid var(--gm-border) !important;
    padding: 0.5rem;
    transition: all 0.2s;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gm-tp-controls-row .gm-btn-small:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    transform: scale(1.1);
    border-color: var(--primary) !important;
}

.gm-icon-control {
    width: 28px;
    height: 28px;
    color: var(--gm-text-main);
}

.gm-btn-small.neon-green .gm-icon-control {
    color: var(--gm-success);
}

.gm-btn-small.neon-red .gm-icon-control {
    color: var(--gm-danger);
}

/* IDEAL SPEECH BOX (Prevent Overflow STRICT v2.13) */
.gm-ideal-speech {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    /* HYPER-STRICT CONTAINMENT */
    width: 100%;
    max-width: 100%;
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--gm-surface);
    border: 1px solid var(--gm-border);
    border-radius: 12px;
    box-sizing: border-box;
    overflow: hidden;
    overflow-x: hidden;
}

#gm-ideal-speech-text {
    width: 100%;
    max-width: 100%;
    white-space: pre-line;
    /* Aggressive wrapping */
    word-wrap: break-word;
    /* Legacy support */
    overflow-wrap: anywhere;
    /* FORCE wrap anywhere if needed */
    word-break: break-word;
    /* Break even URLs or long strings */
    margin: 0;
}

.gm-ideal-speech h4 {
    margin-top: 0;
    color: var(--gm-primary-end);
    margin-bottom: 1rem;
}

/* =========================================
   DESKTOP LAYOUT (85% Width)
   ========================================= */
@media (min-width: 1024px) {
    #gm-app {
        width: 85% !important;
        margin: 0 auto;
        left: 0;
        right: 0;
        max-width: 1600px;
        /* Optional cap */
        border-radius: 20px;
    }
}

/* =========================================
   MODERN VOICE VISUALIZER COLORS
   ========================================= */
/* Override canvas visualizer colors via JS, but add CSS hints */
#gm-app .gm-visualizer-container {
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.05), rgba(6, 182, 212, 0.05));
    border: 1px solid rgba(99, 102, 241, 0.3);
}

/* Karaoke Focus Mode (Absolute Sync v3.3) */
.gm-tp-line {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #ffeb3b;
    opacity: 0.6;
    transition: all 0.3s ease;
    text-align: center;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    max-width: 100%;
}

.gm-tp-line.active-focus {
    opacity: 1;
    color: #FFD700;
    /* Yellow for Focus */
    font-size: 1.6rem;
    transform: scale(1.05);
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

.gm-tp-focus-active .gm-header,
.gm-tp-focus-active .gm-topic-tabs,
.gm-tp-focus-active .gm-visualizer-container,
.gm-tp-focus-active .gm-transcript-section,
.gm-tp-focus-active .gm-recharge-btn,
.gm-tp-focus-active .gm-credit-counter {
    display: none !important;
}

.gm-tp-focus-active #gm-tp-display-main {
    height: 60vh !important;
    max-height: 800px;
    border-color: #FFD700 !important;
    /* Visual indicator */
}

/* =========================================
   LINGOMODE - LANGUAGE LEARNING MODULE
   ========================================= */

/* Compact Controls Row - Language + Time inline */
.gm-lingo-controls-row {
    display: flex;
    gap: 0.75rem;
    margin: 1rem 0;
    align-items: flex-start;
    justify-content: center;
    flex-wrap: wrap;
}

.gm-lingo-select-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    /* Removed flex: 1 to prevent full width */
}

.gm-lingo-mini-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--gm-text);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 0.25rem 0.5rem;
    background: rgba(100, 100, 100, 0.15);
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 0.2rem;
}

.gm-lingo-select {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--gm-border);
    border-radius: 6px;
    background: rgba(50, 50, 50, 0.5);
    color: var(--gm-text);
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color 0.3s ease;
    min-width: 100px;
    max-width: 140px;
}

.gm-lingo-select:hover {
    border-color: var(--primary);
}

.gm-lingo-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.2);
}

/* Teleprompter Box - Always visible scrollable textarea */
.gm-lingo-teleprompter-box {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.gm-lingo-text-input {
    width: 100%;
    min-height: 100px;
    max-height: 150px;
    padding: 0.6rem;
    border: 1px solid var(--gm-border);
    border-radius: 6px;
    background: rgba(50, 50, 50, 0.5);
    color: var(--gm-text);
    font-size: 0.85rem;
    line-height: 1.4;
    resize: none;
    overflow-y: auto;
    font-family: inherit;
}

.gm-lingo-text-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.2);
}

.gm-lingo-text-input::placeholder {
    color: var(--gm-text-sec);
    opacity: 0.6;
}

/* Light mode overrides for LingoMode */
#gm-app.gm-theme-light .gm-lingo-mini-label {
    background: #F9F9F7;
    color: #1E293B;
    font-weight: 700;
}

#gm-app.gm-theme-light .gm-lingo-select {
    background: #F9F9F7;
    color: #1E293B;
    border-color: #CBD5E1;
}

#gm-app.gm-theme-light .gm-lingo-text-input {
    background: #F9F9F7;
    color: #1E293B;
    border-color: #CBD5E1;
}

/* Legacy controls (can be removed later) */
.gm-lingo-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1rem 0;
    padding: 1rem;
    background: var(--gm-surface);
    border-radius: 12px;
    border: 1px solid var(--gm-border);
}

.gm-setting-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.gm-setting-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gm-text-sec);
}

/* LingoMode Teleprompter Section */
.gm-lingo-teleprompter-section {
    margin-top: 1rem;
}

.gm-btn-outline {
    background: transparent;
    border: 2px dashed var(--gm-border);
    color: var(--gm-text-sec);
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.gm-btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(6, 182, 212, 0.1);
}

.gm-lingo-tp-overlay {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    border: 1px solid var(--gm-border);
}

.gm-lingo-tp-display {
    min-height: 200px;
    max-height: 300px;
    overflow: hidden;
    padding: 1rem;
    background: var(--gm-surface);
    border-radius: 8px;
    font-size: 1.4rem;
    line-height: 2;
}

#gm-lingo-tp-scroller {
    transition: transform 0.1s linear;
}

/* Neon Green Button for LingoMode */
.gm-btn.neon-green {
    background: linear-gradient(135deg, #10B981, #059669);
    color: white;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.3);
}

.gm-btn.neon-green:hover {
    box-shadow: 0 0 25px rgba(16, 185, 129, 0.5);
    transform: translateY(-2px);
}

/* =========================================
   LINGOMODE RESULTS SECTION
   ========================================= */

.gm-lingo-results {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--gm-surface);
    border-radius: var(--gm-radius);
    border: 1px solid var(--gm-border);
}

.gm-lingo-results h3 {
    margin: 0 0 1.5rem 0;
    font-size: 1.3rem;
    color: var(--gm-text-main);
    text-align: center;
}

/* Top Grid: CEFR + Mini Stats */
.gm-lingo-top-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 600px) {
    .gm-lingo-top-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* CEFR Level Badge */
.gm-lingo-cefr-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(6, 182, 212, 0.2));
    border-radius: 12px;
    border: 2px solid var(--secondary);
}

.gm-lingo-cefr-label {
    font-size: 0.75rem;
    color: var(--gm-text-sec);
    margin-bottom: 0.5rem;
}

.gm-lingo-cefr-badge {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--gm-primary-start), var(--gm-primary-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Mini Stat Cards */
.gm-lingo-mini-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    background: var(--gm-bg);
    border-radius: 10px;
    border: 1px solid var(--gm-border);
}

.gm-lingo-mini-stat .label {
    font-size: 0.7rem;
    color: var(--gm-text-sec);
    margin-bottom: 0.25rem;
}

.gm-lingo-mini-stat .value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
}

/* LingoMode Cards */
.gm-lingo-card {
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--gm-bg);
    border-radius: 12px;
    border: 1px solid var(--gm-border);
}

.gm-lingo-card h4 {
    margin: 0 0 0.75rem 0;
    font-size: 1rem;
    color: var(--gm-text-main);
}

.gm-lingo-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.gm-lingo-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--gm-border);
    font-size: 0.9rem;
    color: var(--gm-text-main);
}

.gm-lingo-list li:last-child {
    border-bottom: none;
}

.gm-lingo-spanglish-text {
    font-size: 0.95rem;
    color: var(--gm-warning);
    font-style: italic;
}

/* Native Rewrite Box (Highlighted) */
.gm-lingo-native-rewrite {
    padding: 1.25rem;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(6, 182, 212, 0.1));
    border-radius: 12px;
    border: 2px solid var(--accent);
    margin-top: 1rem;
}

.gm-lingo-native-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.gm-lingo-native-header h4 {
    margin: 0;
    font-size: 1rem;
    color: var(--accent);
}

#gm-lingo-native-text {
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--gm-text-main);
    margin: 0;
}

/* TTS Button */
.gm-btn-icon {
    background: none;
    border: 2px solid var(--accent);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gm-btn-icon:hover {
    background: var(--accent);
    transform: scale(1.1);
}

.gm-btn-icon:active {
    transform: scale(0.95);
}

/* Light Mode Overrides for LingoMode */
#gm-app.gm-theme-light .gm-lingo-controls,
#gm-app.gm-theme-light .gm-lingo-card {
    background: #FFFFFF;
    border-color: #E2E8F0;
}

#gm-app.gm-theme-light .gm-lingo-results {
    background: #FFFFFF;
}

#gm-app.gm-theme-light .gm-lingo-mini-stat {
    background: #F1F5F9;
}

/* =========================================
   MOBILE RESPONSIVE DESIGN
   ========================================= */

@media screen and (max-width: 768px) {
    #gm-app {
        padding: 1rem;
        max-width: 100vw;
        overflow-x: hidden;
    }

    .gm-title {
        font-size: 1.5rem;
    }

    .gm-subtitle {
        font-size: 0.9rem;
    }

    .gm-topic-tabs {
        flex-wrap: wrap;
        gap: 0.4rem;
        padding: 0.5rem;
    }

    .gm-tab {
        font-size: 0.7rem;
        padding: 0.35rem 0.5rem;
        flex: 0 1 auto;
        min-width: auto;
        text-align: center;
        white-space: nowrap;
    }

    .gm-btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
    }

    .gm-controls {
        flex-direction: column;
        gap: 0.5rem;
    }

    #gm-transcript-box {
        font-size: 0.9rem;
        padding: 0.75rem;
    }

    .gm-stats {
        flex-wrap: wrap;
    }

    .gm-stat {
        flex: 1 1 45%;
    }

    /* LingoMode mobile - keep compact and centered */
    .gm-lingo-controls-row {
        flex-direction: row;
        justify-content: center;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .gm-lingo-select-group {
        flex: 0 0 auto;
    }

    .gm-lingo-select {
        min-width: 90px;
        max-width: 120px;
        width: auto;
    }

    /* Analysis results mobile */
    .gm-card-feedback {
        padding: 1rem;
    }

    .percentage {
        font-size: 1.5rem;
    }
}

@media screen and (max-width: 480px) {
    #gm-app {
        padding: 0.75rem;
        border-radius: 12px;
    }

    .gm-title {
        font-size: 1.3rem;
    }

    .gm-tab {
        font-size: 0.75rem;
        padding: 0.3rem 0.6rem;
    }

    .gm-btn {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }

    #gm-timer {
        font-size: 2rem;
    }
}

/* =========================================
   CONTROLS ROW WITH INLINE SUBTITLE
   ========================================= */
.gm-controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    margin-bottom: 1.5rem;
    padding: 0 0.5rem;
}

.gm-subtitle-inline {
    flex: 1;
    text-align: center;
    font-size: 1rem;
    font-weight: 500;
    color: var(--gm-text-sec);
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Light mode subtitle */
#gm-app.gm-theme-light .gm-subtitle-inline {
    color: #64748B;
}

/* Desktop - larger subtitle */
@media (min-width: 768px) {
    .gm-subtitle-inline {
        font-size: 1.1rem;
    }
}

/* Mobile - menu + subtitle on same row, credits below */
@media (max-width: 600px) {
    .gm-controls-row {
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: space-between;
    }

    .gm-menu-trigger {
        order: 1;
        flex-shrink: 0;
    }

    .gm-subtitle-inline {
        order: 2;
        flex: 1;
        font-size: 0.85rem;
        text-align: left;
        margin-left: 0.5rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .gm-controls-right {
        order: 3;
        flex-basis: 100%;
        justify-content: center;
        margin-top: 0.25rem;
    }
}

/* Light Mode - Circular Credits */
body.gm-theme-light .gm-credit-counter {
    border-radius: 50% !important;
    width: 38px;
    height: 38px;
    padding: 0;
    justify-content: center;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Mobile Score Fix - Prevent overlap */
@media (max-width: 600px) {
    .percentage {
        font-size: 1.5rem !important;
    }

    .single-chart svg {
        width: 100%;
    }
}

/* === FINAL FIXES FOR MOBILE & UI === */

/* 1. Mobile Visualizer Visibility */
@media (max-width: 600px) {
    .gm-visualizer-container {
        display: block !important;
        min-height: 120px !important;
        background: rgba(0, 0, 0, 0.2);
        /* Contrast */
    }

    #gm-audio-visualizer {
        display: block !important;
        width: 100% !important;
        height: 100% !important;
        min-height: 120px;
    }

    /* 2. Mobile Score Centering & Size */
    .percentage {
        font-size: 8px !important;
        /* Smaller relative to SVG */
        dominant-baseline: central;
        -webkit-text-fill-color: transparent;
        font-weight: 800;
    }

    /* 4. Light Mode Credits Circle */
    body.gm-theme-light .gm-credit-counter {
        border: 2px solid var(--primary) !important;
        background: rgba(255, 255, 255, 0.5);
        border-radius: 50% !important;
        width: 42px;
        height: 42px;
        padding: 0;
        justify-content: center;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    }


    /* FIX 400: Timer Overlay & Visualizer */
    #gm-timer {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        z-index: 10;
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
        pointer-events: none;
        /* Allow clicks to pass through to canvas/container if needed */
    }

    /* FIX 400: Light Mode Credits Highlight */
    /* FIX 400 & 464: Light Mode Credits Highlight (Robust Selector) */
    body.gm-theme-light .gm-credit-counter,
    body.light-mode .gm-credit-counter,
    .gm-theme-light .gm-credit-counter,
    .light-mode .gm-credit-counter {
        background: #f3f4f6 !important;
        /* Very Light Gray */
        color: #1f2937 !important;
        /* Dark Text */
        border: 2px solid var(--primary) !important;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        font-weight: 800;
    }

    body.gm-theme-light #gm-credit-value,
    body.light-mode #gm-credit-value,
    .gm-theme-light #gm-credit-value,
    .light-mode #gm-credit-value {
        color: var(--primary) !important;
    }

    /* FIX 464: Remove mobile visualizer background */
    @media (max-width: 600px) {
        .gm-visualizer-container {
            background: transparent !important;
        }
    }

}

/* FINAL UI FIXES (v11) */

/* 1. Global Left Alignment for Mode Titles */
.gm-mode-info {
    justify-content: flex-start !important;
    text-align: left !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
}

.gm-mode-info h3 {
    margin: 0 !important;
    padding: 0 !important;
}

/* 2. Global H2 Style (Small on PC & Mobile) */
.gm-subtitle-h2 {
    display: inline-block;
    vertical-align: middle;
    font-size: 1rem !important;
    /* Small per request */
    font-weight: 700;
    color: var(--primary) !important;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 3. Gold Color for Timer & Surprise Topic (Global) */
#gm-timer,
#gm-current-topic {
    background: none !important;
    color: #ffaa00 !important;
    /* Gold */
    -webkit-text-fill-color: #ffaa00 !important;
    font-weight: 800 !important;
    text-shadow: 0 0 10px rgba(255, 170, 0, 0.3);
    display: inline-block;
}

/* 4. Credits Border (Global) */
.gm-credit-counter {
    border: 2px solid var(--primary) !important;
    border-radius: 50% !important;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.2);
    /* Cyan glow match */
}

/* Mobile Layout Fixes (v14) */
@media (max-width: 600px) {
    /* Header Layout: Row 1 = Menu + Title, Row 2 = Credits */

    .gm-controls-row {
        flex-wrap: wrap !important;
        justify-content: space-between !important;
        gap: 0 !important;
        align-items: center !important;
    }

    .gm-menu-trigger {
        order: 1;
        flex-basis: auto !important;
        width: auto !important;
        margin: 0;
    }

    .gm-subtitle-h2 {
        order: 2;
        flex: 1;
        /* Take remaining space */
        width: auto !important;
        flex-basis: auto !important;
        text-align: center;
        font-size: 0.95rem !important;
        /* Slightly smaller to fit */
        margin: 0 0.5rem;
        margin-bottom: 0;
        /* Reset bottom margin */
    }

    .gm-controls-right {
        order: 3;
        flex-basis: 100% !important;
        width: 100% !important;
        justify-content: center !important;
        /* Center credits on new row */
        margin-top: 0.5rem;
        display: flex;
        gap: 0.5rem;
    }

    /* Align mode title left (Random Mode etc) */
    .gm-mode-info {
        justify-content: flex-start !important;
        text-align: left !important;
        display: flex;
        align-items: center;
        gap: 0.5rem;
        width: 100%;
    }

    .gm-mode-info h3 {
        margin: 0;
    }

    .gm-tooltip {
        margin-top: 2px;
    }
}

/* Fix Button Centering in Random Mode (Global) */
#gm-btn-topic {
    align-self: center !important;
    margin: 1rem auto !important;
    display: flex !important;
}

/* Enforce Gold Text for Active Tabs */
.gm-tab.active {
    color: #ffaa00 !important;
    /* Gold text forced */
    background: linear-gradient(135deg, var(--gm-primary-start), var(--gm-primary-end));
    font-weight: 700;
}

/* =========================================
   FLOW MODE TOGGLE (Premium Segmented Control)
   ========================================= */
.gm-flow-toggle-container {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.gm-flow-toggle {
    display: flex;
    background: var(--gm-bg);
    border: 1px solid var(--gm-border);
    border-radius: 50px;
    padding: 4px;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.gm-flow-sub-btn {
    background: transparent;
    border: none;
    padding: 0.5rem 1.5rem;
    border-radius: 40px;
    color: var(--gm-text-sec);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.gm-flow-sub-btn:hover {
    color: var(--gm-text-main);
}

.gm-flow-sub-btn.active {
    background: var(--gm-surface);
    color: #ffaa00;
    /* Gold */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--gm-border);
}

/* Light Mode Override */
#gm-app.gm-theme-light .gm-flow-sub-btn.active {
    background: #FFFFFF;
    color: var(--gm-primary-start);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Transitions for Content Switching */
.opacity-transition {
    transition: opacity 0.3s ease;
}


/* LexiMode Definition Box */
.gm-lexi-def-box {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--gm-primary-end);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    color: var(--gm-text-main);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* =========================================
   LEXIMODE STYLES (Restored)
   ========================================= */

.gm-lexi-section {
    margin-top: 1rem;
    animation: fadeIn 0.5s ease-out;
}

.gm-lexi-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(6, 182, 212, 0.1));
    border: 1px solid var(--gm-primary-start);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    text-align: center;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.gm-lexi-card:hover {
    transform: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.gm-lexi-word {
    font-size: 3rem;
    font-weight: 800;
    margin: 0 0 0.5rem 0;
    background: linear-gradient(135deg, #fff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: capitalize;
    letter-spacing: -0.02em;
}

.gm-lexi-type {
    display: inline-block;
    font-size: 0.9rem;
    color: var(--gm-primary-end);
    background: rgba(6, 182, 212, 0.1);
    padding: 0.2rem 0.8rem;
    border-radius: 20px;
    margin-bottom: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.gm-lexi-def {
    font-size: 1.2rem;
    line-height: 1.6;
    color: var(--gm-text-main);
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.gm-lexi-example {
    font-style: italic;
    color: var(--gm-text-sec);
    font-size: 1rem;
    border-top: 1px solid var(--gm-border);
    padding-top: 1rem;
    margin-top: 1rem;
}

/* Definition Box (Existing but ensuring consistency) */
.gm-lexi-def-box {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--gm-primary-end);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    color: var(--gm-text-main);
    font-size: 0.95rem;
    line-height: 1.5;
    text-align: left;
}

/* Navigation Controls */
.gm-lexi-card-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

#gm-lexi-counter {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gm-text-sec);
    min-width: 60px;
    text-align: center;
}

/* Light Mode Overrides for LexiMode */
#gm-app.gm-theme-light .gm-lexi-card {
    background: #ffffff;
    border-color: #cbd5e1;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

#gm-app.gm-theme-light .gm-lexi-word {
    background: linear-gradient(135deg, #1e293b, #475569);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

#gm-app.gm-theme-light .gm-lexi-def-box {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #334155;
}

/* Button Alignment Fixes */
/* LexiMode Button Style */
.gm-btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--gm-surface);
    border: 1px solid var(--gm-border);
    border-radius: 8px;
    /* Rounded borders */
    color: var(--gm-text-main);
    padding: 0.5rem 1.5rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.gm-btn-secondary:hover {
    background-color: var(--gm-border);
    border-color: var(--gm-primary-end);
    color: var(--gm-primary-end);
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.2);
}

/* FIX: Ensure SVG icons are visible and stylized */
.gm-btn-icon {
    color: var(--gm-text-main) !important;
    /* Force visible color for SVG */
    border: 2px solid var(--gm-primary-end) !important;
    /* Cyan border */
    background: rgba(255, 255, 255, 0.05);
}

.gm-btn-icon:hover {
    background: var(--gm-primary-end) !important;
    color: #000 !important;
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.4);
}

.gm-btn-icon svg {
    stroke-width: 2.5;
}

/* NEW: Define Button (Distinct Style) */
.gm-btn-define {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--gm-primary-start), var(--gm-primary-end));
    border: none;
    border-radius: 20px;
    /* More rounded/pill */
    color: #fff;
    padding: 0 1.5rem;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s, box-shadow 0.2s;
    height: 42px;
    /* Match input height */
}

.gm-btn-define:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(99, 102, 241, 0.4);
}

/* NEW: Results Header Styling */
.gm-results-header {
    margin-top: 2.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 1.3rem;
    color: var(--gm-text-main);
    border-bottom: 2px solid var(--gm-border);
    padding-bottom: 0.5rem;
    width: 100%;
}

/* NEW: Lexi Input Group */
.gm-lexi-input-group {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 1rem;
    width: 100%;
}

.gm-input-short {
    flex: 0 0 300px;
    /* Fixed width */
    max-width: 100%;
    margin-bottom: 0 !important;
    /* Override default */
}


.gm-btn-icon svg {
    stroke-width: 2.5;
}

/* NEW: Analyze Action Button (Same as Define/Primary) */
.gm-btn-analyze-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--gm-primary-start), var(--gm-primary-end));
    border: none;
    border-radius: 20px;
    /* Rounded pill */
    color: #fff;
    padding: 0.5rem 1.5rem;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s, box-shadow 0.2s;
    height: 42px;
}

.gm-btn-analyze-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(99, 102, 241, 0.4);
}

/* =========================================
   LEXIMODE UI REFINEMENTS (Mobile & Feedback)
   ========================================= */

/* Mobile Input Group Fixes */
.gm-lexi-input-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    width: 100%;
}

#gm-lexi-custom-word {
    flex: 1;
    min-width: 140px;
}

.gm-btn-define {
    white-space: nowrap;
    flex-shrink: 0;
}

/* Feedback & Examples Separation */
.gm-lexi-examples-box {
    background: rgba(255, 255, 255, 0.05);
    /* Light subtle background */
    border: 1px solid var(--gm-border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 1.5rem;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.gm-lexi-examples-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--gm-primary-start), var(--gm-primary-end));
    opacity: 0.7;
}

/* Mobile Adjustments */
@media (max-width: 480px) {
    .gm-btn-define {
        padding: 0.5rem 0.8rem;
        /* Tighter padding */
        font-size: 0.9rem;
        /* Slightly smaller text */
        max-width: 100px;
        /* Constrain width */
        overflow: hidden;
        text-overflow: ellipsis;
    }

    #gm-lexi-custom-word {
        font-size: 0.95rem;
    }

    .gm-lexi-examples-box {
        padding: 1rem;
    }
}

/* =========================================
   LEXIMODE ADVANCED METRICS (V13 & V14)
   ========================================= */

/* V14: Dashboard Grid Layout */
.gm-lexi-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* V14: Metric Card (Unified Style) */
.gm-lexi-card-metric {
    background: var(--gm-surface);
    border: 1px solid var(--gm-border);
    padding: 1.25rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s ease;
}

.gm-lexi-card-metric:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.1);
}

.gm-lexi-card-title {
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--gm-text-sec);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--gm-border);
    padding-bottom: 0.5rem;
}

/* 1. Traffic Light (Semantics) - Updated for Card */
.gm-lexi-traffic-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
}

.gm-lexi-traffic-light {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.gm-traffic-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #4b5563;
    /* Darker gray for inactive */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid rgba(255, 255, 255, 0.05);
}

.gm-traffic-dot.red.active {
    background: #ef4444;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.6);
    transform: scale(1.1);
}

.gm-traffic-dot.yellow.active {
    background: #f59e0b;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.6);
    transform: scale(1.1);
}

.gm-traffic-dot.green.active {
    background: #10b981;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.6);
    transform: scale(1.1);
}

/* 2. Collocations (Chips) - Updated */
.gm-lexi-collocations-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.gm-lexi-chip {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(168, 85, 247, 0.1));
    border: 1px solid var(--gm-primary-start);
    color: var(--gm-text-main);
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* 3. Evocative Intensity (Bar) - Updated */
.gm-lexi-intensity-bar {
    height: 10px;
    background: var(--gm-bg);
    /* Darker background track */
    border-radius: 5px;
    overflow: hidden;
    margin-top: 0.5rem;
    border: 1px solid var(--gm-border-light);
}

/* 4. Common Alternative (Comparison) - Updated */
.gm-lexi-comparison-box {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 0.5rem;
    align-items: center;
    background: rgba(0, 0, 0, 0.0);
    /* Removed bg, handled by card */
    padding: 0;
    /* Handled by card */
    text-align: center;
}

.gm-lexi-vs-circle {
    background: var(--gm-surface-hover);
    color: var(--gm-text-muted);
    font-size: 0.7rem;
    font-weight: 900;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 5. Syntax Integration (Icon) - Updated */
.gm-lexi-syntax-check {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

/* 6. Pedantry Gauge (Linear) - Updated */
.gm-lexi-pedantry-scale {
    position: relative;
    height: 6px;
    background: linear-gradient(90deg, #10b981 0%, #3b82f6 50%, #f59e0b 80%, #ef4444 100%);
    margin-top: 2rem;
    border-radius: 3px;
    width: 100%;
}

.gm-lexi-pedantry-marker {
    position: absolute;
    top: -8px;
    width: 4px;
    height: 22px;
    background: #fff;
    border-radius: 2px;
    transform: translateX(-50%);
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
    transition: left 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 7. Contextual Rewrite (Standard Box) - Updated */
.gm-lexi-rewrite-card {
    grid-column: 1 / -1;
    /* Full width */
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(6, 182, 212, 0.08));
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* =========================================
   TOOLTIP STYLES (Fixed)
   ========================================= */
.gm-tooltip {
    position: relative;
    display: inline-block;
    margin-left: 5px;
    vertical-align: middle;
    cursor: help;
    z-index: 100;
    /* Ensure high stacking context */
}

.gm-info-round {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: bold;
    color: #fff;
    font-style: italic;
    font-family: serif;
}

.gm-tooltip-text {
    visibility: hidden;
    width: 220px;
    background-color: #1e293b;
    color: #fff;
    text-align: left;
    border-radius: 8px;
    padding: 10px;
    position: absolute;
    z-index: 101;
    bottom: 125%;
    /* Position above */
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.85rem;
    line-height: 1.4;
    text-transform: none;
    /* Reset uppercase from titles */
    letter-spacing: normal;
    font-weight: normal;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.gm-tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #1e293b transparent transparent transparent;
}

.gm-tooltip:hover .gm-tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Tooltip Light Mode */
#gm-app.gm-theme-light .gm-tooltip-text {
    background-color: #fff;
    color: #334155;
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

#gm-app.gm-theme-light .gm-tooltip-text::after {
    border-color: #fff transparent transparent transparent;
}

#gm-app.gm-theme-light .gm-info-round {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.2);
    color: #555;
}

/* =========================================
   NEW ETYMOLOGY CARDS
   ========================================= */

/* Word Family Tree */
.gm-lexi-tree-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

.gm-lexi-root-node {
    background: linear-gradient(135deg, #8b5cf6, #d946ef);
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    color: white;
    font-weight: bold;
    text-align: center;
    position: relative;
    box-shadow: 0 4px 10px rgba(139, 92, 246, 0.3);
}

.gm-lexi-root-node::after {
    content: '';
    position: absolute;
    bottom: -1rem;
    left: 50%;
    width: 2px;
    height: 1rem;
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(-50%);
}

#gm-app.gm-theme-light .gm-lexi-root-node::after {
    background: rgba(0, 0, 0, 0.2);
}

.gm-lexi-cousins-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
    padding-top: 1rem;
    border-top: 2px solid rgba(255, 255, 255, 0.1);
}

#gm-app.gm-theme-light .gm-lexi-cousins-grid {
    border-top-color: rgba(0, 0, 0, 0.1);
}

.gm-lexi-cousin-chip {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 0.3rem 0.8rem;
    font-size: 0.85rem;
    color: var(--gm-text-sec);
}

#gm-app.gm-theme-light .gm-lexi-cousin-chip {
    background: #f1f5f9;
    border-color: #e2e8f0;
    color: #475569;
}

/* Living Etymology (Breakdown) */
.gm-lexi-breakdown-row {
    display: flex;
    justify-content: center;
    gap: 0.2rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.gm-lexi-part {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.3);
    padding: 0.5rem;
    border-radius: 8px;
    min-width: 60px;
}

#gm-app.gm-theme-light .gm-lexi-part {
    background: #ecfeff;
    border-color: #cffafe;
}

.gm-lexi-part-text {
    font-weight: bold;
    color: var(--gm-text-main);
    font-size: 1.1rem;
}

.gm-lexi-part-meaning {
    font-size: 0.75rem;
    color: var(--gm-text-muted);
    margin-top: 0.2rem;
}

.gm-lexi-curiosity-box {
    background: rgba(245, 158, 11, 0.1);
    border-left: 3px solid #f59e0b;
    padding: 0.8rem;
    text-align: left;
    font-size: 0.9rem;
    font-style: italic;
    color: var(--gm-text-main);
    border-radius: 0 8px 8px 0;
    margin-top: 1rem;
}

/* =========================================================================
   SEO FOOTER — Multilingual, all languages rendered for Google indexing
   ========================================================================= */

.gm-seo-footer {
    margin-top: 2rem;
    padding: 1.5rem 1rem;
    border-top: 1px solid var(--gm-border);
    text-align: center;
}

/* Active language section — always visible */
.gm-seo-lang-block {
    max-width: 700px;
    margin: 0 auto;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.3s ease, margin 0.3s ease;
}

.gm-seo-lang-block[data-active="true"] {
    max-height: 500px;
    opacity: 1;
    margin-bottom: 1rem;
}

/* When expanded — show ALL language sections */
.gm-seo-footer.gm-seo-expanded .gm-seo-lang-block {
    max-height: 500px;
    opacity: 1;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--gm-border);
}

.gm-seo-footer.gm-seo-expanded .gm-seo-lang-block:last-of-type {
    border-bottom: none;
}

.gm-seo-footer h2 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--gm-text-sec);
    margin: 0 0 0.75rem 0;
    letter-spacing: -0.01em;
}

.gm-seo-footer p {
    font-size: 0.85rem;
    line-height: 1.65;
    color: var(--gm-text-sec);
    margin: 0;
    opacity: 0.8;
}

/* Toggle button */
.gm-seo-toggle {
    display: inline-block;
    margin-top: 0.75rem;
    padding: 0.4rem 1rem;
    background: transparent;
    border: 1px solid var(--gm-border);
    border-radius: 20px;
    color: var(--gm-text-sec);
    font-size: 0.75rem;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s, background 0.2s;
}

.gm-seo-toggle:hover {
    opacity: 1;
    background: rgba(99, 102, 241, 0.1);
}

.gm-seo-expanded .gm-seo-toggle {
    transform: rotate(180deg);
}

/* h1 keyword suffix */
.gm-h1-suffix {
    font-weight: 400;
    font-size: 0.65em;
    opacity: 0.7;
    display: block;
    margin-top: 0.15rem;
}

/* Light theme adjustments */
#gm-app.gm-theme-light .gm-seo-footer h2 {
    color: var(--gm-text-sec);
}

#gm-app.gm-theme-light .gm-seo-footer p {
    color: var(--gm-text-sec);
}

/* ==========================================================================
   ORATORY WIKI & ANIMATIONS
   ========================================================================== */

.gm-wiki-link {
    display: inline-block;
    margin-top: 10px;
    padding: 6px 12px;
    background: rgba(0, 210, 255, 0.1);
    color: var(--neon-blue);
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 210, 255, 0.2);
}

.gm-wiki-link:hover {
    background: var(--neon-blue);
    color: #000;
    transform: translateX(5px);
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.4);
}

/* Smooth entry for result cards */
.gm-stat-card {
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s ease;
}

/* Wiki Template Specifics (if needed globally) */
.wiki-page-active {
    overflow-x: hidden;
}

@media (max-width: 768px) {
    .gm-wiki-link {
        font-size: 0.8rem;
        padding: 5px 10px;
    }
}

/* =========================================
   EDUCATIONAL PANELS (In-App Learn More)
   ========================================= */

/* "Learn more" button inside each stat card */
.gm-edu-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding: 6px 14px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(6, 182, 212, 0.15));
    color: var(--gm-primary-end);
    border: 1px solid rgba(6, 182, 212, 0.3);
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.gm-edu-btn:hover {
    background: linear-gradient(135deg, var(--gm-primary-start), var(--gm-primary-end));
    color: #fff;
    border-color: transparent;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

#gm-app.gm-theme-light .gm-edu-btn {
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.3);
    color: var(--gm-primary-start);
}

#gm-app.gm-theme-light .gm-edu-btn:hover {
    background: linear-gradient(135deg, var(--gm-primary-start), var(--gm-primary-end));
    color: #fff;
}

/* Full-screen overlay */
.gm-edu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(11, 17, 32, 0.92);
    backdrop-filter: blur(12px);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 2rem;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.gm-edu-overlay.active {
    opacity: 1;
    visibility: visible;
}

#gm-app.gm-theme-light .gm-edu-overlay {
    background: rgba(249, 249, 247, 0.95);
}

/* Content Card */
.gm-edu-card {
    width: 100%;
    max-width: 720px;
    background: var(--gm-surface);
    border: 1px solid var(--gm-border);
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    transform: translateY(20px) scale(0.97);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    margin: auto;
}

.gm-edu-overlay.active .gm-edu-card {
    transform: translateY(0) scale(1);
}

#gm-app.gm-theme-light .gm-edu-card {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.08);
}

/* Header */
.gm-edu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(6, 182, 212, 0.15));
    border-bottom: 1px solid var(--gm-border);
}

.gm-edu-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--gm-primary-start), var(--gm-primary-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gm-edu-close {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--gm-border);
    border-radius: 50%;
    color: var(--gm-text-sec);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.gm-edu-close:hover {
    background: var(--gm-danger);
    color: #fff;
    border-color: var(--gm-danger);
}

/* Body */
.gm-edu-body {
    padding: 2rem;
    color: var(--gm-text-main);
    font-size: 1rem;
    line-height: 1.75;
}

.gm-edu-body h3 {
    color: var(--gm-primary-end);
    font-size: 1.25rem;
    margin: 1.5rem 0 0.75rem 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.gm-edu-body h3:first-child {
    margin-top: 0;
}

.gm-edu-body p {
    margin: 0 0 1rem 0;
    color: var(--gm-text-main);
    opacity: 0.9;
}

.gm-edu-body ul {
    padding-left: 1.5rem;
    margin: 0.5rem 0 1rem 0;
}

.gm-edu-body ul li {
    margin-bottom: 0.5rem;
    color: var(--gm-text-main);
    opacity: 0.85;
}

/* Tip Box */
.gm-edu-tip {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(6, 182, 212, 0.1));
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin: 1rem 0;
}

.gm-edu-tip strong {
    color: var(--gm-success);
}

/* Example Box */
.gm-edu-example {
    background: rgba(245, 158, 11, 0.08);
    border-left: 3px solid var(--gm-warning);
    border-radius: 0 8px 8px 0;
    padding: 1rem 1.25rem;
    margin: 1rem 0;
    font-style: italic;
}

/* Footer Action */
.gm-edu-footer {
    padding: 1rem 2rem 1.5rem;
    text-align: center;
}

.gm-edu-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.75rem 2rem;
    background: linear-gradient(135deg, var(--gm-primary-start), var(--gm-primary-end));
    color: #fff;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.gm-edu-back-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

/* Mobile */
@media (max-width: 768px) {
    .gm-edu-overlay {
        padding: 1rem;
    }

    .gm-edu-header {
        padding: 1rem 1.25rem;
    }

    .gm-edu-header h2 {
        font-size: 1.2rem;
    }

    .gm-edu-body {
        padding: 1.25rem;
        font-size: 0.95rem;
    }

    .gm-edu-body h3 {
        font-size: 1.1rem;
    }
}

/* Light Mode specific overrides */
.gm-edu-overlay.gm-theme-light {
    background: rgba(249, 249, 247, 0.95);
}

.gm-edu-overlay.gm-theme-light .gm-edu-card {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.08);
}

.gm-edu-overlay.gm-theme-light .gm-edu-body p,
.gm-edu-overlay.gm-theme-light .gm-edu-body ul li {
    color: #1e293b;
}

.gm-edu-overlay.gm-theme-light .gm-edu-body h3 {
    color: var(--gm-primary-start);
    font-weight: 700;
}

.gm-edu-overlay.gm-theme-light .gm-edu-body strong {
    color: #0284c7;
    font-weight: 600;
}

.gm-edu-overlay.gm-theme-light .gm-edu-header {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(6, 182, 212, 0.08));
}

.gm-edu-overlay.gm-theme-light .gm-edu-close {
    background: rgba(0, 0, 0, 0.05);
    border-color: #e2e8f0;
    color: #475569;
}

/* Dark Mode specific overrides */
.gm-edu-overlay.gm-theme-dark,
.gm-edu-overlay:not(.gm-theme-light) {
    background: rgba(11, 17, 32, 0.95);
}

.gm-edu-overlay.gm-theme-dark .gm-edu-card,
.gm-edu-overlay:not(.gm-theme-light) .gm-edu-card {
    background: #0f172a;
    border-color: #1e293b;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.gm-edu-overlay.gm-theme-dark .gm-edu-header h2,
.gm-edu-overlay:not(.gm-theme-light) .gm-edu-header h2 {
    background: none;
    -webkit-text-fill-color: #ffffff;
    color: #ffffff;
}

.gm-edu-overlay.gm-theme-dark .gm-edu-body h3,
.gm-edu-overlay:not(.gm-theme-light) .gm-edu-body h3 {
    color: #ffffff;
    font-weight: 700;
}

.gm-edu-overlay.gm-theme-dark .gm-edu-body strong,
.gm-edu-overlay:not(.gm-theme-light) .gm-edu-body strong {
    color: #38bdf8;
    font-weight: 600;
}

.gm-edu-overlay.gm-theme-dark .gm-edu-body p,
.gm-edu-overlay.gm-theme-dark .gm-edu-body ul li,
.gm-edu-overlay:not(.gm-theme-light) .gm-edu-body p,
.gm-edu-overlay:not(.gm-theme-light) .gm-edu-body ul li {
    color: #e2e8f0;
}