/* ===== CSS VARIABLES - THEMES ===== */
:root {
    /* Dark Theme (Default) */
    --bg-primary: #0a0e1a;
    --bg-secondary: #12172a;
    --bg-tertiary: #1a1f38;
    --bg-elevated: #232847;
    --bg-glass: rgba(26, 31, 56, 0.6);
    --bg-overlay: rgba(10, 14, 26, 0.85);

    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --text-muted: #64748b;

    --accent-primary: #6366f1;
    --accent-secondary: #ec4899;
    --accent-tertiary: #8b5cf6;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;

    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.3);

    --font-mono: 'JetBrains Mono', 'Courier New', monospace;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="midnight"] {
    --bg-primary: #000428;
    --bg-secondary: #001845;
    --bg-tertiary: #003366;
    --bg-elevated: #004080;
    --bg-glass: rgba(0, 24, 69, 0.6);
    --accent-primary: #00d4ff;
    --accent-secondary: #7c3aed;
    --accent-tertiary: #3b82f6;
    --shadow-glow: 0 0 40px rgba(0, 212, 255, 0.4);
}

[data-theme="cyberpunk"] {
    --bg-primary: #0f0a1e;
    --bg-secondary: #1a0f2e;
    --bg-tertiary: #2d1b4e;
    --bg-elevated: #3d2860;
    --bg-glass: rgba(45, 27, 78, 0.6);
    --accent-primary: #ff006e;
    --accent-secondary: #fbff00;
    --accent-tertiary: #00f0ff;
    --shadow-glow: 0 0 40px rgba(255, 0, 110, 0.5);
}

[data-theme="forest"] {
    --bg-primary: #0a1f0a;
    --bg-secondary: #0f2e0f;
    --bg-tertiary: #1a3a1a;
    --bg-elevated: #254a25;
    --bg-glass: rgba(26, 58, 26, 0.6);
    --accent-primary: #22c55e;
    --accent-secondary: #84cc16;
    --accent-tertiary: #10b981;
    --shadow-glow: 0 0 40px rgba(34, 197, 94, 0.3);
}

[data-theme="ocean"] {
    --bg-primary: #001a2e;
    --bg-secondary: #002a4a;
    --bg-tertiary: #003d5c;
    --bg-elevated: #004d75;
    --bg-glass: rgba(0, 61, 92, 0.6);
    --accent-primary: #06b6d4;
    --accent-secondary: #0ea5e9;
    --accent-tertiary: #14b8a6;
    --shadow-glow: 0 0 40px rgba(6, 182, 212, 0.3);
}

[data-theme="sunset"] {
    --bg-primary: #1a0a0a;
    --bg-secondary: #2d1510;
    --bg-tertiary: #3d1a0a;
    --bg-elevated: #4d2816;
    --bg-glass: rgba(61, 26, 10, 0.6);
    --accent-primary: #f97316;
    --accent-secondary: #ef4444;
    --accent-tertiary: #f59e0b;
    --shadow-glow: 0 0 40px rgba(249, 115, 22, 0.4);
}

[data-theme="monochrome"] {
    --bg-primary: #000000;
    --bg-secondary: #0a0a0a;
    --bg-tertiary: #171717;
    --bg-elevated: #262626;
    --bg-glass: rgba(38, 38, 38, 0.6);
    --accent-primary: #ffffff;
    --accent-secondary: #a3a3a3;
    --accent-tertiary: #d4d4d4;
    --shadow-glow: 0 0 40px rgba(255, 255, 255, 0.2);
}

[data-theme="rose"] {
    --bg-primary: #1a0a14;
    --bg-secondary: #2d1020;
    --bg-tertiary: #3d1a2e;
    --bg-elevated: #4d2840;
    --bg-glass: rgba(61, 26, 46, 0.6);
    --accent-primary: #f43f5e;
    --accent-secondary: #ec4899;
    --accent-tertiary: #d946ef;
    --shadow-glow: 0 0 40px rgba(244, 63, 94, 0.4);
}

[data-theme="light"] {
    --bg-primary: #f5f5f7;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f3f4f6;
    --bg-elevated: #e5e7eb;
    --bg-glass: rgba(255, 255, 255, 0.8);
    --bg-overlay: rgba(245, 245, 247, 0.85);
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-tertiary: #64748b;
    --text-muted: #94a3b8;
    --accent-primary: #3b82f6;
    --accent-secondary: #8b5cf6;
    --accent-tertiary: #06b6d4;
    --border-color: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(0, 0, 0, 0.15);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 40px rgba(59, 130, 246, 0.2);
}

[data-theme="cream"] {
    --bg-primary: #faf6f0;
    --bg-secondary: #f5ebdc;
    --bg-tertiary: #f0e0c8;
    --bg-elevated: #ebd5b5;
    --bg-glass: rgba(245, 235, 220, 0.8);
    --bg-overlay: rgba(250, 246, 240, 0.85);
    --text-primary: #3d2817;
    --text-secondary: #5d4037;
    --text-tertiary: #795548;
    --text-muted: #8d6e63;
    --accent-primary: #c2410c;
    --accent-secondary: #a16207;
    --accent-tertiary: #b45309;
    --border-color: rgba(93, 64, 55, 0.12);
    --border-hover: rgba(93, 64, 55, 0.2);
    --shadow-sm: 0 2px 8px rgba(93, 64, 55, 0.08);
    --shadow-md: 0 8px 24px rgba(93, 64, 55, 0.12);
    --shadow-lg: 0 16px 48px rgba(93, 64, 55, 0.16);
    --shadow-glow: 0 0 40px rgba(194, 65, 12, 0.2);
}

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html, body {
    height: 100%;
    overflow: hidden;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    transition: background-color var(--transition-slow), color var(--transition-slow);
    position: relative;
    touch-action: manipulation;
}

button, input, select {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* ===== ANIMATED BACKGROUND ===== */
.bg-animation {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
    animation: float 20s infinite ease-in-out;
}

.orb-1 {
    width: 500px;
    height: 500px;
    background: var(--accent-primary);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: var(--accent-secondary);
    bottom: -100px;
    right: -100px;
    animation-delay: -7s;
}

.orb-3 {
    width: 350px;
    height: 350px;
    background: var(--accent-tertiary);
    top: 50%;
    left: 50%;
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(100px, -100px) scale(1.1); }
    66% { transform: translate(-80px, 80px) scale(0.9); }
}

/* ===== APP CONTAINER ===== */
.app-container {
    position: relative;
    z-index: 1;
    height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow: hidden;
}

/* ===== HEADER ===== */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    animation: logoBreath 3s ease-in-out infinite;
}

.logo-icon .logo-bg {
    transform-origin: center;
    animation: logoRotate 10s linear infinite;
}

