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

        :root {
            /* Light theme colors (default) */
            --bg-primary: #ffffff;
            --bg-secondary: #e8f0ff;
            --bg-tertiary: #d9e7ff;
            --text-primary: #031230;
            --text-secondary: #0b1f45;
            --text-tertiary: #1a2f5d;
            --text-muted: #5a6d9a;
            --accent-primary: #1f4ed8;
            --accent-secondary: #2563eb;
            --accent-tertiary: #3b82f6;
            --border-color: #cdd7f3;
            --border-dark: #a5b4dd;
            --error-bg: rgba(248, 113, 113, 0.15);
            --error-border: #f87171;
            --error-text: #dc2626;
            --result-bg: rgba(37, 99, 235, 0.08);
            --canvas-bg: #ffffff;
            --point-color: #1e40af;
            --shadow-light: rgba(59, 130, 246, 0.2);
            --shadow-medium: rgba(2, 6, 23, 0.15);
            --overlay-bg: rgba(255,255,255,0.96);
            transition: background-color 0.3s ease, color 0.3s ease;
        }

        [data-theme="dark"] {
            /* Dark theme colors */
            --bg-primary: #030812;
            --bg-secondary: #05122b;
            --bg-tertiary: #0b1a35;
            --text-primary: #edf2ff;
            --text-secondary: #cfd6ff;
            --text-tertiary: #9fb4ff;
            --text-muted: #83a1ff;
            --accent-primary: #3b82f6;
            --accent-secondary: #60a5fa;
            --accent-tertiary: #93c5fd;
            --border-color: #1f2f51;
            --border-dark: #0c1b3d;
            --error-bg: rgba(248, 113, 113, 0.18);
            --error-border: #fb7185;
            --error-text: #f97316;
            --result-bg: rgba(59, 130, 246, 0.12);
            --canvas-bg: #030b1f;
            --point-color: #93c5fd;
            --shadow-light: rgba(96, 165, 250, 0.25);
            --shadow-medium: rgba(2, 6, 23, 0.7);
            --overlay-bg: rgba(0,0,0,0.94);
        }

        html {
            height: auto;
            scroll-behavior: smooth;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: var(--bg-primary);
            color: var(--text-primary);
            min-height: 100vh;
            min-height: 100dvh;
            padding: 0;
            margin: 0;
            overflow-y: auto;
            overflow-x: hidden;
            -webkit-overflow-scrolling: touch;
            scroll-behavior: smooth;
            transition: background-color 0.3s ease, color 0.3s ease;
        }

        * {
            scroll-behavior: smooth;
        }

        .container {
            width: 100%;
            margin: 0;
            min-height: 100vh;
            background: var(--bg-primary);
            border-radius: 0;
            box-shadow: 0 20px 60px var(--shadow-medium);
            overflow-x: hidden;
            transition: background-color 0.3s ease;
        }

        .header {
            background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
            color: white;
            padding: 40px;
            text-align: center;
            position: relative;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .header h1 {
            font-size: 2.5em;
            margin-bottom: 10px;
            text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
        }

        .header p {
            font-size: 1.2em;
            opacity: 0.9;
        }

        /* Info Button (About) */
        .info-btn {
            position: absolute;
            left: 20px;
            top: 50%;
            transform: translateY(-50%);
            width: 44px;
            height: 44px;
            border-radius: 50%;
            background: rgba(255, 255, 255, 0.2);
            border: 2px solid rgba(255, 255, 255, 0.4);
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s ease;
            z-index: 10;
        }

        .info-btn:hover {
            background: rgba(255, 255, 255, 0.3);
            border-color: rgba(255, 255, 255, 0.6);
            transform: translateY(-50%) scale(1.1);
        }

        .info-btn:active {
            transform: translateY(-50%) scale(0.95);
        }

        .info-icon {
            font-size: 1.5em;
            filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
        }
        .info-icon i {
            font-size: inherit;
            line-height: 1;
        }

        /* About Modal */
        .about-modal {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            z-index: 10000;
            display: none;
            align-items: center;
            justify-content: center;
            padding: 20px;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.3s ease;
            will-change: opacity;
        }

        .about-modal.active {
            display: flex;
            opacity: 1;
            pointer-events: auto;
        }

        .about-modal-overlay {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.7);
            backdrop-filter: blur(4px);
            animation: fadeIn 0.3s ease;
            will-change: backdrop-filter;
        }

        .about-modal-content {
            position: relative;
            background: var(--bg-secondary);
            border-radius: 16px;
            max-width: 800px;
            max-height: 90vh;
            overflow-y: auto;
            overflow-x: hidden;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
            animation: slideInUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
            z-index: 1;
            scrollbar-width: thin;
            scrollbar-color: var(--accent-secondary) var(--bg-tertiary);
            transform: translateZ(0);
            will-change: transform;
            -webkit-font-smoothing: antialiased;
            backface-visibility: hidden;
        }

        .about-modal-content::-webkit-scrollbar {
            width: 8px;
        }

        .about-modal-content::-webkit-scrollbar-track {
            background: var(--bg-tertiary);
            border-radius: 4px;
        }

        .about-modal-content::-webkit-scrollbar-thumb {
            background: var(--accent-secondary);
            border-radius: 4px;
        }

        .about-modal-content::-webkit-scrollbar-thumb:hover {
            background: var(--accent-primary);
        }

        .about-modal-close {
            position: sticky;
            top: 0;
            right: 0;
            float: right;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background: rgba(255, 255, 255, 0.1);
            border: none;
            color: var(--text-primary);
            font-size: 1.8em;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s ease;
            margin: 16px 16px 0 0;
            z-index: 2;
        }

        .about-modal-close:hover {
            background: rgba(255, 255, 255, 0.2);
            transform: rotate(90deg);
        }

        .about-modal-body {
            padding: 0 20px 20px 20px;
        }

        .about-modal-body .panel {
            background: transparent;
            box-shadow: none;
            border: none;
        }

        .about-modal-body h2 {
            color: var(--text-primary);
            border-bottom: 2px solid var(--accent-secondary);
            padding-bottom: 12px;
            margin-bottom: 20px;
        }

        .about-modal-body h3 {
            color: var(--text-primary);
        }

        .about-modal-body p,
        .about-modal-body li {
            color: var(--text-secondary) !important;
        }

        /* Account Settings Modals */
        .account-modal {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            z-index: 10000;
            display: none;
            align-items: center;
            justify-content: center;
            padding: 20px;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.3s ease;
            will-change: opacity;
        }

        .account-modal.active {
            display: flex;
            opacity: 1;
            pointer-events: auto;
        }

        .account-modal-overlay {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.7);
            backdrop-filter: blur(4px);
            animation: fadeIn 0.3s ease;
            cursor: pointer;
        }

        .account-modal-content {
            position: relative;
            background: var(--bg-secondary);
            border-radius: 16px;
            max-width: 500px;
            width: 100%;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
            animation: slideInUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
            z-index: 1;
            transform: translateZ(0);
            will-change: transform;
            -webkit-font-smoothing: antialiased;
            backface-visibility: hidden;
        }

        .account-modal-close {
            position: absolute;
            top: 16px;
            right: 16px;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background: rgba(255, 255, 255, 0.1);
            border: none;
            color: var(--text-primary);
            font-size: 1.8em;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s ease;
            z-index: 2;
        }

        .account-modal-close:hover {
            background: rgba(255, 255, 255, 0.2);
            transform: rotate(90deg);
        }

        .account-modal-body {
            padding: 40px 30px;
            text-align: center;
        }

        .account-modal-icon {
            font-size: 3em;
            color: var(--accent-secondary);
            margin-bottom: 16px;
        }

        .account-modal-body h2 {
            color: var(--text-primary);
            margin: 0 0 8px 0;
            font-size: 1.6em;
        }

        .account-modal-subtitle {
            color: var(--text-muted);
            margin: 0 0 24px 0;
            font-size: 0.95em;
        }

        .account-form-group {
            margin-bottom: 20px;
            text-align: left;
        }

        .account-form-group label {
            display: block;
            color: var(--text-primary);
            font-weight: 600;
            margin-bottom: 8px;
            font-size: 0.95em;
        }

        .account-form-group input {
            width: 100%;
            padding: 12px 14px;
            border: 2px solid var(--border-color);
            border-radius: 10px;
            background: var(--bg-primary);
            color: var(--text-primary);
            font-size: 0.95em;
            transition: all 0.3s ease;
            box-sizing: border-box;
        }

        .account-form-group input:focus {
            outline: none;
            border-color: var(--accent-secondary);
            box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
        }

        .username-display {
            padding: 12px 14px;
            background: var(--bg-primary);
            border: 2px solid var(--border-color);
            border-radius: 10px;
            color: var(--text-primary);
            font-weight: 600;
        }

        .form-hint {
            display: block;
            color: var(--text-muted);
            font-size: 0.85em;
            margin-top: 6px;
        }

        .password-strength {
            margin: 20px 0;
            text-align: left;
        }

        .strength-bar {
            width: 100%;
            height: 8px;
            background: var(--bg-primary);
            border-radius: 4px;
            overflow: hidden;
            margin-bottom: 8px;
        }

        .strength-bar-fill {
            height: 100%;
            width: 0%;
            background: #ef4444;
            transition: width 0.3s ease, background 0.3s ease;
            border-radius: 4px;
        }

        .strength-bar-fill.weak {
            background: #f97316;
            width: 33%;
        }

        .strength-bar-fill.medium {
            background: #eab308;
            width: 66%;
        }

        .strength-bar-fill.strong {
            background: #4caf50;
            width: 100%;
        }

        .strength-text {
            color: var(--text-muted);
            font-size: 0.85em;
        }

        #strengthLevel {
            color: var(--accent-secondary);
            font-weight: 600;
        }

        .account-error {
            background: rgba(248, 113, 113, 0.2);
            border-left: 4px solid #f87171;
            color: #fca5a5;
            padding: 12px;
            border-radius: 6px;
            margin: 16px 0;
            text-align: left;
            font-size: 0.9em;
        }

        .account-modal-actions {
            display: flex;
            gap: 12px;
            margin-top: 24px;
        }

        .btn-primary, .btn-secondary {
            flex: 1;
            padding: 12px 20px;
            border: none;
            border-radius: 10px;
            font-weight: 600;
            font-size: 0.95em;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .btn-primary {
            background: var(--accent-secondary);
            color: white;
        }

        .btn-primary:hover {
            background: var(--accent-primary);
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
        }

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

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

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

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

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

        .header-buttons {
            position: absolute;
            top: 20px;
            right: 20px;
            display: flex;
            gap: 10px;
            align-items: center;
        }

        .header-btn,
        .theme-toggle,
        .history-toggle {
            background: rgba(255, 255, 255, 0.2);
            border: 2px solid rgba(255, 255, 255, 0.3);
            border-radius: 50%;
            width: 50px;
            height: 50px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.3s ease;
            backdrop-filter: blur(10px);
            font-size: 1.5em;
        }

        .history-toggle {
            flex-direction: column;
            gap: 4px;
            padding: 12px;
        }

        .hamburger-line {
            width: 20px;
            height: 2px;
            background: white;
            border-radius: 2px;
            transition: all 0.3s ease;
        }

        .history-toggle.active .hamburger-line:nth-child(1) {
            transform: translateY(6px) rotate(45deg);
        }

        .history-toggle.active .hamburger-line:nth-child(2) {
            opacity: 0;
        }

        .history-toggle.active .hamburger-line:nth-child(3) {
            transform: translateY(-6px) rotate(-45deg);
        }

        .header-btn:hover,
        .theme-toggle:hover,
        .history-toggle:hover {
            background: rgba(255, 255, 255, 0.3);
            transform: scale(1.1);
        }

        /* Sliding History Panel */
        .history-panel {
            position: fixed;
            right: 0;
            top: 0;
            height: 100vh;
            width: 450px;
            max-width: 90vw;
            background: var(--bg-secondary);
            transform: translateX(100%);
            transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            z-index: 9998;
            box-shadow: -4px 0 20px var(--shadow-medium);
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }

        .history-panel.open {
            transform: translateX(0);
        }

        .history-panel-header {
            background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
            color: white;
            padding: 20px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-shrink: 0;
        }

        .history-panel-header h2 {
            margin: 0;
            font-size: 1.5em;
            border: none;
            padding: 0;
            color: white;
        }

        .history-close-btn {
            background: rgba(255, 255, 255, 0.2);
            border: none;
            color: white;
            width: 36px;
            height: 36px;
            border-radius: 50%;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.5em;
            transition: all 0.2s ease;
            padding: 0;
            margin: 0;
        }

        .history-close-btn:hover {
            background: rgba(255, 255, 255, 0.3);
            transform: rotate(90deg);
        }

        .history-panel-content {
            flex: 1;
            overflow-y: auto;
            padding: 20px;
            scrollbar-width: thin;
            scrollbar-color: var(--accent-secondary) var(--bg-tertiary);
        }

        .history-panel-content::-webkit-scrollbar {
            width: 8px;
        }

        .history-panel-content::-webkit-scrollbar-track {
            background: var(--bg-tertiary);
            border-radius: 4px;
        }

        .history-panel-content::-webkit-scrollbar-thumb {
            background: var(--accent-secondary);
            border-radius: 4px;
        }

        .history-panel-content::-webkit-scrollbar-thumb:hover {
            background: var(--accent-primary);
        }

        .history-panel-controls {
            display: flex;
            gap: 10px;
            margin-bottom: 20px;
            flex-wrap: wrap;
        }

        .history-panel-controls button {
            flex: 1;
            min-width: 100px;
            padding: 10px 16px;
            font-size: 0.9em;
        }

        /* Menu Sections */
        .menu-section {
            margin-bottom: 24px;
            padding-bottom: 24px;
            border-bottom: 1px solid var(--border-color);
            animation: fadeInUp 0.4s ease-out;
            animation-fill-mode: both;
        }

        .menu-section:nth-child(1) { animation-delay: 0.1s; }
        .menu-section:nth-child(2) { animation-delay: 0.2s; }
        .menu-section:nth-child(3) { animation-delay: 0.3s; }

        .menu-section:last-child {
            border-bottom: none;
        }

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

        .menu-section-header {
            margin-bottom: 16px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            cursor: pointer;
            padding: 12px 12px;
            border-radius: 8px;
            transition: all 0.2s ease;
            position: relative;
        }

        .menu-section-header:hover {
            background-color: var(--bg-tertiary);
            transform: translateX(2px);
        }

        .menu-section-header:active {
            transform: translateX(1px);
        }

        .menu-section-header:focus-visible {
            outline: 2px solid var(--accent-primary);
            outline-offset: -1px;
        }

        .menu-section-title {
            font-size: 0.85em;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            color: var(--text-muted);
            margin: 0 0 12px 0;
            padding: 0;
            border: none;
        }

        .menu-section-title-wrapper {
            flex: 1;
        }

        .menu-section-chevron {
            transition: transform 0.3s ease, color 0.2s ease, text-shadow 0.2s ease;
            color: var(--accent-primary);
            font-size: 0.9em;
            margin-left: 12px;
            flex-shrink: 0;
        }

        .menu-section-header:hover .menu-section-chevron,
        .menu-section-title-row:hover .menu-section-chevron {
            text-shadow: 0 0 8px rgba(var(--accent-primary-rgb), 0.4);
        }

        .menu-section-title-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 12px;
            cursor: pointer;
            padding: 12px 12px;
            border-radius: 8px;
            transition: all 0.2s ease;
            position: relative;
        }

        .menu-section-title-row:hover {
            background-color: var(--bg-tertiary);
            transform: translateX(2px);
        }

        .menu-section-title-row:active {
            transform: translateX(1px);
        }

        .menu-section-title-row:focus-visible {
            outline: 2px solid var(--accent-primary);
            outline-offset: -1px;
        }

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

        /* User Profile Card */
        .user-profile-card {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 16px;
            background: var(--bg-tertiary);
            border-radius: 12px;
            margin-bottom: 12px;
            transition: all 0.3s ease;
        }

        .user-avatar {
            width: 48px;
            height: 48px;
            border-radius: 50%;
            background: var(--accent-secondary);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 24px;
            flex-shrink: 0;
        }
        .user-avatar i {
            font-size: inherit;
            line-height: 1;
        }

        .user-info {
            flex: 1;
        }

        .user-name {
            font-size: 1.1em;
            font-weight: 600;
            color: var(--text-primary);
            margin-bottom: 2px;
        }

        .user-status {
            font-size: 0.85em;
            color: var(--text-muted);
        }

        .btn-auth {
            padding: 8px 20px;
            background: var(--accent-primary);
            color: white;
            border: none;
            border-radius: 8px;
            font-weight: 600;
            font-size: 0.9em;
            cursor: pointer;
            transition: all 0.2s ease;
            white-space: nowrap;
        }

        .btn-auth:hover {
            background: var(--accent-secondary);
            transform: translateY(-1px);
            box-shadow: 0 4px 12px var(--shadow-light);
        }

        .btn-auth:active {
            transform: translateY(0);
            box-shadow: 0 2px 6px var(--shadow-light);
        }

        /* User Actions Container */
        .user-actions {
            display: flex;
            gap: 8px;
            align-items: center;
        }

        /* Settings Button */
        .btn-settings {
            width: 40px;
            height: 40px;
            padding: 0;
            background: var(--bg-tertiary);
            color: var(--accent-primary);
            border: 1px solid var(--border-color);
            border-radius: 8px;
            font-size: 1.1em;
            cursor: pointer;
            transition: all 0.2s ease;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .btn-settings:hover {
            background: var(--accent-primary);
            color: white;
            border-color: var(--accent-secondary);
            transform: scale(1.05);
        }

        .btn-settings:active {
            transform: scale(0.98);
        }

        /* Menu Grid - Quick Actions */
        .menu-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 12px;
        }

        .menu-section-content {
            animation: slideDownFadeIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
        }

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

        .history-list {
            animation: slideDownFadeIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
        }

        .menu-card {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 20px 12px;
            background: var(--bg-tertiary);
            border: 1px solid var(--border-color);
            border-radius: 12px;
            cursor: pointer;
            transition: all 0.3s ease;
            text-align: center;
            gap: 8px;
        }

        .menu-card:hover {
            background: var(--bg-primary);
            border-color: var(--accent-secondary);
            transform: translateY(-2px);
            box-shadow: 0 4px 12px var(--shadow-light);
        }

        .menu-card:active {
            transform: translateY(0);
        }

        /* Override default button styles for menu cards */
        .menu-card,
        .btn-auth,
        .icon-btn {
            width: auto;
            margin-top: 0;
        }

        .menu-card-icon {
            font-size: 2em;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            transition: transform 0.3s ease;
        }
        .menu-card-icon i {
            font-size: inherit;
            line-height: 1;
        }

        .menu-card:hover .menu-card-icon {
            transform: scale(1.1);
        }

        .menu-card-label {
            font-size: 0.95em;
            font-weight: 600;
            color: var(--text-primary);
            display: block;
        }

        .menu-card-hint {
            font-size: 0.75em;
            color: var(--text-muted);
            display: block;
        }

        /* Icon Buttons */
        .icon-btn {
            width: 36px;
            height: 36px;
            padding: 0;
            margin: 0;
            background: var(--bg-tertiary);
            border: 1px solid var(--border-color);
            border-radius: 8px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.2em;
            transition: all 0.2s ease;
        }

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

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

        .icon-btn span {
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .icon-btn i {
            font-size: 1em;
            line-height: 1;
        }

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

        .history-panel-empty-icon {
            font-size: 3em;
            margin-bottom: 10px;
            opacity: 0.5;
        }

        /* Menu Search Styling */
        .menu-search-container {
            position: relative;
            margin: 0 0 24px 0;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .menu-search-icon {
            position: absolute;
            left: 14px;
            font-size: 1.1em;
            color: var(--text-muted);
            pointer-events: none;
            z-index: 2;
        }

        .menu-search-input {
            width: 100%;
            padding: 12px 40px 12px 40px;
            border: 2px solid var(--border-color);
            border-radius: 10px;
            background: var(--bg-secondary);
            color: var(--text-primary);
            font-size: 0.95em;
            transition: all 0.3s ease;
        }

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

        .menu-search-input:focus {
            outline: none;
            border-color: var(--accent-secondary);
            background: var(--bg-primary);
            box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
        }

        .menu-search-clear {
            position: absolute;
            right: 12px;
            background: none;
            border: none;
            color: var(--text-muted);
            cursor: pointer;
            font-size: 1.2em;
            padding: 6px;
            transition: all 0.2s ease;
            z-index: 3;
        }

        .menu-search-clear:hover {
            color: var(--text-primary);
            transform: scale(1.1);
        }

        /* Menu Section Descriptions */
        .menu-section-desc {
            font-size: 0.80em;
            color: var(--text-muted);
            margin: 4px 0 0 0;
            font-weight: 400;
            opacity: 0.85;
            transition: opacity 0.2s ease;
        }

        .menu-section-header:hover .menu-section-desc {
            opacity: 1;
            color: var(--text-secondary);
        }

        /* Improved Menu Section Title with Icon */
        .menu-title-icon {
            margin-right: 10px;
            color: var(--accent-primary);
            font-size: 1.2em;
            transition: transform 0.3s ease, color 0.2s ease;
        }

        .menu-section-header:hover .menu-title-icon {
            transform: scale(1.15);
            color: var(--accent-secondary);
        }

        /* Menu item hiding for search */
        .menu-card.hidden {
            display: none;
        }

        .menu-section.hidden {
            display: none;
        }

        /* Menu item highlight on search */
        .menu-card.search-highlight {
            animation: searchHighlight 0.3s ease;
        }

        @keyframes searchHighlight {
            0% {
                background: rgba(59, 130, 246, 0.2);
            }
            100% {
                background: var(--bg-tertiary);
            }
        }

        /* Improved menu section header styling */
        .menu-section-header {
            margin-bottom: 16px;
            padding-bottom: 8px;
        }

        .history-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.5);
            z-index: 9997;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.3s ease;
        }

        .history-overlay.visible {
            opacity: 1;
            pointer-events: auto;
        }

        .theme-toggle:hover {
            transform: rotate(180deg) scale(1.1);
        }

        .theme-icon {
            font-size: 1.5em;
            transition: transform 0.3s ease;
            display: inline-flex;
            align-items: center;
            justify-content: center;
        }
        .theme-icon i {
            font-size: inherit;
            line-height: 1;
        }

        /* Toast Notifications */
        .toast-container {
            position: fixed;
            top: 80px;
            right: 20px;
            z-index: 10000;
            display: flex;
            flex-direction: column;
            gap: 10px;
            pointer-events: none;
        }

        .toast {
            background: var(--bg-secondary);
            color: var(--text-primary);
            border: 1px solid var(--border-color);
            border-radius: 8px;
            padding: 12px 18px;
            min-width: 250px;
            max-width: 400px;
            box-shadow: 0 4px 12px var(--shadow-medium);
            display: flex;
            align-items: center;
            gap: 10px;
            pointer-events: auto;
            animation: slideInRight 0.3s ease-out;
            transition: all 0.3s ease;
            cursor: pointer;
        }

        .toast:hover {
            transform: translateX(-5px);
        }

        .toast.success {
            border-left: 4px solid #10b981;
        }

        .toast.error {
            border-left: 4px solid var(--error-border);
        }

        .toast.warning {
            border-left: 4px solid #f59e0b;
        }

        .toast.info {
            border-left: 4px solid var(--accent-secondary);
        }

        .toast-icon {
            font-size: 1.2em;
            flex-shrink: 0;
        }

        .toast-message {
            flex: 1;
            font-size: 0.95em;
        }

        .toast-close {
            color: var(--text-muted);
            font-size: 1.2em;
            cursor: pointer;
            padding: 0 5px;
            flex-shrink: 0;
        }

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

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

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

        .toast.hiding {
            animation: slideOutRight 0.3s ease-out forwards;
        }

        /* Loading Overlay */
        .loading-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.7);
            backdrop-filter: blur(8px);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 9999;
            animation: fadeIn 0.2s ease-out;
        }

        .loading-overlay.visible {
            display: flex;
        }

        .loading-spinner {
            background: var(--bg-secondary);
            border: 1px solid var(--border-color);
            border-radius: 16px;
            padding: 40px;
            text-align: center;
            box-shadow: 0 10px 40px var(--shadow-medium);
            min-width: 250px;
            animation: scaleIn 0.3s ease-out;
        }

        .spinner {
            width: 60px;
            height: 60px;
            border: 4px solid var(--border-color);
            border-top-color: var(--accent-primary);
            border-radius: 50%;
            margin: 0 auto 20px;
            animation: spin 1s linear infinite;
        }

        .loading-text {
            font-size: 1.2em;
            font-weight: 600;
            color: var(--text-primary);
            margin-bottom: 8px;
        }

        .loading-details {
            font-size: 0.9em;
            color: var(--text-muted);
            min-height: 1.2em;
        }

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

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

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

        .content {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 30px;
            padding: 20px;
        }

        .panel {
            background: var(--bg-secondary);
            border: 1px solid var(--border-color);
            border-radius: 15px;
            padding: 30px;
            box-shadow: 0 4px 6px var(--shadow-light);
            transition: all 0.3s ease;
            animation: fadeIn 0.3s ease-out;
        }

        .panel:hover {
            box-shadow: 0 6px 12px var(--shadow-medium);
        }

        .panel h2 {
            color: var(--accent-tertiary);
            margin-bottom: 20px;
            font-size: 1.8em;
            border-bottom: 3px solid var(--accent-tertiary);
            padding-bottom: 10px;
            transition: color 0.3s ease, border-color 0.3s ease;
        }

        .form-group {
            margin-bottom: 20px;
        }

        .form-group label {
            display: block;
            margin-bottom: 8px;
            color: var(--text-secondary);
            font-weight: 600;
            font-size: 1.1em;
            transition: color 0.3s ease;
        }

        .curve-description {
            display: block;
            margin-top: 8px;
            color: var(--text-muted);
            font-size: 0.9em;
            font-style: italic;
            min-height: 1.2em;
            transition: color 0.3s ease;
        }

        /* Copy Button */
        .copy-btn {
            background: transparent;
            border: 1px solid var(--border-color);
            color: var(--text-primary);
            padding: 6px 12px;
            border-radius: 6px;
            font-size: 0.9em;
            cursor: pointer;
            transition: all 0.2s ease;
            width: auto;
            margin-top: 0;
            display: inline-flex;
            align-items: center;
            gap: 5px;
        }

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

        .copy-btn-group {
            display: flex;
            gap: 8px;
            margin-top: 10px;
            flex-wrap: wrap;
        }

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

        .result-header h3 {
            margin: 0;
        }

        .form-group input,
        .form-group select {
            width: 100%;
            padding: 12px;
            border: 2px solid var(--border-dark);
            border-radius: 8px;
            font-size: 1em;
            transition: border-color 0.3s, background-color 0.3s, color 0.3s;
            background: var(--bg-primary);
            color: var(--text-primary);
        }

        .form-group input:focus,
        .form-group select:focus {
            outline: none;
            border-color: var(--accent-secondary);
            box-shadow: 0 0 0 3px rgba(var(--accent-primary), 0.18);
        }

        /* Validation States */
        .form-group input.valid {
            border-color: #10b981;
        }

        .form-group input.invalid {
            border-color: #ef4444;
        }

        .validation-icon {
            position: absolute;
            right: 12px;
            top: 50%;
            transform: translateY(-50%);
            font-size: 1.2em;
        }

        .validation-message {
            font-size: 0.85em;
            margin-top: 6px;
            min-height: 1.2em;
            transition: all 0.2s ease;
        }

        .validation-message.error {
            color: #ef4444;
        }

        .validation-message.success {
            color: #10b981;
        }

        .validation-message.warning {
            color: #f59e0b;
        }

        .validation-message.info {
            color: var(--text-muted);
        }

        .input-wrapper {
            position: relative;
        }

        /* Step-by-step display */
        .steps-container {
            margin-top: 20px;
        }

        .step-item {
            background: var(--bg-tertiary);
            border-left: 3px solid var(--accent-secondary);
            padding: 12px;
            margin: 8px 0;
            border-radius: 6px;
            transition: all 0.3s ease;
        }

        .step-header {
            cursor: pointer;
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-weight: 600;
            color: var(--text-primary);
        }

        .step-header:hover {
            color: var(--accent-secondary);
        }

        .step-content {
            margin-top: 10px;
            padding-top: 10px;
            border-top: 1px solid var(--border-color);
            font-family: 'Courier New', monospace;
            font-size: 0.9em;
            color: var(--text-secondary);
        }

        .step-content.collapsed {
            display: none;
        }

        .step-toggle {
            font-size: 0.8em;
            transition: transform 0.3s ease;
        }

        .step-toggle.expanded {
            transform: rotate(90deg);
        }

        .show-steps-toggle {
            margin-bottom: 15px;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .show-steps-toggle input[type="checkbox"] {
            width: auto;
            margin: 0;
        }

        .inline-inputs {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 15px;
        }

        button {
            background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
            color: white;
            border: none;
            padding: 15px 30px;
            border-radius: 8px;
            font-size: 1.1em;
            font-weight: 600;
            cursor: pointer;
            transition: transform 0.2s, box-shadow 0.2s, background 0.3s;
            width: 100%;
            margin-top: 10px;
        }

        button:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 12px rgba(102, 126, 234, 0.4);
            filter: brightness(1.1);
        }

        button:active {
            transform: translateY(0);
            transition: transform 0.05s;
        }

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

        button:focus-visible {
            outline: 3px solid var(--accent-secondary);
            outline-offset: 2px;
        }

        button:disabled {
            opacity: 0.5;
            cursor: not-allowed;
            transform: none;
        }

        .result-box {
            background: var(--bg-primary);
            border: 2px solid var(--border-color);
            border-radius: 10px;
            padding: 20px;
            margin-top: 20px;
            max-height: 400px;
            overflow-y: auto;
            color: var(--text-primary);
            transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
            animation: fadeIn 0.3s ease-out;
        }

        .result-box h3 {
            color: var(--accent-tertiary);
            margin-bottom: 15px;
            font-size: 1.3em;
            transition: color 0.3s ease;
        }

        .point-item {
            background: var(--bg-tertiary);
            padding: 10px;
            margin: 8px 0;
            border-radius: 6px;
            font-family: 'Courier New', monospace;
            border-left: 4px solid var(--accent-secondary);
            color: var(--text-primary);
            transition: all 0.3s ease;
            animation: slideInRight 0.2s ease-out;
        }

        .point-item:hover {
            transform: translateX(5px);
            background: var(--bg-secondary);
        }

        .point-at-infinity {
            color: var(--accent-secondary);
            font-weight: bold;
        }

        .curve-info {
            background: var(--result-bg);
            padding: 15px;
            border-radius: 8px;
            margin-bottom: 20px;
            border-left: 4px solid var(--accent-secondary);
            color: var(--text-primary);
            transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
        }

        .curve-info code {
            background: var(--bg-tertiary);
            padding: 4px 8px;
            border-radius: 4px;
            font-size: 1.1em;
            color: var(--accent-secondary);
            transition: background-color 0.3s ease, color 0.3s ease;
        }

        .full-width {
            grid-column: 1 / -1;
        }

        .operation-result {
            background: var(--result-bg);
            border: 2px solid var(--accent-secondary);
            padding: 20px;
            border-radius: 10px;
            margin-top: 15px;
            font-size: 1.1em;
            color: var(--text-primary);
            transition: all 0.3s ease;
            animation: fadeIn 0.3s ease-out, scaleIn 0.3s ease-out;
        }

        .operation-result strong {
            color: var(--accent-tertiary);
            transition: color 0.3s ease;
        }

        .error {
            background: var(--error-bg);
            border: 2px solid var(--error-border);
            color: var(--error-text);
            padding: 15px;
            border-radius: 8px;
            margin-top: 15px;
            transition: all 0.3s ease;
        }

        canvas {
            border: 2px solid var(--border-dark);
            border-radius: 10px;
            background: var(--canvas-bg);
            width: 100%;
            max-width: none;
            height: 60vh;
            max-height: none;
            display: block;
            margin: 10px auto;
            transition: background-color 0.3s ease, border-color 0.3s ease;
        }

        .info-badge {
            display: inline-block;
            background: var(--accent-secondary);
            color: white;
            padding: 5px 12px;
            border-radius: 20px;
            font-size: 0.9em;
            margin-left: 10px;
            transition: background-color 0.3s ease;
        }

        .point-info {
            margin-top: 6px;
            color: var(--text-muted);
            font-size: 0.95em;
            min-height: 1.2em;
            transition: color 0.3s ease;
        }
        .point-status {
            margin-top: 6px;
            font-size: 0.85em;
            color: #6b7280;
        }
        .point-status.valid {
            color: #10b981;
        }
        .point-status.invalid {
            color: #ef4444;
        }

        .steps-toggle-row {
            margin-top: 12px;
            display: flex;
            justify-content: flex-start;
        }

        .toggle-steps-btn {
            background: linear-gradient(135deg, var(--accent-secondary) 0%, var(--accent-primary) 100%);
            color: #fff;
            border: none;
            padding: 10px 22px;
            border-radius: 999px;
            font-weight: 600;
            font-size: 0.95em;
            cursor: pointer;
            box-shadow: 0 4px 10px var(--shadow-light);
            transition: transform 0.2s ease, box-shadow 0.2s ease;
        }

        .toggle-steps-btn:hover {
            transform: translateY(-1px);
            box-shadow: 0 6px 12px var(--shadow-light);
        }

        .toggle-steps-btn:active {
            transform: translateY(0);
            box-shadow: 0 3px 8px var(--shadow-light);
        }

        /* removed badge styling */

        @media (max-width: 1024px) {
            .content {
                grid-template-columns: 1fr;
            }
            .tab-pane.active {
                grid-template-columns: 1fr;
            }
        }

        .math-formula {
            background: var(--bg-tertiary);
            padding: 15px;
            border-radius: 8px;
            margin: 15px 0;
            text-align: center;
            font-size: 1.3em;
            font-style: italic;
            color: var(--text-secondary);
            border: 1px solid var(--border-color);
            box-shadow: 0 10px 25px var(--shadow-light);
        }

        /* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}
.tabs .tab-btn {
    width: auto;
    padding: 12px 18px;
    font-size: 1.05em;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}
        .tabs .tab-btn.active {
            box-shadow: 0 6px 12px rgba(102, 126, 234, 0.4);
            transform: translateY(-1px);
        }
        .tab-pane {
            display: none;
            grid-column: 1 / -1;
            opacity: 0;
            transition: opacity 0.3s ease;
        }
        .tab-pane.active {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 30px;
            opacity: 1;
            animation: fadeIn 0.3s ease-out;
        }

        /* Curve Type Dropdown Selector */
        .curve-selector-dropdown {
            display: inline-block;
            position: relative;
        }

        .curve-selector-btn {
            background: var(--accent-primary);
            color: white;
            border: 2px solid var(--accent-primary);
            border-radius: 999px;
            padding: 12px 24px;
            font-size: 1.05em;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: 0 4px 12px rgba(31, 78, 216, 0.2);
            min-width: 200px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
        }

        .curve-selector-btn:hover {
            box-shadow: 0 6px 16px rgba(31, 78, 216, 0.3);
            transform: translateY(-1px);
            border-color: var(--accent-secondary);
        }

        .dropdown-arrow {
            font-size: 0.7em;
            transition: transform 0.3s ease;
        }

        .curve-selector-dropdown:hover .dropdown-arrow {
            transform: rotate(180deg);
        }

        .curve-dropdown-menu {
            position: absolute;
            top: calc(100% + 8px);
            left: 50%;
            transform: translateX(-50%);
            background: var(--bg-primary);
            border: 2px solid var(--accent-primary);
            border-radius: 12px;
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
            min-width: 200px;
            opacity: 0;
            visibility: hidden;
            transition: all 0.3s ease;
            z-index: 1000;
            overflow: hidden;
        }

        .curve-selector-dropdown:hover .curve-dropdown-menu {
            opacity: 1;
            visibility: visible;
            transform: translateX(-50%) translateY(0);
        }

        .curve-dropdown-item {
            padding: 12px 20px;
            cursor: pointer;
            transition: all 0.2s ease;
            color: var(--text-primary);
            font-weight: 500;
        }

        .curve-dropdown-item:hover {
            background: var(--accent-primary);
            color: white;
        }

        .curve-dropdown-item.active {
            background: var(--accent-secondary);
            color: white;
            font-weight: 600;
        }

        .selector-row {
            display: flex;
            gap: 20px;
            justify-content: center;
            align-items: center;
            flex-wrap: wrap;
            margin: 20px 0;
            grid-column: 1 / -1;
        }

        .curve-selector-dropdown {
            flex: 1;
            max-width: 260px;
        }

        .curve-selector-btn {
            width: 100%;
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 8px;
        }

        /* About tab */
        #aboutTab .panel.full-width {
            max-width: 1000px;
            margin: 0 auto;
        }
        #aboutTab .panel { text-align: center; }
        #aboutTab h2 { font-size: 2.4em; }
        #aboutTab p { font-size: 1.3em; line-height: 1.9; color: #ccc; }
        #aboutTab ul {
            display: inline-block;
            text-align: left;
            margin: 10px auto;
            font-size: 1.2em;
            color: #ccc;
        }
        #aboutTab li { margin: 8px 0; }

        /* Animation controls */
        .anim-controls {
            display: grid;
            grid-template-columns: auto auto 1fr auto auto;
            align-items: center;
            gap: 10px;
            max-width: 600px;
            margin: 10px auto 0 auto;
        }
        .anim-controls button {
            width: auto;
            padding: 8px 14px;
            margin-top: 0;
        }
        .anim-controls input[type="range"] {
            width: 100%;
            background: #222;
            height: 6px;
            border-radius: 3px;
            outline: none;
        }
        .anim-controls input[type="range"]::-webkit-slider-thumb {
            -webkit-appearance: none;
            appearance: none;
            width: 18px;
            height: 18px;
            border-radius: 50%;
            background: #667eea;
            cursor: pointer;
        }
        .anim-controls input[type="range"]::-moz-range-thumb {
            width: 18px;
            height: 18px;
            border-radius: 50%;
            background: #667eea;
            cursor: pointer;
        }
        .anim-controls .step-label {
            color: #ddd;
            font-weight: 600;
            min-width: 60px;
            text-align: right;
        }

        /* Tabs + Profile */
        .tabs-bar {
            display: flex;
            align-items: center;
            gap: 10px;
            position: relative;
        }
        .tabs-bar .tabs { flex: 1; }
        .menu-profile-area {
            display: flex;
            flex-direction: column;
            justify-content: flex-start;
            margin: 12px 0;
            position: relative;
            gap: 12px;
        }

        .menu-actions-row {
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
        }

        .menu-action-btn {
            flex: 1;
            min-width: 110px;
            border-radius: 8px;
            border: 1px solid rgba(255,255,255,0.25);
            background: rgba(255,255,255,0.08);
            color: var(--text-primary);
            padding: 10px 12px;
            font-weight: 600;
            font-size: 0.95em;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            cursor: pointer;
            transition: background 0.2s ease, border-color 0.2s ease;
        }

        .menu-action-btn:hover {
            background: rgba(255,255,255,0.16);
            border-color: var(--accent-secondary);
        }
        .profile-btn {
            background: var(--accent-secondary);
            color: #fff;
            border: 0;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-size: 1.05em;
            cursor: pointer;
            box-shadow: 0 6px 12px rgba(15, 23, 42, 0.3);
        }
        .profile-menu {
            position: absolute;
            right: 0;
            top: 48px;
            background: #111;
            border: 1px solid #333;
            border-radius: 8px;
            min-width: 200px;
            box-shadow: 0 10px 24px rgba(0,0,0,0.4);
            display: none;
            z-index: 10;
            opacity: 0;
            transform: translateY(-6px);
            transition: opacity 180ms ease, transform 180ms ease;
        }
        .profile-menu.visible { display: block; opacity: 1; transform: translateY(0); }
        .profile-menu .header {
            padding: 10px 12px;
            color: #aaa;
            border-bottom: 1px solid #222;
            font-size: 0.95em;
        }
        .profile-menu .dropdown-item {
            display: block;
            width: 100%;
            padding: 10px 12px;
            background: transparent;
            color: #e6e6e6;
            border: none;
            text-align: left;
            cursor: pointer;
        }
        .profile-menu .dropdown-item:hover {
            background: rgba(102, 126, 234, 0.12);
        }

        /* Auth full-screen card */
        .auth-overlay {
            position: fixed;
            inset: 0;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 10000;
            padding: 20px;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
            will-change: opacity;
            backdrop-filter: blur(10px);
        }
        .auth-overlay.visible {
            opacity: 1;
            pointer-events: auto;
        }
        .auth-card {
            background: #fff;
            color: #111;
            border-radius: 18px;
            box-shadow: 0 20px 60px rgba(0,0,0,0.3);
            width: 100%;
            max-width: 460px;
            padding: 24px;
            opacity: 0;
            transform: translateY(30px) scale(0.95);
            transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                        opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                        box-shadow 0.3s ease;
            will-change: transform, opacity;
        }
        .auth-overlay.visible .auth-card {
            opacity: 1;
            transform: translateY(0) scale(1);
        }
        .auth-card:hover {
            box-shadow: 0 25px 70px rgba(0,0,0,0.35);
        }
        .auth-form { width: 100%; max-width: 360px; margin: 0 auto; }
        .auth-icon {
            width: 52px;
            height: 52px;
            border-radius: 12px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            color: #fff;
            font-size: 24px;
            box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
        }
        .auth-title { font-size: 1.25rem; font-weight: 700; margin-top: 10px; }
        .auth-sub { color: #666; font-size: 0.95rem; margin-top: 4px; }
        .auth-field { position: relative; margin-top: 14px; }
        .auth-field input {
            width: 100%;
            border: 1px solid #ddd;
            border-radius: 12px;
            padding: 12px 16px 12px 42px;
            font-size: 0.95rem;
            outline: none;
        }
        .auth-field input:focus { border-color: #667eea; box-shadow: 0 0 0 3px rgba(102,126,234,0.15); }
        .auth-ico {
            position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
            width: 18px; height: 18px; fill: #667eea; opacity: 0.9;
        }
        .auth-right-link { font-size: 0.9rem; color: #667eea; text-decoration: none; }
        .auth-right-row { display: flex; justify-content: flex-end; margin-top: 6px; }
        .btn-primary-dark {
            width: 100%;
            padding: 14px 18px;
            border-radius: 999px;
            background: #000;
            color: #fff;
            border: none;
            font-weight: 700;
            cursor: pointer;
            margin-top: 14px;
        }
        .auth-sep { display: flex; align-items: center; gap: 10px; margin: 14px 0; }
        .auth-sep .line { flex: 1; height: 1px; background: #eee; }
        .auth-sep .txt { color: #999; font-size: 0.85rem; }
        .btn-row { display: grid; grid-template-columns: 1fr; gap: 10px; }
        @media (min-width: 420px) { .btn-row { grid-template-columns: 1fr 1fr; } }
        .btn-pill { padding: 10px 16px; border-radius: 999px; border: 1px solid #ddd; background: #fff; color: #111; cursor: pointer; }
        .btn-pill.secondary { border-color: #667eea; color: #667eea; }
        .btn-pill.ghost { border-color: #ccc; color: #333; }
        .auth-msg { color: #e53935; min-height: 1.2em; margin-top: 6px; font-size: 0.9rem; }

        /* Auth panel */
        .auth-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 20px;
            align-items: start;
        }
        .auth-status {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 10px 0 0 0;
            color: #ddd;
        }
        .auth-actions {
            display: flex;
            flex-direction: column;
            justify-content: center;
        }
        @media (max-width: 1024px) {
            .auth-grid { grid-template-columns: 1fr; }
        }
        /* Subtabs */
        .subtabs {
            display: flex;
            gap: 10px;
            justify-content: center;
            flex-wrap: wrap;
            margin: 8px 0 14px 0;
        }
        .subtabs .subtab-btn {
            width: auto;
            padding: 10px 16px;
            font-size: 1.0em;
        }
        .subtabs .subtab-btn.active {
            box-shadow: 0 6px 12px rgba(102, 126, 234, 0.4);
            transform: translateY(-1px);
        }
        .subtab-pane {
            display: none;
            grid-column: 1 / -1;
            opacity: 0;
            transition: opacity 0.3s ease;
        }
        .subtab-pane.active {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 30px;
            opacity: 1;
            animation: fadeIn 0.3s ease-out;
        }
        @media (max-width: 1024px) { .subtab-pane.active { grid-template-columns: 1fr; } }

        /* Real range inline formatter */
        .range-inline { display:flex; align-items:center; gap:8px; color:#ddd; margin-top:4px; flex-wrap: nowrap; white-space: nowrap; }
        .range-inline .token { color:#aaa; font-family: 'Courier New', monospace; }
        .range-input { width: 8ch; max-width: 8ch; text-align: center; }
        @media (max-width: 480px) { .range-input { width: 8ch; max-width: 8ch; } }

        /* History list */
        .history-controls { display:flex; gap:10px; margin-bottom: 10px; }
        .history-list {
            max-height: 500px;
            overflow-y: auto;
            overflow-x: hidden;
        }

        .history-list:empty::after {
            content: "No history yet";
            display: block;
            text-align: center;
            padding: 40px 20px;
            color: var(--text-muted);
            font-size: 0.95em;
        }

        .history-item {
            background: var(--bg-tertiary);
            border: 1px solid var(--border-color);
            border-radius: 10px;
            padding: 14px;
            margin: 8px 0;
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            justify-content: space-between;
            align-items: center;
            animation: slideInRight 0.3s ease-out;
        }
        .history-item:hover {
            background: var(--bg-primary);
            border-color: var(--accent-secondary);
            transform: translateX(-4px);
            box-shadow: 0 2px 8px var(--shadow-light);
        }
        .history-item .operation-icon {
            font-size: 24px;
            margin-right: 15px;
            display: inline-flex;
            align-items: center;
        }
        .history-item .operation-icon i {
            font-size: 1em;
            line-height: 1;
        }
        .history-item .operation-details { flex: 1; color: var(--text-secondary); }
        .history-item .operation-type { color: var(--accent-secondary); font-weight: bold; margin-bottom: 5px; }
        .history-item .operation-params { font-family: 'Courier New', monospace; color: var(--text-muted); font-size: 0.9em; }
        .history-item .timestamp { color: var(--text-muted); font-size: 0.85em; }

        /* Math formula styling */
        .math-formula {
            background: var(--bg-primary);
            color: var(--text-secondary);
            border: 1px solid var(--border-color);
            transition: all 0.3s ease;
        }

        /* About tab text styling */
        #aboutTab p { color: var(--text-tertiary) !important; transition: color 0.3s ease; }
        #aboutTab ul { color: var(--text-tertiary) !important; transition: color 0.3s ease; }
        #aboutTab li { color: var(--text-tertiary) !important; transition: color 0.3s ease; }
        #aboutTab h2, #aboutTab h3 { color: var(--text-primary) !important; transition: color 0.3s ease; }
        #aboutTab code { color: var(--accent-secondary) !important; transition: color 0.3s ease; }

        /* Range inline formatter with variables */
        .range-inline { color: var(--text-tertiary); transition: color 0.3s ease; }
        .range-inline .token { color: var(--text-muted); }

        /* History items with variables */
        .history-item {
            background: var(--bg-tertiary);
            border-color: var(--border-color);
            transition: all 0.3s ease;
            border-left: 4px solid var(--accent-secondary);
            display: flex;
            gap: 12px;
            align-items: flex-start;
        }
        .history-item:hover {
            background: var(--bg-secondary);
            border-color: var(--accent-secondary);
            transform: translateX(5px);
            box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
        }
        .history-item .operation-icon {
            font-size: 20px;
            flex-shrink: 0;
            color: var(--accent-secondary);
            display: flex;
            align-items: center;
            justify-content: center;
            width: 32px;
            height: 32px;
            background: rgba(59, 130, 246, 0.1);
            border-radius: 6px;
        }
        .history-item .operation-details {
            color: var(--text-secondary);
            flex: 1;
            min-width: 0;
        }
        .history-item .operation-type {
            color: var(--text-primary);
            font-weight: bold;
            margin-bottom: 6px;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        .history-item .operation-params {
            color: var(--text-tertiary);
            font-size: 0.9em;
            line-height: 1.4;
            word-break: break-word;
        }
        .history-item .timestamp {
            color: var(--text-muted);
            font-size: 0.8em;
            margin-top: 4px;
        }

        /* Operation type badges */
        .history-item .curveType-badge {
            display: inline-block;
            padding: 3px 10px;
            border-radius: 12px;
            font-size: 0.75em;
            font-weight: 600;
            white-space: nowrap;
        }
        .history-item .curveType-badge.fp {
            background: rgba(59, 130, 246, 0.2);
            color: var(--accent-primary);
        }
        .history-item .curveType-badge.real {
            background: rgba(139, 92, 246, 0.2);
            color: #8b5cf6;
        }
        .history-item .curveType-badge.local {
            background: rgba(76, 175, 80, 0.2);
            color: #4caf50;
        }

        /* Color-coded operation icons */
        .history-item[data-op*="encrypt"] .operation-icon {
            background: rgba(59, 130, 246, 0.15);
            color: #3b82f6;
        }
        .history-item[data-op*="decrypt"] .operation-icon {
            background: rgba(76, 175, 80, 0.15);
            color: #4caf50;
        }
        .history-item[data-op*="add"] .operation-icon {
            background: rgba(245, 158, 11, 0.15);
            color: #f59e0b;
        }
        .history-item[data-op*="multiply"] .operation-icon {
            background: rgba(139, 92, 246, 0.15);
            color: #8b5cf6;
        }
        .history-item[data-op*="key_exchange"] .operation-icon {
            background: rgba(236, 72, 153, 0.15);
            color: #ec4899;
        }
        .history-item[data-op*="attack"] .operation-icon {
            background: rgba(239, 68, 68, 0.15);
            color: #ef4444;
        }

        /* Auth components with transitions */
        .auth-status { color: var(--text-secondary); transition: color 0.3s ease; }
        .auth-overlay { background: var(--overlay-bg); transition: background-color 0.3s ease; }
        .auth-card { transition: box-shadow 0.3s ease; }
        .auth-icon {
            background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
            transition: background 0.3s ease;
        }
        .auth-ico { fill: var(--accent-secondary); transition: fill 0.3s ease; }
        .auth-right-link { color: var(--accent-secondary); transition: color 0.3s ease; }
        .btn-primary-dark {
            background: var(--accent-primary);
            transition: background-color 0.3s ease;
        }
        .btn-pill.secondary {
            border-color: var(--accent-secondary);
            color: var(--accent-secondary);
            transition: border-color 0.3s ease, color 0.3s ease;
        }

        /* Tab and profile styles */
        .tabs .tab-btn,
        .subtabs .subtab-btn {
            background: var(--bg-primary);
            color: var(--text-primary);
            border: 1px solid var(--border-color);
            border-radius: 999px;
            transition: all 0.3s ease;
        }
        .tabs .tab-btn.active,
        .subtabs .subtab-btn.active {
            background: var(--accent-primary);
            color: white;
            border-color: var(--accent-primary);
        }

        .profile-btn {
            color: var(--accent-tertiary);
            border-color: var(--accent-secondary);
            transition: all 0.3s ease;
        }
        .profile-menu {
            background: var(--bg-primary);
            border-color: var(--border-color);
            transition: all 0.3s ease;
        }
        .profile-menu .header {
            color: var(--text-muted);
            border-bottom-color: var(--border-color);
            transition: all 0.3s ease;
        }
        .profile-menu .dropdown-item {
            color: var(--text-primary);
            transition: color 0.3s ease, background-color 0.3s ease;
        }
        .profile-menu .dropdown-item:hover {
            background: var(--result-bg);
        }

        /* =================== ECC EXPERT CHAT =================== */

        .chat-assistant {
            position: fixed;
            right: 28px;
            bottom: 28px;
            display: flex;
            flex-direction: column;
            align-items: flex-end;
            gap: 12px;
            z-index: 1400;
        }
        .chat-fab {
            width: 58px;
            height: 58px;
            border-radius: 50%;
            border: none;
            color: white;
            background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-size: 1.4em;
            cursor: grab;
            touch-action: none;
            transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.25s ease;
        }
        .chat-assistant.dragging .chat-fab {
            cursor: grabbing;
        }
        .chat-assistant.dragging {
            transition: none;
        }
        .chat-fab:hover {
            transform: translateY(-2px) scale(1.03);
            box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
        }
        .chat-fab:active {
            transform: scale(0.98);
        }
        .chat-fab.active {
            box-shadow: 0 12px 36px rgba(0, 0, 0, 0.48);
            background: linear-gradient(135deg, var(--accent-secondary) 0%, var(--accent-primary) 100%);
        }

        .chat-window {
            width: 360px;
            max-width: calc(100vw - 32px);
            background: var(--bg-primary);
            border: 1px solid var(--border-color);
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
            border-radius: 16px;
            overflow: hidden;
            opacity: 0;
            transform: translateY(10px) scale(0.98);
            pointer-events: none;
            transition: opacity 0.25s ease, transform 0.25s ease;
            max-height: 82vh;
            backdrop-filter: blur(6px);
        }
        .chat-window.open {
            opacity: 1;
            pointer-events: auto;
            transform: translateY(0) scale(1);
        }

        .chat-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 14px 16px;
            background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(10, 178, 132, 0.14));
            border-bottom: 1px solid var(--border-color);
        }
        .chat-title { font-weight: 700; color: var(--text-primary); }
        .chat-subtitle { color: var(--text-muted); font-size: 0.9em; }
        .chat-header-actions {
            display: flex;
            gap: 8px;
            align-items: center;
        }
        .chat-status {
            color: var(--accent-secondary);
            font-weight: 600;
            font-size: 0.9em;
        }
        .chat-close-btn {
            background: transparent;
            border: none;
            color: var(--text-primary);
            font-size: 1.2em;
            cursor: pointer;
            transition: color 0.2s ease, transform 0.2s ease;
        }
        .chat-close-btn:hover { color: var(--accent-secondary); transform: translateY(-1px); }

        .chat-messages {
            max-height: 380px;
            overflow-y: auto;
            padding: 14px 14px 6px;
            background: var(--bg-secondary);
            scroll-behavior: smooth;
            border-bottom: 1px solid var(--border-color);
        }
        .chat-message {
            display: flex;
            gap: 10px;
            margin-bottom: 12px;
            align-items: flex-start;
        }
        .chat-message.user {
            flex-direction: row-reverse;
        }
        .chat-avatar {
            width: 34px;
            height: 34px;
            border-radius: 10px;
            display: grid;
            place-items: center;
            background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
            color: white;
            font-size: 0.95em;
        }
        .chat-message.user .chat-avatar {
            background: var(--accent-secondary);
        }
        .chat-bubble {
            max-width: 80%;
            padding: 10px 12px;
            border-radius: 12px;
            background: var(--bg-primary);
            color: var(--text-primary);
            border: 1px solid var(--border-color);
            line-height: 1.5;
        }
        .chat-message.user .chat-bubble {
            background: linear-gradient(135deg, rgba(37, 99, 235, 0.18), rgba(10, 178, 132, 0.18));
            border-color: rgba(37, 99, 235, 0.3);
        }
        .chat-message.error .chat-bubble {
            border-color: #e11d48;
            background: rgba(225, 29, 72, 0.12);
            color: #fda4af;
        }

        .chat-input-area {
            display: grid;
            grid-template-columns: 1fr auto;
            align-items: end;
            gap: 10px;
            padding: 12px;
            background: var(--bg-primary);
            border-top: 1px solid var(--border-color);
        }
        .chat-input-area textarea {
            width: 100%;
            border-radius: 12px;
            border: 1px solid var(--border-color);
            background: var(--bg-secondary);
            color: var(--text-primary);
            padding: 10px 12px;
            resize: vertical;
            min-height: 52px;
            max-height: 120px;
            transition: border-color 0.2s ease, box-shadow 0.2s ease;
        }
        .chat-input-area textarea:focus {
            border-color: var(--accent-secondary);
            outline: none;
            box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
        }
        .chat-send-btn {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
            border: none;
            color: white;
            padding: 12px 14px;
            border-radius: 12px;
            cursor: pointer;
            min-width: 98px;
            justify-content: center;
            box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25);
            transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
        }
        .chat-send-btn:disabled {
            opacity: 0.6;
            cursor: not-allowed;
            box-shadow: none;
        }
        .chat-send-btn:hover:not(:disabled) {
            transform: translateY(-1px);
            box-shadow: 0 14px 30px rgba(0, 0, 0, 0.3);
        }

        .chat-typing {
            font-size: 0.9em;
            color: var(--text-muted);
        }

        /* Animation controls styling */
        .anim-controls input[type="range"] {
            background: var(--bg-tertiary);
            transition: background-color 0.3s ease;
        }
        .anim-controls input[type="range"]::-webkit-slider-thumb {
            background: var(--accent-secondary);
        }
        .anim-controls input[type="range"]::-moz-range-thumb {
            background: var(--accent-secondary);
        }
        .anim-controls .step-label {
            color: var(--text-secondary);
            transition: color 0.3s ease;
        }

        /* =================== RESPONSIVE MOBILE DESIGN =================== */

        /* Tablets and small laptops */
        @media (max-width: 1024px) {
            .header h1 {
                font-size: 2em;
            }
        }

        /* Mobile devices (landscape and portrait) */
        @media (max-width: 768px) {
            /* Menu adjustments for mobile */
            .history-panel {
                width: 100%;
                max-width: 100vw;
            }

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

            .menu-card {
                padding: 16px 10px;
            }

            .menu-card-icon {
                font-size: 1.8em;
            }

            .user-profile-card {
                padding: 12px;
            }

            .user-avatar {
                width: 40px;
                height: 40px;
                font-size: 20px;
            }

            .btn-auth {
                padding: 6px 16px;
                font-size: 0.85em;
            }

            /* Header adjustments */
            .header {
                padding: 30px 20px;
            }

            .header h1 {
                font-size: 1.8em;
                padding-right: 200px;
                padding-left: 60px;
            }

            .info-btn {
                width: 40px;
                height: 40px;
                left: 15px;
            }

            .info-icon {
                font-size: 1.3em;
            }

            .header-buttons {
                top: 15px;
                right: 15px;
                gap: 8px;
            }

            .header-btn,
            .theme-toggle,
            .history-toggle {
                width: 44px;
                height: 44px;
                font-size: 1.3em;
            }

            /* History Panel Mobile */
            .history-panel {
                width: 100%;
                max-width: 100vw;
            }

            .history-panel-header {
                padding: 15px;
            }

            .history-panel-header h2 {
                font-size: 1.3em;
            }

            .history-panel-content {
                padding: 15px;
            }

            .history-panel-controls button {
                padding: 8px 12px;
                font-size: 0.85em;
            }

            .history-item {
                padding: 10px;
                font-size: 0.9em;
            }

            .history-item .operation-icon {
                font-size: 20px;
                margin-right: 10px;
            }

            /* Content layout */
            .content {
                padding: 15px;
                gap: 20px;
            }

            .panel {
                padding: 20px;
            }

            .panel h2 {
                font-size: 1.5em;
            }

            /* Form elements - touch-friendly sizing */
            .form-group input,
            .form-group select {
                padding: 14px;
                font-size: 1em;
                min-height: 44px;
            }

            button {
                padding: 14px 20px;
                font-size: 1em;
                min-height: 44px;
            }

            .inline-inputs {
                grid-template-columns: 1fr;
                gap: 10px;
            }

            /* Copy buttons - stack vertically on mobile */
            .copy-btn-group {
                flex-direction: column;
                gap: 6px;
            }

            .copy-btn {
                width: 100%;
                justify-content: center;
                padding: 10px 12px;
                min-height: 44px;
            }

            /* Toast notifications */
            .toast-container {
                top: 60px;
                right: 10px;
                left: 10px;
            }

            .toast {
                min-width: auto;
                max-width: 100%;
            }

            /* Result boxes */
            .result-box {
                padding: 15px;
            }

            .result-header {
                flex-direction: column;
                align-items: flex-start;
                gap: 10px;
            }

            /* Point items */
            .point-item {
                font-size: 0.9em;
                padding: 8px;
            }

            /* Canvas adjustments */
            canvas {
                height: 50vh;
                max-height: 400px;
            }

            /* Tabs */
            .tabs .tab-btn {
                padding: 10px 14px;
                font-size: 0.95em;
            }

            .subtabs .subtab-btn {
                padding: 8px 12px;
                font-size: 0.9em;
            }

            /* Auth overlay */
            .auth-card {
                max-width: 90%;
                padding: 30px 20px;
            }

            /* Chat assistant positioning */
            .chat-assistant {
                right: 16px;
                bottom: 16px;
                width: calc(100% - 32px);
                align-items: stretch;
            }
            .chat-window {
                width: 100%;
                max-height: 70vh;
            }
            .chat-send-btn {
                min-width: 88px;
            }
        }

        /* Small mobile devices (portrait) */
        @media (max-width: 480px) {
            .menu-section {
                margin-bottom: 20px;
                padding-bottom: 20px;
            }

            .menu-section-title {
                font-size: 0.8em;
                margin-bottom: 10px;
            }

            .menu-card {
                padding: 14px 8px;
            }

            .menu-card-icon {
                font-size: 1.6em;
            }

            .menu-card-label {
                font-size: 0.9em;
            }

            .menu-card-hint {
                font-size: 0.7em;
            }

            .user-name {
                font-size: 1em;
            }

            .user-status {
                font-size: 0.8em;
            }

            .header h1 {
                font-size: 1.5em;
                padding-right: 100px;
                padding-left: 50px;
            }

            .header {
                padding: 20px 15px;
            }

            .info-btn {
                width: 36px;
                height: 36px;
                left: 10px;
            }

            .info-icon {
                font-size: 1.2em;
            }

            .about-modal-content {
                max-width: 95%;
                max-height: 85vh;
            }

            .header-buttons {
                gap: 5px;
            }

            /* Curve type dropdown mobile */
            .curve-selector-btn {
                padding: 10px 18px;
                font-size: 0.9em;
                min-width: 160px;
            }

            .curve-dropdown-item {
                padding: 10px 16px;
                font-size: 0.9em;
            }

            .header-btn,
            .theme-toggle {
                width: 40px;
                height: 40px;
                font-size: 1.2em;
            }

            .content {
                padding: 10px;
            }

            .panel {
                padding: 15px;
            }

            .panel h2 {
                font-size: 1.3em;
            }

            /* Smaller fonts for mobile */
            body {
                font-size: 14px;
            }

            .tabs {
                gap: 6px;
            }

            .tabs .tab-btn {
                padding: 8px 10px;
                font-size: 0.85em;
            }

            .subtabs .subtab-btn {
                padding: 6px 10px;
                font-size: 0.85em;
            }

            .result-box h3 {
                font-size: 1.1em;
            }

            .curve-info {
                font-size: 0.9em;
                padding: 12px;
            }

            .operation-result {
                font-size: 0.95em;
                padding: 15px;
            }

            /* Toast notifications smaller */
            .toast {
                padding: 10px 12px;
                font-size: 0.9em;
            }

            /* History items */
            .history-item {
                padding: 12px;
                font-size: 0.9em;
            }

            .history-item .operation-icon {
                font-size: 20px;
            }
        }

        /* Very small devices */
        @media (max-width: 360px) {
            .header h1 {
                font-size: 1.3em;
            }

            .panel h2 {
                font-size: 1.2em;
            }

            .copy-btn {
                font-size: 0.85em;
                padding: 8px 10px;
            }
        }

        /* Landscape mobile optimization */
        @media (max-height: 600px) and (orientation: landscape) {
            .header {
                padding: 15px 20px;
            }

            .header h1 {
                font-size: 1.3em;
            }

            .header-btn,
            .theme-toggle {
                width: 36px;
                height: 36px;
                font-size: 1em;
            }

            canvas {
                height: 40vh;
            }

            .panel {
                padding: 15px;
            }
        }

/* =================== ENCRYPTION TAB STYLING =================== */

.step-item.active {
    background: var(--result-bg);
    border-left-color: var(--accent-primary);
    border-left-width: 4px;
    animation: highlightStep 0.3s ease;
}

@keyframes highlightStep {
    0% {
        transform: translateX(-5px);
        opacity: 0.8;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

.step-item .step-content {
    font-family: 'Courier New', monospace;
    font-size: 0.95em;
    line-height: 1.6;
    color: var(--text-primary);
}

#encryptionSystemInfo .result-box,
#encryptionKeyInfo .result-box {
    animation: fadeInUp 0.4s ease;
}

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

#encryptionResult textarea,
#decryptionResult textarea,
#ciphertextInput {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px;
    font-family: 'Courier New', monospace;
    resize: vertical;
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

#encryptionResult textarea:focus,
#ciphertextInput:focus,
#plaintextInput:focus {
    outline: none;
    border-color: var(--accent-secondary);
    box-shadow: 0 0 0 3px var(--shadow-light);
}

#plaintextInput {
    width: 100%;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px;
    font-family: 'Segoe UI', sans-serif;
    font-size: 1em;
    resize: vertical;
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

/* Canvas point highlights for encryption */
canvas {
    transition: opacity 0.3s ease;
}

/* Encryption animation controls */
#encryptionAnimControls button:disabled,
#encryptPrevBtn:disabled,
#encryptNextBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#encryptionAnimControls button:not(:disabled):hover,
#encryptPrevBtn:not(:disabled):hover,
#encryptNextBtn:not(:disabled):hover,
#encryptPlayBtn:not(:disabled):hover {
    background: var(--accent-secondary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-light);
}

/* Toggle steps button */
.steps-toggle-row {
    text-align: center;
    margin: 15px 0;
}

.toggle-steps-btn {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9em;
}

.toggle-steps-btn:hover {
    background: var(--result-bg);
    border-color: var(--accent-secondary);
}

/* Steps display visibility toggle */
.steps-display {
    max-height: 600px;
    overflow-y: auto;
    transition: max-height 0.3s ease, opacity 0.3s ease;
}

.steps-display.hidden {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

/* Success message styling for encryption/decryption */
.result-box.success h3 {
    color: #10b981;
    margin-bottom: 10px;
}

.result-box.success {
    border-left: 4px solid #10b981;
}

/* Encryption key info styling */
#encryptionKeyInfo hr {
    margin: 15px 0;
    border: none;
    border-top: 1px solid var(--border-color);
}


/* =================== DUAL DROPDOWN LAYOUT =================== */

/* Make dropdowns responsive on mobile */
@media (max-width: 768px) {
    div[style*="display: flex"][style*="gap: 20px"] {
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    .curve-selector-dropdown {
        width: 100%;
        max-width: 100%;
    }
}

/* Ensure encryption dropdown has same styling as curve dropdown */
#encryptionSelectorBtn {
    min-width: 200px;
}


/* =================== DIFFIE-HELLMAN DEMO ENHANCEMENTS =================== */

/* Header section with icon */
.dh-header {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
    position: relative;
}

.dh-header::before {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-primary), transparent);
    animation: slideRight 2s ease-in-out infinite;
}

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

.dh-icon-wrapper {
    width: 56px;
    height: 56px;
    min-width: 56px;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #ec4899 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    color: white;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4), 0 4px 12px rgba(139, 92, 246, 0.3);
    position: relative;
    overflow: hidden;
}

.dh-icon-wrapper::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shine 3s ease-in-out infinite;
}

@keyframes shine {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
    }
    50%, 100% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
    }
}

.dh-icon-wrapper i {
    animation: iconFloat 3s ease-in-out infinite;
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

@keyframes iconFloat {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    25% {
        transform: translateY(-3px) rotate(-5deg);
    }
    75% {
        transform: translateY(-3px) rotate(5deg);
    }
}

/* Info box */
.dh-info-box {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(16, 185, 129, 0.12));
    border-left: 4px solid var(--accent-primary);
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 24px;
    display: flex;
    gap: 14px;
    align-items: flex-start;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
    transition: all 0.3s ease;
}

.dh-info-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.dh-info-box:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.2);
}

