
.splash-logo {
    width: 400px;
    max-width: 80vw;
    height: auto;
    position: relative;
    z-index: 2;
    animation: logoFloat 3s ease-in-out infinite;
}

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


:root {
    --bg-primary: #0f0f23;
    --bg-secondary: #1a1a2e;
    --bg-tertiary: #16213e;
    --bg-card: rgba(26, 26, 46, 0.6);
    --accent-primary: #00f5ff;
    --accent-secondary: #00d4ff;
    --accent-tertiary: #0095ff;
    --accent-glow: rgba(0, 245, 255, 0.25);
    --accent-glow-strong: rgba(0, 245, 255, 0.4);
    --text-primary: #ffffff;
    --text-secondary: #a8b2d1;
    --text-tertiary: #6b7280;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-bg-strong: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-strong: rgba(255, 255, 255, 0.15);
    --shadow-light: rgba(0, 0, 0, 0.15);
    --shadow-medium: rgba(0, 0, 0, 0.25);
    --shadow-heavy: rgba(0, 0, 0, 0.45);
    --shadow-glow: 0 0 30px var(--accent-glow);
    --border-radius-sm: 12px;
    --border-radius-md: 16px;
    --border-radius-lg: 24px;
    --border-radius-xl: 32px;
}

[data-theme="emerald"] {
    --accent-primary: #10b981;
    --accent-secondary: #059669;
    --accent-glow: rgba(16, 185, 129, 0.3);
}

[data-theme="purple"] {
    --accent-primary: #a855f7;
    --accent-secondary: #9333ea;
    --accent-glow: rgba(168, 85, 247, 0.3);
}

[data-theme="crimson"] {
    --accent-primary: #ef4444;
    --accent-secondary: #dc2626;
    --accent-glow: rgba(239, 68, 68, 0.3);
}

[data-theme="amber"] {
    --accent-primary: #f59e0b;
    --accent-secondary: #d97706;
    --accent-glow: rgba(245, 158, 11, 0.3);
}

[data-theme="white"] {
    --accent-primary: #f0f0f0;
    --accent-secondary: #d0d0d0;
    --accent-glow: rgba(240, 240, 240, 0.3);
}

[data-theme="light"] {
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e9ecef;
    --bg-card: rgba(255, 255, 255, 0.8);
    --accent-primary: #0056d2;
    --accent-secondary: #004bbd;
    --accent-tertiary: #003d9e;
    --accent-glow: rgba(0, 86, 210, 0.15);
    --accent-glow-strong: rgba(0, 86, 210, 0.25);
    --text-primary: #1a1a1a;
    --text-secondary: #4a5568;
    --text-tertiary: #718096;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-bg-strong: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(0, 0, 0, 0.08);
    --glass-border-strong: rgba(0, 0, 0, 0.12);
    --shadow-light: rgba(0, 0, 0, 0.05);
    --shadow-medium: rgba(0, 0, 0, 0.1);
    --shadow-heavy: rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 0 20px var(--accent-glow);
}

[data-theme="light-emerald"] {
    --bg-primary: #f0fdf4;
    --bg-secondary: #ffffff;
    --bg-tertiary: #dcfce7;
    --bg-card: rgba(255, 255, 255, 0.8);
    --accent-primary: #059669;
    --accent-secondary: #047857;
    --accent-tertiary: #065f46;
    --accent-glow: rgba(5, 150, 105, 0.15);
    --accent-glow-strong: rgba(5, 150, 105, 0.25);
    --text-primary: #1a1a1a;
    --text-secondary: #4a5568;
    --text-tertiary: #718096;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-bg-strong: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(0, 0, 0, 0.08);
    --glass-border-strong: rgba(0, 0, 0, 0.12);
    --shadow-light: rgba(0, 0, 0, 0.05);
    --shadow-medium: rgba(0, 0, 0, 0.1);
    --shadow-heavy: rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 0 20px var(--accent-glow);
}

[data-theme="light-purple"] {
    --bg-primary: #faf5ff;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f3e8ff;
    --bg-card: rgba(255, 255, 255, 0.8);
    --accent-primary: #7c3aed;
    --accent-secondary: #6d28d9;
    --accent-tertiary: #5b21b6;
    --accent-glow: rgba(124, 58, 237, 0.15);
    --accent-glow-strong: rgba(124, 58, 237, 0.25);
    --text-primary: #1a1a1a;
    --text-secondary: #4a5568;
    --text-tertiary: #718096;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-bg-strong: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(0, 0, 0, 0.08);
    --glass-border-strong: rgba(0, 0, 0, 0.12);
    --shadow-light: rgba(0, 0, 0, 0.05);
    --shadow-medium: rgba(0, 0, 0, 0.1);
    --shadow-heavy: rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 0 20px var(--accent-glow);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

#matrix-rain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    opacity: 0.15;
    pointer-events: none;
    display: block;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse at 15% 25%, var(--accent-glow) 0%, transparent 45%),
        radial-gradient(ellipse at 85% 75%, rgba(0, 212, 255, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(0, 149, 255, 0.1) 0%, transparent 60%);
    animation: gradientFloat 20s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes gradientFloat {
    0%, 100% { 
        transform: translate(0, 0) scale(1);
        opacity: 0.8;
    }
    33% { 
        transform: translate(3%, -4%) scale(1.05);
        opacity: 1;
    }
    66% { 
        transform: translate(-3%, 4%) scale(0.98);
        opacity: 0.9;
    }
}

@keyframes gradientShift {
    0%, 100% { transform: translate(0, 0); }
    33% { transform: translate(5%, 5%); }
    66% { transform: translate(-5%, 5%); }
}

.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.splash-screen.active {
    opacity: 1;
    visibility: visible;
}

.splash-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 50%, var(--bg-tertiary) 100%);
    animation: backgroundPulse 3s ease infinite;
}