@keyframes logoBreath {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes logoRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.logo-text h1 {
    font-size: 22px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.logo-text span {
    font-size: 11px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.icon-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.icon-btn:hover {
    background: var(--bg-elevated);
    border-color: var(--border-hover);
    color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.icon-btn:active {
    transform: translateY(0);
}

.icon-btn.small {
    width: 32px;
    height: 32px;
}

.icon-btn.active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.voice-pulse {
    position: absolute;
    inset: 0;
    border-radius: var(--radius-md);
    border: 2px solid var(--accent-primary);
    opacity: 0;
    pointer-events: none;
}

.icon-btn.listening .voice-pulse {
    animation: voicePulse 1s infinite;
}

@keyframes voicePulse {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}

/* ===== MODE TABS ===== */
.mode-tabs {
    display: flex;
    gap: 8px;
    padding: 8px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
}

.mode-tabs::-webkit-scrollbar { display: none; }

.mode-tab {
    flex: 0 0 auto;
    width: max-content;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: visible;
    white-space: nowrap;
    scroll-snap-align: start;
    line-height: 1;
}

.mode-tab span {
    flex: 0 0 auto;
    white-space: nowrap;
    overflow: visible;
}

.mode-tab svg.tab-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.95;
    overflow: visible;
    filter: drop-shadow(0 0 3px rgba(99, 102, 241, 0.3));
    transform-origin: center;
    transition: filter var(--transition-base), color var(--transition-base);
}

.mode-tab.active svg.tab-icon {
    opacity: 1;
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.45));
}

/* Per-icon subtle inner animations (only the small accents move) */
.mode-tab[data-mode="calculator"] .ti-dot { animation: tiBlink 2.4s ease-in-out infinite; transform-origin: center; }
.mode-tab[data-mode="calculator"] .d1 { animation-delay: 0s; }
.mode-tab[data-mode="calculator"] .d2 { animation-delay: 0.2s; }
.mode-tab[data-mode="calculator"] .d3 { animation-delay: 0.4s; }
.mode-tab[data-mode="calculator"] .d4 { animation-delay: 0.6s; }
.mode-tab[data-mode="calculator"] .d5 { animation-delay: 0.8s; }
.mode-tab[data-mode="calculator"] .d6 { animation-delay: 1.0s; }

.mode-tab[data-mode="currency"] .ti-symbol { animation: tiBob 2.4s ease-in-out infinite; transform-origin: 12px 12px; }
.mode-tab[data-mode="metric"] .ti-edge { animation: tiFade 3s ease-in-out infinite; }
.mode-tab[data-mode="ai"] .ti-core { animation: tiBob 2s ease-in-out infinite; transform-origin: 12px 12px; }
.mode-tab[data-mode="ai"] .ti-spark { animation: tiFade 1.6s ease-in-out infinite; }
.mode-tab[data-mode="ovulation"] .ti-heart { animation: tiHeart 1.4s ease-in-out infinite; transform-origin: 12px 13px; }
.mode-tab[data-mode="loan"] .ti-coin { animation: tiBob 2.4s ease-in-out infinite; transform-origin: 12px 12px; }
.mode-tab[data-mode="tax"] .ti-pct { animation: tiBlink 1.6s ease-in-out infinite; transform-origin: center; }
.mode-tab[data-mode="tax"] .ti-pct-b { animation-delay: 0.8s; }
.mode-tab[data-mode="tax"] .ti-slash { animation: tiFade 2s ease-in-out infinite; }

@keyframes tiBlink {
    0%, 70%, 100% { opacity: 0.55; transform: scale(1); }
    35% { opacity: 1; transform: scale(1.3); }
}
@keyframes tiBob {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.12); }
}
@keyframes tiFade {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}
@keyframes tiHeart {
    0%, 50%, 100% { transform: scale(1); }
    20% { transform: scale(1.12); }
    35% { transform: scale(1.04); }
}

.mode-tab span {
    color: inherit;
    letter-spacing: 0.2px;
}

.mode-tab:hover {
    color: var(--text-primary);
    background: var(--bg-elevated);
    border-color: var(--accent-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.mode-tab:hover svg.tab-icon {
    filter: drop-shadow(0 0 6px var(--accent-primary));
}

.mode-tab.active {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-tertiary));
    color: white;
    border-color: transparent;
    box-shadow: var(--shadow-glow);
}

/* ===== MODE CONTENT ===== */
.mode-content {
    display: none;
    flex: 1;
    overflow: hidden;
    animation: fadeInUp 0.4s ease;
}

.mode-content.active {
    display: flex;
    gap: 16px;
}

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

/* ===== CALCULATOR ===== */
.calculator-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-md);
    overflow-y: auto;
    min-width: 0;
}

.display-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    position: relative;
    overflow: hidden;
}

.display-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--accent-primary) 0%, transparent 50%);
    opacity: 0.03;
    pointer-events: none;
}

.display-expression {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--text-tertiary);
    min-height: 20px;
    text-align: right;
    word-break: break-all;
}

.display-result {
    font-family: var(--font-mono);
    font-size: 42px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: right;
    word-break: break-all;
    line-height: 1.1;
    margin-top: 8px;
    letter-spacing: -1px;
    transition: color var(--transition-fast);
}

.display-result.error {
    color: var(--accent-danger);
    font-size: 24px;
}

.display-memory {
    position: absolute;
    top: 10px;
    left: 12px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Calc Mode Toggle */
.calc-mode-toggle {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.toggle-btn {
    flex: 1;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-tertiary);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.toggle-btn.active {
    background: var(--bg-elevated);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.toggle-btn:hover:not(.active) {
    color: var(--text-secondary);
}

/* Calculator Buttons */
.calc-buttons {
    display: none;
    gap: 8px;
}

.calc-buttons.active {
    display: grid;
}

.standard-calc {
    grid-template-columns: repeat(5, 1fr);
    grid-auto-rows: minmax(56px, auto);
}

.scientific-calc {
    grid-template-columns: repeat(6, 1fr);
    grid-auto-rows: minmax(52px, auto);
}

.programmer-calc {
    display: none;
    grid-template-columns: 1fr;
}

.programmer-calc.active {
    display: grid;
}

.prog-display {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-bottom: 8px;
}

.prog-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 13px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.prog-row:hover {
    background: var(--bg-tertiary);
}

.prog-row span:first-child {
    color: var(--text-tertiary);
    font-size: 11px;
    letter-spacing: 1px;
}

.prog-row span:last-child {
    color: var(--text-primary);
    font-weight: 600;
    word-break: break-all;
    text-align: right;
}

.prog-base-selector {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 4px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
}

.prog-buttons {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
}

.hex-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.calc-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
    user-select: none;
}

.calc-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.2), transparent);
    opacity: 0;
    transition: opacity var(--transition-fast);
    pointer-events: none;
}

.calc-btn:hover {
    background: var(--bg-elevated);
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.calc-btn:hover::after {
    opacity: 1;
}

.calc-btn:active {
    transform: translateY(0) scale(0.97);
}

.calc-btn.pressed {
    animation: btnPress 0.2s ease;
}

@keyframes btnPress {
    0% { transform: scale(1); }
    50% { transform: scale(0.94); box-shadow: 0 0 20px var(--accent-primary); }
    100% { transform: scale(1); }
}

.calc-btn.function {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: 15px;
}

.calc-btn.operator {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-tertiary));
    color: white;
    border-color: transparent;
    font-weight: 600;
    font-size: 20px;
}

.calc-btn.operator:hover {
    filter: brightness(1.15);
    box-shadow: var(--shadow-glow);
}

.calc-btn.equals {
    background: linear-gradient(135deg, var(--accent-secondary), var(--accent-primary));
    color: white;
    border-color: transparent;
    font-weight: 600;
    font-size: 24px;
}

.calc-btn.equals:hover {
    filter: brightness(1.15);
    box-shadow: var(--shadow-glow);
}

.calc-btn.number {
    font-size: 20px;
    font-weight: 500;
}

.row-span-2 {
    grid-row: span 2;
}

/* ===== HISTORY PANEL ===== */
.history-panel {
    width: 320px;
    flex-shrink: 0;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
}

.history-panel.hidden {
    display: none;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.panel-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.history-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    animation: slideIn 0.3s ease;
}

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

.history-item:hover {
    background: var(--bg-elevated);
    border-color: var(--accent-primary);
    transform: translateX(-4px);
}

.history-expression {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-tertiary);
    margin-bottom: 4px;
}

.history-result {
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-all;
}

.history-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    padding: 40px 20px;
}

/* ===== CONVERTER ===== */
.converter-wrapper {
    flex: 1;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

.converter-header h2 {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.rate-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--text-tertiary);
}

#rateStatus {
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border-radius: 20px;
    font-weight: 500;
}

.category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 0;
    scrollbar-width: thin;
}

.category-tab {
    padding: 10px 18px;
    background: var(--bg-tertiary);
    border: 1.5px solid var(--border-color);
    border-radius: 24px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    line-height: 1;
}

.category-tab span {
    color: inherit;
    font-size: inherit;
}

.category-tab span:first-child {
    font-size: 16px;
    line-height: 1;
}

.category-tab:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.category-tab.active {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-tertiary));
    color: white !important;
    border-color: transparent;
    box-shadow: var(--shadow-glow);
}

.category-tab.active span {
    color: white !important;
}

.converter-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    position: relative;
}

