/* ─── CSS Variables ─────────────────────────────────────────────── */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-tertiary: #eeeeee;
    --text-primary: #000000;
    --border-color: #dddddd;
    --button-hover: #e0e0e0;
    --button-active: #d0d0d0;
    --info-color: #2196f3;
    --equals-bg: #4caf50;
    --equals-text: #ffffff;
    --special-button-bg: #ff9800;
    --special-button-text: #ffffff;
}

body.dark-mode {
    --bg-primary: #1e1e1e;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #3d3d3d;
    --text-primary: #ffffff;
    --border-color: #444444;
    --button-hover: #404040;
    --button-active: #505050;
    --equals-bg: #66bb6a;
    --equals-text: #ffffff;
    --special-button-bg: #ffb74d;
    --special-button-text: #000000;
}

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

html, body {
    width: 100%;
    height: 100%;
    font-family: "Times New Roman", Times, serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s, color 0.3s;
}

body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

/* ─── Main Wrapper ───────────────────────────────────────────────── */
.Main {
    width: 100%;
    max-width: 650px;
    padding: 28px;
    background-color: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    position: relative;
}

/* ─── Show Notes Button ─────────────────────────────────────────── */
.show-notes-button {
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.1);
    border: 2px solid blue;
    padding: 3px;
    border-radius: 10px;
    cursor: pointer;
    color: black;
    position: absolute;
    width: fit-content;
    top: 15px;
    left: 10px;
    background-color: #f2f2f2;
    font-size: 13px;
    z-index: 200;
}

.show-notes-button:hover {
    background-color: lightseagreen;
}

/* ─── Toggle Mode Button ────────────────────────────────────────── */
.toggle-mode {
    background-color: #f2f2f2;
    border: 2px solid blue;
    padding: 3px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    color: black;
    position: absolute;
    width: fit-content;
    top: 15px;
    left: 100px;
    font-size: 13px;
    z-index: 200;
}

.toggle-mode:hover {
    color: red;
}

body.dark-mode .show-notes-button,
body.dark-mode .toggle-mode {
    background-color: #2d2d44;
    color: #aaaaff;
    border-color: #aaaaff;
}

/* ─── Notes ─────────────────────────────────────────────────────── */
.notes {
    display: none;
    list-style-type: square;
    font-size: larger;
    position: fixed;
    top: 60px;
    left: 20px;
    background-color: #f2f2f2;
    padding: 10px;
    border-radius: 15px;
    overflow-wrap: break-word;
    width: 400px;
    max-height: 80vh;
    overflow-y: auto;
    font-family: "Times New Roman", Times, serif;
    z-index: 300;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
    scrollbar-width: thin;
}

.notes li {
    color: blue;
    margin-bottom: 10px;
    border-bottom: 1px solid #ccc;
    padding-bottom: 5px;
}

body.dark-mode .notes {
    background-color: #2d2d44;
    color: #aaaaff;
}

body.dark-mode .notes li {
    color: #aaaaff;
    border-bottom-color: #444466;
}

/* ─── Calculator Grid ───────────────────────────────────────────── */
.calculator {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    width: 100%;
}

/* ─── Display Screen ────────────────────────────────────────────── */
#output-screen {
    grid-column: 1 / -1;
    width: 100%;
    padding: 18px 14px;
    font-size: 26px;
    font-weight: 500;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    text-align: right;
    overflow: hidden;
    white-space: nowrap;
    cursor: text;
    margin-bottom: 8px;
}

#output-screen:focus {
    outline: none;
    border-color: var(--info-color);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

#output-screen:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* ─── Buttons ───────────────────────────────────────────────────── */
.calculator button {
    padding: 18px;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    background-color: var(--button-hover);
    color: var(--text-primary);
    transition: all 0.15s ease;
    user-select: none;
}