.dh-info-box:hover::before {
    transform: translateX(100%);
}

.dh-info-box i {
    color: var(--accent-primary);
    font-size: 22px;
    margin-top: 2px;
    animation: pulse 2s ease-in-out infinite;
}

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

.dh-info-box strong {
    color: var(--text-primary);
}

/* Start button */
.dh-start-btn {
    width: 100%;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 70%, #1d4ed8 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4), 0 2px 6px rgba(37, 99, 235, 0.3);
    position: relative;
    overflow: hidden;
}

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

.dh-start-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.5), 0 4px 12px rgba(37, 99, 235, 0.4);
}

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

.dh-start-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.dh-start-btn i {
    font-size: 18px;
    animation: playPulse 1.5s ease-in-out infinite;
}

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

/* Visualization header */
.dh-viz-header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
}

/* Canvas wrapper */
.dh-canvas-wrapper {
    position: relative;
    background: var(--bg-tertiary);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(59, 130, 246, 0.08);
    margin-bottom: 20px;
    border: 2px solid rgba(59, 130, 246, 0.15);
    transition: all 0.3s ease;
}

.dh-canvas-wrapper:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.25);
}

#dhCanvas {
    width: 100%;
    height: auto;
    display: none;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

#dhCanvas.visible {
    display: block;
}