@keyframes backgroundPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.9; }
}

.splash-content {
    position: relative;
    z-index: 1;
    text-align: center;
    animation: fadeInUp 1s ease;
}

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

.logo-container {
    position: relative;
    margin-bottom: 2rem;
}

.logo-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, var(--accent-primary) 0%, transparent 70%);
    filter: blur(40px);
    animation: logoGlow 2s ease infinite;
}

@keyframes logoGlow {
    0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.8; transform: translate(-50%, -50%) scale(1.1); }
}

.logo-text {
    position: relative;
    font-size: 3.5rem;
    font-weight: 700;
    display: flex;
    justify-content: center;
}

.logo-letter {
    display: inline-block;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: letterFloat 2s ease-in-out infinite;
}

.logo-letter:nth-child(1) { animation-delay: 0s; }
.logo-letter:nth-child(2) { animation-delay: 0.1s; }
.logo-letter:nth-child(3) { animation-delay: 0.2s; }
.logo-letter:nth-child(4) { animation-delay: 0.3s; }
.logo-letter:nth-child(5) { animation-delay: 0.4s; }
.logo-letter:nth-child(6) { animation-delay: 0.5s; }
.logo-letter:nth-child(7) { animation-delay: 0.6s; }
.logo-letter:nth-child(8) { animation-delay: 0.7s; }
.logo-letter:nth-child(9) { animation-delay: 0.8s; }
.logo-letter:nth-child(10) { animation-delay: 0.9s; }
.logo-letter:nth-child(11) { animation-delay: 1s; }
.logo-letter:nth-child(12) { animation-delay: 1.1s; }

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

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

.splash-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-weight: 300;
}

.badges {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 3rem;
}

.badge {
    padding: 0.5rem 1rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    font-size: 0.85rem;
    backdrop-filter: blur(10px);
    animation: badgeSlideIn 0.5s ease forwards;
    opacity: 0;
}

.badge:nth-child(1) { animation-delay: 0.2s; }
.badge:nth-child(2) { animation-delay: 0.4s; }
.badge:nth-child(3) { animation-delay: 0.6s; }

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

.tap-continue {
    font-size: 1rem;
    color: var(--accent-primary);
    animation: pulseText 2s ease infinite;
    cursor: pointer;
}

@keyframes pulseText {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.math-particles {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.particle {
    position: absolute;
    font-size: 2rem;
    color: var(--accent-primary);
    opacity: 0.15;
    animation: particleFloat 15s infinite ease-in-out;
}

.particle:nth-child(1) { left: 10%; top: 20%; animation-delay: 0s; }
.particle:nth-child(2) { left: 20%; top: 70%; animation-delay: 2s; }
.particle:nth-child(3) { left: 80%; top: 30%; animation-delay: 4s; }
.particle:nth-child(4) { left: 70%; top: 80%; animation-delay: 1s; }
.particle:nth-child(5) { left: 50%; top: 10%; animation-delay: 3s; }
.particle:nth-child(6) { left: 30%; top: 50%; animation-delay: 5s; }
.particle:nth-child(7) { left: 90%; top: 60%; animation-delay: 6s; }
.particle:nth-child(8) { left: 15%; top: 90%; animation-delay: 2.5s; }
.particle:nth-child(9) { left: 60%; top: 40%; animation-delay: 4.5s; }
.particle:nth-child(10) { left: 40%; top: 15%; animation-delay: 1.5s; }

@keyframes particleFloat {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(20px, -30px) rotate(90deg); }
    50% { transform: translate(-15px, 25px) rotate(180deg); }
    75% { transform: translate(30px, 15px) rotate(270deg); }
}

.logo-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 180px;
    height: 180px;
    border: 2px solid var(--accent-primary);
    border-radius: 50%;
    opacity: 0.2;
    animation: rotateCircle 10s linear infinite;
}

@keyframes rotateCircle {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.splash-features {
    display: flex;
    gap: 2rem;
    justify-content: center;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.feature-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    min-width: 120px;
    animation: featureSlideIn 0.6s ease forwards;
    opacity: 0;
}

.feature-item:nth-child(1) { animation-delay: 0.3s; }
.feature-item:nth-child(2) { animation-delay: 0.5s; }
.feature-item:nth-child(3) { animation-delay: 0.7s; }

@keyframes featureSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.feature-item svg {
    color: var(--accent-primary);
}

.feature-item span {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.loading-bar {
    width: 200px;
    height: 4px;
    background: var(--glass-bg);
    border-radius: 10px;
    margin: 2rem auto 1.5rem;
    overflow: hidden;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.2);
}

.loading-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary), var(--accent-primary));
    background-size: 200% 100%;
    border-radius: 10px;
    animation: loadingProgress 2s ease-in-out infinite;
}

@keyframes loadingProgress {
    0% {
        width: 0%;
        background-position: 0% 0%;
    }
    50% {
        width: 70%;
        background-position: 100% 0%;
    }
    100% {
        width: 100%;
        background-position: 200% 0%;
    }
}

