html[data-theme="dark"] {
    --boss-black: #060b12;
    --boss-dark: #0d1521;
    --boss-gray: #172233;
    --boss-white: #f8fafc;
    --boss-silver: #cbd5e1;
    --page-bg: #060b12;
    --page-surface: #0d1521;
    --page-surface-alt: #111b28;
    --page-text: #e8eef6;
    --page-muted: #94a3b8;
    --page-border: rgba(100, 116, 139, 0.24);
    --page-table-head: #111b28;
    color-scheme: dark;
}

html[data-theme="dark"] body {
    background-color: #060b12 !important;
    color: #e8eef6 !important;
}

html[data-theme="dark"] nav {
    background: rgba(6, 11, 18, 0.94) !important;
    border-bottom-color: #ff6b00 !important;
}

html[data-theme="dark"] footer,
html[data-theme="dark"] .footer-bottom {
    background: #060b12 !important;
    color: #cbd5e1 !important;
}

html[data-theme="dark"] .page-header,
html[data-theme="dark"] .games-header,
html[data-theme="dark"] .materials-bar {
    background:
        linear-gradient(135deg, rgba(6, 11, 18, 0.97) 0%, rgba(15, 23, 36, 0.94) 100%) !important;
}

html[data-theme="dark"] .page-header p,
html[data-theme="dark"] .games-header p,
html[data-theme="dark"] .materials-bar,
html[data-theme="dark"] .footer-bottom,
html[data-theme="dark"] .footer-links a,
html[data-theme="dark"] .footer-about p {
    color: #cbd5e1 !important;
}