.dh-canvas-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 0.95em;
    text-align: center;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(16, 185, 129, 0.08));
    position: relative;
}

.dh-canvas-hint::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(59, 130, 246, 0.1), transparent 70%);
    animation: breathe 3s ease-in-out infinite;
}

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

.dh-canvas-hint i {
    font-size: 28px;
    color: var(--accent-primary);
    animation: bounce 2s ease-in-out infinite;
    position: relative;
    z-index: 1;
}

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

.dh-canvas-hint span {
    position: relative;
    z-index: 1;
}

/* Animation controls */
.dh-anim-controls {
    display: none;
    grid-template-columns: auto auto 1fr auto;
    gap: 12px;
    align-items: center;
    background: var(--bg-tertiary);
    padding: 16px;
    border-radius: 10px;
    margin-bottom: 24px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.dh-anim-controls.active {
    display: grid;
}

.dh-control-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

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

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

.dh-control-btn i {
    font-size: 14px;
}

.dh-play-btn {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border-color: #10b981;
}

.dh-play-btn:hover {
    background: linear-gradient(135deg, #059669, #047857);
}

.dh-slider-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

#dhStepSlider {
    flex: 1;
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

#dhStepSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

#dhStepSlider::-webkit-slider-thumb:hover {
    background: var(--accent-secondary);
    transform: scale(1.2);
}

#dhStepSlider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--accent-primary);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

#dhStepSlider::-moz-range-thumb:hover {
    background: var(--accent-secondary);
    transform: scale(1.2);
}