.converter-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.converter-row label {
    font-size: 12px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.converter-input-group {
    display: flex;
    gap: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all var(--transition-fast);
}

.converter-input-group:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.converter-input {
    flex: 1;
    padding: 14px 16px;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 20px;
    font-weight: 500;
    min-width: 0;
}

.converter-input::-webkit-inner-spin-button,
.converter-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.converter-select {
    padding: 14px 16px;
    background: var(--bg-elevated);
    border: none;
    border-left: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    min-width: 140px;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 36px;
}

.converter-select option {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.swap-btn {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-tertiary));
    border: 3px solid var(--bg-secondary);
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-md);
    z-index: 2;
}

.swap-btn:hover {
    transform: translate(-50%, -50%) rotate(180deg) scale(1.1);
    box-shadow: var(--shadow-glow);
}

.exchange-rate, .conversion-formula {
    margin-top: 16px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
}

/* Presets */
.presets-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.section-header h3 {
    font-size: 15px;
    font-weight: 600;
}

.presets-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 40px;
}

.preset-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition-fast);
    animation: popIn 0.3s ease;
}

@keyframes popIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

.preset-chip:hover {
    background: var(--bg-elevated);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.preset-chip .remove-preset {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 50%;
    transition: all var(--transition-fast);
    font-size: 16px;
}

.preset-chip .remove-preset:hover {
    background: var(--accent-danger);
    color: white;
}

.presets-empty {
    color: var(--text-muted);
    font-size: 13px;
    padding: 8px;
}

/* Quick Amounts */
.quick-amounts h3, .popular-rates h3, .all-conversions h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
}

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

.quick-btn {
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.quick-btn:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

/* Popular Rates / Conversions Grid */
.rates-grid, .conversions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}

.rate-card, .conversion-card {
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.rate-card:hover, .conversion-card:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.rate-card-top, .conversion-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.rate-flag, .unit-name {
    font-size: 13px;
    color: var(--text-tertiary);
    font-weight: 500;
}

.rate-code {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 700;
    color: var(--accent-primary);
}

.rate-value, .conversion-value {
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Buttons */
.btn-primary, .btn-primary-small {
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-tertiary));
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-primary-small {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-primary:hover, .btn-primary-small:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    padding: 10px 20px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-secondary:hover {
    background: var(--bg-elevated);
    border-color: var(--border-hover);
}

.btn-danger {
    padding: 10px 20px;
    background: var(--accent-danger);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    width: 100%;
}

.btn-danger:hover {
    filter: brightness(1.1);
}

/* ===== AI ASSISTANT ===== */
.ai-wrapper {
    flex: 1;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow: hidden;
}

.ai-header {
    text-align: center;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.ai-icon-wrapper {
    display: inline-block;
    margin-bottom: 12px;
}

.ai-icon .ai-ring {
    animation: aiRotate 8s linear infinite;
    transform-origin: center;
}

.ai-icon .ai-core {
    animation: aiPulse 2s ease-in-out infinite;
    transform-origin: center;
}

.ai-icon .ai-center {
    animation: aiBlink 1.5s ease-in-out infinite;
}

@keyframes aiRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes aiPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(0.9); opacity: 0.8; }
}

@keyframes aiBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.ai-header h2 {
    font-size: 22px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}

.ai-subtitle {
    font-size: 13px;
    color: var(--text-tertiary);
}

.ai-chat {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-right: 8px;
}

.ai-message {
    display: flex;
    gap: 10px;
    animation: fadeInUp 0.4s ease;
}

.ai-message.ai-user {
    flex-direction: row-reverse;
}

.ai-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
}

.ai-user .ai-avatar {
    background: linear-gradient(135deg, var(--accent-tertiary), var(--accent-primary));
}

.ai-bubble {
    max-width: 70%;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    line-height: 1.6;
}

.ai-user .ai-bubble {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-tertiary));
    color: white;
    border-color: transparent;
}

.ai-bubble ul {
    list-style: none;
    padding: 0;
    margin: 8px 0 0 0;
}

.ai-bubble ul li {
    padding: 4px 0;
    font-size: 13px;
}

.ai-bubble em {
    color: var(--accent-primary);
    font-style: normal;
    font-family: var(--font-mono);
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}

.ai-result {
    margin-top: 8px;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border-left: 3px solid var(--accent-primary);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 16px;
    color: var(--accent-primary);
}

.ai-typing {
    display: flex;
    gap: 4px;
    padding: 14px 16px;
}

.ai-typing span {
    width: 8px;
    height: 8px;
    background: var(--accent-primary);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.ai-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-6px); }
}

.ai-input-wrapper {
    display: flex;
    gap: 8px;
    padding: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.ai-input-wrapper:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.ai-input {
    flex: 1;
    padding: 10px 12px;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
}

.voice-btn-ai {
    background: var(--bg-elevated);
}

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

.suggestion-chip {
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.suggestion-chip:hover {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-tertiary));
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
}

/* ===== PANELS ===== */
.theme-panel, .settings-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 380px;
    height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    padding: 24px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    transition: right var(--transition-base);
    z-index: 100;
    overflow-y: auto;
}

.theme-panel.open, .settings-panel.open {
    right: 0;
}

.themes-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 24px;
}

.theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
}

.theme-option:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.theme-option.active {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

.theme-preview {
    width: 100%;
    height: 50px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 16px;
}

.custom-theme-section h4 {
    font-size: 14px;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.custom-color-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.custom-color-row label {
    font-size: 13px;
    color: var(--text-secondary);
}

.custom-color-row input[type="color"] {
    width: 40px;
    height: 30px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: transparent;
}

/* Settings */
.settings-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.setting-group {
    padding: 14px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.setting-group label {
    font-size: 13px;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 6px;
}

.toggle-label {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    margin-bottom: 0 !important;
}

.toggle-label input[type="checkbox"] {
    display: none;
}

.toggle-label .slider {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--bg-elevated);
    border-radius: 12px;
    transition: background var(--transition-fast);
}

.toggle-label .slider::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: var(--text-tertiary);
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.toggle-label input:checked + .slider {
    background: var(--accent-primary);
}

.toggle-label input:checked + .slider::before {
    left: 23px;
    background: white;
}

.setting-select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    outline: none;
}

/* ===== ABOUT DEVELOPER SECTION ===== */
.about-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.about-title {
    font-size: 13px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 700;
    margin-bottom: 16px;
}

.developer-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-elevated));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 14px;
    position: relative;
    overflow: hidden;
}

.developer-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, var(--accent-primary), transparent 70%);
    opacity: 0.15;
    pointer-events: none;
}

.developer-avatar {
    flex-shrink: 0;
    position: relative;
}

.developer-avatar .dev-avatar-bg {
    animation: devPulse 3s ease-in-out infinite;
    transform-origin: center;
}

@keyframes devPulse {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 8px var(--accent-primary)); }
    50% { transform: scale(1.03); filter: drop-shadow(0 0 16px var(--accent-secondary)); }
}

.developer-info {
    flex: 1;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.developer-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.3px;
}

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

.title-badge {
    display: inline-block;
    padding: 3px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
}

.title-badge.ai-badge {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-tertiary));
    color: white;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.developer-bio {
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 12px;
    padding: 0 4px;
}

.developer-bio strong {
    color: var(--text-primary);
    font-weight: 600;
}

.developer-bio em {
    color: var(--accent-primary);
    font-style: normal;
    font-weight: 500;
}

.developer-links {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.dev-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.dev-link:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.app-version {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    border-top: 1px dashed var(--border-color);
    margin-top: 4px;
}

.version-dot {
    color: var(--accent-primary);
}

/* ===== APP FOOTER CREDIT ===== */
.app-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 14px;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-tertiary);
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
}

.footer-heart {
    color: var(--accent-secondary);
    animation: heartbeat 1.5s ease-in-out infinite;
    display: inline-block;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    14% { transform: scale(1.2); }
    28% { transform: scale(1); }
    42% { transform: scale(1.2); }
    70% { transform: scale(1); }
}