.app {
    position: relative;
    z-index: 1;
    max-width: 600px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.app.hidden {
    opacity: 0;
    pointer-events: none;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.1rem 1.2rem;
    margin: 1rem 1rem 0 1rem;
    background: var(--glass-bg-strong);
    backdrop-filter: blur(30px);
    border: 2px solid var(--glass-border-strong);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 8px 32px var(--shadow-medium), 0 0 0 1px rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: visible;
}

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

.app-title {
    font-size: 1.6rem;
    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;
    text-shadow: 0 2px 10px var(--accent-glow);
}

.memory-indicator {
    font-size: 0.9rem;
    color: var(--accent-primary);
    font-weight: 600;
}

.header-right {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.icon-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border: none;
    background: linear-gradient(145deg, var(--glass-bg-strong), var(--glass-bg));
    border: 1.5px solid var(--glass-border-strong);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px var(--shadow-light);
}

.icon-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-tertiary));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.icon-btn svg {
    position: relative;
    z-index: 1;
}

.icon-btn:hover {
    background: linear-gradient(145deg, var(--glass-bg-strong), var(--glass-bg-strong));
    transform: translateY(-2px);
    box-shadow: 0 4px 16px var(--shadow-medium);
}

.icon-btn:hover::before {
    opacity: 0.15;
}

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

#angleModeText {
    font-size: 0.75rem;
    font-weight: 600;
}

.display-panel {
    background: linear-gradient(135deg, var(--glass-bg-strong) 0%, var(--glass-bg) 100%);
    backdrop-filter: blur(30px);
    border: 2px solid var(--glass-border-strong);
    border-radius: var(--border-radius-xl);
    margin: 1rem;
    padding: 2.25rem;
    box-shadow: 
        0 20px 60px var(--shadow-heavy),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        var(--shadow-glow);
    position: relative;
    overflow: hidden;
    min-height: 180px;
}

.display-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-primary), transparent);
    opacity: 0.5;
}