.dh-step-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 45px;
    text-align: center;
    padding: 6px 12px;
    background: var(--bg-secondary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

/* Steps wrapper */
.dh-steps-wrapper {
    margin-top: 24px;
}

.dh-steps-scroll {
    max-height: 400px;
    overflow-y: auto;
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 16px;
    border: 1px solid var(--border-color);
}

/* Enhanced step items */
.dh-steps-scroll .step-item {
    background: var(--bg-tertiary);
    border-left: 4px solid var(--border-color);
    padding: 16px 16px 16px 60px;
    margin-bottom: 12px;
    border-radius: 10px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.5;
    position: relative;
    border: 1px solid var(--border-color);
}

.dh-steps-scroll .step-item::before {
    content: attr(data-step-number);
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: var(--text-muted);
    transition: all 0.3s ease;
}

.dh-steps-scroll .step-item:last-child {
    margin-bottom: 0;
}

.dh-steps-scroll .step-item.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(16, 185, 129, 0.08));
    border-left-color: var(--accent-primary);
    border-left-width: 5px;
    border-color: rgba(59, 130, 246, 0.3);
    opacity: 1;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2), 0 2px 6px rgba(16, 185, 129, 0.1);
    transform: translateX(6px) scale(1.02);
}

.dh-steps-scroll .step-item.active::before {
    background: linear-gradient(135deg, #3b82f6, #10b981);
    border-color: transparent;
    color: white;
    transform: translateY(-50%) scale(1.15);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
    animation: stepPulse 1s ease-in-out;
}

@keyframes stepPulse {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
    }
    50% {
        box-shadow: 0 4px 16px rgba(59, 130, 246, 0.6);
    }
}