.calculator button:hover:not(:disabled) {
    background-color: var(--button-active);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.calculator button:active:not(:disabled) {
    transform: translateY(0);
}

.calculator button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ─── Equal Button ──────────────────────────────────────────────── */
.calculator .equal {
    grid-column: 4;
    background-color: var(--equals-bg);
    color: var(--equals-text);
    font-weight: bold;
    font-size: 18px;
}

.calculator .equal:hover {
    background-color: #388e3c;
    opacity: 0.9;
}

/* ─── Special Buttons ───────────────────────────────────────────── */
#factorial-button,
#mod-button,
#gcd-button,
#lcm-button,
#prime-button {
    background-color: var(--special-button-bg);
    color: var(--special-button-text);
    font-weight: 600;
    font-size: 13px;
}

#factorial-button:hover,
#mod-button:hover,
#gcd-button:hover,
#lcm-button:hover,
#prime-button:hover {
    background-color: #f57c00;
    opacity: 0.9;
}

/* ─── History Button — full-width, red ──────────────────────────── */
.history-button {
    grid-column: 1 / -1;
    width: 100%;
    background-color: #e53935;
    color: #ffffff;
    font-family: "Times New Roman", Times, serif;
    font-size: 18px;
    font-weight: bold;
    padding: 18px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.1s ease;
}

.history-button:hover {
    background-color: red !important;
    opacity: 1 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.history-button:active {
    transform: translateY(0);
}

/* ─── History Bar — DESKTOP ─────────────────────────────────────── */
.history-bar {
    color: blue;
    position: fixed;
    top: 60px;
    right: 16px;
    left: calc(50% + 335px);
    width: auto;
    display: none;
    max-height: calc(100vh - 80px);
    overflow: hidden;
    padding: 10px;
    border-radius: 10px;
    font-family: "Times New Roman", Times, serif;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.1);
    overflow-wrap: break-word;
    background-color: #f2f2f2;
    z-index: 50;
    flex-direction: column;
}

.history-bar.visible {
    display: flex;
}

body.dark-mode .history-bar {
    background-color: #2d2d44;
    color: #aaaaff;
}

/* ─── Scrollable wrapper for all history items ─────────────────── */
.history-scroll-wrapper {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: #888 var(--bg-secondary);
    padding-right: 4px;
}

.history-scroll-wrapper::-webkit-scrollbar {
    width: 8px;
    display: block;
}

.history-scroll-wrapper::-webkit-scrollbar-track {
    background-color: var(--bg-secondary);
    border-radius: 4px;
}

.history-scroll-wrapper::-webkit-scrollbar-thumb {
    background-color: #888;
    border-radius: 4px;
}

.history-scroll-wrapper::-webkit-scrollbar-thumb:hover {
    background-color: #666;
}

body.dark-mode .history-scroll-wrapper {
    scrollbar-color: #666 #2d2d44;
}

body.dark-mode .history-scroll-wrapper::-webkit-scrollbar-track {
    background: #1e1e30;
}

body.dark-mode .history-scroll-wrapper::-webkit-scrollbar-thumb {
    background: #666;
}

/* ─── History Item ──────────────────────────────────────────────── */
.history-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 10px 5px;
    border-bottom: 1px solid #ccc;
    gap: 10px;
    position: relative;
}

.history-content {
    flex: 1;
    white-space: pre-wrap;
    word-break: break-all;
    overflow-wrap: break-word;
    font-family: "Times New Roman", Times, serif;
    max-height: 250px;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
    scrollbar-width: thin;
}

/* ─── Button Column ─────────────────────────────────────────────── */
.history-btn-col {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-self: flex-start;
    position: sticky;
    top: 0;
    z-index: 5;
}

/* ─── Copy History Button ───────────────────────────────────────── */
.copy-history-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: #e0e0e0;
    border-radius: 8px;
    border: 1px solid #ccc;
    transition: background 0.15s, transform 0.1s;
}

.copy-history-btn:hover {
    background: #c8c8c8;
    transform: scale(1.05);
}

body.dark-mode .copy-history-btn {
    background: #3a3a55;
    border-color: #555577;
    color: #fff;
}

body.dark-mode .copy-history-btn:hover {
    background: #4a4a65;
}