.footer-credit {
    background: none;
    border: none;
    padding: 0;
    font-size: inherit;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: all var(--transition-fast);
    letter-spacing: 0.2px;
}

.footer-credit:hover {
    filter: brightness(1.2);
    transform: translateY(-1px);
}

.footer-dot {
    color: var(--text-muted);
    opacity: 0.6;
}

.footer-role {
    color: var(--text-tertiary);
    font-style: italic;
    font-size: 11px;
}

@media (max-width: 480px) {
    .app-footer {
        font-size: 11px;
        padding: 8px 10px;
    }

    .footer-role {
        font-size: 10px;
    }

    .developer-card {
        padding: 12px;
        gap: 10px;
    }

    .developer-avatar svg {
        width: 52px;
        height: 52px;
    }

    .developer-name {
        font-size: 14px;
    }

    .developer-bio {
        font-size: 12px;
        line-height: 1.6;
    }

    .title-badge {
        font-size: 10px;
        padding: 2px 8px;
    }
}

/* ===== VOICE OVERLAY ===== */
.voice-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    backdrop-filter: blur(30px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.voice-overlay.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

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

.voice-content {
    text-align: center;
    max-width: 500px;
    padding: 40px;
}

.voice-animation {
    position: relative;
    width: 180px;
    height: 180px;
    margin: 0 auto 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.voice-circle {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 2px solid var(--accent-primary);
    border-radius: 50%;
    opacity: 0;
    animation: voiceRipple 2s infinite;
}

.voice-circle:nth-child(2) { animation-delay: 0.5s; }
.voice-circle:nth-child(3) { animation-delay: 1s; }

@keyframes voiceRipple {
    0% { transform: scale(0.5); opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}

.voice-mic {
    color: var(--accent-primary);
    animation: micPulse 1s ease-in-out infinite;
    z-index: 2;
    background: var(--bg-secondary);
    border-radius: 50%;
    padding: 20px;
    box-sizing: content-box;
}

@keyframes micPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.voice-content h2 {
    font-size: 28px;
    margin-bottom: 12px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.voice-content p {
    font-size: 15px;
    color: var(--text-tertiary);
    margin-bottom: 24px;
    min-height: 48px;
}

/* ===== TOAST ===== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 300;
    pointer-events: none;
}

.toast {
    padding: 12px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    box-shadow: var(--shadow-lg);
    animation: toastSlide 0.3s ease;
    pointer-events: all;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.success { border-left: 3px solid var(--accent-success); }
.toast.error { border-left: 3px solid var(--accent-danger); }
.toast.info { border-left: 3px solid var(--accent-primary); }
.toast.warning { border-left: 3px solid var(--accent-warning); }

@keyframes toastSlide {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* ===== RESPONSIVE - TABLET & MOBILE ===== */

/* Tablet landscape & below (1024px) */
@media (max-width: 1024px) {
    html, body {
        overflow: auto;
        height: auto;
        min-height: 100vh;
        min-height: 100dvh;
    }

    .app-container {
        height: auto;
        min-height: 100vh;
        min-height: 100dvh;
        padding: 16px;
        gap: 14px;
        overflow: visible;
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
        padding-top: calc(16px + env(safe-area-inset-top));
    }

    .mode-content {
        overflow: visible;
    }

    .mode-content.active {
        flex-direction: column;
        overflow: visible;
    }

    .calculator-wrapper,
    .converter-wrapper,
    .ai-wrapper {
        overflow-y: visible;
        min-height: 0;
    }

    .history-panel {
        width: 100%;
        max-height: 300px;
    }

    .orb { opacity: 0.2; }
}

/* Tablet portrait (768px) */
@media (max-width: 900px) {
    .mode-tabs {
        max-width: 100%;
    }

    .mode-tab {
        padding: 12px 14px;
        font-size: 14px;
        gap: 8px;
    }

    .scientific-calc {
        grid-template-columns: repeat(5, 1fr);
    }

    .scientific-calc .calc-btn {
        font-size: 14px;
        min-height: 56px;
    }

    .rates-grid, .conversions-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }

    .ai-bubble {
        max-width: 80%;
    }
}

/* Mobile (768px and below) */
@media (max-width: 768px) {
    .app-container {
        padding: 10px;
        gap: 10px;
    }

    /* Header */
    .app-header {
        padding: 10px 14px;
    }

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

    .logo-text h1 { font-size: 18px; }
    .logo-text span { font-size: 10px; }

    .header-actions {
        gap: 6px;
    }

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

    /* Mode tabs - icon above label on small screens */
    .mode-tabs {
        padding: 6px;
        gap: 6px;
    }

    .mode-tab {
        padding: 10px 10px;
        font-size: 12px;
        gap: 4px;
        flex-direction: column;
        min-height: 52px;
    }

    .mode-tab svg.tab-icon {
        width: 18px;
        height: 18px;
    }

    .mode-tab span {
        font-size: 11px;
    }

    /* Calculator */
    .calculator-wrapper {
        padding: 14px;
    }

    .display-container {
        padding: 16px 18px;
        min-height: 100px;
    }

    .display-expression {
        font-size: 13px;
    }

    .display-result {
        font-size: 32px;
    }

    .calc-btn {
        min-height: 52px;
        font-size: 17px;
    }

    .calc-btn.function {
        font-size: 13px;
    }

    .calc-btn.operator {
        font-size: 18px;
    }

    .calc-btn.equals {
        font-size: 22px;
    }

    .standard-calc {
        grid-auto-rows: minmax(52px, auto);
        gap: 6px;
    }

    .scientific-calc {
        grid-template-columns: repeat(4, 1fr);
        grid-auto-rows: minmax(48px, auto);
        gap: 5px;
    }

    .scientific-calc .calc-btn {
        font-size: 12px;
        min-height: 48px;
        padding: 4px;
    }

    .programmer-calc .prog-buttons {
        grid-template-columns: repeat(4, 1fr);
        gap: 5px;
    }

    .prog-row {
        font-size: 12px;
    }

    .prog-row span:last-child {
        font-size: 14px;
    }

    /* Converter */
    .converter-wrapper {
        padding: 16px;
        gap: 16px;
    }

    .converter-header h2 {
        font-size: 20px;
    }

    .converter-card {
        padding: 16px;
    }

    .converter-input {
        padding: 12px 14px;
        font-size: 18px;
    }

    .converter-select {
        padding: 12px 36px 12px 14px;
        font-size: 13px;
        min-width: 110px;
    }

    .swap-btn {
        width: 42px;
        height: 42px;
        border-width: 2px;
    }

    .category-tab {
        padding: 8px 14px;
        font-size: 13px;
    }

    .category-tab span:first-child {
        font-size: 14px;
    }

    .quick-btn {
        padding: 10px 14px;
        font-size: 13px;
        flex: 1;
        min-width: 70px;
    }

    .quick-btns {
        gap: 6px;
    }

    .rates-grid, .conversions-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 8px;
    }

    .rate-card, .conversion-card {
        padding: 10px;
    }

    /* AI */
    .ai-wrapper {
        padding: 16px;
    }

    .ai-header h2 {
        font-size: 19px;
    }

    .ai-icon {
        width: 50px;
        height: 50px;
    }

    .ai-chat {
        max-height: 400px;
    }

    .ai-avatar {
        width: 30px;
        height: 30px;
        font-size: 11px;
    }

    .ai-bubble {
        max-width: 78%;
        padding: 10px 14px;
        font-size: 13px;
    }

    .ai-bubble ul li {
        font-size: 12px;
    }

    .ai-input {
        font-size: 14px;
        padding: 10px;
    }

    .suggestion-chip {
        font-size: 11px;
        padding: 6px 10px;
    }

    /* Panels - slide from bottom as sheet */
    .theme-panel, .settings-panel {
        width: 100%;
        right: 0;
        left: 0;
        top: auto;
        bottom: -100%;
        height: 85vh;
        height: 85dvh;
        border-left: none;
        border-top: 1px solid var(--border-color);
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        transition: bottom var(--transition-base);
        padding: 20px;
    }

    .theme-panel.open, .settings-panel.open {
        right: 0;
        bottom: 0;
    }

    /* Drag handle on mobile sheets */
    .theme-panel::before, .settings-panel::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 4px;
        background: var(--border-hover);
        border-radius: 2px;
    }

    .theme-panel .panel-header,
    .settings-panel .panel-header {
        margin-top: 12px;
    }

    .themes-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Voice overlay */
    .voice-content {
        padding: 24px;
    }

    .voice-animation {
        width: 140px;
        height: 140px;
    }

    .voice-content h2 {
        font-size: 22px;
    }

    .voice-content p {
        font-size: 14px;
    }

    /* Toast */
    .toast-container {
        top: auto;
        bottom: 20px;
        right: 10px;
        left: 10px;
    }

    .toast {
        font-size: 13px;
        padding: 10px 16px;
    }

    /* History panel */
    .history-panel {
        padding: 14px;
        max-height: 260px;
    }

    .history-item {
        padding: 10px;
    }

    .history-expression {
        font-size: 12px;
    }

    .history-result {
        font-size: 14px;
    }
}

/* Small mobile (480px and below) */
@media (max-width: 480px) {
    .app-container {
        padding: 8px;
        gap: 8px;
    }

    /* Header - more compact */
    .app-header {
        padding: 8px 10px;
    }

    .logo {
        gap: 8px;
    }

    .logo-icon {
        width: 30px;
        height: 30px;
    }

    .logo-text h1 { font-size: 16px; }
    .logo-text span { font-size: 9px; }

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

    .icon-btn svg {
        width: 18px;
        height: 18px;
    }

    /* Mode tabs */
    .mode-tab {
        padding: 8px 6px;
        min-height: 48px;
    }

    .mode-tab span {
        font-size: 10px;
    }

    .mode-tab svg.tab-icon {
        width: 16px;
        height: 16px;
    }

    /* Calculator */
    .calculator-wrapper {
        padding: 10px;
    }

    .display-container {
        padding: 14px;
        min-height: 90px;
    }

    .display-result {
        font-size: 28px;
    }

    .display-result.error {
        font-size: 18px;
    }

    .display-expression {
        font-size: 12px;
    }

    .calc-mode-toggle {
        padding: 3px;
    }

    .toggle-btn {
        padding: 7px 6px;
        font-size: 11px;
    }

    .standard-calc {
        grid-auto-rows: minmax(48px, auto);
        gap: 5px;
    }

    .calc-btn {
        min-height: 48px;
        font-size: 16px;
        border-radius: var(--radius-sm);
    }

    .calc-btn.function {
        font-size: 12px;
    }

    .calc-btn.operator {
        font-size: 17px;
    }

    .calc-btn.equals {
        font-size: 20px;
    }

    .scientific-calc {
        grid-template-columns: repeat(4, 1fr);
    }

    .scientific-calc .calc-btn {
        font-size: 11px;
        min-height: 44px;
    }

    .programmer-calc .prog-buttons {
        grid-template-columns: repeat(4, 1fr);
    }

    .programmer-calc .calc-btn {
        min-height: 44px;
        font-size: 14px;
    }

    .prog-display {
        padding: 10px;
    }

    .prog-row {
        font-size: 11px;
        padding: 3px 6px;
    }

    /* Converter */
    .converter-wrapper {
        padding: 12px;
        gap: 12px;
    }

    .converter-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .converter-header h2 {
        font-size: 18px;
    }

    .converter-card {
        padding: 12px;
    }

    .converter-input-group {
        flex-direction: column;
    }

    .converter-select {
        border-left: none;
        border-top: 1px solid var(--border-color);
        width: 100%;
        min-width: 0;
    }

    .converter-input {
        font-size: 18px;
        padding: 12px;
    }

    /* Swap button needs repositioning when stacked */
    .swap-btn {
        position: relative;
        left: auto;
        top: auto;
        transform: none;
        margin: 4px auto;
        display: flex;
    }

    .swap-btn:hover {
        transform: rotate(180deg) scale(1.1);
    }

    .exchange-rate, .conversion-formula {
        padding: 10px;
        font-size: 12px;
    }

    .category-tab {
        padding: 7px 12px;
        font-size: 12px;
    }

    .presets-section {
        padding: 12px;
    }

    .preset-chip {
        padding: 5px 8px 5px 10px;
        font-size: 11px;
    }

    .quick-btns {
        gap: 5px;
    }

    .quick-btn {
        padding: 8px 10px;
        font-size: 12px;
        min-width: 60px;
    }

    .rates-grid, .conversions-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 6px;
    }

    .rate-card, .conversion-card {
        padding: 8px;
    }

    .rate-flag, .unit-name {
        font-size: 11px;
    }

    .rate-code {
        font-size: 12px;
    }

    .rate-value, .conversion-value {
        font-size: 14px;
    }

    /* AI */
    .ai-wrapper {
        padding: 12px;
    }

    .ai-header {
        padding-bottom: 12px;
    }

    .ai-icon {
        width: 44px;
        height: 44px;
    }

    .ai-header h2 {
        font-size: 17px;
    }

    .ai-subtitle {
        font-size: 12px;
    }

    .ai-chat {
        max-height: 320px;
    }

    .ai-bubble {
        max-width: 85%;
        font-size: 13px;
        padding: 10px 12px;
    }

    .ai-input-wrapper {
        padding: 6px;
    }

    .ai-input {
        font-size: 13px;
    }

    .voice-btn-ai {
        width: 36px;
        height: 36px;
    }

    .btn-primary {
        padding: 8px 14px;
        font-size: 13px;
    }

    /* Suggestion chips scroll horizontally */
    .ai-suggestions {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 4px;
        scrollbar-width: none;
    }

    .ai-suggestions::-webkit-scrollbar {
        display: none;
    }

    .suggestion-chip {
        flex-shrink: 0;
    }

    /* Panels */
    .theme-panel, .settings-panel {
        padding: 16px;
    }

    .themes-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .theme-preview {
        height: 42px;
    }

    .theme-option {
        padding: 8px;
        font-size: 11px;
    }

    .custom-color-row {
        padding: 6px 10px;
    }

    /* Voice */
    .voice-animation {
        width: 120px;
        height: 120px;
    }

    .voice-mic {
        padding: 16px;
    }

    .voice-content h2 {
        font-size: 20px;
    }

    .voice-content p {
        font-size: 13px;
    }

    /* Section headers */
    .section-header h3,
    .quick-amounts h3,
    .popular-rates h3,
    .all-conversions h3,
    .presets-section h3 {
        font-size: 14px;
    }

    /* Toast */
    .toast {
        font-size: 12px;
        padding: 10px 14px;
    }
}