.dh-steps-scroll .step-item .step-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.95em;
    color: var(--text-primary);
}

.dh-steps-scroll .step-item.active .step-header {
    color: var(--accent-primary);
}

.dh-steps-scroll .step-item .step-content {
    color: var(--text-secondary);
    font-size: 0.9em;
    line-height: 1.7;
    margin-left: 0;
}

.dh-steps-scroll .step-item.active .step-content {
    color: var(--text-primary);
}

.dh-steps-scroll .step-item code {
    background: var(--bg-secondary);
    padding: 6px 10px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: var(--accent-primary);
    border: 1px solid var(--border-color);
    display: inline-block;
    margin-top: 6px;
}

/* Result box enhancement for DH demo */
#dhDemoResult .result-box {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(5, 150, 105, 0.08));
    border: 2px solid rgba(16, 185, 129, 0.35);
    border-radius: 16px;
    padding: 24px;
    margin-top: 20px;
    animation: fadeInUp 0.5s ease, glow 2s ease-in-out infinite;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.15);
}

#dhDemoResult .result-box::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.15), transparent 60%);
    animation: rotate 10s linear infinite;
}

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

@keyframes glow {
    0%, 100% {
        box-shadow: 0 4px 16px rgba(16, 185, 129, 0.15);
    }
    50% {
        box-shadow: 0 6px 24px rgba(16, 185, 129, 0.25);
    }
}