/* ─── Scroll Up/Down Buttons ────────────────────────────────────── */
.scroll-history-btn {
    flex-shrink: 0;
    width: 36px;
    height: 28px;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: #d8e8f8;
    border-radius: 6px;
    border: 1px solid #aac4e0;
    transition: background 0.15s, transform 0.1s;
    color: #2a5a8a;
}

.scroll-history-btn:hover {
    background: #b8d4f0;
    transform: scale(1.08);
}

.scroll-history-btn:active {
    transform: scale(0.95);
}

body.dark-mode .scroll-history-btn {
    background: #2a3a55;
    border-color: #4a5a77;
    color: #8ab4e8;
}

body.dark-mode .scroll-history-btn:hover {
    background: #3a4a65;
}

/* ─── Clear History Button ──────────────────────────────────────── */
.clear-history-btn {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 6px;
    border-radius: 8px;
    font-size: 14px;
    color: red;
    border: 1px solid #ffaaaa;
    cursor: pointer;
    background-color: transparent;
}

.clear-history-btn:hover {
    background-color: #fff0f0;
}

/* ─── Clock ─────────────────────────────────────────────────────── */
.clock {
    position: fixed;
    top: 8px;
    right: 10px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    font-size: 15px;
    font-family: "Times New Roman", Times, serif;
    background-color: lightseagreen;
    padding: 5px 10px;
    border-radius: 8px;
    border-bottom: 2px solid #ccc;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
    white-space: nowrap;
}

#day, #month, #date {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    font-size: 13px;
    font-family: "Times New Roman", Times, serif;
    background-color: rgba(255,255,255,0.25);
    padding: 2px 6px;
    border-radius: 6px;
}

/* ─── Developer Link ────────────────────────────────────────────── */
.developer-link {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #1976d2;
    color: #ffffff;
    font-size: 20px;
    font-weight: bold;
    font-family: "Times New Roman", Times, serif;
    border: none;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    transition: background 0.15s, transform 0.1s;
}

.developer-link:hover {
    background-color: #1565c0;
    transform: scale(1.08);
}

body.dark-mode .developer-link {
    background-color: #3a3a55;
    color: #aaaaff;
}

body.dark-mode .developer-link:hover {
    background-color: #4a4a65;
}

/* ─── Loading Overlay ───────────────────────────────────────────── */
.loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.4);
    z-index: 999;
    align-items: center;
    justify-content: center;
}

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

.spinner {
    width: 36px;
    height: 36px;
    border: 4px solid #ccc;
    border-top-color: green;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* ─── Modal ─────────────────────────────────────────────────────── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: fadeIn 0.15s ease;
}

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

.modal-panel {
    background: #ecf0f3;
    border-radius: 18px;
    padding: 24px 22px 18px;
    width: min(560px, 96vw);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22);
    display: flex;
    flex-direction: column;
    gap: 14px;
    animation: slideUp 0.18s ease;
}

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

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

.modal-title {
    font-size: 15px;
    font-weight: 700;
    color: #333;
    letter-spacing: 0.01em;
}

.modal-close {
    background: none;
    border: none;
    font-size: 18px;
    color: #888;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.15s, color 0.15s;
}

.modal-close:hover {
    background: #e0e0e0;
    color: #333;
}

.modal-input {
    width: 100%;
    min-height: 110px;
    max-height: 55vh;
    resize: vertical;
    border: 2px solid #c8ccd4;
    border-radius: 12px;
    background: #f7f8fa;
    box-shadow: inset 2px 2px 6px rgba(0, 0, 0, 0.07);
    padding: 12px 14px;
    font-size: 15px;
    font-family: "Times New Roman", Times, serif;
    color: #1a7a3a;
    line-height: 1.5;
    word-break: break-all;
    transition: border-color 0.15s;
    text-align: left;
    box-sizing: border-box;
}

.modal-input:focus {
    border-color: #4a90d9;
    outline: none;
    background: #fff;
}

.modal-error {
    background: #fff0f0;
    border: 1px solid #ffaaaa;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    color: darkred;
    word-break: break-word;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-btn {
    height: 38px;
    padding: 0 22px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.10);
    transition: background 0.15s, transform 0.1s;
}