/* Very small devices (360px and below) */
@media (max-width: 360px) {
    .mode-tab span {
        display: none;
    }

    .mode-tab {
        flex-direction: row;
        min-height: 48px;
        padding: 10px;
    }

    .display-result {
        font-size: 26px;
    }

    .calc-btn {
        min-height: 44px;
        font-size: 15px;
    }

    .scientific-calc {
        grid-template-columns: repeat(3, 1fr);
    }

    .scientific-calc .calc-btn {
        font-size: 10px;
        min-height: 42px;
    }
}

/* Landscape orientation on mobile - compact */
@media (max-height: 500px) and (orientation: landscape) {
    html, body {
        overflow: auto;
    }

    .app-container {
        min-height: auto;
    }

    .display-container {
        min-height: 70px;
        padding: 12px;
    }

    .display-result {
        font-size: 24px;
    }

    .display-expression {
        font-size: 11px;
    }

    .calc-btn {
        min-height: 40px;
        font-size: 14px;
    }

    .orb { display: none; }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }

    .orb { display: none; }
}

/* Hover-only devices (not touch) */
@media (hover: none) {
    .calc-btn:hover,
    .mode-tab:hover,
    .category-tab:hover,
    .quick-btn:hover,
    .rate-card:hover,
    .conversion-card:hover,
    .preset-chip:hover,
    .icon-btn:hover,
    .suggestion-chip:hover {
        transform: none;
    }
}