.display-history {
    font-size: 0.85rem;
    color: var(--text-secondary);
    min-height: 1.2rem;
    margin-bottom: 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.display-expression {
    font-size: 2.4rem;
    font-weight: 500;
    margin-bottom: 0.85rem;
    min-height: 3rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    position: relative;
    letter-spacing: 0.8px;
    line-height: 1.4;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.display-char {
    display: inline-block;
    animation: charPopIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes charPopIn {
    0% {
        opacity: 0;
        transform: scale(0.3) translateY(-20px);
    }
    50% {
        transform: scale(1.1) translateY(-5px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.display-char-delete {
    animation: charDeleteOut 0.2s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes charDeleteOut {
    0% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    50% {
        transform: scale(1.2) translateY(-10px);
    }
    100% {
        opacity: 0;
        transform: scale(0) translateY(-20px);
    }
}

.display-expression.error-shake {
    animation: errorShake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes errorShake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-10px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(10px);
    }
}

.display-result.error {
    animation: errorPulse 0.5s ease-out;
    color: #ef4444 !important;
}

@keyframes errorPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    25% {
        opacity: 0.8;
        transform: scale(1.05);
    }
    50% {
        opacity: 1;
        transform: scale(0.95);
    }
    75% {
        opacity: 0.8;
        transform: scale(1.02);
    }
}

.cursor {
    display: inline-block;
    width: 2.5px;
    height: 2rem;
    background: linear-gradient(180deg, var(--accent-primary), var(--accent-secondary));
    animation: blink 1s step-end infinite;
    margin: 0 2px;
    vertical-align: middle;
    border-radius: 2px;
    box-shadow: 0 0 8px var(--accent-glow);
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    50.1%, 100% { opacity: 0; }
}

.display-result {
    font-size: 1.8rem;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary), var(--accent-tertiary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    min-height: 2.5rem;
    animation: fadeIn 0.3s ease;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 8px var(--accent-glow);
}

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

.display-info {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.show-steps-hint {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.3s ease;
    animation: pulse 2s ease infinite;
}

.show-steps-hint:hover {
    transform: scale(1.05);
}

.tabs {
    display: flex;
    padding: 0 1rem;
    gap: 0.4rem;
    margin-bottom: 1rem;
    background: var(--glass-bg);
    border-radius: var(--border-radius-lg);
    margin: 0 1rem 1rem 1rem;
    padding: 0.6rem;
    backdrop-filter: blur(20px);
    border: 1.5px solid var(--glass-border);
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-primary) transparent;
    box-shadow: 0 4px 16px var(--shadow-light);
}

.tabs::-webkit-scrollbar {
    height: 4px;
}

.tabs::-webkit-scrollbar-track {
    background: transparent;
}

.tabs::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 2px;
}

.tab-btn {
    flex: 0 0 auto;
    min-width: fit-content;
    padding: 0.75rem 0.9rem;
    border: none;
    background: transparent;
    border-radius: var(--border-radius-md);
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    white-space: nowrap;
    border: 1px solid transparent;
}

.tab-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--border-radius-md);
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-tertiary));
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.tab-btn:hover::before {
    opacity: 0.1;
}

.tab-btn.active {
    color: white;
    box-shadow: 
        0 4px 16px var(--accent-glow-strong),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.tab-btn.active::before {
    opacity: 1;
}

.tab-btn span {
    position: relative;
    z-index: 1;
}

.calculator-body {
    flex: 1;
    padding: 0 1rem 1rem;
}

.tab-content {
    display: none;
    animation: slideIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

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

.button-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    padding: 1.25rem;
    background: var(--glass-bg);
    border-radius: var(--border-radius-lg);
    border: 1.5px solid var(--glass-border);
    backdrop-filter: blur(20px);
    box-shadow: 0 4px 16px var(--shadow-light);
}

.calc-btn {
    padding: 1.5rem 0.8rem;
    border: none;
    background: linear-gradient(145deg, var(--glass-bg-strong), var(--glass-bg));
    backdrop-filter: blur(15px);
    border: 1.5px solid var(--glass-border-strong);
    border-radius: var(--border-radius-md);
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 3px 10px var(--shadow-light),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.3px;
    animation: buttonFadeIn 0.5s ease-out backwards;
}

@keyframes buttonFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.calc-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s ease;
}

.calc-btn:hover::before {
    left: 100%;
}

.calc-btn::after {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(45deg, var(--accent-primary), var(--accent-secondary), var(--accent-tertiary), var(--accent-primary));
    background-size: 300% 300%;
    border-radius: var(--border-radius-md);
    opacity: 0;
    z-index: -1;
    animation: gradientRotate 3s ease infinite;
    transition: opacity 0.3s ease;
}

@keyframes gradientRotate {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.calc-btn:hover {
    transform: translateY(-4px) scale(1.03);
    box-shadow: 
        0 8px 24px var(--shadow-medium),
        0 0 20px var(--accent-glow),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    background: linear-gradient(145deg, var(--glass-bg-strong), var(--glass-bg-strong));
    border-color: var(--accent-primary);
}

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

.calc-btn:active {
    transform: translateY(-1px) scale(0.98);
    box-shadow: 
        0 2px 8px var(--shadow-light),
        inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.calc-btn:active::after {
    opacity: 0.5;
}

.number-btn {
    font-size: 1.35rem;
    font-weight: 500;
}

.button-grid .calc-btn:nth-child(1) { animation-delay: 0.02s; }
.button-grid .calc-btn:nth-child(2) { animation-delay: 0.04s; }
.button-grid .calc-btn:nth-child(3) { animation-delay: 0.06s; }
.button-grid .calc-btn:nth-child(4) { animation-delay: 0.08s; }
.button-grid .calc-btn:nth-child(5) { animation-delay: 0.10s; }
.button-grid .calc-btn:nth-child(6) { animation-delay: 0.12s; }
.button-grid .calc-btn:nth-child(7) { animation-delay: 0.14s; }
.button-grid .calc-btn:nth-child(8) { animation-delay: 0.16s; }
.button-grid .calc-btn:nth-child(9) { animation-delay: 0.18s; }
.button-grid .calc-btn:nth-child(10) { animation-delay: 0.20s; }
.button-grid .calc-btn:nth-child(11) { animation-delay: 0.22s; }
.button-grid .calc-btn:nth-child(12) { animation-delay: 0.24s; }
.button-grid .calc-btn:nth-child(13) { animation-delay: 0.26s; }
.button-grid .calc-btn:nth-child(14) { animation-delay: 0.28s; }
.button-grid .calc-btn:nth-child(15) { animation-delay: 0.30s; }
.button-grid .calc-btn:nth-child(16) { animation-delay: 0.32s; }
.button-grid .calc-btn:nth-child(17) { animation-delay: 0.34s; }
.button-grid .calc-btn:nth-child(18) { animation-delay: 0.36s; }
.button-grid .calc-btn:nth-child(19) { animation-delay: 0.38s; }
.button-grid .calc-btn:nth-child(20) { animation-delay: 0.40s; }

.operator-btn {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    box-shadow: 
        0 4px 16px var(--accent-glow-strong),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    font-weight: 700;
    color: #0a0e1a;
}

.operator-btn:hover {
    box-shadow: 
        0 8px 28px var(--accent-glow-strong),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    background: linear-gradient(135deg, var(--accent-secondary), var(--accent-primary));
}

.function-btn {
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.memory-btn {
    font-size: 0.88rem;
    font-weight: 700;
    background: linear-gradient(145deg, var(--bg-tertiary), var(--bg-secondary));
    color: var(--accent-primary);
    border-color: var(--accent-glow);
}

.constant-btn {
    font-size: 1.05rem;
    font-weight: 600;
}

.clear-btn {
    background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
    border: none;
    box-shadow: 
        0 4px 16px rgba(255, 107, 107, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    font-weight: 700;
    color: white;
}

.clear-btn:hover {
    background: linear-gradient(135deg, #ee5a6f, #ff6b6b);
    box-shadow: 
        0 8px 24px rgba(255, 107, 107, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.delete-btn {
    background: linear-gradient(135deg, #ffa94d, #ff922b);
    border: none;
    box-shadow: 
        0 4px 16px rgba(255, 169, 77, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    font-weight: 700;
    color: white;
}

.delete-btn:hover {
    background: linear-gradient(135deg, #ff922b, #ffa94d);
    box-shadow: 
        0 8px 24px rgba(255, 169, 77, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.equals-btn {
    background: linear-gradient(135deg, #a855f7, #9333ea);
    border: none;
    box-shadow: 
        0 6px 20px rgba(168, 85, 247, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    font-weight: 800;
    font-size: 1.6rem;
    color: white;
    grid-column: 1 / -1;
}

.equals-btn:hover {
    background: linear-gradient(135deg, #9333ea, #7e22ce);
    box-shadow: 
        0 10px 32px rgba(168, 85, 247, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transform: translateY(-5px) scale(1.03);
}

.constants-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.constant-card {
    padding: 1.5rem;
    border: none;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.constant-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px var(--shadow-heavy);
    background: var(--glass-border);
}

.constant-symbol {
    font-size: 2rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.constant-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.conversion-panel {
    display: grid;
    gap: 1.5rem;
}

.conversion-section {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    padding: 1.5rem;
}

.conversion-section h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--accent-primary);
}

.conversion-row {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 0.75rem;
    align-items: center;
}

.conversion-input,
.conversion-output,
.conversion-select {
    padding: 0.75rem;
    border: 1px solid var(--glass-border);
    background: var(--bg-secondary);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
}

.conversion-input:focus,
.conversion-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.conversion-output {
    background: var(--bg-tertiary);
    cursor: not-allowed;
}

.conversion-arrow {
    text-align: center;
    font-size: 1.5rem;
    color: var(--accent-primary);
    margin: 0.5rem 0;
}

.programmer-panel,
.equation-panel,
.stats-panel,
.matrix-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    padding: 1.5rem;
}

.base-section,
.bitwise-section {
    margin-bottom: 1.5rem;
}

.base-input-group {
    margin-bottom: 1rem;
}

.base-input-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--accent-primary);
    font-size: 0.9rem;
}

.base-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--glass-border);
    background: var(--bg-secondary);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: 'Courier New', monospace;
}

.button-grid-small {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.equation-desc {
    text-align: center;
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.equation-display-editable {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.5rem;
    background: var(--bg-tertiary);
    border: 2px solid var(--accent-primary);
    border-radius: 15px;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.equation-term {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.coeff-input {
    width: 80px;
    padding: 0.5rem;
    border: 2px solid var(--glass-border);
    background: var(--bg-secondary);
    border-radius: 8px;
    color: var(--accent-primary);
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s ease;
}

.coeff-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: var(--bg-primary);
}

.var-label {
    font-size: 1.3rem;
    color: var(--text-primary);
    font-weight: 600;
}

.equation-operator {
    font-size: 1.3rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.reset-btn {
    width: 100%;
    padding: 0.8rem;
    border: none;
    background: linear-gradient(135deg, #6b7280, #4b5563);
    border-radius: 10px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 1rem;
}

.reset-btn:hover {
    box-shadow: 0 4px 16px rgba(107, 114, 128, 0.4);
    transform: translateY(-2px);
    background: linear-gradient(135deg, #4b5563, #374151);
}

.equation-inputs {
    display: grid;
    gap: 1rem;
    margin-bottom: 1rem;
}

.equation-input-group {
    display: grid;
    grid-template-columns: 60px 1fr;
    gap: 0.5rem;
    align-items: center;
}

.equation-input-group label {
    color: var(--accent-primary);
    font-weight: 600;
}

.equation-input {
    padding: 0.75rem;
    border: 1px solid var(--glass-border);
    background: var(--bg-secondary);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1rem;
}

.solve-btn {
    width: 100%;
    padding: 1rem;
    border: none;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 10px;
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 1rem;
}

.solve-btn:hover {
    box-shadow: 0 4px 16px var(--accent-glow);
    transform: translateY(-2px);
}

.equation-result,
.matrix-result {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 10px;
    min-height: 50px;
}

.solution-steps {
    line-height: 1.8;
}

.solution-steps p {
    margin-bottom: 0.5rem;
}

.success {
    color: #10b981;
}

.warning {
    color: #f59e0b;
}

.error {
    color: #ef4444;
}

.stats-input-group {
    margin-bottom: 1rem;
}

.stats-input-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--accent-primary);
}

.stats-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--glass-border);
    background: var(--bg-secondary);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    min-height: 80px;
    resize: vertical;
}

.stats-results {
    margin-top: 1rem;
}

.stats-result-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.stat-item {
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-item span {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.stat-item strong {
    color: var(--accent-primary);
    font-size: 1rem;
}

.matrix-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.matrix-input-section p {
    text-align: center;
    color: var(--accent-primary);
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.matrix-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.matrix-cell {
    padding: 0.5rem;
    border: 1px solid var(--glass-border);
    background: var(--bg-secondary);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    text-align: center;
    width: 100%;
}

.matrix-operations {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.matrix-btn {
    padding: 0.75rem;
    border: none;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.matrix-display {
    text-align: center;
}

.result-matrix {
    display: inline-block;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 10px;
    border-left: 3px solid var(--accent-primary);
    border-right: 3px solid var(--accent-primary);
}

.matrix-row {
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    margin: 0.25rem 0;
    color: var(--accent-primary);
}

.copy-result-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.copy-result-btn:hover {
    background: var(--accent-primary);
    color: white;
}

.side-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: var(--bg-secondary);
    backdrop-filter: blur(20px);
    border-left: 1px solid var(--glass-border);
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
    box-shadow: -4px 0 20px var(--shadow-heavy);
}

.side-panel.open {
    right: 0;
}

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

.panel-header h2 {
    font-size: 1.5rem;
}

.close-panel-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-panel-btn:hover {
    background: var(--glass-border);
    transform: rotate(90deg);
}

.panel-content {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

.empty-message {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
}

.history-item {
    padding: 1rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.history-item:hover {
    background: var(--glass-border);
    transform: translateX(-5px);
}

.history-expression {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.history-result {
    font-size: 1.1rem;
    color: var(--accent-primary);
    font-weight: 600;
}

.step-item {
    padding: 1.25rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-left: 3px solid var(--accent-primary);
    border-radius: 12px;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.step-item:hover {
    background: var(--glass-bg-strong);
    border-left-width: 4px;
    transform: translateX(3px);
}

.step-number {
    display: inline-block;
    width: 28px;
    height: 28px;
    line-height: 28px;
    text-align: center;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: 700;
    margin-right: 0.75rem;
    box-shadow: 0 2px 8px var(--accent-glow);
}

.step-description {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-top: 0.75rem;
    margin-bottom: 0.5rem;
    line-height: 1.6;
    white-space: pre-line;
}

.step-formula {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    background: var(--bg-tertiary);
    padding: 0.75rem;
    border-radius: 8px;
    margin-top: 0.75rem;
    border-left: 2px solid var(--accent-secondary);
    line-height: 1.6;
    white-space: pre-line;
    overflow-x: auto;
}

.step-result {
    font-size: 1.1rem;
    color: var(--accent-primary);
    font-weight: 700;
    margin-top: 0.75rem;
    padding: 0.5rem;
    background: var(--glass-bg);
    border-radius: 6px;
    display: inline-block;
}

.clear-history-btn {
    margin: 1rem;
    padding: 0.75rem;
    border: none;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border-radius: 10px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.clear-history-btn:hover {
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
    transform: translateY(-2px);
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal.open {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.3s ease;
}

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

.close-modal-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border: none;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-modal-btn:hover {
    background: var(--glass-border);
    transform: rotate(90deg);
}

.modal-content h2 {
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

.modal-content h3 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    font-size: 1.3rem;
    color: var(--accent-primary);
}

.shortcuts-list {
    display: grid;
    gap: 0.75rem;
}

.shortcut-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
}

kbd {
    padding: 0.25rem 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--glass-border);
    border-radius: 5px;
    font-family: 'Inter', monospace;
    font-size: 0.85rem;
    font-weight: 600;
}

.features-list {
    list-style: none;
}

.features-list li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.features-list li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--accent-primary);
    font-weight: 700;
}

.theme-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.theme-option {
    padding: 1rem;
    border: 2px solid var(--glass-border);
    background: var(--glass-bg);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

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

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

.theme-preview {
    width: 80px;
    height: 80px;
    border-radius: 10px;
    background: linear-gradient(135deg, #00d9ff, #00a8cc);
}

.emerald-preview {
    background: linear-gradient(135deg, #10b981, #059669);
}

.purple-preview {
    background: linear-gradient(135deg, #a855f7, #9333ea);
}

.crimson-preview {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.amber-preview {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.white-preview {
    background: linear-gradient(135deg, #f0f0f0, #d0d0d0);
}

.light-preview {
    background: linear-gradient(135deg, #e3f2fd, #0056d2);
    border: 2px solid rgba(0, 86, 210, 0.3);
}

.light-emerald-preview {
    background: linear-gradient(135deg, #f0fdf4, #059669);
    border: 2px solid rgba(5, 150, 105, 0.3);
}

.light-purple-preview {
    background: linear-gradient(135deg, #faf5ff, #7c3aed);
    border: 2px solid rgba(124, 58, 237, 0.3);
}

.theme-section {
    margin-bottom: 2rem;
}

.theme-section:last-child {
    margin-bottom: 0;
}

.theme-category {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--glass-border);
}

.theme-modal-content {
    max-height: 80vh;
    overflow-y: auto;
}

.lang-btn {
    font-size: 0.9rem;
    font-weight: 500;
}

.formulas-panel,
.percentage-panel,
.geometry-panel,
.examples-panel {
    padding: 1.5rem;
}

.formulas-panel h3,
.percentage-panel h3,
.geometry-panel h3,
.examples-panel h3 {
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
}

.formula-categories {
    display: grid;
    gap: 1.5rem;
}

.formula-category {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    padding: 1.2rem;
}

.formula-category h4 {
    color: var(--accent-primary);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.formula-item {
    margin-bottom: 1rem;
    padding: 0.8rem;
    background: var(--glass-bg-strong);
    border-radius: 10px;
}

.formula-item:last-child {
    margin-bottom: 0;
}

.formula-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.formula-equation {
    font-family: 'Courier New', monospace;
    color: var(--accent-primary);
    font-size: 1.05rem;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 5px;
}

.calc-section {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    padding: 1.2rem;
    margin-bottom: 1.5rem;
}

.calc-section h4 {
    color: var(--accent-primary);
    margin-bottom: 1rem;
}

.input-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    align-items: center;
    margin-bottom: 1rem;
}

.input-row label {
    color: var(--text-secondary);
    min-width: 60px;
}

.calc-input {
    padding: 0.6rem;
    background: var(--glass-bg-strong);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    flex: 1;
    min-width: 100px;
}

.calc-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.calc-btn-secondary {
    width: 100%;
    padding: 0.8rem;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    border-radius: 10px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.calc-btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--accent-glow);
}

.result-display {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--glass-bg-strong);
    border-radius: 10px;
    color: var(--accent-primary);
    font-size: 1.1rem;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.geometry-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.2rem;
}

.geo-section {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    padding: 1.2rem;
}

.geo-section h4 {
    color: var(--accent-primary);
    margin-bottom: 1rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.input-group label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.geo-input {
    padding: 0.6rem;
    background: var(--glass-bg-strong);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
}

.geo-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.geo-results {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--glass-bg-strong);
    border-radius: 10px;
    min-height: 60px;
}

.geo-results div {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.geo-results div:last-child {
    margin-bottom: 0;
}

.geo-results strong {
    color: var(--accent-primary);
}

.example-categories {
    display: grid;
    gap: 1.5rem;
}

.example-item {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    padding: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.example-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px var(--shadow-medium);
}

.example-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent-primary);
    margin-bottom: 0.8rem;
}

.example-problem {
    font-size: 1.05rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding: 0.8rem;
    background: var(--glass-bg-strong);
    border-radius: 8px;
    border-left: 3px solid var(--accent-primary);
}

.example-steps {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.example-steps .step {
    padding: 0.7rem;
    background: var(--glass-bg-strong);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.app-footer {
    position: relative;
    z-index: 10;
    padding: 0.4rem 1rem;
    margin: 1rem 0 1rem 0;
    text-align: center;
    animation: footerSlideUp 0.8s ease-out;
}

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

.footer-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.footer-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text-primary);
    padding: 0.3rem 1rem;
    border-radius: var(--border-radius-lg);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.social-links {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.social-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.social-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-tertiary));
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 50%;
}

.social-btn:hover {
    transform: translateY(-3px) scale(1.1);
    box-shadow: 0 5px 20px var(--accent-glow);
}

.social-btn:hover::before {
    opacity: 0.2;
}

.social-btn svg {
    position: relative;
    z-index: 1;
    width: 20px;
    height: 20px;
}

.social-btn.facebook:hover {
    color: #1877F2;
}

.social-btn.youtube:hover {
    color: #FF0000;
}

.social-btn.whatsapp:hover {
    color: #25D366;
}

.footer-link::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-tertiary));
    opacity: 0;
    transition: opacity 0.4s ease;
    border-radius: var(--border-radius-lg);
}

.footer-link:hover::before {
    opacity: 0.1;
}

.footer-link:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 10px 30px var(--accent-glow-strong);
}

.footer-link:active {
    transform: translateY(-2px) scale(1.01);
}

.footer-logo {
    width: 32px;
    height: 32px;
    position: relative;
    z-index: 1;
    animation: logoRotate 20s linear infinite, logoPulse 3s ease-in-out infinite;
    filter: drop-shadow(0 0 10px var(--accent-glow));
}

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

@keyframes logoPulse {
    0%, 100% { 
        filter: drop-shadow(0 0 10px var(--accent-glow));
        transform: scale(1);
    }
    50% { 
        filter: drop-shadow(0 0 20px var(--accent-glow-strong));
        transform: scale(1.1);
    }
}

.footer-link:hover .footer-logo {
    animation: logoRotate 2s linear infinite, logoPulse 1s ease-in-out infinite;
}

.footer-text {
    font-size: 0.95rem;
    font-weight: 500;
    position: relative;
    z-index: 1;
}

.footer-highlight {
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary), var(--accent-tertiary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientFlow 3s ease infinite;
    background-size: 200% 200%;
}

@keyframes gradientFlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Button Ripple Effect */
.calc-btn,
.icon-btn,
.solve-btn,
.reset-btn,
.matrix-btn,
.calc-btn-secondary,
.theme-option {
    position: relative;
    overflow: hidden;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    transform: scale(0);
    animation: rippleEffect 0.6s ease-out;
    pointer-events: none;
}

@keyframes rippleEffect {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Pulse Animation for Important Buttons */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 var(--accent-glow-strong);
    }
    50% {
        box-shadow: 0 0 0 10px transparent;
    }
    100% {
        box-shadow: 0 0 0 0 transparent;
    }
}

.equals-btn,
.solve-btn {
    animation: pulse 3s infinite;
}

.equals-btn:hover,
.solve-btn:hover {
    animation: none;
}

/* Smooth Number Counter Animation */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.display-result {
    animation: countUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Enhanced Modal Animations */
.modal.open {
    animation: modalFadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(10px);
    }
}

.modal-content {
    animation: modalSlideUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(100px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Side Panel Enhanced Animation */
.side-panel.open {
    animation: panelSlideIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes panelSlideIn {
    from {
        right: -400px;
        opacity: 0;
    }
    to {
        right: 0;
        opacity: 1;
    }
}

/* Shimmer Loading Effect */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.calculating::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 100%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

/* Success Checkmark Animation */
@keyframes checkmarkScale {
    0% {
        transform: scale(0) rotate(0deg);
    }
    50% {
        transform: scale(1.3) rotate(180deg);
    }
    100% {
        transform: scale(1) rotate(360deg);
    }
}

.success-check {
    display: inline-block;
    animation: checkmarkScale 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Bounce Animation for Error Messages */
@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
    }
}

.error,
.warning {
    animation: bounceIn 0.5s ease-out;
}

/* Smooth Tab Transition */
.tab-content.active {
    animation: tabFadeSlide 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes tabFadeSlide {
    from {
        opacity: 0;
        transform: translateX(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

/* Button Press Animation */
.calc-btn:active,
.icon-btn:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
}

/* Enhanced Hover Glow Effect */
.calc-btn:hover,
.icon-btn:hover,
.constant-card:hover,
.example-item:hover {
    box-shadow: 
        0 0 20px var(--accent-glow),
        0 5px 15px var(--shadow-medium);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Input Focus Animation */
.base-input:focus,
.equation-input:focus,
.stats-input:focus,
.matrix-cell:focus,
.calc-input:focus,
.geo-input:focus,
.conversion-input:focus {
    animation: inputPulse 0.6s ease-out;
}

@keyframes inputPulse {
    0% {
        box-shadow: 0 0 0 0 var(--accent-glow-strong);
    }
    50% {
        box-shadow: 0 0 0 5px var(--accent-glow);
    }
    100% {
        box-shadow: 0 0 0 3px var(--accent-glow);
    }
}

/* Floating Animation for Feature Items */
@keyframes floatUpDown {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.feature-item:hover {
    animation: floatUpDown 2s ease-in-out infinite;
}

/* Number Highlight Animation */
@keyframes highlightNumber {
    0% {
        background: transparent;
    }
    50% {
        background: var(--accent-glow);
    }
    100% {
        background: transparent;
    }
}

.display-expression {
    position: relative;
}

.display-expression.calculating {
    animation: highlightNumber 1.5s ease-in-out infinite;
}

/* Card Stack Animation for History Items */
.history-item {
    animation: cardStackIn 0.4s ease-out backwards;
}

.history-item:nth-child(1) { animation-delay: 0.05s; }
.history-item:nth-child(2) { animation-delay: 0.1s; }
.history-item:nth-child(3) { animation-delay: 0.15s; }
.history-item:nth-child(4) { animation-delay: 0.2s; }
.history-item:nth-child(5) { animation-delay: 0.25s; }

@keyframes cardStackIn {
    from {
        opacity: 0;
        transform: translateX(50px) rotateY(-15deg);
    }
    to {
        opacity: 1;
        transform: translateX(0) rotateY(0);
    }
}

/* Step Item Slide Animation */
.step-item {
    animation: stepSlideIn 0.5s ease-out backwards;
}

.step-item:nth-child(1) { animation-delay: 0.1s; }
.step-item:nth-child(2) { animation-delay: 0.2s; }
.step-item:nth-child(3) { animation-delay: 0.3s; }
.step-item:nth-child(4) { animation-delay: 0.4s; }
.step-item:nth-child(5) { animation-delay: 0.5s; }

@keyframes stepSlideIn {
    from {
        opacity: 0;
        transform: translateX(-50px);
        filter: blur(5px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
        filter: blur(0);
    }
}

/* Theme Option Enhanced Hover */
.theme-option:hover {
    animation: themeHover 0.6s ease-in-out infinite alternate;
}

@keyframes themeHover {
    from {
        transform: translateY(-5px);
    }
    to {
        transform: translateY(-8px) scale(1.02);
    }
}

/* Constant Card Flip Animation on Click */
.constant-card:active {
    animation: cardFlip 0.6s ease-in-out;
}

@keyframes cardFlip {
    0% {
        transform: rotateY(0);
    }
    50% {
        transform: rotateY(180deg);
    }
    100% {
        transform: rotateY(360deg);
    }
}

/* Enhanced Button Feedback */
.solve-btn:active,
.reset-btn:active,
.calc-btn-secondary:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px var(--accent-glow);
}

/* Matrix Cell Highlight on Input */
.matrix-cell {
    transition: all 0.3s ease;
}

.matrix-cell:focus {
    transform: scale(1.05);
    z-index: 10;
    position: relative;
}

/* Smooth Scroll Behavior */
html {
    scroll-behavior: smooth;
}

/* Loading Spinner for Calculations */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Professional Gradient Text Animation */
@keyframes gradientShine {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.app-title,
.display-result {
    background-size: 200% 200%;
    animation: gradientShine 3s ease infinite;
}

/* Backdrop Blur Animation */
.modal,
.side-panel {
    backdrop-filter: blur(0px);
    transition: backdrop-filter 0.4s ease;
}

.modal.open {
    backdrop-filter: blur(10px);
}

.side-panel.open {
    backdrop-filter: blur(5px);
}

@media (max-width: 768px) {
    .logo-text {
        font-size: 2.5rem;
    }
    
    .app-footer {
        margin: 0 0 0 0;
        padding: 0.35rem 0.5rem;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .footer-link {
        padding: 0.25rem 0.75rem;
        gap: 0.5rem;
    }
    
    .social-btn {
        width: 36px;
        height: 36px;
    }
    
    .social-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .footer-logo {
        width: 28px;
        height: 28px;
    }
    
    .footer-text {
        font-size: 0.85rem;
    }

    .splash-subtitle {
        font-size: 1rem;
    }

    .badges {
        gap: 0.5rem;
    }

    .badge {
        font-size: 0.75rem;
        padding: 0.4rem 0.8rem;
    }

    .app-title {
        font-size: 1rem;
    }

    .header {
        padding: 0.75rem;
        margin: 0.5rem 0.5rem 0 0.5rem;
    }

    .header-left {
        gap: 0.5rem;
    }

    .header-right {
        gap: 0.35rem;
    }

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

    #angleModeText {
        font-size: 0.65rem;
    }

    .memory-indicator {
        font-size: 0.8rem;
    }

    .display-expression {
        font-size: 1.5rem;
    }

    .display-result {
        font-size: 1.2rem;
    }

    .display-panel {
        margin: 0.5rem;
        padding: 1.5rem;
    }

    .button-grid {
        gap: 0.5rem;
        padding: 0.75rem;
    }

    .calc-btn {
        padding: 1rem;
        font-size: 1rem;
    }

    .constants-grid {
        grid-template-columns: 1fr;
    }

    .matrix-container {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .matrix-cell {
        padding: 0.6rem;
        font-size: 0.85rem;
    }

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

    .side-panel {
        width: 100%;
        right: -100%;
    }

    .modal-content {
        padding: 1.5rem;
    }

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

    .tabs {
        margin: 0 0.5rem 0.5rem 0.5rem;
        padding: 0.35rem;
        gap: 0.25rem;
    }

    .tab-btn {
        padding: 0.6rem 0.5rem;
        font-size: 0.65rem;
        letter-spacing: 0.3px;
    }

    .calculator-body {
        padding: 0 0.5rem 0.5rem;
    }
}

@media (min-width: 769px) and (orientation: landscape) {
    .button-grid {
        grid-template-columns: repeat(8, 1fr);
    }

    .calc-btn {
        padding: 1rem;
    }
}

::-webkit-scrollbar {
    width: 8px;
}

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

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

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