.theme-toggle-btn {
    margin-left: auto;
    border: 1px solid rgba(255, 183, 61, 0.55);
    border-radius: 999px;
    background: linear-gradient(180deg, #ffb53b 0%, #ff6b00 100%);
    color: #fffdf8;
    display: inline-flex;
    align-items: center;
    gap: 0.58rem;
    font-family: 'Oswald', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.58rem 1rem;
    cursor: pointer;
    box-shadow: 0 10px 18px rgba(255, 107, 0, 0.3);
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.theme-toggle-btn:hover {
    background: linear-gradient(180deg, #ffca6b 0%, #ff7a12 100%);
    border-color: rgba(255, 215, 145, 0.85);
    transform: translateY(-1px) scale(1.01);
    box-shadow: 0 14px 24px rgba(255, 107, 0, 0.38);
}

.theme-toggle-btn:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.96);
    outline-offset: 3px;
}

.theme-toggle-btn [data-theme-toggle-icon] {
    font-size: 1.08rem;
    line-height: 1;
}

html[data-theme="dark"] .theme-toggle-btn {
    background: linear-gradient(180deg, #ffe08a 0%, #ffb53b 100%);
    border-color: rgba(255, 224, 138, 0.88);
    color: #2d1800;
    box-shadow: 0 12px 22px rgba(255, 181, 59, 0.34);
}

html[data-theme="dark"] .theme-toggle-btn:hover {
    background: linear-gradient(180deg, #fff1bf 0%, #ffc761 100%);
    border-color: #fff1bf;
    box-shadow: 0 15px 26px rgba(255, 181, 59, 0.42);
}

html[data-theme="dark"] .resource-window {
    background: #0d1521;
    color: #e8eef6;
    border-color: rgba(148, 163, 184, 0.14);
}

html[data-theme="dark"] .resource-window-bar {
    background: linear-gradient(90deg, #09111a 0%, #111c2a 100%);
}

html[data-theme="dark"] .resource-workspace {
    background:
        radial-gradient(circle at top right, rgba(255, 107, 0, 0.12), transparent 26%),
        linear-gradient(180deg, #121c2a 0%, #0b1320 100%);
}

html[data-theme="dark"] .resource-panel,
html[data-theme="dark"] .text-editor-card,
html[data-theme="dark"] .text-helper-card,
html[data-theme="dark"] .unit-sidebar,
html[data-theme="dark"] .unit-main-card,
html[data-theme="dark"] .unit-common-card,
html[data-theme="dark"] .currency-shell,
html[data-theme="dark"] .currency-main-card,
html[data-theme="dark"] .currency-rates-card,
html[data-theme="dark"] .currency-live-card,
html[data-theme="dark"] .calculator-main-card,
html[data-theme="dark"] .calculator-history-card,
html[data-theme="dark"] .notepad-toolbar,
html[data-theme="dark"] .notepad-editor-card,
html[data-theme="dark"] .notepad-find-card,
html[data-theme="dark"] .rig-card,
html[data-theme="dark"] .rig-table-panel,
html[data-theme="dark"] .rig-stat-card {
    background: rgba(14, 23, 36, 0.92) !important;
    border-color: rgba(100, 116, 139, 0.24) !important;
    box-shadow: 0 16px 28px rgba(0, 0, 0, 0.22) !important;
    color: #e8eef6 !important;
}

html[data-theme="dark"] .calc-history-item {
    background: #111b28 !important;
    border-color: rgba(100, 116, 139, 0.28) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02) !important;
}

html[data-theme="dark"] .calculator-history-empty {
    background: #111b28 !important;
    border-color: rgba(100, 116, 139, 0.28) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02) !important;
}

html[data-theme="dark"] .currency-result-card,
html[data-theme="dark"] .calculator-screen {
    background: linear-gradient(180deg, rgba(15, 23, 36, 0.96) 0%, rgba(9, 15, 25, 0.96) 100%) !important;
    border-color: rgba(100, 116, 139, 0.22) !important;
}

html[data-theme="dark"] .rig-panel-title h2,
html[data-theme="dark"] .rig-card h3,
html[data-theme="dark"] .rig-table-head h3,
html[data-theme="dark"] .text-editor-head h3,
html[data-theme="dark"] .text-helper-card h4,
html[data-theme="dark"] .unit-sidebar h3,
html[data-theme="dark"] .unit-main-card h3,
html[data-theme="dark"] .unit-common-card h3,
html[data-theme="dark"] .currency-main-card h3,
html[data-theme="dark"] .currency-rates-card h3,
html[data-theme="dark"] .currency-live-card h4,
html[data-theme="dark"] .calculator-history-head h3,
html[data-theme="dark"] .notepad-editor-head h3,
html[data-theme="dark"] .notepad-find-head h3,
html[data-theme="dark"] .rig-latest-date,
html[data-theme="dark"] .rig-stat-value,
html[data-theme="dark"] .calculator-result,
html[data-theme="dark"] .calc-history-result {
    color: #f8fafc !important;
}

html[data-theme="dark"] .rig-panel-title p,
html[data-theme="dark"] .rig-status-banner,
html[data-theme="dark"] .rig-source-note,
html[data-theme="dark"] .rig-date-block-label,
html[data-theme="dark"] .rig-page-info,
html[data-theme="dark"] .rig-year-note,
html[data-theme="dark"] .text-counts,
html[data-theme="dark"] .text-helper-card p,
html[data-theme="dark"] .unit-toolbar-copy,
html[data-theme="dark"] .unit-helper-copy,
html[data-theme="dark"] .unit-result-note,
html[data-theme="dark"] .currency-intro,
html[data-theme="dark"] .currency-status-copy,
html[data-theme="dark"] .currency-meta-copy,
html[data-theme="dark"] .currency-live-card p,
html[data-theme="dark"] .currency-result-meta,
html[data-theme="dark"] .currency-result-note,
html[data-theme="dark"] .calculator-copy,
html[data-theme="dark"] .calculator-history-head p,
html[data-theme="dark"] .calculator-expression,
html[data-theme="dark"] .calculator-status,
html[data-theme="dark"] .notepad-copy,
html[data-theme="dark"] .notepad-editor-head p,
html[data-theme="dark"] .notepad-find-head p,
html[data-theme="dark"] .notepad-meta,
html[data-theme="dark"] .calc-history-expression,
html[data-theme="dark"] .calc-history-time,
html[data-theme="dark"] .calculator-history-empty,
html[data-theme="dark"] .rig-empty-state,
html[data-theme="dark"] .rig-empty-cell {
    color: #94a3b8 !important;
}

html[data-theme="dark"] .calc-history-expression {
    color: #cbd5e1 !important;
}

html[data-theme="dark"] .calc-history-time {
    color: #8ea2bb !important;
}

html[data-theme="dark"] .text-editor,
html[data-theme="dark"] .unit-field input,
html[data-theme="dark"] .unit-field select,
html[data-theme="dark"] .currency-inline-field input,
html[data-theme="dark"] .currency-inline-field select,
html[data-theme="dark"] .currency-live-select,
html[data-theme="dark"] .calc-history-note,
html[data-theme="dark"] .notepad-editor,
html[data-theme="dark"] .notepad-find-grid input {
    background: #09111a !important;
    border-color: rgba(100, 116, 139, 0.28) !important;
    color: #e8eef6 !important;
}

html[data-theme="dark"] .calc-history-note::placeholder {
    color: #7f93ab !important;
}

html[data-theme="dark"] .text-editor[readonly],
html[data-theme="dark"] .unit-field input[readonly],
html[data-theme="dark"] .currency-inline-field input[readonly] {
    background: #0d1724 !important;
}

html[data-theme="dark"] .text-action-btn,
html[data-theme="dark"] .text-mode-btn,
html[data-theme="dark"] .unit-chip,
html[data-theme="dark"] .unit-category-btn,
html[data-theme="dark"] .unit-common-btn,
html[data-theme="dark"] .notepad-toolbar-btn,
html[data-theme="dark"] .notepad-inline-btn,
html[data-theme="dark"] .calculator-history-clear,
html[data-theme="dark"] .calc-btn {
    background: #101a28 !important;
    border-color: rgba(100, 116, 139, 0.24) !important;
    color: #dbe5f1 !important;
}

html[data-theme="dark"] .text-mode-btn.is-active,
html[data-theme="dark"] .unit-chip.is-active,
html[data-theme="dark"] .unit-category-btn.is-active,
html[data-theme="dark"] .text-action-btn.is-primary,
html[data-theme="dark"] .currency-action-btn,
html[data-theme="dark"] .calc-btn.is-equal,
html[data-theme="dark"] .calc-history-use,
html[data-theme="dark"] .notepad-toolbar-btn.is-primary,
html[data-theme="dark"] .notepad-inline-btn.is-primary,
html[data-theme="dark"] .unit-swap {
    background: linear-gradient(180deg, #ffb53b 0%, #ff6b00 100%) !important;
    color: #fff !important;
}

html[data-theme="dark"] .currency-inverse-btn,
html[data-theme="dark"] .notepad-toolbar-btn.is-muted,
html[data-theme="dark"] .calc-btn.is-action {
    background: #162233 !important;
    color: #dbe5f1 !important;
}

html[data-theme="dark"] .calc-btn.is-clear {
    background: linear-gradient(180deg, #f87171 0%, #dc2626 100%) !important;
}

html[data-theme="dark"] .notepad-find-help {
    background: linear-gradient(180deg, rgba(40, 22, 4, 0.98) 0%, rgba(72, 39, 4, 0.96) 100%) !important;
    border-color: rgba(245, 158, 11, 0.25) !important;
    color: #fed7aa !important;
}

html[data-theme="dark"] .notepad-find-help::before {
    color: #fdba74 !important;
}

html[data-theme="dark"] .rig-table th {
    background: #111b28 !important;
    color: #94a3b8 !important;
}

html[data-theme="dark"] .rig-table td {
    border-bottom-color: rgba(100, 116, 139, 0.18) !important;
    color: #e8eef6 !important;
}

html[data-theme="dark"] .rig-bar-track {
    background: #0d1724 !important;
}

html[data-theme="dark"] .rig-bar-label,
html[data-theme="dark"] .rig-bar-value,
html[data-theme="dark"] .unit-field label,
html[data-theme="dark"] .currency-inline-field label,
html[data-theme="dark"] .notepad-find-field label {
    color: #cbd5e1 !important;
}