/* ===== NO ANIMATION MODE ===== */
.no-anim *, .no-anim *::before, .no-anim *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
}

/* ===== NEW CALCULATOR MODULES (Ovulation / Loan / Tax) ===== */

.module-pill {
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--accent-primary);
    border: 1px solid var(--border-color);
}

.module-description {
    color: var(--text-tertiary);
    font-size: 14px;
    line-height: 1.5;
    margin-top: -8px;
}

.form-card {
    padding: 24px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-field label {
    font-size: 12px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.form-input {
    padding: 12px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 500;
    outline: none;
    transition: all var(--transition-fast);
    width: 100%;
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
}

select.form-input {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 36px;
}

.form-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.form-input::-webkit-inner-spin-button,
.form-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.form-actions button {
    flex: 1 1 auto;
    min-width: 110px;
}

.advanced-options {
    margin: 8px 0 16px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.advanced-options summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    color: var(--accent-primary);
    padding: 4px 0;
    user-select: none;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.advanced-options summary::-webkit-details-marker { display: none; }

.advanced-options summary::before {
    content: '▸';
    transition: transform var(--transition-fast);
    font-size: 12px;
}

.advanced-options[open] summary::before {
    transform: rotate(90deg);
}

.advanced-options[open] {
    background: var(--bg-secondary);
}

.advanced-options .form-grid {
    margin-top: 12px;
    margin-bottom: 0;
}

.muted-note {
    color: var(--text-muted);
    font-size: 13px;
    margin: 8px 0 12px;
}

/* Result grid + cards */
.result-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
    animation: fadeInUp 0.4s ease;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.result-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: all var(--transition-fast);
    animation: popIn 0.3s ease;
}

.result-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.result-card-primary {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.18), rgba(139, 92, 246, 0.12));
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

.result-label {
    font-size: 11px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.result-value {
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    word-break: break-word;
}

.result-card-primary .result-value {
    font-size: 20px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Disclaimer card */
.disclaimer-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent-warning);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.disclaimer-card.warning {
    border-left-color: var(--accent-warning);
    background: rgba(245, 158, 11, 0.06);
}

.disclaimer-card strong {
    color: var(--accent-warning);
}

/* Charts */
.chart-section {
    margin-top: 4px;
}

.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
}

.chart-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
}

.chart-card h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-align: center;
}

.donut-chart, .line-chart, .bar-chart {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    font-size: 12px;
    color: var(--text-secondary);
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-primary);
}

.chart-meta {
    font-size: 12px;
    color: var(--text-tertiary);
    text-align: center;
    margin-top: 8px;
}

/* Chart SVG typography + richer chart details */
.donut-chart svg text,
.line-chart svg text { font-family: var(--font-sans); }

.donut-center-value {
    font-family: var(--font-mono);
    font-weight: 700;
    letter-spacing: -0.5px;
}

.line-chart svg { max-height: 240px; }

.bar-fill { min-width: 3px; }

/* Bar chart */
.bar-chart-inner {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bar-row {
    display: grid;
    grid-template-columns: 90px 1fr 80px;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.bar-label {
    color: var(--text-tertiary);
    text-align: right;
    font-weight: 600;
}

.bar-track {
    background: var(--bg-tertiary);
    border-radius: 6px;
    overflow: hidden;
    height: 18px;
}

.bar-fill {
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    height: 100%;
    border-radius: 6px;
    transition: width 0.4s ease;
}

.bar-value {
    text-align: right;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-weight: 600;
}

/* Schedule / breakdown table */
.schedule-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
}

.schedule-table-wrapper {
    max-height: 420px;
    overflow: auto;
    border-radius: var(--radius-sm);
    transition: max-height var(--transition-base);
}

.schedule-table-wrapper.collapsed {
    max-height: 0;
    overflow: hidden;
}

.schedule-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.schedule-table thead {
    position: sticky;
    top: 0;
    background: var(--bg-elevated);
    z-index: 2;
}

.schedule-table th {
    padding: 10px 8px;
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.schedule-table td {
    padding: 8px;
    border-bottom: 1px solid var(--border-color);
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-primary);
    white-space: nowrap;
}

.schedule-table tbody tr:hover {
    background: var(--bg-tertiary);
}

/* Tax bracket editor */
.brackets-editor {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.bracket-row {
    display: grid;
    grid-template-columns: 1fr 1fr 100px 30px;
    gap: 8px;
    align-items: center;
}

.bracket-row .form-input {
    padding: 8px 10px;
    font-size: 13px;
}

.remove-bracket {
    width: 30px;
    height: 30px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    transition: all var(--transition-fast);
}

.remove-bracket:hover {
    background: var(--accent-danger);
    border-color: var(--accent-danger);
    color: white;
}

/* Ovulation calendar */
.calendar-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
}

.calendar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 12px;
    color: var(--text-secondary);
}

.calendar-legend .legend-dot.period { background: var(--accent-danger); }
.calendar-legend .legend-dot.fertile { background: var(--accent-success); }
.calendar-legend .legend-dot.ovulation { background: var(--accent-warning); }
.calendar-legend .legend-dot.today { background: var(--accent-primary); }

.ovulation-calendar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 12px;
}

.calendar-month {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
}

.cal-month-header {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 10px;
    color: var(--text-primary);
    text-align: center;
}

.cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 6px;
    font-size: 11px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    font-weight: 600;
    text-align: center;
}

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

.cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--text-primary);
    border-radius: 50%;
    background: transparent;
    position: relative;
    border: 1px solid transparent;
    transition: all var(--transition-fast);
}

.cal-day.empty { background: transparent; }

.cal-day.period {
    background: rgba(239, 68, 68, 0.18);
    color: var(--accent-danger);
    font-weight: 600;
}

.cal-day.fertile {
    background: rgba(16, 185, 129, 0.18);
    color: var(--accent-success);
    font-weight: 600;
}

.cal-day.ovulation {
    background: var(--accent-warning);
    color: white;
    font-weight: 700;
    box-shadow: var(--shadow-glow);
}

.cal-day.today {
    border-color: var(--accent-primary);
    font-weight: 700;
}

.cal-day.today.period,
.cal-day.today.fertile,
.cal-day.today.ovulation {
    border-color: var(--accent-primary);
    border-width: 2px;
}

/* Mobile tweaks for new calculator forms */
@media (max-width: 640px) {
    .form-grid { grid-template-columns: 1fr; }
    .bracket-row { grid-template-columns: 1fr 1fr 80px 30px; gap: 6px; }
    .form-actions button { min-width: auto; }
    .bar-row { grid-template-columns: 80px 1fr 70px; font-size: 11px; }
    .result-value { font-size: 16px; }
    .schedule-table th, .schedule-table td { padding: 6px 4px; font-size: 11px; }
    .ovulation-calendar { grid-template-columns: 1fr; }
}

/* ===== UTILS ===== */
.hidden { display: none !important; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}

/* =========================================================
   UI POLISH v2 — refined depth, motion & hierarchy
   Appended last so it layers cleanly over the base styles.
   ========================================================= */

/* ---- Calculator: the "screen" ---- */
.display-container {
    background: linear-gradient(160deg, var(--bg-elevated) 0%, var(--bg-secondary) 55%, #0b0f1e 100%);
    border-color: var(--border-hover);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05),
                inset 0 -22px 44px rgba(99, 102, 241, 0.05),
                var(--shadow-sm);
    min-height: 128px;
}
.display-container::before {
    background: radial-gradient(130% 90% at 100% 0%, var(--accent-primary), transparent 55%);
    opacity: 0.07;
}
.display-result { font-size: 46px; text-shadow: 0 2px 24px rgba(99, 102, 241, 0.18); }
.display-expression { font-size: 15px; }

