/* standard.css — extracted verbatim from original inline <style>; logic/behavior unchanged, only relocated */
/* ==========================================================================
           1. DESIGN SYSTEM & VARIABLES (Synced with Dashboard)
           ========================================================================== */
        :root {
            --font-main: 'Plus Jakarta Sans', sans-serif;
            --transition-speed: 0.4s;
            --transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
            
            /* Light Theme Variables */
            --bg-page: #f8fafc;
            --calc-bg: #ffffff;
            --bg-widget: rgba(241, 245, 249, 0.6);
            --border-color: rgba(15, 23, 42, 0.06);
            --text-main: #0f172a;
            --text-muted: #64748b;
            --accent-glow: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #c084fc 100%);
            
            /* Keypad - Light */
            --btn-num-bg: rgba(241, 245, 249, 0.8);
            --btn-num-text: #0f172a;
            --btn-op-bg: rgba(79, 70, 229, 0.08);
            --btn-op-text: #4f46e5;
            --btn-fn-bg: rgba(241, 245, 249, 0.5);
            --btn-fn-text: #64748b;
            --btn-eq-bg: linear-gradient(135deg, #4f46e5, #7c3aed);
            --btn-eq-text: #ffffff;
            
            --btn-hover-bg: rgba(15, 23, 42, 0.04);
            --calc-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.04);
        }

        body.dark-mode {
            /* Dark Theme Variables */
            --bg-page: #020617;
            --calc-bg: rgba(15, 23, 42, 0.6);
            --bg-widget: rgba(30, 41, 59, 0.5);
            --border-color: rgba(255, 255, 255, 0.06);
            --text-main: #f8fafc;
            --text-muted: #94a3b8;
            
            /* Keypad - Dark */
            --btn-num-bg: rgba(255, 255, 255, 0.03);
            --btn-num-text: #f8fafc;
            --btn-op-bg: rgba(192, 132, 252, 0.1);
            --btn-op-text: #c084fc;
            --btn-fn-bg: rgba(255, 255, 255, 0.01);
            --btn-fn-text: #94a3b8;
            
            --btn-hover-bg: rgba(255, 255, 255, 0.05);
            --calc-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
        }

        /* ==========================================================================
           2. GLOBAL STYLES & LAYOUT
           ========================================================================== */
        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
            user-select: none;
            -webkit-user-select: none;
        }

        body {
            font-family: var(--font-main);
            background: var(--bg-page);
            color: var(--text-main);
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 20px;
            transition: background-color var(--transition-speed), color var(--transition-speed);
            overflow: hidden;
            position: relative;
        }

        body::before {
            content: '';
            position: absolute;
            width: 400px;
            height: 400px;
            border-radius: 50%;
            filter: blur(150px);
            opacity: 0.15;
            z-index: -1;
            top: -10%; left: -10%; background: #4f46e5;
        }

        /* ==========================================================================
           3. CONTAINER STYLES
           ========================================================================== */
        .calc-container {
            position: relative;
            width: 100%;
            max-width: 430px;
            height: 840px;
            background: var(--calc-bg);
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            border: 1px solid var(--border-color);
            border-radius: 28px;
            box-shadow: var(--calc-shadow);
            display: flex;
            flex-direction: column;
            overflow: hidden;
            transition: var(--transition-smooth);
        }

        .calc-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 20px 24px 10px 24px;
            z-index: 10;
        }

        .calc-title {
            font-family: 'Space Grotesk', sans-serif;
            font-size: 1.2rem;
            font-weight: 700;
            letter-spacing: -0.5px;
        }

        .header-controls {
            display: flex;
            gap: 10px;
            align-items: center;
        }

        .icon-btn {
            background: var(--bg-widget);
            border: 1px solid var(--border-color);
            color: var(--text-main);
            width: 38px;
            height: 38px;
            border-radius: 12px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: var(--transition-smooth);
        }

        .icon-btn:hover {
            transform: scale(1.05);
            border-color: #4f46e5;
        }

        body.dark-mode .icon-btn:hover {
            border-color: #c084fc;
        }

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

        /* ==========================================================================
           4. DISPLAY SCREEN
           ========================================================================== */
        .calc-screen {
            padding: 10px 28px 20px 28px;
            display: flex;
            flex-direction: column;
            justify-content: flex-end;
            align-items: flex-end;
            min-height: 150px;
            text-align: right;
        }

        .screen-history {
            font-size: 1rem;
            color: var(--text-muted);
            min-height: 24px;
            margin-bottom: 6px;
            width: 100%;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .screen-current {
            font-family: 'Space Grotesk', sans-serif;
            font-size: 2.8rem;
            font-weight: 700;
            width: 100%;
            white-space: nowrap;
            overflow: hidden;
        }

        /* ==========================================================================
           5. KEYPAD & BUTTONS
           ========================================================================== */
        .memory-bar {
            display: grid;
            grid-template-columns: repeat(5, 1fr);
            gap: 6px;
            padding: 0 24px 12px 24px;
        }

        .mem-btn {
            background: transparent;
            border: none;
            font-size: 0.8rem;
            font-weight: 700;
            color: var(--text-muted);
            padding: 8px 0;
            border-radius: 8px;
            cursor: pointer;
            transition: var(--transition-smooth);
        }

        .mem-btn:hover:not(:disabled) {
            color: var(--text-main);
            background: var(--btn-hover-bg);
        }

        .mem-btn:disabled { opacity: 0.25; cursor: not-allowed; }

        .mem-btn.active-mem { color: #4f46e5; }
        body.dark-mode .mem-btn.active-mem { color: #c084fc; }

        .calc-keypad {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 12px;
            padding: 12px 24px 24px 24px;
            flex-grow: 1;
        }

        .btn {
            border: 1px solid var(--border-color);
            outline: none;
            font-size: 1.15rem;
            font-weight: 600;
            border-radius: 16px;
            cursor: pointer;
            display: flex;
            justify-content: center;
            align-items: center;
            transition: background-color 0.2s, transform 0.1s, border-color 0.2s;
        }

        .btn-num { background: var(--btn-num-bg); color: var(--btn-num-text); font-weight: 700; }
        .btn-op { background: var(--btn-op-bg); color: var(--btn-op-text); font-size: 1.3rem; }
        .btn-fn { background: var(--btn-fn-bg); color: var(--btn-fn-text); }
        .btn-eq { background: var(--btn-eq-bg); color: var(--btn-eq-text); font-size: 1.4rem; border: none; }

        .btn:hover, .btn.keyboard-active {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
        }
        .btn:active { transform: scale(0.96); }

        /* ==========================================================================
           6. HISTORY SIDEBAR
           ========================================================================== */
        .history-panel {
            position: absolute;
            top: 0; right: -100%;
            width: 100%; height: 100%;
            background: var(--calc-bg);
            backdrop-filter: blur(25px);
            -webkit-backdrop-filter: blur(25px);
            z-index: 100;
            transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
            display: flex;
            flex-direction: column;
        }

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

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

        .history-title { font-family: 'Space Grotesk', sans-serif; font-size: 1.3rem; font-weight: 700; }

        .history-list {
            flex-grow: 1;
            overflow-y: auto;
            padding: 20px 24px;
            display: flex;
            flex-direction: column;
            gap: 16px;
        }

        .history-item { text-align: right; padding: 10px; border-radius: 12px; cursor: pointer; transition: var(--transition-smooth); }
        .history-item:hover { background: var(--btn-hover-bg); }
        .history-item-expr { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 4px; }
        .history-item-res { font-size: 1.25rem; font-weight: 700; }

        .history-footer { padding: 20px 24px; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; }
        .clear-hist-btn { background: transparent; border: none; color: #4f46e5; font-size: 0.9rem; font-weight: 700; cursor: pointer; }
        body.dark-mode .clear-hist-btn { color: #c084fc; }

        .toast {
            position: absolute; bottom: 35px; left: 50%; transform: translate(-50%, 20px);
            background: #0f172a; color: #ffffff; padding: 10px 20px; border-radius: 50px;
            font-size: 0.85rem; font-weight: 600; opacity: 0; pointer-events: none;
            transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1); z-index: 200;
        }
        body.dark-mode .toast { background: #f8fafc; color: #0f172a; }
        .toast.show { transform: translate(-50%, 0); opacity: 1; }

        /* Sync structure for theme toggler SVG visibility rules */
        .theme-btn .sun-icon,
        body.dark-mode .theme-btn .moon-icon { display: none; }
        body.dark-mode .theme-btn .sun-icon { display: block; }

        @media (max-width: 480px) {
            body { padding: 0; }
            .calc-container { max-width: 100%; height: 100vh; border-radius: 0; border: none; }
        }