.modal-btn:active { transform: scale(0.97); }

.modal-cancel {
    background: #e8e8e8;
    color: #555;
}

.modal-cancel:hover { background: #d8d8d8; }

.modal-confirm {
    background: #2d8a52;
    color: #fff;
}

.modal-confirm:hover { background: #246e42; }

body.dark-mode .modal-panel {
    background: #2d2d44;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

body.dark-mode .modal-title { color: #ddddff; }
body.dark-mode .modal-close { color: #aaaacc; }

body.dark-mode .modal-close:hover {
    background: #3a3a55;
    color: #eeeeee;
}

body.dark-mode .modal-input {
    background: #1e1e30;
    border-color: #555577;
    color: #7fffb2;
}

body.dark-mode .modal-input:focus {
    border-color: #7a9fd9;
    background: #22223a;
}

body.dark-mode .modal-error {
    background: #3a1a1a;
    border-color: #aa4444;
    color: #ff9999;
}

body.dark-mode .modal-cancel {
    background: #3a3a55;
    color: #ccccee;
}

body.dark-mode .modal-cancel:hover { background: #44445f; }

body.dark-mode .modal-confirm {
    background: #1e6e40;
    color: #ccffdd;
}

body.dark-mode .modal-confirm:hover { background: #186035; }

/* ─── Calc Notices ──────────────────────────────────────────────── */
.calc-notice {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    min-width: 260px;
    max-width: min(480px, 92vw);
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 14px;
    font-family: "Times New Roman", Times, serif;
    font-weight: 600;
    text-align: center;
    word-break: break-word;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
    animation: noticeIn 0.2s ease;
    cursor: pointer;
}

@keyframes noticeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.calc-notice--error {
    background: #fff0f0;
    border: 1.5px solid #ffaaaa;
    color: darkred;
}

.calc-notice--success {
    background: #edfff4;
    border: 1.5px solid #7ed8a0;
    color: #1a6e38;
}

.calc-notice--info {
    background: #f0f4ff;
    border: 1.5px solid #a0b4e8;
    color: #2a3d80;
}

body.dark-mode .calc-notice--error {
    background: #3a1a1a;
    border-color: #aa4444;
    color: #ff9999;
}

body.dark-mode .calc-notice--success {
    background: #1a2e22;
    border-color: #4a9a66;
    color: #7fffb2;
}

body.dark-mode .calc-notice--info {
    background: #1a1e30;
    border-color: #5566aa;
    color: #aabbff;
}

/* ─── Accessibility ─────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

button:focus-visible {
    outline: 2px solid var(--info-color);
    outline-offset: 2px;
}

/* ─── Tablet 601px–900px ────────────────────────────────────────── */
@media only screen and (min-width: 601px) and (max-width: 900px) {
    .history-bar {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        width: 100%;
        max-width: 650px;
        margin: 16px auto 0;
        max-height: 50vh;
        overflow: hidden;
        scrollbar-width: thin;
        flex-direction: column;
    }

    .history-bar.visible {
        display: flex;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   MOBILE  ≤ 600px
═══════════════════════════════════════════════════════════════════ */
@media only screen and (max-width: 600px) {

    .clock, #day, #month, #date, .show-notes-button, .notes {
        display: none !important;
    }

    body {
        display: flex;
        flex-direction: column;
        height: 100dvh;
        min-height: 100dvh;
        justify-content: flex-start;
        align-items: stretch;
        padding: 0;
        overflow: hidden;
    }

    .toggle-mode {
        position: fixed;
        top: 8px;
        left: 8px;
        z-index: 300;
    }

    .Main {
        flex-shrink: 0;
        width: 100%;
        max-width: 100%;
        border-radius: 0;
        padding: 10px;
        margin-top: 40px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    }

    .calculator { gap: 6px; }
    .calculator button { padding: 13px 8px; font-size: 14px; }
    #output-screen { padding: 12px 10px; font-size: 19px; }

    .history-bar {
        position: fixed !important;
        top: auto;
        left: 0;
        right: 0;
        width: 100%;
        height: auto;
        max-height: calc(100dvh - 485px);
        min-height: 0;
        margin: 0;
        border-radius: 0;
        padding: 0;
        display: none;
        background: var(--bg-secondary);
        box-shadow: inset 0 2px 6px rgba(0,0,0,0.08);
        flex-direction: column;
        overflow: hidden;
    }

    .history-bar.visible { display: flex !important; }

    .history-scroll-wrapper {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: scroll;
        -webkit-overflow-scrolling: touch;
        padding: 8px 8px 4px;
        display: flex;
        flex-direction: column;
        gap: 8px;
        scrollbar-width: thin;
        scrollbar-color: #999 #e0e0e0;
    }

    .history-scroll-wrapper::-webkit-scrollbar {
        width: 6px;
        display: block;
    }

    .history-scroll-wrapper::-webkit-scrollbar-track { background: #e0e0e0; }
    .history-scroll-wrapper::-webkit-scrollbar-thumb { background: #999; border-radius: 3px; }

    body.dark-mode .history-scroll-wrapper {
        scrollbar-color: #555 #2a2a3a;
    }

    body.dark-mode .history-scroll-wrapper::-webkit-scrollbar-track { background: #2a2a3a; }
    body.dark-mode .history-scroll-wrapper::-webkit-scrollbar-thumb { background: #555; }

    .history-item {
        flex-shrink: 0;
        background-color: #ffffff;
        border: 1px solid #ddd;
        border-radius: 6px;
        padding: 10px;
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 8px;
        box-shadow: 0 1px 2px rgba(0,0,0,0.08);
    }

    body.dark-mode .history-item {
        background-color: #3a3a55;
        border-color: #555577;
    }

    .history-content {
        flex: 1;
        font-size: 13px;
        line-height: 1.6;
        font-family: 'Courier New', monospace;
        color: var(--text-primary);
        white-space: pre-wrap;
        word-break: break-all;
        overflow-wrap: break-word;
        max-height: 220px;
        overflow-y: auto;
        overflow-x: hidden;
        scroll-behavior: smooth;
        scrollbar-width: thin;
        scrollbar-color: #bbb #f0f0f0;
    }

    body.dark-mode .history-content {
        scrollbar-color: #555 #2a2a40;
    }

    .scroll-history-btn {
        width: 46px;
        height: 40px;
        font-size: 20px;
        background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
        color: white;
        border-radius: 6px;
        border: 2px solid #1565c0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .copy-history-btn {
        width: 40px;
        height: 40px;
        font-size: 18px;
        background: #e8e8e8;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    body.dark-mode .copy-history-btn { background: #4a4a65; }

    .clear-history-btn {
        flex-shrink: 0;
        padding: 14px;
        font-size: 14px;
        width: 100%;
        color: red;
        text-align: center;
        border: 1px solid #ffaaaa;
        border-radius: 8px;
        cursor: pointer;
        background-color: #fff0f0;
    }
}

/* ─── Very small screens ≤ 400px ────────────────────────────────── */
@media only screen and (max-width: 400px) {
    .calculator button { padding: 11px 6px; font-size: 13px; }
    #output-screen { font-size: 16px; padding: 10px 8px; }
    .history-button { font-size: 13px; padding: 11px; }
    .scroll-history-btn { width: 40px; height: 38px; font-size: 16px; }
    .history-content { font-size: 12px; }
}
/* ─── History loading skeleton ──────────────────────────────────── */
@keyframes shimmer {
    0%   { background-position: -600px 0; }
    100% { background-position: 600px 0; }
}

.history-loading-row {
    height: 14px;
    width: 100%;
    border-radius: 6px;
    margin-bottom: 12px;
    background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
    background-size: 600px 100%;
    animation: shimmer 1.4s infinite linear;
}

body.dark-mode .history-loading-row {
    background: linear-gradient(90deg, #2a2a3a 25%, #3a3a4e 50%, #2a2a3a 75%);
    background-size: 600px 100%;
}