/* ---- Calculator: tactile keys ---- */
.calc-btn {
    background: linear-gradient(180deg, var(--bg-elevated), var(--bg-tertiary));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 2px 5px rgba(0, 0, 0, 0.28);
    transition: transform 130ms cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 150ms ease, background 150ms ease,
                border-color 150ms ease, filter 150ms ease;
}
.calc-btn:hover {
    transform: translateY(-2px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09), 0 8px 18px rgba(0, 0, 0, 0.38);
}
.calc-btn:active {
    transform: translateY(1px) scale(0.97);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.45);
}
.calc-btn.function {
    background: linear-gradient(180deg, var(--bg-elevated), var(--bg-tertiary));
    color: var(--text-secondary);
}
.calc-btn.operator {
    background: linear-gradient(150deg, var(--accent-primary), var(--accent-tertiary));
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.calc-btn.equals {
    background: linear-gradient(150deg, var(--accent-secondary), var(--accent-primary));
    box-shadow: 0 4px 16px rgba(236, 72, 153, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.calc-btn.operator:hover, .calc-btn.equals:hover { transform: translateY(-2px); filter: brightness(1.08); }

/* ---- Calculator: Standard/Scientific/Programmer toggle ---- */
.toggle-btn.active {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-tertiary));
    color: #fff;
    box-shadow: 0 3px 12px rgba(99, 102, 241, 0.35);
}

/* ---- Currency / Metric: converter depth + result ---- */
.converter-input-group {
    background: linear-gradient(180deg, var(--bg-tertiary), var(--bg-secondary));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
.converter-input-group:focus-within {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18), 0 8px 20px rgba(0, 0, 0, 0.28);
    transform: translateY(-1px);
}
.swap-btn:active { transform: translate(-50%, -50%) scale(0.9) rotate(180deg); }
.exchange-rate, .conversion-formula {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(236, 72, 153, 0.06));
    border: 1px solid rgba(99, 102, 241, 0.22);
    color: var(--text-primary);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* ---- Metric: category chips ---- */
.category-tab { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03); }
.category-tab.active {
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

/* ---- Currency: quick amounts + rate/conversion cards ---- */
.quick-btn:hover {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-tertiary));
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}
.rate-card, .conversion-card { background: linear-gradient(180deg, var(--bg-secondary), var(--bg-tertiary)); }
.rate-card:hover, .conversion-card:hover { box-shadow: 0 8px 20px rgba(0, 0, 0, 0.32); }

/* ---- AI Assistant: bubbles, input, chips ---- */
.ai-bubble {
    background: linear-gradient(180deg, var(--bg-elevated), var(--bg-tertiary));
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.22);
    border-bottom-left-radius: 4px;
}
.ai-user .ai-bubble {
    border-bottom-left-radius: var(--radius-md);
    border-bottom-right-radius: 4px;
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.32);
}
.ai-input-wrapper:focus-within {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18), 0 8px 20px rgba(0, 0, 0, 0.28);
    transform: translateY(-1px);
}
#aiSend {
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
    transition: transform 130ms cubic-bezier(0.34, 1.56, 0.64, 1), filter 150ms ease, box-shadow 150ms ease;
}
#aiSend:hover { transform: translateY(-2px); filter: brightness(1.08); }
#aiSend:active { transform: translateY(1px) scale(0.96); }
.suggestion-chip:active { transform: translateY(0) scale(0.96); }
.ai-icon-wrapper { filter: drop-shadow(0 4px 14px rgba(139, 92, 246, 0.4)); }

/* ---- Respect reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
    .calc-btn, #aiSend, .converter-input-group, .category-tab.active, .swap-btn { transition: none; }
}

/* =========================================================
   CALCULATOR DISPLAY REDESIGN v3 — glassmorphism + animated icons
   ========================================================= */
.glass-display {
    position: relative;
    min-height: 178px;
    padding: 16px 20px 20px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015)), rgba(10, 14, 26, 0.5);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.55),
                inset 0 1px 0 rgba(255, 255, 255, 0.16),
                inset 0 -1px 0 rgba(255, 255, 255, 0.03),
                inset 0 0 60px rgba(99, 102, 241, 0.06);
    overflow: hidden;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 12px;
}
.glass-display::before { content: none; }

/* aurora light behind the glass */
.glass-aurora { position: absolute; inset: 0; z-index: 0; overflow: hidden; }
.orb { position: absolute; border-radius: 50%; filter: blur(34px); opacity: 0.55; will-change: transform; }
.orb-a { width: 190px; height: 190px; top: -60px; left: -30px;
    background: radial-gradient(circle, var(--accent-primary), transparent 70%); animation: orbA 15s ease-in-out infinite; }
.orb-b { width: 170px; height: 170px; bottom: -70px; right: -20px;
    background: radial-gradient(circle, var(--accent-secondary), transparent 70%); animation: orbB 18s ease-in-out infinite; }
.orb-c { width: 150px; height: 150px; top: 10px; right: 90px;
    background: radial-gradient(circle, var(--accent-tertiary), transparent 70%); animation: orbC 13s ease-in-out infinite; }
@keyframes orbA { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(34px,26px) scale(1.18); } }
@keyframes orbB { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-30px,-20px) scale(1.12); } }
@keyframes orbC { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-24px,28px) scale(0.85); } }

/* frosted layer + light sweep */
.glass-frost { position: absolute; inset: 0; z-index: 1;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(9px) saturate(130%);
    -webkit-backdrop-filter: blur(9px) saturate(130%); }
.glass-shine { position: absolute; inset: 0; z-index: 1; pointer-events: none;
    background: linear-gradient(115deg, transparent 34%, rgba(255,255,255,0.07) 47%, transparent 60%);
    transform: translateX(-120%); animation: shineSweep 8s ease-in-out infinite; }
@keyframes shineSweep { 0%,55% { transform: translateX(-120%); } 78%,100% { transform: translateX(120%); } }

/* top chrome: brand + status */
.display-chrome { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; }
.chrome-brand { display: flex; align-items: center; gap: 9px; }
.chrome-title { font-family: var(--font-sans); font-size: 12px; font-weight: 700; letter-spacing: 3px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.chrome-status { display: flex; align-items: center; gap: 7px; }
.mem-pill, .live-pill { font-family: var(--font-mono); font-size: 10px; font-weight: 600; letter-spacing: 1px;
    padding: 3px 9px; border-radius: 20px; border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.05); color: var(--text-tertiary);
    display: inline-flex; align-items: center; gap: 5px; }
.mem-pill { color: var(--accent-primary); border-color: rgba(99,102,241,0.4); background: rgba(99,102,241,0.10); }
.mem-pill:empty { display: none; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-success);
    box-shadow: 0 0 8px var(--accent-success); animation: livePulse 1.8s ease-in-out infinite; }
@keyframes livePulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.45; transform: scale(0.65); } }

/* animated brand mark */
.brand-mark { display: block; overflow: visible; }
.bm-ring { transform-box: view-box; transform-origin: 20px 20px; animation: bmSpin 7s linear infinite; }
.bm-orbit { transform-box: view-box; transform-origin: 20px 20px; animation: bmOrbit 4.5s linear infinite;
    filter: drop-shadow(0 0 4px var(--accent-secondary)); }
.bm-sigma { animation: bmGlow 2.6s ease-in-out infinite; }
@keyframes bmSpin { to { transform: rotate(360deg); } }
@keyframes bmOrbit { to { transform: rotate(360deg); } }
@keyframes bmGlow { 0%,100% { opacity: 0.9; } 50% { opacity: 1; filter: drop-shadow(0 0 5px rgba(99,102,241,0.9)); } }

/* readout */
.display-readout { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.glass-display .display-expression { font-family: var(--font-mono); font-size: 15px; color: var(--text-tertiary);
    min-height: 20px; text-align: right; word-break: break-all; opacity: 0.92; }
.glass-display .display-result { font-family: var(--font-mono); font-size: 48px; font-weight: 700; line-height: 1.05;
    text-align: right; word-break: break-all; letter-spacing: -1px;
    color: #ffffff; -webkit-text-fill-color: #ffffff; background: none;
    text-shadow: 0 2px 22px rgba(99, 102, 241, 0.55), 0 0 1px rgba(255, 255, 255, 0.5);
    transform-origin: right center;
    animation: displayZoom 2.6s ease-in-out infinite; }
@keyframes displayZoom { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } }
.glass-display .display-result.error { background: none; -webkit-text-fill-color: var(--accent-danger);
    color: var(--accent-danger); filter: none; font-size: 26px; animation: none; }