#dhDemoResult .result-box h3 {
    color: #10b981;
    margin: 0 0 20px 0;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    z-index: 1;
}

#dhDemoResult .result-box h3::before {
    content: '✓';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border-radius: 50%;
    font-size: 15px;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
    animation: checkmark 0.5s ease 0.3s backwards;
}

@keyframes checkmark {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(0deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

#dhDemoResult .result-box p {
    margin: 12px 0;
    line-height: 1.7;
    position: relative;
    z-index: 1;
    padding-left: 12px;
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
}

#dhDemoResult .result-box p:hover {
    border-left-color: rgba(16, 185, 129, 0.3);
    transform: translateX(4px);
}

#dhDemoResult .result-box strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .dh-header {
        flex-direction: column;
        gap: 12px;
    }

    .dh-icon-wrapper {
        width: 45px;
        height: 45px;
        font-size: 20px;
    }

    .dh-anim-controls {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .dh-slider-wrapper {
        grid-column: 1;
        order: 3;
    }

    .dh-control-btn span {
        display: none;
    }

    .dh-control-btn {
        justify-content: center;
        padding: 10px;
    }

    .dh-steps-scroll {
        max-height: 300px;
    }
}

/* Scrollbar styling for steps container */
.dh-steps-scroll::-webkit-scrollbar {
    width: 8px;
}