@media (prefers-reduced-motion: reduce) {
    .orb, .glass-shine, .bm-ring, .bm-orbit, .bm-sigma, .live-dot { animation: none; }
}

@media (max-width: 480px) {
    .glass-display { min-height: 160px; }
    .glass-display .display-result { font-size: 40px; }
    .chrome-title { display: none; }
}

/* =========================================================
   GLASS ACROSS MODULES v4 — frosted cards + hero aurora
   Translucent glass only (NO backdrop-filter on these cards:
   they sit inside .converter-wrapper which already has one,
   and nested backdrop-filter renders black in Chromium).
   ========================================================= */

/* Glass container cards */
.converter-card,
.chart-card,
.presets-section,
.schedule-section,
.calendar-section,
.disclaimer-card,
.ai-wrapper,
.history-panel {
    background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02)), rgba(17,22,42,0.72);
    border: 1px solid rgba(255,255,255,0.10);
    box-shadow: 0 16px 38px rgba(0,0,0,0.38), inset 0 1px 0 rgba(255,255,255,0.10);
}
.disclaimer-card.warning {
    background: linear-gradient(180deg, rgba(245,158,11,0.10), rgba(245,158,11,0.02)), rgba(17,22,42,0.72);
    border-color: rgba(255,255,255,0.10);
    border-left: 4px solid var(--accent-warning);
}

/* Lightweight glass item cards */
.result-card,
.rate-card, .conversion-card {
    background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02)), rgba(22,27,50,0.72);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}
.result-card:hover,
.rate-card:hover, .conversion-card:hover {
    border-color: rgba(99,102,241,0.5);
    box-shadow: 0 10px 24px rgba(0,0,0,0.34), inset 0 1px 0 rgba(255,255,255,0.10);
}

/* Hero cards — accent glass + drifting aurora (pure background layers = compositor-safe) */
.result-card-primary {
    background-image:
        radial-gradient(circle 130px, rgba(99,102,241,0.5), transparent 66%),
        linear-gradient(135deg, rgba(99,102,241,0.24), rgba(139,92,246,0.12));
    background-repeat: no-repeat;
    background-size: 260px 260px, cover;
    background-position: 112% -34%, center;
    background-color: rgba(16,21,40,0.6);
    border: 1px solid rgba(99,102,241,0.45);
    animation: heroAurora 13s ease-in-out infinite;
}
.exchange-rate, .conversion-formula {
    background-image:
        radial-gradient(circle 120px, rgba(236,72,153,0.4), transparent 66%),
        linear-gradient(135deg, rgba(99,102,241,0.12), rgba(236,72,153,0.06));
    background-repeat: no-repeat;
    background-size: 240px 240px, cover;
    background-position: 110% -30%, center;
    background-color: rgba(16,21,40,0.55);
    border: 1px solid rgba(99,102,241,0.22);
    animation: heroAurora 15s ease-in-out infinite;
}
@keyframes heroAurora {
    0%, 100% { background-position: 112% -34%, center; }
    50%      { background-position: 55% 125%, center; }
}

@media (prefers-reduced-motion: reduce) {
    .result-card-primary, .exchange-rate, .conversion-formula { animation: none; }
}

/* =========================================================
   ABOUT THE DEVELOPER — redesigned glass profile card
   ========================================================= */
.dev-profile {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    padding: 18px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255,255,255,0.10);
    background: linear-gradient(180deg, rgba(255,255,255,0.055), rgba(255,255,255,0.015)), rgba(17,22,42,0.72);
    box-shadow: 0 16px 40px rgba(0,0,0,0.42), inset 0 1px 0 rgba(255,255,255,0.10);
    margin-bottom: 14px;
}
.dev-profile > *:not(.dev-profile-glow) { position: relative; z-index: 1; }
.dev-profile-glow {
    position: absolute; z-index: 0;
    width: 210px; height: 210px; top: -80px; right: -60px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--accent-primary), transparent 68%);
    filter: blur(42px); opacity: 0.4; pointer-events: none;
    animation: devGlowDrift 15s ease-in-out infinite;
}
@keyframes devGlowDrift {
    0%,100% { transform: translate(0,0) scale(1); }
    50%     { transform: translate(-46px, 34px) scale(1.22); }
}

.dev-profile-head { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }

.developer-avatar { position: relative; width: 60px; height: 60px; flex-shrink: 0; }
.dev-avatar-face { display: block; position: relative; z-index: 1; }
.dev-avatar-ring {
    position: absolute; top: 50%; left: 50%; width: 78px; height: 78px;
    transform: translate(-50%, -50%); transform-origin: center;
    animation: devRingSpin 9s linear infinite;
}
@keyframes devRingSpin { to { transform: translate(-50%, -50%) rotate(360deg); } }
.dev-status {
    position: absolute; z-index: 2; bottom: 2px; right: 2px;
    width: 14px; height: 14px; border-radius: 50%;
    background: var(--accent-success);
    border: 2.5px solid var(--bg-secondary);
    box-shadow: 0 0 8px var(--accent-success);
    animation: devStatusPulse 2s ease-in-out infinite;
}
@keyframes devStatusPulse { 0%,100% { box-shadow: 0 0 6px var(--accent-success); } 50% { box-shadow: 0 0 13px var(--accent-success); } }

.dev-tagline { font-size: 12px; color: var(--text-tertiary); font-weight: 500; margin: 3px 0 8px; }

.dev-skills { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.skill-chip {
    font-size: 11px; font-weight: 600; padding: 5px 11px; border-radius: 20px;
    background: rgba(99,102,241,0.10); border: 1px solid rgba(99,102,241,0.28);
    color: var(--accent-primary); letter-spacing: 0.2px;
    transition: all var(--transition-fast);
}
.skill-chip:hover { background: rgba(99,102,241,0.2); transform: translateY(-1px); }

.dev-profile .developer-bio { margin-bottom: 16px; padding: 0; color: var(--text-secondary); }
.dev-profile .developer-links { margin-bottom: 0; }
.dev-profile .dev-link {
    flex: 1 1 auto; justify-content: center;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.10);
}
.dev-profile .dev-link:hover {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-tertiary));
    border-color: transparent; color: #fff;
    box-shadow: 0 6px 16px rgba(99,102,241,0.35);
}
.app-version strong { color: var(--text-secondary); font-weight: 700; }

@media (prefers-reduced-motion: reduce) {
    .dev-profile-glow, .dev-avatar-bg { animation: none; }
    /* ring, status & photo keep animating so they stay visible in the mobile (TWA) app */
}

/* Developer photo avatar (overlays the CA fallback; ring stays around it) */
.dev-avatar-photo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center 28%;
    z-index: 1;
    display: block;
    border: 2px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.45);
}

/* Animated developer avatar: gently zooming photo (the dotted ring already rotates) */
.dev-avatar-photo { animation: devPhotoZoom 3.4s ease-in-out infinite; }
@keyframes devPhotoZoom {
    0%, 100% { transform: translate(-50%, -50%) scale(0.9); }
    50%      { transform: translate(-50%, -50%) scale(1.08); }
}

/* Edit button on user chat messages — click to reload the question into the input */
.ai-message.ai-user { align-items: center; }
.ai-edit-btn {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-tertiary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.75;
    transition: all var(--transition-fast);
}
.ai-message.ai-user:hover .ai-edit-btn { opacity: 1; }
.ai-edit-btn:hover {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-tertiary));
    color: #fff;
    border-color: transparent;
    transform: scale(1.08);
}
.ai-edit-btn:active { transform: scale(0.94); }
/* Touch devices have no hover — keep the edit affordance visible */
@media (hover: none) { .ai-edit-btn { opacity: 0.9; } }

/* .dev-avatar-photo intentionally keeps its zoom under reduced-motion (user request) */

/* AI Assistant: source label under Gemini-answered replies */
.ai-source {
    margin-top: 8px;
    font-size: 11px;
    opacity: 0.65;
    letter-spacing: 0.3px;
}