.dh-steps-scroll::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

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

.dh-steps-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--accent-secondary);
}


/* =================== DISCRETE LOGARITHM ATTACK PROGRESS =================== */

/* Attack header */
.dlog-attack-header {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
    position: relative;
}

.dlog-attack-header::before {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, #ef4444, transparent);
    animation: slideRight 2s ease-in-out infinite;
}

.dlog-attack-icon {
    width: 56px;
    height: 56px;
    min-width: 56px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 50%, #b91c1c 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    color: white;
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.4), 0 4px 12px rgba(220, 38, 38, 0.3);
    position: relative;
    overflow: hidden;
}

.dlog-attack-icon::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shine 3s ease-in-out infinite;
}

.dlog-attack-icon i {
    animation: shieldPulse 2s ease-in-out infinite;
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

@keyframes shieldPulse {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }
    25% {
        transform: scale(1.05) rotate(-3deg);
    }
    75% {
        transform: scale(1.05) rotate(3deg);
    }
}

/* Attack steps container */
.dlog-steps-container {
    max-height: 550px;
    overflow-y: auto;
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 0;
    border: 2px solid rgba(239, 68, 68, 0.2);
    position: relative;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.1);
}

.dlog-steps-container.active {
    border-color: rgba(239, 68, 68, 0.35);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.2);
}

/* Empty state */
.dlog-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.dlog-empty-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.1));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    position: relative;
}

.dlog-empty-icon::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: inherit;
    border-radius: 50%;
    animation: ripple 2s ease-out infinite;
}

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

.dlog-empty-icon i {
    font-size: 36px;
    color: var(--accent-primary);
    animation: searchScan 2s ease-in-out infinite;
    position: relative;
    z-index: 1;
}

@keyframes searchScan {
    0%, 100% {
        transform: rotate(0deg) scale(1);
    }
    25% {
        transform: rotate(-10deg) scale(1.1);
    }
    75% {
        transform: rotate(10deg) scale(1.1);
    }
}

.dlog-empty-title {
    font-size: 1.15em;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.dlog-empty-subtitle {
    font-size: 0.95em;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.6;
    max-width: 400px;
}

/* Attack attempt items */
.dlog-attempt-item {
    background: var(--bg-tertiary);
    border-left: 4px solid var(--border-color);
    padding: 14px 14px 14px 55px;
    margin: 12px;
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.7;
    position: relative;
    border: 1px solid var(--border-color);
    animation: attemptSlideIn 0.3s ease;
}

@keyframes attemptSlideIn {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 0.7;
    }
}

.dlog-attempt-item::before {
    content: attr(data-attempt-number);
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    color: var(--text-muted);
    transition: all 0.3s ease;
}

.dlog-attempt-item.testing {
    border-left-color: #f59e0b;
    border-color: rgba(245, 158, 11, 0.3);
    opacity: 1;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(245, 158, 11, 0.05));
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.15);
    animation: testingPulse 1s ease-in-out infinite;
}

@keyframes testingPulse {
    0%, 100% {
        transform: translateX(0);
    }
    50% {
        transform: translateX(2px);
    }
}

.dlog-attempt-item.testing::before {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border-color: transparent;
    color: white;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: translateY(-50%) rotate(0deg);
    }
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

.dlog-attempt-item.failed {
    border-left-color: #6b7280;
    opacity: 0.5;
}

.dlog-attempt-item.failed::before {
    background: #6b7280;
    border-color: transparent;
    color: white;
    content: '✗';
    font-size: 14px;
}

.dlog-attempt-item.success {
    border-left-color: #10b981;
    border-left-width: 5px;
    border-color: rgba(16, 185, 129, 0.4);
    opacity: 1;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(16, 185, 129, 0.08));
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.25), 0 2px 8px rgba(16, 185, 129, 0.15);
    transform: scale(1.02);
    animation: successBounce 0.5s ease;
}

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

.dlog-attempt-item.success::before {
    background: linear-gradient(135deg, #10b981, #059669);
    border-color: transparent;
    color: white;
    content: '✓';
    font-size: 16px;
    transform: translateY(-50%) scale(1.2);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
    animation: checkmarkPop 0.5s ease;
}

@keyframes checkmarkPop {
    0% {
        transform: translateY(-50%) scale(0) rotate(-180deg);
    }
    50% {
        transform: translateY(-50%) scale(1.3) rotate(0deg);
    }
    100% {
        transform: translateY(-50%) scale(1.2) rotate(0deg);
    }
}

.dlog-attempt-content {
    font-size: 0.9em;
    line-height: 1.6;
    color: var(--text-secondary);
}

.dlog-attempt-item.testing .dlog-attempt-content {
    color: #f59e0b;
    font-weight: 500;
}

.dlog-attempt-item.success .dlog-attempt-content {
    color: var(--text-primary);
    font-weight: 600;
}

.dlog-attempt-content code {
    background: var(--bg-secondary);
    padding: 3px 7px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: var(--accent-primary);
    border: 1px solid var(--border-color);
}

.dlog-attempt-item.success .dlog-attempt-content code {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.3);
}

/* Progress bar */
.dlog-progress-bar {
    position: sticky;
    top: 0;
    background: var(--bg-tertiary);
    padding: 12px 16px;
    border-bottom: 2px solid var(--border-color);
    z-index: 10;
}

.dlog-progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.9em;
}

.dlog-progress-label {
    color: var(--text-primary);
    font-weight: 600;
}

.dlog-progress-count {
    color: var(--text-muted);
}

.dlog-progress-track {
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.dlog-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6, #ec4899);
    border-radius: 4px;
    transition: width 0.3s ease;
    position: relative;
}

.dlog-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: progressShine 1.5s ease-in-out infinite;
}

@keyframes progressShine {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Scrollbar styling for attack container */
.dlog-steps-container::-webkit-scrollbar {
    width: 10px;
}

.dlog-steps-container::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 5px;
}

.dlog-steps-container::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border-radius: 5px;
}

.dlog-steps-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .dlog-attack-header {
        flex-direction: column;
        gap: 12px;
    }

    .dlog-attack-icon {
        width: 48px;
        height: 48px;
        font-size: 22px;
    }

    .dlog-steps-container {
        max-height: 400px;
    }

    .dlog-attempt-item {
        padding: 12px 12px 12px 48px;
    }

    .dlog-attempt-item::before {
        width: 26px;
        height: 26px;
        font-size: 11px;
    }
}


/* =================== ENCRYPTION/DECRYPTION UI ENHANCEMENTS =================== */

/* Encryption Header */
.encrypt-header {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
    position: relative;
}

.encrypt-icon-wrapper {
    width: 56px;
    height: 56px;
    min-width: 56px;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #ec4899 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    color: white;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4), 0 4px 12px rgba(139, 92, 246, 0.3);
    position: relative;
    overflow: hidden;
    animation: lockFloat 3s ease-in-out infinite;
}

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

.encrypt-icon-wrapper::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shine 3s ease-in-out infinite;
}

.encrypt-icon-wrapper i {
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* Encrypt Info Box */
.encrypt-info-box {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(139, 92, 246, 0.12));
    border-left: 4px solid var(--accent-primary);
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 24px;
    display: flex;
    gap: 14px;
    align-items: flex-start;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.encrypt-info-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.encrypt-info-box:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.2);
}

.encrypt-info-box:hover::before {
    transform: translateX(100%);
}

.encrypt-info-box i {
    color: var(--accent-primary);
    font-size: 22px;
    margin-top: 2px;
    animation: pulse 2s ease-in-out infinite;
    position: relative;
    z-index: 1;
}

.encrypt-info-box strong {
    color: var(--text-primary);
    position: relative;
    z-index: 1;
}

/* Input Method Tabs */
.input-method-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    background: var(--bg-tertiary);
    padding: 8px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.input-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    border-radius: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.input-tab i {
    font-size: 16px;
}

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

.input-tab.active {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Input Sections */
.input-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.input-section.active {
    display: block;
}

/* Character Counter */
.char-count-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.char-count {
    font-size: 0.9em;
    font-weight: 600;
    color: var(--accent-primary);
}

.char-hint {
    font-size: 0.85em;
    color: var(--text-muted);
}

/* File Upload Area */
.file-upload-area {
    position: relative;
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05), rgba(139, 92, 246, 0.05));
}

.file-upload-area:hover {
    border-color: var(--accent-primary);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.1));
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.15);
}

.file-upload-icon {
    font-size: 32px;
    color: var(--accent-primary);
    margin-bottom: 12px;
    display: block;
    animation: fileUploadBounce 2s ease-in-out infinite;
}

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

.file-upload-text {
    font-size: 1em;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.file-upload-hint {
    font-size: 0.85em;
    color: var(--text-muted);
    margin: 6px 0 0 0;
}

/* File Info */
.file-info {
    margin-top: 16px;
}

.file-selected {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    animation: slideDown 0.3s ease;
}

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

.file-selected i {
    font-size: 20px;
    color: #10b981;
    flex-shrink: 0;
}

.file-details {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex: 1;
}

.file-details strong {
    color: var(--text-primary);
    font-size: 0.95em;
}

.file-details span {
    color: var(--text-muted);
    font-size: 0.85em;
    margin-top: 2px;
}

.file-remove-btn {
    background: transparent;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 18px;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.file-remove-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

/* Format Selector */
.format-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.format-option {
    cursor: pointer;
}

.format-option input {
    display: none;
}

.format-option label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.format-option input:checked + label {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(139, 92, 246, 0.15));
    border-color: var(--accent-primary);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.format-option label i {
    font-size: 24px;
    color: var(--accent-primary);
}

.format-option label div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.format-option label strong {
    color: var(--text-primary);
    font-size: 0.95em;
}

.format-option label span {
    color: var(--text-muted);
    font-size: 0.85em;
}

/* Encrypt/Decrypt Buttons */
.encrypt-btn,
.decrypt-btn {
    width: 100%;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
}

.encrypt-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 70%, #1d4ed8 100%);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4), 0 2px 6px rgba(37, 99, 235, 0.3);
}

.decrypt-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 70%, #047857 100%);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4), 0 2px 6px rgba(5, 150, 105, 0.3);
}

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

.encrypt-btn:hover,
.decrypt-btn:hover {
    transform: translateY(-3px);
}

.encrypt-btn:hover::before,
.decrypt-btn:hover::before {
    left: 100%;
}

.encrypt-btn:hover {
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.5), 0 4px 12px rgba(37, 99, 235, 0.4);
}

.decrypt-btn:hover {
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.5), 0 4px 12px rgba(5, 150, 105, 0.4);
}

.encrypt-btn i,
.decrypt-btn i {
    font-size: 18px;
    position: relative;
    z-index: 1;
}

/* Decrypt Header */
.decrypt-header {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.decrypt-icon-wrapper {
    width: 56px;
    height: 56px;
    min-width: 56px;
    background: linear-gradient(135deg, #10b981 0%, #059669 50%, #047857 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    color: white;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4), 0 4px 12px rgba(5, 150, 105, 0.3);
    position: relative;
    overflow: hidden;
    animation: lockOpenFloat 3s ease-in-out infinite;
}

@keyframes lockOpenFloat {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    50% {
        transform: translateY(-6px) rotate(-5deg);
    }
}

.decrypt-icon-wrapper::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shine 3s ease-in-out infinite;
}

.decrypt-icon-wrapper i {
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* Decrypt Info Box */
.decrypt-info-box {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(5, 150, 105, 0.12));
    border-left: 4px solid #10b981;
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 24px;
    display: flex;
    gap: 14px;
    align-items: flex-start;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.1);
}

.decrypt-info-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.decrypt-info-box:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.2);
}

.decrypt-info-box:hover::before {
    transform: translateX(100%);
}

.decrypt-info-box i {
    color: #10b981;
    font-size: 22px;
    margin-top: 2px;
    animation: pulse 2s ease-in-out infinite;
    position: relative;
    z-index: 1;
}

.decrypt-info-box strong {
    color: var(--text-primary);
    position: relative;
    z-index: 1;
}

/* Compact Textarea Styling */
#ciphertextInput {
    resize: vertical;
    min-height: 80px;
    max-height: 150px;
    overflow-y: auto;
    padding: 12px 14px;
    font-size: 0.9em;
    line-height: 1.4;
    transition: all 0.3s ease;
}

#ciphertextInput:focus {
    max-height: 200px;
}

/* Ciphertext Info Bar */
.ciphertext-info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    gap: 12px;
}

.format-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-secondary);
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 500;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.format-badge.json {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    border-color: rgba(59, 130, 246, 0.3);
}

.format-badge.ciphertext {
    background: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
    border-color: rgba(139, 92, 246, 0.3);
}

.format-badge i {
    font-size: 14px;
}

.length-badge {
    font-size: 0.85em;
    color: var(--text-muted);
    font-weight: 500;
}

/* Quick Actions */
.quick-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.action-btn:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.1));
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

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

.action-btn.secondary:hover {
    background: var(--bg-tertiary);
    border-color: #ef4444;
    color: #ef4444;
}

.action-btn i {
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    .encrypt-header,
    .decrypt-header {
        flex-direction: column;
        gap: 12px;
    }

    .encrypt-icon-wrapper,
    .decrypt-icon-wrapper {
        width: 48px;
        height: 48px;
        font-size: 22px;
    }

    .format-selector {
        grid-template-columns: 1fr;
    }

    .ciphertext-info-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .quick-actions {
        flex-direction: column;
    }

    .input-method-tabs {
        gap: 8px;
    }

    .input-tab span {
        display: none;
    }

    .input-tab {
        padding: 10px 12px;
    }
}
