/* ==========================================================================
   Rubik's Bluetooth Timer - Multi-Theme & Multi-Color Matrix Stylesheet
   ========================================================================== */

:root {
    /* Base Surface Palette (Default: Precision Dark) */
    --bg-primary: #0D0E12;
    --bg-surface: #16181F;
    --bg-surface-elevated: #1F222C;
    --bg-surface-hover: #282C38;
    --border-color: #2D3240;
    --border-subtle: #232733;

    --text-primary: #F4F4F6;
    --text-secondary: #9DA3B4;
    --text-muted: #646A7E;

    /* Accent Color Palette (Default: Emerald Green) */
    --accent-primary: #10B981;
    --accent-hover: #059669;
    --accent-active: #047857;
    --accent-glow: rgba(16, 185, 129, 0.4);
    --accent-subtle: rgba(16, 185, 129, 0.15);
    --accent-text: #FFFFFF;

    --warning-primary: #F59E0B;   /* Amber */
    --danger-primary: #EF4444;    /* Red */
    --info-primary: #3B82F6;      /* Blue */

    --font-mono: 'JetBrains Mono', 'Fira Code', SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --shadow-subtle: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* ==========================================================================
   1. Visual Design Styles (主体设计框架)
   ========================================================================== */

/* 1.1 Precision Dark (极简暗黑 - 默认) */
body.style-dark, body.theme-dark {
    --bg-primary: #0D0E12;
    --bg-surface: #16181F;
    --bg-surface-elevated: #1F222C;
    --bg-surface-hover: #282C38;
    --border-color: #2D3240;
    --border-subtle: #232733;

    --text-primary: #F4F4F6;
    --text-secondary: #9DA3B4;
    --text-muted: #646A7E;
}

/* 1.2 Apple Liquid Glass (苹果流体玻璃 iOS / visionOS / macOS) */
body.style-apple, body.theme-apple {
    --bg-primary: #000000;
    --bg-surface: rgba(28, 28, 30, 0.78);
    --bg-surface-elevated: rgba(44, 44, 46, 0.82);
    --bg-surface-hover: rgba(58, 58, 60, 0.9);
    --border-color: rgba(255, 255, 255, 0.14);
    --border-subtle: rgba(255, 255, 255, 0.08);

    --text-primary: #FFFFFF;
    --text-secondary: rgba(235, 235, 245, 0.72);
    --text-muted: rgba(235, 235, 245, 0.42);

    --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "SF Pro", "Helvetica Neue", sans-serif;
    --font-mono: "SF Mono", "JetBrains Mono", Menlo, Monaco, Consolas, monospace;

    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --shadow-subtle: 0 8px 32px rgba(0, 0, 0, 0.6);
}

body.style-apple .card-collapsible,
body.style-apple .arena-card,
body.style-apple .module-toggle-toolbar,
body.style-apple .app-header,
body.style-apple .modal-card,
body.theme-apple .card-collapsible,
body.theme-apple .arena-card,
body.theme-apple .module-toggle-toolbar,
body.theme-apple .app-header,
body.theme-apple .modal-card {
    backdrop-filter: blur(28px) saturate(190%);
    -webkit-backdrop-filter: blur(28px) saturate(190%);
    border: 0.5px solid rgba(255, 255, 255, 0.13);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 8px 24px rgba(0, 0, 0, 0.45);
}

body.style-apple .app-nav-tabs,
body.theme-apple .app-nav-tabs {
    background: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    gap: 2px;
    padding: 0 4px;
}

body.style-apple .nav-tab-btn,
body.theme-apple .nav-tab-btn {
    background: transparent;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    color: rgba(235, 235, 245, 0.65);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
    transition: background 0.15s ease, color 0.15s ease;
}

body.style-apple .nav-tab-btn:hover:not(.active),
body.theme-apple .nav-tab-btn:hover:not(.active) {
    color: #FFFFFF;
    background: rgba(118, 118, 128, 0.24);
}

body.style-apple .nav-tab-btn.active,
body.theme-apple .nav-tab-btn.active {
    background: #000000 !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    border-bottom: 1px solid #000000 !important;
    color: #FFFFFF !important;
    font-weight: 600;
    box-shadow: none !important;
    margin-bottom: -1px !important;
}

body.style-apple .module-toggle-toolbar,
body.theme-apple .module-toggle-toolbar {
    background: rgba(28, 28, 30, 0.72);
    border-radius: 18px;
    padding: 0.4rem;
}

body.style-apple .module-chip-btn,
body.theme-apple .module-chip-btn {
    background: rgba(44, 44, 46, 0.6);
    border: 0.5px solid rgba(255, 255, 255, 0.08);
    border-radius: 13px;
    transition: transform 0.15s cubic-bezier(0.25, 1, 0.5, 1), background 0.18s ease, box-shadow 0.18s ease;
}

body.style-apple .module-chip-btn:active,
body.theme-apple .module-chip-btn:active {
    transform: scale(0.94);
}

body.style-apple .module-chip-btn.active,
body.theme-apple .module-chip-btn.active {
    background: var(--accent-primary, #10B981) !important;
    border-color: rgba(255, 255, 255, 0.35) !important;
    color: #FFFFFF !important;
    box-shadow: 0 4px 14px var(--accent-glow, rgba(16, 185, 129, 0.4)) !important;
}

body.style-apple .module-chip-btn.active svg,
body.theme-apple .module-chip-btn.active svg {
    stroke: #FFFFFF !important;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
}

body.style-apple .module-chip-btn.active .module-chip-text,
body.theme-apple .module-chip-btn.active .module-chip-text {
    color: #FFFFFF !important;
    font-weight: 700 !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

body.style-apple .btn:active,
body.style-apple .nav-tab-btn:active,
body.style-apple .btn-panel-toggle:active,
body.theme-apple .btn:active,
body.theme-apple .nav-tab-btn:active,
body.theme-apple .btn-panel-toggle:active {
    transform: scale(0.95);
    transition: transform 0.1s cubic-bezier(0.25, 1, 0.5, 1);
}

body.style-apple .btn,
body.theme-apple .btn {
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.15s cubic-bezier(0.25, 1, 0.5, 1);
}

body.style-apple .btn-primary,
body.theme-apple .btn-primary {
    background: var(--accent-primary);
    color: var(--accent-text, #FFFFFF);
    box-shadow: 0 2px 8px var(--accent-glow);
}

body.style-apple .btn-primary:hover,
body.theme-apple .btn-primary:hover {
    background: var(--accent-hover);
}

body.style-apple .btn-secondary,
body.theme-apple .btn-secondary {
    background: rgba(118, 118, 128, 0.24);
    border: 0.5px solid rgba(255, 255, 255, 0.1);
    color: #FFFFFF;
}

body.style-apple .collapsible-header,
body.theme-apple .collapsible-header {
    background: rgba(44, 44, 46, 0.65);
    border-bottom: 0.5px solid rgba(255, 255, 255, 0.08);
}

body.style-apple .card-collapsible.collapsed .btn-panel-toggle,
body.theme-apple .card-collapsible.collapsed .btn-panel-toggle {
    background: var(--accent-subtle);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

body.style-apple .timer-digits,
body.theme-apple .timer-digits {
    font-weight: 700;
    letter-spacing: -0.04em;
}

/* 1.3 Material Design 3 (谷歌 M3) */
body.style-material, body.theme-material {
    --bg-primary: #141218;
    --bg-surface: #211F26;
    --bg-surface-elevated: #2B2930;
    --bg-surface-hover: #36343B;
    --border-color: #49454F;
    --border-subtle: #36343B;

    --text-primary: #E6E0E9;
    --text-secondary: #CAC4D0;
    --text-muted: #938F99;

    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --shadow-subtle: 0 4px 16px rgba(0, 0, 0, 0.45);
}

body.style-material .btn,
body.style-material .badge,
body.style-material .btn-panel-toggle,
body.theme-material .btn,
body.theme-material .badge,
body.theme-material .btn-panel-toggle {
    border-radius: 9999px;
}

body.style-material .card-collapsible,
body.style-material .arena-card,
body.style-material .module-toggle-toolbar,
body.style-material .modal-card,
body.theme-material .card-collapsible,
body.theme-material .arena-card,
body.theme-material .module-toggle-toolbar,
body.theme-material .modal-card {
    border-radius: 18px;
}

body.style-material .module-chip-btn,
body.theme-material .module-chip-btn {
    border-radius: 12px;
}

body.style-material .module-chip-btn.active,
body.theme-material .module-chip-btn.active {
    background-color: var(--accent-subtle);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    box-shadow: 0 2px 8px var(--accent-glow);
}

body.style-material .module-chip-btn.active svg,
body.theme-material .module-chip-btn.active svg {
    stroke: var(--accent-primary);
    filter: drop-shadow(0 0 4px var(--accent-glow));
}

body.style-material .module-chip-btn.active .module-chip-text,
body.theme-material .module-chip-btn.active .module-chip-text {
    color: var(--accent-primary);
}

body.style-material .app-nav-tabs,
body.theme-material .app-nav-tabs {
    border-bottom: 1px solid var(--border-color, #49454F);
    gap: 2px;
    padding: 0 4px;
}

body.style-material .nav-tab-btn,
body.theme-material .nav-tab-btn {
    border-radius: 8px 8px 0 0;
    border: 1px solid transparent;
    border-bottom: none;
    background: transparent;
    color: var(--text-secondary, #CAC4D0);
}

body.style-material .nav-tab-btn:hover:not(.active),
body.theme-material .nav-tab-btn:hover:not(.active) {
    background: var(--bg-surface-hover, rgba(255, 255, 255, 0.08));
    color: var(--text-primary);
}

body.style-material .nav-tab-btn.active,
body.theme-material .nav-tab-btn.active {
    background-color: var(--bg-primary, #141218) !important;
    border: 1px solid var(--border-color, #49454F) !important;
    border-bottom: 1px solid var(--bg-primary, #141218) !important;
    color: var(--accent-primary) !important;
    font-weight: 700;
    box-shadow: none !important;
    margin-bottom: -1px !important;
}

body.style-material .btn-primary,
body.theme-material .btn-primary {
    background-color: var(--accent-primary);
    color: var(--accent-text, #FFFFFF);
}

body.style-material .btn-primary:hover,
body.theme-material .btn-primary:hover {
    background-color: var(--accent-hover);
}

body.style-material .collapsible-header,
body.theme-material .collapsible-header {
    background-color: #2B2930;
}

body.style-material .card-collapsible.collapsed .btn-panel-toggle,
body.theme-material .card-collapsible.collapsed .btn-panel-toggle {
    background-color: var(--accent-subtle);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* 1.4 Cyber Neon (赛博霓虹) */
body.style-cyber, body.theme-cyber {
    --bg-primary: #050811;
    --bg-surface: #0B1021;
    --bg-surface-elevated: #111833;
    --bg-surface-hover: #192247;
    --border-color: #1E2B58;
    --border-subtle: #141D3B;

    --text-primary: #E0F2FE;
    --text-secondary: #7DD3FC;
    --text-muted: #38BDF8;
}

/* 1.5 Clean Light (明亮极简日间) */
body.style-light, body.theme-light {
    --bg-primary: #F8FAFC;
    --bg-surface: #FFFFFF;
    --bg-surface-elevated: #F1F5F9;
    --bg-surface-hover: #E2E8F0;
    --border-color: #CBD5E1;
    --border-subtle: #E2E8F0;

    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-muted: #94A3B8;

    --shadow-subtle: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* 1.6 Designmodo Flat UI (经典纯平设计风格) */
body.style-flat, body.theme-flat {
    --bg-primary: #2C3E50; /* Midnight Blue */
    --bg-surface: #34495E; /* Wet Asphalt */
    --bg-surface-elevated: #243342;
    --bg-surface-hover: #3D566E;
    --border-color: #415B76;
    --border-subtle: #3A5169;

    --text-primary: #FFFFFF;
    --text-secondary: #ECF0F1; /* Clouds */
    --text-muted: #BDC3C7; /* Silver */

    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --shadow-subtle: none;
}

body.style-flat .card-collapsible,
body.style-flat .arena-card,
body.style-flat .module-toggle-toolbar,
body.style-flat .app-header,
body.style-flat .modal-card {
    background-color: #34495E;
    border: 2px solid #415B76;
    border-radius: 6px;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

body.style-flat .app-nav-tabs {
    background: transparent;
    border-bottom: 2px solid #415B76;
    gap: 2px;
    padding: 0 4px;
}

body.style-flat .nav-tab-btn {
    border-radius: 6px 6px 0 0;
    border: 2px solid transparent;
    border-bottom: none;
    background: transparent;
    font-weight: 600;
    color: #BDC3C7;
    box-shadow: none;
    transition: background 0.15s ease, color 0.15s ease;
}

body.style-flat .nav-tab-btn:hover:not(.active) {
    color: #FFFFFF;
    background-color: rgba(255, 255, 255, 0.08);
}

body.style-flat .nav-tab-btn.active {
    background-color: #2C3E50 !important;
    border: 2px solid #415B76 !important;
    border-bottom: 2px solid #2C3E50 !important;
    color: #FFFFFF !important;
    font-weight: 700;
    box-shadow: none !important;
    margin-bottom: -2px !important;
}

body.style-flat .module-chip-btn {
    background-color: #243342;
    border: none;
    border-bottom: 2px solid #1A252F;
    border-radius: 4px;
    font-weight: 700;
    color: #ECF0F1;
}

body.style-flat .module-chip-btn:hover {
    background-color: #2D3E4F;
}

body.style-flat .module-chip-btn.active {
    background-color: var(--accent-primary, #1ABC9C);
    color: #FFFFFF;
    border-bottom: 2px solid var(--accent-hover, #16A085);
    box-shadow: none;
}

body.style-flat .module-chip-btn.active svg {
    stroke: #FFFFFF;
    filter: none;
}

/* Flat UI 2D Solid Buttons with Click Down Offset */
body.style-flat .btn {
    border: none;
    border-bottom: 3px solid rgba(0, 0, 0, 0.28);
    border-radius: 4px;
    font-weight: 700;
    box-shadow: none !important;
    transition: transform 0.08s ease, filter 0.1s ease;
}

body.style-flat .btn:hover {
    filter: brightness(1.08);
}

body.style-flat .btn:active,
body.style-flat .btn-icon-square:active {
    transform: translateY(2px);
    border-bottom-width: 1px;
}

body.style-flat .btn-primary {
    background-color: var(--accent-primary, #1ABC9C);
    color: #FFFFFF;
    border-bottom: 3px solid var(--accent-hover, #16A085);
}

body.style-flat .btn-secondary {
    background-color: #4E6D8C;
    color: #FFFFFF;
    border-bottom: 3px solid #34495E;
}

body.style-flat .btn-danger {
    background-color: #E74C3C;
    color: #FFFFFF;
    border-bottom: 3px solid #C0392B;
}

body.style-flat .btn-icon-square {
    border-radius: 4px;
    border-bottom: 3px solid rgba(0, 0, 0, 0.28);
}

body.style-flat .badge {
    border: none;
    border-radius: 4px;
    font-weight: 700;
    background-color: #243342;
    color: #ECF0F1;
}

body.style-flat .badge-connected {
    background-color: #2ECC71;
    color: #FFFFFF;
}

body.style-flat .badge-disconnected {
    background-color: #95A5A6;
    color: #2C3E50;
}

/* 1.7 Windows 98 Classic (经典复古灰风格) */
body.style-win98, body.theme-win98 {
    --bg-primary: #C0C0C0; /* Win98 Window Gray - No Teal Desktop */
    --bg-surface: #C0C0C0; /* Win98 Dialog / Window Gray */
    --bg-surface-elevated: #D4D0C8; /* Surface Light Gray */
    --bg-surface-hover: #DCD8D0;
    --border-color: #808080;
    --border-subtle: #DFDFDF;

    --text-primary: #000000;
    --text-secondary: #222222;
    --text-muted: #555555;

    --font-sans: 'Tahoma', 'MS Sans Serif', 'Segoe UI', Arial, sans-serif;
    --font-mono: 'Lucida Console', 'Consolas', 'Courier New', monospace;

    --radius-sm: 0px;
    --radius-md: 0px;
    --radius-lg: 0px;
    --shadow-subtle: none;
}

/* Entire App as a Single Windows 98 Window */
body.style-win98,
body.theme-win98 {
    background-color: #C0C0C0 !important;
    font-family: var(--font-sans);
    color: #000000;
    box-shadow: inset 1px 1px 0px #DFDFDF, inset 2px 2px 0px #FFFFFF, inset -1px -1px 0px #0a0a0a, inset -2px -2px 0px #808080 !important;
    border: 1px solid #C0C0C0 !important;
    padding: 2px !important;
    min-height: 100vh;
    box-sizing: border-box;
}

/* Window Header Container */
body.style-win98 .app-header,
body.theme-win98 .app-header {
    background-color: #C0C0C0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
    width: 100% !important;
}

/* Top Row: The Windows 98 Window Titlebar */
body.style-win98 .header-top-row,
body.theme-win98 .header-top-row {
    background: linear-gradient(90deg, #000080 0%, #1084D0 100%) !important;
    color: #FFFFFF !important;
    min-height: 28px !important;
    height: 28px !important;
    max-height: 28px !important;
    padding: 2px 4px 2px 6px !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    user-select: none !important;
}

body.style-win98 .header-brand,
body.theme-win98 .header-brand {
    display: flex !important;
    align-items: center !important;
    gap: 0.35rem !important;
}

body.style-win98 .brand-title,
body.theme-win98 .brand-title {
    color: #FFFFFF !important;
    font-family: var(--font-sans) !important;
    font-size: 0.85rem !important;
    font-weight: 700 !important;
    letter-spacing: 0 !important;
    line-height: 1 !important;
}

body.style-win98 .brand-svg,
body.theme-win98 .brand-svg {
    stroke: #FFFFFF !important;
    color: #FFFFFF !important;
    width: 15px !important;
    height: 15px !important;
}

body.style-win98 .app-version-badge,
body.theme-win98 .app-version-badge {
    background-color: #C0C0C0 !important;
    color: #000000 !important;
    font-family: var(--font-sans) !important;
    font-size: 0.68rem !important;
    font-weight: 700 !important;
    padding: 1px 4px !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: inset -1px -1px #ffffff, inset 1px 1px #808080 !important;
    line-height: 1 !important;
}

body.style-win98 .header-actions,
body.theme-win98 .header-actions {
    display: flex !important;
    align-items: center !important;
    gap: 3px !important;
}

body.style-win98 .header-actions .btn-icon-square,
body.style-win98 .header-actions #btn-bluetooth-capsule,
body.theme-win98 .header-actions .btn-icon-square,
body.theme-win98 .header-actions #btn-bluetooth-capsule {
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    min-height: 20px !important;
    max-width: 20px !important;
    max-height: 20px !important;
    background-color: #C0C0C0 !important;
    color: #000000 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #ffffff, inset -2px -2px #808080, inset 2px 2px #dfdfdf !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0 !important;
}

body.style-win98 .header-actions #btn-bluetooth-capsule.connected,
body.theme-win98 .header-actions #btn-bluetooth-capsule.connected,
body.style-win98 .header-actions #btn-bluetooth-capsule.connecting,
body.theme-win98 .header-actions #btn-bluetooth-capsule.connecting,
body.style-win98 .header-actions #btn-bluetooth-capsule.disconnected,
body.theme-win98 .header-actions #btn-bluetooth-capsule.disconnected {
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    min-height: 20px !important;
    max-width: 20px !important;
    max-height: 20px !important;
    padding: 0 !important;
    background-color: #C0C0C0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #ffffff, inset -2px -2px #808080, inset 2px 2px #dfdfdf !important;
}

body.style-win98 .header-actions #btn-bluetooth-capsule .header-battery-val,
body.theme-win98 .header-actions #btn-bluetooth-capsule .header-battery-val,
body.style-win98 .header-actions #btn-bluetooth-capsule .bt-connected-dot,
body.theme-win98 .header-actions #btn-bluetooth-capsule .bt-connected-dot {
    display: none !important;
}

body.style-win98 .header-actions .btn-icon-square svg,
body.theme-win98 .header-actions .btn-icon-square svg {
    stroke: #000000 !important;
    color: #000000 !important;
    width: 12px !important;
    height: 12px !important;
}

body.style-win98 .header-actions .btn-icon-square:active,
body.theme-win98 .header-actions .btn-icon-square:active {
    box-shadow: inset -1px -1px #ffffff, inset 1px 1px #0a0a0a, inset -2px -2px #dfdfdf, inset 2px 2px #808080 !important;
    transform: translate(1px, 1px) !important;
}

/* Win98 Property Sheet Tabs Strip */
body.style-win98 .app-nav-tabs,
body.theme-win98 .app-nav-tabs {
    display: flex !important;
    align-items: flex-end !important;
    gap: 3px !important;
    background-color: #C0C0C0 !important;
    padding: 6px 6px 0 6px !important;
    margin: 0 !important;
    border: none !important;
    border-bottom: 1px solid #FFFFFF !important;
    border-radius: 0 !important;
    position: relative !important;
    z-index: 2 !important;
    min-height: 36px !important;
    height: 36px !important;
    box-sizing: border-box !important;
    box-shadow: none !important;
}

/* Inactive Tab - Closed at bottom */
body.style-win98 .nav-tab-btn,
body.theme-win98 .nav-tab-btn {
    position: relative !important;
    top: 0 !important;
    background-color: #C0C0C0 !important;
    color: #000000 !important;
    border: none !important;
    border-radius: 0 !important;
    border-top: 1px solid #FFFFFF !important;
    border-left: 1px solid #FFFFFF !important;
    border-right: 1px solid #000000 !important;
    border-bottom: 1px solid #FFFFFF !important;
    box-shadow: inset 1px 1px 0 #FFFFFF, inset -1px 0 0 #808080, inset -2px 0 0 #000000 !important;
    font-family: var(--font-sans) !important;
    font-size: 0.78rem !important;
    font-weight: 400 !important;
    padding: 3px 12px 2px 12px !important;
    margin-bottom: 0px !important;
    height: 26px !important;
    min-height: 26px !important;
    line-height: 1 !important;
    cursor: pointer !important;
    transition: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.35rem !important;
    box-sizing: border-box !important;
}

body.style-win98 .nav-tab-btn:hover,
body.theme-win98 .nav-tab-btn:hover {
    color: #000000 !important;
    background-color: #D4D0C8 !important;
}

body.style-win98 .nav-tab-btn::before,
body.theme-win98 .nav-tab-btn::before {
    display: none !important;
}

/* Active Tab - Open at bottom (开口，与下方内容无缝连通) */
body.style-win98 .nav-tab-btn.active,
body.theme-win98 .nav-tab-btn.active {
    position: relative !important;
    top: 0 !important;
    background-color: #C0C0C0 !important;
    color: #000000 !important;
    font-weight: 700 !important;
    margin-bottom: -1px !important;
    padding: 5px 14px 7px 14px !important;
    height: 33px !important;
    min-height: 33px !important;
    border-top: 1px solid #FFFFFF !important;
    border-left: 1px solid #FFFFFF !important;
    border-right: 1px solid #000000 !important;
    border-bottom: 1px solid #C0C0C0 !important; /* 开口关键：底边与背景同色完全抹平分割线 */
    box-shadow: inset 1px 1px 0 #FFFFFF, inset -1px 0 0 #808080, inset -2px 0 0 #000000 !important;
    z-index: 10 !important;
}

body.style-win98 .nav-tab-btn.active svg,
body.theme-win98 .nav-tab-btn.active svg {
    stroke: #000080 !important;
}

/* Window Content Area - Windows 98 Property Sheet Body (Connected to Tab Strip) */
body.style-win98 .app-main,
body.theme-win98 .app-main {
    background-color: #C0C0C0 !important;
    padding: 10px 8px 16px 8px !important;
    position: relative !important;
    z-index: 1 !important;
    box-sizing: border-box !important;
    width: calc(100% - 12px) !important;
    max-width: calc(100% - 12px) !important;
    margin: 0 6px 6px 6px !important;
    border-left: 1px solid #FFFFFF !important;
    border-right: 1px solid #000000 !important;
    border-bottom: 1px solid #000000 !important;
    border-top: none !important;
    box-shadow: inset 1px 0 0 #DFDFDF, inset -1px -1px 0 #808080 !important;
}

/* Win98 Dialog Section Group Boxes */
body.style-win98 .card-collapsible,
body.style-win98 .arena-card,
body.theme-win98 .card-collapsible,
body.theme-win98 .arena-card {
    background-color: #C0C0C0 !important;
    border: 1px solid #808080 !important;
    border-radius: 0 !important;
    box-shadow: inset 1px 1px 0 #FFFFFF, 1px 1px 0 #FFFFFF !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    padding: 3px !important;
    margin-bottom: 0.65rem !important;
}

/* Section Group Box Headers */
body.style-win98 .collapsible-header,
body.theme-win98 .collapsible-header {
    background: #D4D0C8 !important;
    color: #000000 !important;
    min-height: 26px !important;
    padding: 3px 6px !important;
    border: none !important;
    border-bottom: 1px solid #808080 !important;
    box-shadow: inset 0 1px 0 #FFFFFF !important;
    border-radius: 0 !important;
}

body.style-win98 .collapsible-title,
body.theme-win98 .collapsible-title {
    color: #000000 !important;
    font-family: var(--font-sans) !important;
    font-weight: 700 !important;
    font-size: 0.8rem !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
}

body.style-win98 .collapsible-title svg,
body.theme-win98 .collapsible-title svg {
    stroke: #000000 !important;
    color: #000000 !important;
    filter: none !important;
}

body.style-win98 .card-collapsible.collapsed .collapsible-header,
body.theme-win98 .card-collapsible.collapsed .collapsible-header {
    background: #C0C0C0 !important;
    border-bottom: none !important;
}

/* Collapsible Panel Toggle Button & Header Buttons */
body.style-win98 .btn-panel-toggle,
body.theme-win98 .btn-panel-toggle,
body.style-win98 .collapsible-header .btn,
body.theme-win98 .collapsible-header .btn {
    background-color: #C0C0C0 !important;
    color: #000000 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #ffffff, inset -2px -2px #808080, inset 2px 2px #dfdfdf !important;
    font-family: var(--font-sans) !important;
    font-size: 0.74rem !important;
    font-weight: 400 !important;
    height: 22px !important;
    min-height: 22px !important;
    padding: 1px 8px !important;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.3rem !important;
}

body.style-win98 .collapsible-header .btn svg,
body.theme-win98 .collapsible-header .btn svg,
body.style-win98 .collapsible-header .btn-panel-toggle svg,
body.theme-win98 .collapsible-header .btn-panel-toggle svg {
    width: 12px !important;
    height: 12px !important;
    stroke: #000000 !important;
}

body.style-win98 .card-collapsible.collapsed .btn-panel-toggle,
body.theme-win98 .card-collapsible.collapsed .btn-panel-toggle {
    background-color: #C0C0C0 !important;
    color: #000000 !important;
    border: none !important;
}

/* Win98 Modal Dialogs (Floating Secondary Windows) */
body.style-win98 .modal-card,
body.theme-win98 .modal-card {
    background-color: #C0C0C0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #dfdfdf, inset -2px -2px #808080, inset 2px 2px #ffffff, 2px 2px 0px #000000 !important;
    padding: 3px !important;
}

body.style-win98 .modal-header,
body.theme-win98 .modal-header {
    background: linear-gradient(90deg, #000080 0%, #1084D0 100%) !important;
    color: #FFFFFF !important;
    min-height: 26px !important;
    padding: 3px 6px !important;
    border: none !important;
    border-radius: 0 !important;
}

body.style-win98 .modal-title,
body.theme-win98 .modal-title {
    color: #FFFFFF !important;
    font-family: var(--font-sans) !important;
    font-weight: 700 !important;
    font-size: 0.82rem !important;
}

body.style-win98 .modal-header svg,
body.theme-win98 .modal-header svg {
    stroke: #FFFFFF !important;
    color: #FFFFFF !important;
}

body.style-win98 .modal-header button,
body.style-win98 .modal-header .btn-icon-square,
body.theme-win98 .modal-header button,
body.theme-win98 .modal-header .btn-icon-square {
    background-color: #C0C0C0 !important;
    color: #000000 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #ffffff, inset -2px -2px #808080, inset 2px 2px #dfdfdf !important;
    min-width: 20px !important;
    min-height: 20px !important;
    width: 20px !important;
    height: 20px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: 700 !important;
}

body.style-win98 .modal-header button svg,
body.style-win98 .modal-header .btn-icon-square svg,
body.theme-win98 .modal-header button svg,
body.theme-win98 .modal-header .btn-icon-square svg {
    stroke: #000000 !important;
    width: 12px !important;
    height: 12px !important;
}

/* Win98 Module Toggle Toolbar */
body.style-win98 .module-toggle-toolbar,
body.theme-win98 .module-toggle-toolbar {
    background-color: #C0C0C0;
    border: none;
    border-radius: 0;
    box-shadow: inset -1px -1px #ffffff, inset 1px 1px #808080, inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a;
    padding: 3px;
    gap: 3px;
}

body.style-win98 .module-chip-btn,
body.theme-win98 .module-chip-btn {
    background-color: #C0C0C0;
    color: #000000;
    border: none;
    border-radius: 0;
    box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #ffffff, inset -2px -2px #808080, inset 2px 2px #dfdfdf;
    font-family: var(--font-sans);
    font-size: 0.74rem;
    font-weight: 700;
    transition: none;
    transform: none;
}

body.style-win98 .module-chip-btn:hover,
body.theme-win98 .module-chip-btn:hover {
    background-color: #D4D0C8;
}

body.style-win98 .module-chip-btn.active,
body.theme-win98 .module-chip-btn.active {
    background-color: #D4D0C8 !important;
    color: #000080 !important;
    box-shadow: inset -1px -1px #ffffff, inset 1px 1px #0a0a0a, inset -2px -2px #dfdfdf, inset 2px 2px #808080 !important;
    transform: translate(1px, 1px);
}

body.style-win98 .module-chip-btn.active svg,
body.theme-win98 .module-chip-btn.active svg {
    stroke: #000080 !important;
    filter: none !important;
}

body.style-win98 .module-chip-btn.active .module-chip-text,
body.theme-win98 .module-chip-btn.active .module-chip-text {
    color: #000080 !important;
    font-weight: 700 !important;
}

/* Win98 Buttons */
body.style-win98 .btn,
body.theme-win98 .btn {
    background-color: #C0C0C0;
    color: #000000;
    border: none;
    border-radius: 0;
    box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #ffffff, inset -2px -2px #808080, inset 2px 2px #dfdfdf;
    font-family: var(--font-sans);
    font-size: 0.78rem;
    font-weight: 400;
    padding: 4px 12px;
    min-height: 24px;
    cursor: pointer;
    transition: none;
    box-sizing: border-box;
}

body.style-win98 .btn:hover,
body.theme-win98 .btn:hover {
    filter: none;
}

body.style-win98 .btn:active,
body.style-win98 .btn.active,
body.style-win98 .btn-icon-square:active,
body.style-win98 .btn-panel-toggle:active,
body.style-win98 .modal-header button:active,
body.theme-win98 .btn:active,
body.theme-win98 .btn.active,
body.theme-win98 .btn-icon-square:active,
body.theme-win98 .btn-panel-toggle:active,
body.theme-win98 .modal-header button:active {
    box-shadow: inset -1px -1px #ffffff, inset 1px 1px #0a0a0a, inset -2px -2px #dfdfdf, inset 2px 2px #808080 !important;
    transform: translate(1px, 1px) !important;
}

body.style-win98 .btn:focus-visible,
body.theme-win98 .btn:focus-visible {
    outline: 1px dotted #000000;
    outline-offset: -4px;
}

body.style-win98 .btn-primary,
body.theme-win98 .btn-primary {
    background-color: #C0C0C0;
    color: #000000;
    font-weight: 700;
    border: 1px solid #000000;
    box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #ffffff, inset -2px -2px #808080, inset 2px 2px #dfdfdf;
}

body.style-win98 .btn-secondary,
body.theme-win98 .btn-secondary {
    background-color: #C0C0C0;
    color: #000000;
}

body.style-win98 .btn-danger,
body.theme-win98 .btn-danger {
    background-color: #C0C0C0;
    color: #800000;
    font-weight: 700;
}

body.style-win98 .btn-icon-square,
body.theme-win98 .btn-icon-square {
    border-radius: 0;
    border: none;
    background-color: #C0C0C0;
    color: #000000;
    box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #ffffff, inset -2px -2px #808080, inset 2px 2px #dfdfdf;
}

/* Win98 Sunken Inputs & Dropdowns */
body.style-win98 input[type="text"],
body.style-win98 input[type="number"],
body.style-win98 select,
body.style-win98 textarea,
body.theme-win98 input[type="text"],
body.theme-win98 input[type="number"],
body.theme-win98 select,
body.theme-win98 textarea {
    background-color: #FFFFFF !important;
    color: #000000 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: inset -1px -1px #ffffff, inset 1px 1px #808080, inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a !important;
    font-family: var(--font-sans) !important;
    font-size: 0.8rem;
    padding: 3px 6px;
}

/* Win98 Sunken Displays (Timer & Scramble) */
body.style-win98 #main-timer-container,
body.theme-win98 #main-timer-container {
    background-color: #000000 !important;
    box-shadow: inset -1px -1px #ffffff, inset 1px 1px #808080, inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a !important;
    border-radius: 0 !important;
    margin: 4px;
    padding: 1.25rem 0.5rem !important;
}

body.style-win98 .timer-digits,
body.theme-win98 .timer-digits {
    color: var(--accent-primary, #10B981) !important;
    text-shadow: 0 0 6px var(--accent-glow, rgba(16, 185, 129, 0.4)) !important;
    font-family: var(--font-mono) !important;
    font-weight: 700;
}

body.style-win98 .timer-running .timer-digits,
body.theme-win98 .timer-running .timer-digits {
    color: var(--accent-primary, #10B981) !important;
}

body.style-win98 #scramble-box,
body.theme-win98 #scramble-box {
    background-color: #FFFFFF !important;
    box-shadow: inset -1px -1px #ffffff, inset 1px 1px #808080, inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a !important;
    border-radius: 0 !important;
    margin: 4px;
    padding: 0.5rem !important;
}

body.style-win98 .scramble-reel-viewport,
body.theme-win98 .scramble-reel-viewport {
    background-color: #FFFFFF !important;
    mask-image: none !important;
    -webkit-mask-image: none !important;
}

body.style-win98 .scramble-card,
body.theme-win98 .scramble-card {
    background-color: transparent !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
}

body.style-win98 .scramble-reel-footer,
body.theme-win98 .scramble-reel-footer {
    color: #444444 !important;
}

body.style-win98 .scramble-reel-footer .progress-highlight,
body.theme-win98 .scramble-reel-footer .progress-highlight {
    color: #000080 !important;
    font-weight: 700 !important;
}

body.style-win98 .overall-move-chip,
body.theme-win98 .overall-move-chip {
    border-radius: 0 !important;
    border: 1px solid #808080 !important;
    background-color: #D4D0C8 !important;
    color: #000000 !important;
}

body.style-win98 .overall-move-chip.active,
body.theme-win98 .overall-move-chip.active {
    background-color: #000080 !important;
    color: #FFFFFF !important;
    border-color: #000080 !important;
}

body.style-win98 .stat-card,
body.theme-win98 .stat-card {
    background-color: #FFFFFF;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: inset -1px -1px #ffffff, inset 1px 1px #808080, inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a !important;
}

body.style-win98 .stat-label,
body.theme-win98 .stat-label {
    color: #555555 !important;
    font-weight: 700;
}

body.style-win98 .stat-val,
body.theme-win98 .stat-val {
    color: #000000 !important;
}

body.style-win98 .cube-view-card,
body.theme-win98 .cube-view-card {
    background-color: #FFFFFF;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: inset -1px -1px #ffffff, inset 1px 1px #808080, inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a !important;
}

/* Win98 History Table */
body.style-win98 .history-table-wrapper,
body.theme-win98 .history-table-wrapper {
    background-color: #FFFFFF;
    box-shadow: inset -1px -1px #ffffff, inset 1px 1px #808080, inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a !important;
    border: none !important;
    border-radius: 0 !important;
}

body.style-win98 .history-table,
body.theme-win98 .history-table {
    border-collapse: separate;
    border-spacing: 0;
    border: none;
    background-color: #FFFFFF;
}

body.style-win98 .history-table th,
body.theme-win98 .history-table th {
    background-color: #C0C0C0 !important;
    color: #000000 !important;
    border: none !important;
    box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #ffffff, inset -2px -2px #808080, inset 2px 2px #dfdfdf !important;
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
    padding: 3px 6px;
}

body.style-win98 .history-table td,
body.theme-win98 .history-table td {
    border: 1px solid #EFEFEF;
    color: #000000;
    font-size: 0.78rem;
    padding: 2px 4px;
}

body.style-win98 .history-table tr:hover,
body.theme-win98 .history-table tr:hover {
    background-color: #000080 !important;
    color: #FFFFFF !important;
}

body.style-win98 .history-table tr:hover td,
body.style-win98 .history-table tr:hover .col-num,
body.style-win98 .history-table tr:hover strong,
body.theme-win98 .history-table tr:hover td,
body.theme-win98 .history-table tr:hover .col-num,
body.theme-win98 .history-table tr:hover strong {
    color: #FFFFFF !important;
}

/* Win98 Badges */
body.style-win98 .badge,
body.theme-win98 .badge {
    border-radius: 0 !important;
    border: none !important;
    box-shadow: inset -1px -1px #ffffff, inset 1px 1px #808080, inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a !important;
    font-weight: 700;
    font-size: 0.72rem;
    padding: 2px 6px;
}

body.style-win98 .badge-connected,
body.theme-win98 .badge-connected {
    background-color: #008000 !important;
    color: #FFFFFF !important;
}

body.style-win98 .badge-disconnected,
body.theme-win98 .badge-disconnected {
    background-color: #C0C0C0 !important;
    color: #555555 !important;
}

body.style-win98 .app-version-badge,
body.theme-win98 .app-version-badge {
    background-color: #D4D0C8;
    color: #000000;
    border: none;
    box-shadow: inset -1px -1px #ffffff, inset 1px 1px #808080;
}

/* Win98 Fullscreen Scramble Bar */
body.style-win98 .scramble-fullscreen-bar,
body.theme-win98 .scramble-fullscreen-bar {
    background: linear-gradient(90deg, #000080 0%, #1084D0 100%) !important;
    color: #FFFFFF !important;
    border-radius: 0 !important;
    border: none !important;
}

body.style-win98 .scramble-fullscreen-bar span,
body.theme-win98 .scramble-fullscreen-bar span {
    color: #FFFFFF !important;
}

body.style-win98 .btn-exit-scramble-fs,
body.theme-win98 .btn-exit-scramble-fs {
    background-color: #C0C0C0 !important;
    color: #000000 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #ffffff, inset -2px -2px #808080, inset 2px 2px #dfdfdf !important;
}

/* Win98 Scrollbars */
body.style-win98 ::-webkit-scrollbar,
body.theme-win98 ::-webkit-scrollbar {
    width: 16px;
    height: 16px;
}

body.style-win98 ::-webkit-scrollbar-track,
body.theme-win98 ::-webkit-scrollbar-track {
    background: #E0DFE3;
    box-shadow: inset 1px 1px 0 #FFFFFF;
}

body.style-win98 ::-webkit-scrollbar-thumb,
body.theme-win98 ::-webkit-scrollbar-thumb {
    background: #C0C0C0;
    box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #ffffff, inset -2px -2px #808080, inset 2px 2px #dfdfdf;
    border: none;
}

/* Win98 Telemetry Pills & Stats Bar */
body.style-win98 .breakdown-stat-pill,
body.theme-win98 .breakdown-stat-pill {
    background-color: #C0C0C0 !important;
    color: #000000 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: inset -1px -1px #ffffff, inset 1px 1px #808080 !important;
    font-family: var(--font-sans) !important;
    font-size: 0.72rem !important;
    font-weight: 700 !important;
    padding: 1px 6px !important;
}

body.style-win98 .breakdown-stat-pill.stat-avg,
body.theme-win98 .breakdown-stat-pill.stat-avg {
    background-color: #D4D0C8 !important;
    color: #000000 !important;
}

body.style-win98 .main-solve-stats-bar,
body.theme-win98 .main-solve-stats-bar {
    border-top: 1px solid #808080 !important;
}

body.style-win98 .solve-stats-title,
body.theme-win98 .solve-stats-title {
    color: #000000 !important;
    font-family: var(--font-sans) !important;
    font-weight: 700 !important;
}

/* ==========================================================================
   2. Accent Color Palettes (强调主题色 - 自由正交切换)
   ========================================================================== */

/* 2.1 Emerald Green (翡翠绿 - 默认) */
body.color-emerald {
    --accent-primary: #10B981;
    --accent-hover: #059669;
    --accent-active: #047857;
    --accent-glow: rgba(16, 185, 129, 0.45);
    --accent-subtle: rgba(16, 185, 129, 0.15);
    --accent-text: #FFFFFF;
}

/* 2.2 Apple / System Blue (苹果天蓝) */
body.color-blue {
    --accent-primary: #0A84FF;
    --accent-hover: #409CFF;
    --accent-active: #0064D6;
    --accent-glow: rgba(10, 132, 255, 0.45);
    --accent-subtle: rgba(10, 132, 255, 0.15);
    --accent-text: #FFFFFF;
}

/* 2.3 Electric Violet / Purple (罗兰紫) */
body.color-purple {
    --accent-primary: #A855F7;
    --accent-hover: #C084FC;
    --accent-active: #7E22CE;
    --accent-glow: rgba(168, 85, 247, 0.45);
    --accent-subtle: rgba(168, 85, 247, 0.15);
    --accent-text: #FFFFFF;
}

/* 2.4 Cyber Cyan (霓虹青) */
body.color-cyan {
    --accent-primary: #06B6D4;
    --accent-hover: #22D3EE;
    --accent-active: #0891B2;
    --accent-glow: rgba(6, 182, 212, 0.45);
    --accent-subtle: rgba(6, 182, 212, 0.15);
    --accent-text: #FFFFFF;
}

/* 2.5 Sunset Amber (暖阳橙) */
body.color-amber {
    --accent-primary: #F59E0B;
    --accent-hover: #FBBF24;
    --accent-active: #D97706;
    --accent-glow: rgba(245, 158, 11, 0.45);
    --accent-subtle: rgba(245, 158, 11, 0.15);
    --accent-text: #000000;
}

/* 2.6 Crimson Red (极速红) */
body.color-crimson {
    --accent-primary: #EF4444;
    --accent-hover: #F87171;
    --accent-active: #DC2626;
    --accent-glow: rgba(239, 68, 68, 0.45);
    --accent-subtle: rgba(239, 68, 68, 0.15);
    --accent-text: #FFFFFF;
}

/* 2.7 Sakura Rose (樱花粉) */
body.color-rose {
    --accent-primary: #EC4899;
    --accent-hover: #F472B6;
    --accent-active: #DB2777;
    --accent-glow: rgba(236, 72, 153, 0.45);
    --accent-subtle: rgba(236, 72, 153, 0.15);
    --accent-text: #FFFFFF;
}

/* 2.8 Flat Turquoise (绿松石青 - Designmodo) */
body.color-turquoise {
    --accent-primary: #1ABC9C;
    --accent-hover: #16A085;
    --accent-active: #117A65;
    --accent-glow: rgba(26, 188, 156, 0.45);
    --accent-subtle: rgba(26, 188, 156, 0.15);
    --accent-text: #FFFFFF;
}

/* Color Palette Swatches Widget */
.color-palette-swatches {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
    margin-top: 0.5rem;
    padding: 0.4rem 0.5rem;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.swatch-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.15s cubic-bezier(0.25, 1, 0.5, 1), border-color 0.15s ease, box-shadow 0.15s ease;
    padding: 0;
    outline: none;
    flex-shrink: 0;
}

.swatch-btn:hover {
    transform: scale(1.18);
}

.swatch-btn:active {
    transform: scale(0.92);
}

.swatch-btn.active {
    border-color: #FFFFFF;
    box-shadow: 0 0 10px currentColor;
    transform: scale(1.15);
}

.color-swatch-emerald { background-color: #10B981; color: #10B981; }
.color-swatch-turquoise { background-color: #1ABC9C; color: #1ABC9C; }
.color-swatch-blue { background-color: #0A84FF; color: #0A84FF; }
.color-swatch-purple { background-color: #A855F7; color: #A855F7; }
.color-swatch-cyan { background-color: #06B6D4; color: #06B6D4; }
.color-swatch-amber { background-color: #F59E0B; color: #F59E0B; }
.color-swatch-crimson { background-color: #EF4444; color: #EF4444; }
.color-swatch-rose { background-color: #EC4899; color: #EC4899; }

/* Reset & Base Setup */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
    -webkit-text-size-adjust: 100%;
    touch-action: manipulation;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ==========================================================================
   Unified SVG Vector Icons (No Emoji)
   ========================================================================== */
.svg-icon {
    display: inline-block;
    vertical-align: -0.15em;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
    transition: stroke 0.15s ease, transform 0.15s ease;
}

.svg-icon.filled {
    fill: currentColor;
    stroke: none;
}

.brand-svg {
    stroke: #3B82F6;
    filter: drop-shadow(0 0 6px rgba(59, 130, 246, 0.6));
}

.svg-chevron {
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-collapsible.collapsed .svg-chevron {
    transform: rotate(-90deg);
}

.btn-icon .svg-icon {
    vertical-align: middle;
}

.collapsible-title .svg-icon {
    vertical-align: -0.2em;
    stroke: var(--accent-primary);
}

/* Top App Header */
.app-header {
    background-color: var(--bg-surface);
    border-bottom: none;
    padding: 0.75rem 1.25rem 0 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0.5rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.header-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    min-height: 44px;
    height: 44px;
    max-height: 44px;
    box-sizing: border-box;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-shrink: 0;
}

.brand-icon {
    font-size: 1.35rem;
    line-height: 1;
}

.brand-title {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.app-version-badge {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.72rem;
    padding: 0.12rem 0.45rem;
    border-radius: var(--radius-sm);
    letter-spacing: 0.03em;
    font-family: var(--font-mono);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-shrink: 0;
}

/* Unified Square Icon Buttons for Row 1 Actions (Optimized for 6.7" Mobile Touch) */
.btn-icon-square,
.header-actions .btn {
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    max-width: 38px;
    max-height: 38px;
    aspect-ratio: 1 / 1;
    border-radius: var(--radius-sm);
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative;
    box-sizing: border-box;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: all 0.15s ease;
}

.btn-icon-square *,
.header-actions .btn * {
    pointer-events: none;
}

.btn-icon-square svg,
.header-actions .btn svg {
    width: 19px;
    height: 19px;
    display: block;
    flex-shrink: 0;
    pointer-events: none;
}

.btn-icon-square.disconnected {
    background: var(--bg-surface-elevated);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-icon-square.disconnected:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.btn-icon-square.connecting {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.6);
    color: #F59E0B;
}

.btn-icon-square.connected {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.6);
    color: #10B981;
    width: auto !important;
    min-width: 38px !important;
    max-width: 80px !important;
    padding: 0 0.5rem !important;
    gap: 0.35rem;
}

.btn-icon-square.connected .bt-icon-connected {
    display: inline-block !important;
}

.btn-icon-square.connected .bt-icon-disconnected {
    display: none !important;
}

.header-battery-val {
    font-family: var(--font-mono);
    font-size: 0.76rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.02em;
}

.bt-connected-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #10B981;
    box-shadow: 0 0 5px rgba(16, 185, 129, 0.9);
    animation: btPulse 2s infinite ease-in-out;
}

@keyframes btPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.35); opacity: 0.65; }
}

.metronome-armed-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #F59E0B;
    box-shadow: 0 0 5px rgba(245, 158, 11, 0.9);
    animation: btPulse 1.8s infinite ease-in-out;
}

#btn-metronome.metronome-ticking {
    color: var(--accent-primary) !important;
    border-color: var(--accent-primary) !important;
}

#btn-metronome.metronome-ticking svg {
    animation: metronome-tick-swing 0.35s ease-in-out infinite alternate;
    transform-origin: 12px 18px;
}

@keyframes metronome-tick-swing {
    0% { transform: rotate(-14deg); }
    100% { transform: rotate(14deg); }
}

.metronome-quick-bps .btn-bps-preset {
    padding: 0.2rem 0.55rem;
    font-size: 0.76rem;
    font-family: var(--font-mono);
    border-radius: var(--radius-sm);
}

.metronome-quick-bps .btn-bps-preset.active {
    background-color: var(--accent-primary) !important;
    color: var(--accent-text, #FFF) !important;
    border-color: var(--accent-primary) !important;
}

/* Chrome-Style Navigation Tab Bar (Unified Across Themes) */
.app-nav-tabs {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 0 4px;
    margin: 0;
    width: 100%;
    min-height: 40px;
    height: 40px;
    box-sizing: border-box;
    position: relative;
    z-index: 5;
}

.nav-tab-btn {
    border: 1px solid transparent;
    border-bottom: none;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    padding: 0.45rem 1rem;
    height: 35px;
    min-height: 35px;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    line-height: 1;
    box-sizing: border-box;
    flex: 1;
    position: relative;
    top: 0;
    margin-bottom: 0;
}

/* Chrome tab separator line between inactive tabs */
.nav-tab-btn:not(.active) + .nav-tab-btn:not(.active)::before {
    content: "";
    position: absolute;
    left: -2px;
    top: 50%;
    transform: translateY(-50%);
    height: 16px;
    width: 1px;
    background-color: var(--border-color);
    opacity: 0.45;
}

.nav-tab-btn:hover:not(.active) {
    color: var(--text-primary);
    background: var(--bg-surface-hover);
}

.nav-tab-btn.active {
    position: relative;
    top: 0;
    background-color: var(--bg-primary) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
    border-bottom: 1px solid var(--bg-primary) !important;
    border-radius: 8px 8px 0 0 !important;
    box-shadow: none !important;
    margin-bottom: -1px !important;
    height: 36px !important;
    min-height: 36px !important;
    z-index: 10 !important;
    font-weight: 700;
}

.nav-tab-btn.active svg {
    stroke: var(--accent-primary);
}

/* Main Layout */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--card-gap, 0.85rem);
    padding: 1rem 1.25rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 1024px) {
    :root {
        --card-gap: 0.75rem;
    }
    .app-main {
        padding: 0.6rem 0.5rem;
        gap: var(--card-gap, 0.75rem);
        width: 100%;
        max-width: 100%;
    }
    .stage-section {
        gap: var(--card-gap, 0.75rem);
    }
}

@media (max-width: 768px) {
    :root {
        --card-gap: 0.6rem;
    }
    .app-header {
        padding: 0.45rem 0.55rem 0 0.55rem;
        border-bottom: none;
        display: flex;
        flex-direction: column;
        gap: 0.35rem;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    .header-top-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        gap: 0.3rem;
    }
    .brand-title {
        font-size: 0.95rem;
    }
    .header-actions .btn {
        padding: 0.25rem 0.45rem;
        font-size: 0.74rem;
    }
    .app-nav-tabs {
        width: 100%;
        display: flex;
        align-items: flex-end;
        gap: 2px;
        padding: 0 4px;
        min-height: 38px;
        height: 38px;
    }
    .nav-tab-btn {
        flex: 1;
        text-align: center;
        padding: 0.35rem 0.35rem;
        font-size: 0.76rem;
        height: 33px;
        min-height: 33px;
    }
    .nav-tab-btn.active {
        height: 34px !important;
        min-height: 34px !important;
        margin-bottom: -1px !important;
    }
    .app-main {
        padding: 0.4rem;
        gap: var(--card-gap, 0.6rem);
        align-items: start;
        align-content: start;
        grid-auto-rows: max-content;
        width: 100%;
        max-width: 100%;
    }
    .stage-section,
    .sidebar-section {
        gap: var(--card-gap, 0.6rem);
    }
    .module-toggle-toolbar {
        padding: 0.15rem 0.35rem;
        gap: 0.35rem;
        width: 100%;
        min-height: 44px;
        height: 44px;
        max-height: 44px;
        box-sizing: border-box;
    }
    .module-chip-btn {
        min-height: 100%;
        height: 100%;
        padding: 0 0.25rem;
        border-radius: var(--radius-sm);
        display: inline-flex;
        flex-direction: row;
        gap: 0.25rem;
    }
    .module-chip-btn svg {
        width: 15px;
        height: 15px;
    }
    .module-chip-text {
        font-size: 0.74rem;
    }
}

/* Stage Area (Scramble / Timer Arena + Inline Breakdown + Cube Views) */
.stage-section {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: var(--card-gap, 0.85rem);
    min-width: 0;
    width: 100%;
    max-width: 820px;
    box-sizing: border-box;
    margin: 0 auto;
}

/* 0. Module Visibility Toggle Toolbar (Full-Width Icon + Label Dock Bar) */
.module-toggle-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.45rem;
    padding: 0.15rem 0.45rem;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    width: 100%;
    min-height: 44px;
    height: 44px;
    max-height: 44px;
    min-width: 0;
    box-sizing: border-box;
}

.module-chip-btn {
    flex: 1;
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 100%;
    height: 100%;
    padding: 0 0.4rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background-color: var(--bg-surface-elevated);
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    touch-action: manipulation;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
    text-align: center;
}

.module-chip-btn svg {
    display: block;
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    transition: transform 0.18s ease, stroke 0.18s ease;
}

.module-chip-text {
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    letter-spacing: -0.01em;
    color: var(--text-secondary);
    transition: color 0.18s ease;
}

/* Bluetooth Diagnostics & Live Logs Modal */
.bt-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
}

.bt-info-card {
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.bt-info-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
}

.bt-info-val {
    font-size: 0.92rem;
    color: var(--text-primary);
    font-weight: 700;
}

.bt-modal-battery-bar {
    width: 65px;
    height: 9px;
    background: var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.bt-modal-battery-fill {
    height: 100%;
    background: #10B981;
    border-radius: 6px;
    transition: width 0.3s ease;
}

.bt-log-terminal {
    background: #0B0E14;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.6rem;
    font-family: var(--font-mono);
    font-size: 0.76rem;
    color: #A3B8CC;
    height: 180px;
    max-height: 220px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    user-select: text;
    -webkit-user-select: text;
}

.bt-log-entry {
    line-height: 1.4;
    word-break: break-all;
}

.bt-log-system { color: #60A5FA; }
.bt-log-move { color: #34D399; }
.bt-log-scramble { color: #A78BFA; }
.bt-log-warn { color: #FBBF24; }
.bt-log-err { color: #F87171; }

.module-chip-btn.active {
    background-color: var(--accent-primary, #10B981) !important;
    border-color: rgba(255, 255, 255, 0.35) !important;
    color: #FFFFFF !important;
    box-shadow: 0 4px 14px var(--accent-glow, rgba(16, 185, 129, 0.4)) !important;
}

.module-chip-btn.active svg {
    stroke: #FFFFFF !important;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
}

.module-chip-btn.active .module-chip-text {
    color: #FFFFFF !important;
    font-weight: 700 !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.module-chip-btn:not(.active) {
    opacity: 0.45;
    border-style: dashed;
    background-color: transparent;
    color: var(--text-muted);
}

.module-chip-btn:not(.active) svg {
    stroke: var(--text-muted);
}

.module-chip-btn:not(.active) .module-chip-text {
    color: var(--text-muted);
}

.module-chip-btn:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
    opacity: 1;
}

.module-chip-btn:active {
    transform: scale(0.94);
}

/* 1. Unified Central Arena (In-Place Scramble / Timer Swap) */
.arena-card {
    position: relative;
    width: 100%;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    container-type: inline-size;
}

.arena-view {
    width: 100% !important;
    min-height: 200px;
    box-sizing: border-box;
}

#scramble-box,
.scramble-view {
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
    width: 100% !important;
    min-height: unset !important;
    box-sizing: border-box !important;
}

#main-timer-container,
.timer-view {
    padding: 0.5rem 0.25rem !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center;
    justify-content: center;
    gap: 0 !important;
    width: 100% !important;
    min-height: unset !important;
    position: relative;
    box-sizing: border-box !important;
}

/* Module Hidden Utility */
.module-hidden {
    display: none !important;
}

/* 2. Modular Collapsible Cards & Minimization */
.card-collapsible {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all 0.2s ease;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0.85rem;
    min-height: 42px;
    background-color: var(--bg-surface-elevated);
    border-bottom: 1px solid var(--border-color);
    user-select: none;
    cursor: pointer;
    touch-action: manipulation;
    margin: 0;
    box-sizing: border-box;
}

.collapsible-header:hover {
    background-color: rgba(255, 255, 255, 0.04);
}

.collapsible-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    line-height: 1.2;
    white-space: nowrap;
    min-width: 0;
}

.collapsible-title svg {
    flex-shrink: 0;
}

.cube-views-heading + div,
#btn-reset-3d-cam {
    flex-shrink: 0;
}

#btn-reset-3d-cam {
    white-space: nowrap;
}

@media (max-width: 380px) {
    .cube-views-heading-detail {
        display: none;
    }

    #card-cube-views .collapsible-header {
        padding-left: 0.65rem;
        padding-right: 0.65rem;
    }
}

@media (max-width: 340px) {
    .app-version-badge {
        display: none !important;
    }

    .header-actions {
        gap: 0.25rem;
    }

    #card-cube-views .collapsible-title {
        font-size: 0.74rem;
    }
}

.collapsible-body {
    padding: 0.85rem;
    transition: max-height 0.25s ease, opacity 0.2s ease;
    margin: 0;
    box-sizing: border-box;
}

.collapsible-body.collapsible-body-flush {
    padding: 0 !important;
}

.card-collapsible.collapsed .collapsible-body {
    display: none !important;
    padding: 0 !important;
    max-height: 0 !important;
    opacity: 0 !important;
    margin: 0 !important;
}

.card-collapsible.collapsed .collapsible-header {
    border-bottom: none;
    margin: 0;
}

.btn-panel-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.2rem 0.55rem;
    min-height: 28px;
    font-size: 0.74rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background-color: var(--bg-surface);
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    touch-action: manipulation;
    transition: all 0.15s ease;
    line-height: 1;
    flex-shrink: 0;
    box-sizing: border-box;
}

.btn-panel-toggle:hover {
    background-color: var(--bg-surface-elevated);
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.btn-panel-toggle:active {
    transform: scale(0.95);
}

.card-collapsible.collapsed .btn-panel-toggle {
    background-color: var(--accent-subtle);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    font-weight: 700;
}

.card-collapsible.collapsed .btn-panel-toggle:hover {
    background-color: var(--accent-primary);
    color: #FFFFFF;
    border-color: var(--accent-primary);
}

body.style-light .card-collapsible.collapsed .btn-panel-toggle,
body.theme-light .card-collapsible.collapsed .btn-panel-toggle {
    background-color: var(--accent-subtle);
    border-color: var(--accent-primary);
    color: var(--accent-hover, var(--accent-primary));
    font-weight: 700;
}

/* Scramble Box */
.scramble-box {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    min-height: 240px;
    justify-content: center;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.scramble-box.scramble-alert-active {
    border-color: rgba(239, 68, 68, 0.75);
    box-shadow: 0 0 16px rgba(239, 68, 68, 0.3);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.scramble-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.scramble-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.scramble-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

/* Continuous Photo-Album Scramble Carousel */
.scramble-carousel-viewport {
    width: 100% !important;
    position: relative;
    overflow: hidden;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
}

.scramble-carousel-track {
    display: flex;
    align-items: stretch;
    width: 100%;
    gap: 0px;
    margin: 0;
    padding: 0;
    position: relative;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
    will-change: transform;
    transform: translate3d(-100%, 0, 0);
}

.scramble-card {
    min-width: 100%;
    max-width: 100%;
    width: 100%;
    flex: 0 0 100%;
    box-sizing: border-box;
    font-family: var(--font-mono);
    font-size: clamp(1.45rem, 5.2vw, 2.05rem);
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: 0.02em;
    text-align: center;
    padding: 1.1rem 0.2rem;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.55rem;
    transition: background-color 0.15s ease;
}

.scramble-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: clamp(0.1rem, 0.8vw, 0.35rem);
    flex-wrap: nowrap;
}

.scramble-correction-row {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    gap: 0.45rem;
    margin-bottom: 0.2rem;
}

.scramble-card:hover {
    background-color: var(--bg-surface-hover);
}

.scramble-card:active {
    opacity: 0.85;
}

.scramble-card.scramble-empty-hint {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-style: italic;
    opacity: 0.6;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scramble-text.scramble-text-hidden {
    display: none;
}

/* Floating Toast HUD (Apple Fluid Feedback) */
.toast-container {
    position: fixed;
    top: 1.2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    pointer-events: none;
}

.toast-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 1rem;
    background: rgba(28, 28, 30, 0.9);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 0.5px solid rgba(255, 255, 255, 0.18);
    border-radius: 9999px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    color: #FFFFFF;
    font-size: 0.82rem;
    font-weight: 600;
    opacity: 0;
    transform: translateY(-12px) scale(0.92);
    transition: all 0.25s cubic-bezier(0.25, 1, 0.5, 1);
    pointer-events: auto;
}

.toast-pill.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.toast-pill.hide {
    opacity: 0;
    transform: translateY(-16px) scale(0.9);
}

.scramble-move {
    display: inline-flex;
    flex: 1 1 0px;
    align-items: center;
    justify-content: center;
    min-width: 0;
    padding: 0.12rem 0.05rem;
    margin: 0;
    border-radius: 6px;
    white-space: nowrap;
    text-align: center;
    font-weight: 800;
    transition: all 0.15s ease;
}

.move-done {
    color: var(--text-muted);
    opacity: 0.45;
}

.move-active {
    background-color: rgba(16, 185, 129, 0.2);
    color: var(--accent-primary);
    font-weight: 700;
    text-decoration: underline;
}

.move-half-active {
    background-color: rgba(59, 130, 246, 0.2);
    color: #60A5FA;
    font-weight: 700;
    border: 1px dashed rgba(59, 130, 246, 0.6);
}

.move-pending {
    color: var(--text-primary);
}

.move-correction {
    color: var(--warning-primary);
    font-weight: 600;
}

.move-correction-active {
    background-color: rgba(245, 158, 11, 0.25);
    color: var(--warning-primary);
    font-weight: 700;
    border: 1px solid rgba(245, 158, 11, 0.5);
}

.scramble-correction-prefix {
    color: var(--warning-primary);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85rem;
}

/* ==========================================================================
   Horizontal Focused Reel Scramble Track (Apple Spring Fluid Motion)
   ========================================================================== */

.scramble-reel-container {
    width: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 0.25rem 0;
    user-select: none;
    -webkit-user-select: none;
    box-sizing: border-box;
}

.scramble-reel-viewport {
    width: 100%;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    height: 76px;
    mask-image: linear-gradient(to right, transparent 0%, rgba(0,0,0,1) 5%, rgba(0,0,0,1) 95%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0%, rgba(0,0,0,1) 5%, rgba(0,0,0,1) 95%, transparent 100%);
}

.scramble-reel-track {
    display: inline-flex;
    align-items: center;
    position: relative;
    left: 0;
    top: 0;
    margin: 0;
    padding: 0;
    width: max-content;
    height: 100%;
    white-space: nowrap;
    will-change: transform;
    transition: transform var(--reel-transition-dur, 0.25s) var(--reel-transition-ease, cubic-bezier(0.25, 0.1, 0.25, 1.0));
}

.reel-step-item {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    font-family: var(--font-mono);
    font-weight: 700;
    line-height: 1;
    position: relative;
    user-select: none;
    width: 60px;
    height: 50px;
    margin: 0 4px;
    font-size: 1.85rem;
    flex-shrink: 0;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    transform: none !important;
    transition: opacity 0.18s ease, color 0.18s ease;
}

/* Done past steps - Grayed out for easy current position tracking */
.reel-step-item.step-done {
    color: var(--text-muted) !important;
    opacity: 0.32 !important;
    font-size: 1.85rem !important;
    font-weight: 700 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    transform: none !important;
}

.reel-step-item.step-done.step-far {
    opacity: 0.16 !important;
    transform: none !important;
}

.reel-step-item.step-wrong {
    color: var(--text-muted) !important;
    opacity: 0.32 !important;
    text-decoration: line-through;
    text-decoration-color: #EF4444;
}

.reel-step-item.step-hidden {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Active current step in center - Exact same size, font, and color as queue, no inverted box, no scaling, no shadow */
.reel-step-item.step-active {
    min-width: unset !important;
    width: 60px !important;
    height: 50px !important;
    padding: 0 !important;
    font-size: 1.85rem !important;
    font-weight: 700 !important;
    color: var(--text-primary) !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    transform: none !important;
    opacity: 1 !important;
    z-index: 2;
}

/* Light mode crisp contrast for active step */
body.style-light .reel-step-item.step-active,
body.theme-light .reel-step-item.step-active {
    color: var(--text-primary) !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    transform: none !important;
}

/* Single Next Correction Move Display (clean red text with rewind badge on tape) */
.reel-step-item.step-correction {
    min-width: unset !important;
    width: 60px !important;
    height: 50px !important;
    padding: 0 !important;
    font-size: 1.85rem !important;
    font-weight: 800 !important;
    color: #EF4444 !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    opacity: 1 !important;
    z-index: 3;
    animation: step-error-rewind-pulse 0.3s ease-out;
}

.reel-step-item.step-correction.step-rewind {
    display: inline-flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
}

.step-undo-icon {
    font-size: 0.72rem;
    line-height: 1;
    margin-bottom: 2px;
    opacity: 0.85;
}

.step-corr-tag {
    font-size: 0.52rem;
    font-weight: 700;
    line-height: 1;
    opacity: 0.85;
    margin-top: 2px;
    letter-spacing: 0.02em;
}

@keyframes step-error-rewind-pulse {
    0% {
        transform: scale(0.92);
        opacity: 0.4;
    }
    50% {
        transform: scale(1.04);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.reel-step-item.step-pushed-back {
    animation: scramble-queue-pushback 0.28s ease-out both;
}

@keyframes scramble-queue-pushback {
    0% {
        opacity: 0.45;
    }
    100% {
        opacity: 1;
    }
}

.overall-move-chip.correction {
    background-color: rgba(239, 68, 68, 0.22) !important;
    color: #EF4444 !important;
    border: 1px solid #EF4444 !important;
    font-weight: 800 !important;
    animation: step-error-rewind-pulse 0.28s ease-out;
}

/* Half-turn in-progress with expanded guidance */
.reel-step-item.step-half-active {
    min-width: unset !important;
    width: 60px !important;
    height: 50px !important;
    padding: 0 !important;
    font-size: 1.85rem !important;
    font-weight: 700 !important;
    color: var(--text-primary) !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    transform: none !important;
    opacity: 1 !important;
    z-index: 2;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.step-half-base {
    line-height: 1;
}

.step-half-guide {
    display: block;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--accent-primary);
    letter-spacing: 0.02em;
    margin-top: 2px;
    white-space: nowrap;
}

/* Upcoming pending steps - Same font size and weight as active */
.reel-step-item.step-pending {
    width: 60px !important;
    height: 50px !important;
    font-size: 1.85rem !important;
    font-weight: 700 !important;
    color: var(--text-primary) !important;
    opacity: 0.85 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    transform: none !important;
}

.reel-step-item.step-pending.step-far {
    opacity: 0.42 !important;
    transform: none !important;
}

/* Error Correction Capsule in Center */
.reel-correction-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.75rem;
    background: rgba(245, 158, 11, 0.22);
    border: 1.5px solid rgba(245, 158, 11, 0.85);
    border-radius: 9999px;
    box-shadow: 0 0 22px rgba(245, 158, 11, 0.4);
    font-family: var(--font-mono);
}

.reel-correction-undo {
    color: #F59E0B;
    font-weight: 800;
    font-size: 1.5rem;
}

.reel-correction-arrow {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.reel-correction-next {
    color: var(--accent-primary);
    font-weight: 800;
    font-size: 1.5rem;
}

/* Footer progress label */
.scramble-reel-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 0.4rem;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

.scramble-reel-footer .progress-highlight {
    color: var(--accent-primary);
    font-weight: 700;
}

.scramble-divider {
    color: var(--text-muted);
    margin: 0 0.5rem;
}

.scramble-banner {
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.scramble-banner.status-pending {
    background-color: var(--bg-surface-elevated);
    color: var(--text-secondary);
}

.scramble-banner.status-half-turn {
    background-color: rgba(59, 130, 246, 0.15);
    color: #93C5FD;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.scramble-banner.status-ready {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--accent-primary);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.scramble-banner.status-warning {
    background-color: rgba(245, 158, 11, 0.15);
    color: var(--warning-primary);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Center Timer Container */
.timer-container {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 2.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    min-height: 280px;
    position: relative;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.timer-ready-pulse {
    border-color: var(--accent-primary);
    box-shadow: 0 0 24px rgba(16, 185, 129, 0.2);
}

.timer-running .timer-digits {
    color: var(--accent-primary);
}

.timer-finished-flash {
    animation: flashSuccess 0.8s ease;
}

@keyframes flashSuccess {
    0% { background-color: rgba(16, 185, 129, 0.25); }
    100% { background-color: var(--bg-surface); }
}

.timer-digits {
    font-family: var(--font-mono);
    font-size: min(25.5cqw, 25.5vw, 36vh, 175px);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1;
    color: var(--text-primary);
    user-select: none;
    text-align: center;
    width: 100%;
    padding: 1rem 0;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    transition: transform 0.12s ease, color 0.12s ease;
}

.timer-digits.timer-digits-long {
    font-size: min(18cqw, 18vw, 28vh, 125px);
}

.live-stats-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

/* Visual Cube Views (3D & 2D) */
.cube-views-container {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 580px) {
    .cube-views-container {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.5rem;
    }
}

.cube-view-card {
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.6rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

.cube-view-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.4rem;
}

.cube-view-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.cube-3d-stage {
    width: 100%;
    height: 190px;
    max-width: 260px;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    position: relative;
    touch-action: none;
}

.cube-3d-stage canvas {
    max-width: 100% !important;
    max-height: 100% !important;
    display: block;
}

@media (max-width: 768px) {
    .cube-3d-stage {
        height: 170px;
        max-width: 220px;
    }
}

.cube-3d-stage:active {
    cursor: grabbing;
}

.canvas-2d-net {
    background-color: transparent;
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* Sidebar Section (Stats & History) */
.sidebar-section {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: var(--card-gap, 0.85rem);
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    width: 100%;
    box-sizing: border-box;
}

.stat-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.8rem;
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.04em;
}

.stat-val {
    font-family: var(--font-mono);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 0.2rem;
}

/* History Box */
.history-box {
    margin: 0;
    padding: 0;
}

.history-table-wrapper {
    overflow-y: auto;
    overflow-x: auto;
    width: 100%;
    max-width: 100%;
    max-height: 420px;
    -webkit-overflow-scrolling: touch;
    flex: 1;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    border: 1px solid var(--border-color);
}

.history-table th {
    text-align: center;
    padding: 0.45rem 0.4rem;
    color: var(--text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.04em;
    border: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background-color: var(--bg-surface-elevated);
    white-space: nowrap;
    vertical-align: middle;
}

.history-table th:nth-child(2),
.history-table th:nth-child(4) {
    text-align: left;
}

.history-table td {
    padding: 0.4rem 0.4rem;
    border: 1px solid var(--border-subtle);
    vertical-align: middle;
    text-align: center;
    font-size: 0.78rem;
}

.history-table tr:hover {
    background-color: rgba(255, 255, 255, 0.035);
}

.history-table td.col-time,
.history-table td.col-scramble {
    text-align: left;
}

.history-table td.col-moves {
    font-size: 0.75rem;
    font-family: var(--font-mono);
}

.col-num {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

.col-time {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.82rem;
}

.time-penalty {
    color: var(--warning-primary);
}

.time-dnf {
    color: var(--danger-primary);
}

.col-scramble {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.col-date {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.col-actions {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
}

.empty-state {
    padding: 2rem 1rem !important;
    color: var(--text-muted);
}

.history-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.75rem;
    margin-top: 0.5rem;
    border-top: 1px solid var(--border-color);
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Badges & Buttons */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: currentColor;
    display: inline-block;
    flex-shrink: 0;
}

.badge-connected {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--accent-primary);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-connected .status-dot {
    background-color: var(--accent-primary);
    box-shadow: 0 0 6px var(--accent-primary);
    animation: statusPulse 2s infinite;
}

.badge-connecting {
    background-color: rgba(245, 158, 11, 0.15);
    color: var(--warning-primary);
}

.badge-connecting .status-dot {
    background-color: var(--warning-primary);
    animation: statusPulse 0.8s infinite;
}

.badge-disconnected {
    background-color: var(--bg-surface-elevated);
    color: var(--text-muted);
}

.badge-disconnected .status-dot {
    background-color: var(--text-muted);
    opacity: 0.5;
}

@keyframes statusPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.35); opacity: 0.6; }
}

.badge-battery {
    background-color: var(--bg-surface-elevated);
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.badge-ready {
    background-color: rgba(16, 185, 129, 0.2);
    color: var(--accent-primary);
    font-weight: 700;
}

.badge-scrambling {
    background-color: var(--bg-surface-elevated);
    color: var(--text-secondary);
}

.badge-warning {
    background-color: rgba(245, 158, 11, 0.2);
    color: var(--warning-primary);
}

.badge-running {
    background-color: rgba(16, 185, 129, 0.2);
    color: var(--accent-primary);
}

.badge-finished {
    background-color: var(--bg-surface-elevated);
    color: var(--text-primary);
}

.badge-move {
    background-color: var(--bg-surface-elevated);
    color: var(--text-primary);
    font-family: var(--font-mono);
    padding: 0.15rem 0.4rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s ease;
    user-select: none;
}

.btn-primary {
    background-color: var(--accent-primary);
    color: #FFFFFF;
}

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

.btn-secondary {
    background-color: var(--bg-surface-elevated);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: var(--bg-surface-hover);
}

.btn-danger {
    background-color: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--danger-primary);
}

.btn-danger:hover {
    background-color: rgba(239, 68, 68, 0.25);
}

.btn-sm {
    padding: 0.2rem 0.55rem;
    font-size: 0.74rem;
    min-height: 28px;
    line-height: 1;
    box-sizing: border-box;
}

.btn-icon {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    min-height: 26px;
    min-width: 26px;
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    box-sizing: border-box;
}

.btn-icon:hover {
    background-color: var(--bg-surface-hover);
    color: var(--text-primary);
    border-color: var(--border-color);
}

/* Modals */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-backdrop.active {
    display: flex;
}

.modal-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-subtle);
    width: 100%;
    max-width: 580px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-card-lg {
    max-width: 820px;
}

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

.modal-title {
    font-size: 1.1rem;
    font-weight: 700;
}

.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Form Controls */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-group input, .form-group select {
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    color: var(--text-primary);
    font-family: inherit;
}

/* Universal Form Inputs & Checkboxes Accent Theme */
input[type="checkbox"],
input[type="radio"],
input[type="range"] {
    accent-color: var(--accent-primary);
    cursor: pointer;
}

.form-check {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    user-select: none;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.form-check input[type="checkbox"] {
    accent-color: var(--accent-primary);
    width: 15px;
    height: 15px;
    margin: 0;
    cursor: pointer;
    vertical-align: middle;
}

/* TPS Smooth Window Selector */
.tps-smooth-selector {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    padding: 2px 7px;
    border-radius: var(--radius-sm);
    margin-right: 0.2rem;
    transition: all 0.15s ease;
}

.tps-smooth-selector select {
    background: transparent;
    border: none;
    color: var(--accent-primary);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0;
    outline: none;
    cursor: pointer;
}

.tps-smooth-selector select option {
    background: var(--bg-surface);
    color: var(--text-primary);
}

/* Reconstruction Modal Components */
.recon-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    background-color: var(--bg-surface-elevated);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
}

.recon-stat {
    display: flex;
    flex-direction: column;
}

.recon-stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-muted);
}

.recon-stat-val {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.1rem;
}

.recon-interactive-grid {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 1rem;
}

@media (max-width: 768px) {
    .recon-interactive-grid {
        grid-template-columns: 1fr;
    }
}

.recon-playback-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
    background-color: var(--bg-surface-elevated);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
}

.recon-btn-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.recon-slider {
    width: 100%;
}

.recon-table-wrapper {
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.recon-active-row {
    background-color: rgba(16, 185, 129, 0.15) !important;
}

.canvas-tps-graph {
    width: 100%;
    height: 240px;
    min-height: 240px;
    background-color: var(--bg-surface-elevated);
    border-radius: var(--radius-sm);
}

/* ==========================================================================
   Movement Layer Typographic System (Scheme A: Clean & Modern)
   ========================================================================== */
.move-color-u, .move-color-d, .move-color-r, .move-color-l, 
.move-color-f, .move-color-b, .move-color-m, .move-color-e, 
.move-color-s, .move-color-x, .move-color-y, .move-color-z { 
    color: inherit;
    font-weight: 700; 
}

.move-token {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.15rem 0.35rem;
    margin: 0.1rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.15s ease;
}
.move-token.active {
    border-color: var(--accent-primary);
    background: rgba(16, 185, 129, 0.2);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.3);
}

/* Clean Light (明亮极简日间) Tab Overrides */
body.style-light .app-nav-tabs,
body.theme-light .app-nav-tabs {
    border-bottom: 1px solid var(--border-color, #CBD5E1);
    gap: 2px;
    padding: 0 4px;
}

body.style-light .nav-tab-btn,
body.theme-light .nav-tab-btn {
    background-color: transparent;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    color: var(--text-secondary, #475569);
}

body.style-light .nav-tab-btn:hover:not(.active),
body.theme-light .nav-tab-btn:hover:not(.active) {
    background-color: rgba(0, 0, 0, 0.06);
    color: #0F172A;
}

body.style-light .nav-tab-btn.active,
body.theme-light .nav-tab-btn.active {
    background-color: #F8FAFC !important;
    color: #0F172A !important;
    border: 1px solid var(--border-color, #CBD5E1) !important;
    border-bottom: 1px solid #F8FAFC !important;
    border-radius: 8px 8px 0 0 !important;
    box-shadow: none !important;
    margin-bottom: -1px !important;
}

/* Views Visibility */
.view-section {
    display: none;
}
.view-section.active {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ==========================================================================
   Review Mode & Method Stage Segmentation (Phase 3)
   ========================================================================== */
.stage-summary-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.5rem;
    margin: 0.75rem 0;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .stage-summary-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.4rem;
    }
}

.stage-card {
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.stage-card:hover, .stage-card.active {
    border-color: var(--accent-primary);
    background: rgba(16, 185, 129, 0.08);
}

.stage-card-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.stage-card-stat {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 700;
}

.stage-card-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.main-solve-metrics-dashboard {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin-bottom: 0.6rem;
    padding: 0.55rem 0.65rem;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-sizing: border-box;
}

#main-solve-telemetry-bar,
.main-solve-telemetry-bar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.45rem 0.65rem;
    min-width: 0;
    width: 100%;
}

.breakdown-stat-pill {
    display: inline-flex;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 0.22rem 0.6rem;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    line-height: 1.2;
    transition: all 0.15s ease;
    box-sizing: border-box;
}

/* Enlarged prominent pill for current solve key metrics */
.breakdown-stat-pill.prominent-pill {
    font-size: 0.95rem;
    font-weight: 800;
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.breakdown-stat-pill.highlight-time {
    color: var(--accent-primary, #10B981);
    border-color: rgba(16, 185, 129, 0.35);
    background: rgba(16, 185, 129, 0.08);
}

.breakdown-stat-pill.highlight-moves {
    color: var(--text-primary);
    border-color: var(--border-color);
}

.breakdown-stat-pill.highlight-tps {
    color: #38BDF8;
    border-color: rgba(56, 189, 248, 0.35);
    background: rgba(56, 189, 248, 0.08);
}

.breakdown-stat-pill.stat-avg {
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
    border-color: var(--border-subtle);
    background: var(--bg-surface);
    padding: 0.18rem 0.5rem;
}

.breakdown-stat-divider {
    color: var(--border-color);
    font-weight: 300;
    margin: 0 0.05rem;
    opacity: 0.5;
}

.main-solve-stats-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem 0.55rem;
    padding-top: 0.35rem;
    border-top: 1px dashed var(--border-subtle);
    width: 100%;
}

.solve-stats-title {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    user-select: none;
}

.breakdown-chart-wrapper {
    position: relative;
    width: 100%;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.4rem 0.3rem 0.3rem 0.3rem;
    box-sizing: border-box;
    overflow: hidden;
}

.proportional-moves-flow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0;
    padding: 0.45rem 0.6rem;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin: 0.35rem 0 0 0;
    max-height: 110px;
    overflow-y: auto;
}

.recon-move-token {
    display: inline-block;
    padding: 0.15rem 0.35rem;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid transparent;
    transition: all 0.15s ease;
}

.recon-move-token:hover, .recon-move-token.active {
    border-color: #F59E0B;
    background-color: rgba(245, 158, 11, 0.25);
}

/* ==========================================================================
   Data Analysis & Trend Curves (Phase 4)
   ========================================================================== */
#view-analytics,
#view-practice {
    grid-column: 1 / -1;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.trend-card-main {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    box-sizing: border-box;
}

#view-analytics #card-history-table {
    width: 100%;
    max-width: 100%;
    margin-top: 1rem;
    box-sizing: border-box;
}

#view-analytics .history-table-wrapper {
    max-height: 540px;
}

.canvas-trend-full {
    width: 100%;
    height: 320px;
    background-color: var(--bg-surface-elevated);
    border-radius: var(--radius-sm);
    display: block;
}

.chart-controls-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.85rem;
    background-color: var(--bg-surface-elevated);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    width: 100%;
    box-sizing: border-box;
}

.chart-toggle-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.trend-styles-panel {
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
    animation: fadeIn 0.15s ease;
    width: 100%;
    box-sizing: border-box;
}

.trend-styles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
    gap: 0.5rem;
    width: 100%;
    box-sizing: border-box;
}

.curve-style-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--bg-surface);
    padding: 0.35rem 0.6rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}

.curve-style-item input[type="color"] {
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background: transparent;
}

.recon-curve-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.75rem;
    margin-top: 0.5rem;
}

.recon-curve-toggles {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

/* ==========================================================================
   Algorithm Practice Mode (Phase 5)
   ========================================================================== */
.practice-grid {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    width: 100%;
}

.practice-stage-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    align-items: center;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
}

/* Practice Reel Components (Borrowing Scramble Reel Track) */
.practice-reel-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 0.25rem 0;
    user-select: none;
    -webkit-user-select: none;
    box-sizing: border-box;
}

.practice-reel-viewport {
    width: 100%;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    height: 76px;
    mask-image: linear-gradient(to right, transparent 0%, rgba(0,0,0,1) 5%, rgba(0,0,0,1) 95%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0%, rgba(0,0,0,1) 5%, rgba(0,0,0,1) 95%, transparent 100%);
}

.practice-reel-track {
    display: inline-flex;
    align-items: center;
    position: relative;
    left: 0;
    top: 0;
    margin: 0;
    padding: 0;
    width: max-content;
    height: 100%;
    white-space: nowrap;
    will-change: transform;
    transition: transform var(--reel-transition-dur, 0.25s) var(--reel-transition-ease, cubic-bezier(0.25, 0.1, 0.25, 1.0));
}

.practice-reel-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    margin-top: 0.4rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    user-select: none;
}

.practice-overall-container {
    width: 100%;
    margin-top: 0.45rem;
    padding: 0.35rem 0.55rem;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.25rem 0.38rem;
    box-sizing: border-box;
}

.case-list-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
    box-sizing: border-box;
}

.case-list-wrapper {
    max-height: 480px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.5rem;
}

.case-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.75rem 0 0;
    border-radius: var(--radius-sm);
    background-color: var(--bg-surface-elevated);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    overflow: hidden;
    min-height: 52px;
}

.case-item:hover {
    border-color: var(--border-color);
    background-color: var(--bg-surface-hover);
}

.case-item.active {
    border-color: var(--accent-primary);
    background-color: rgba(16, 185, 129, 0.15);
}

.practice-alg-display {
    font-family: var(--font-mono);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 0.85rem 1.25rem;
    background-color: var(--bg-surface-elevated);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    width: 100%;
    word-break: break-word;
}

.practice-timer-digits {
    font-family: var(--font-mono);
    font-size: 4rem;
    font-weight: 800;
    color: var(--text-primary);
}

.practice-status-banner {
    width: 100%;
    padding: 0.6rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.practice-status-banner.status-idle {
    background-color: var(--bg-surface-elevated);
    color: var(--text-secondary);
}

.practice-status-banner.status-running {
    background-color: rgba(16, 185, 129, 0.2);
    color: var(--accent-primary);
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.practice-status-banner.status-complete {
    background-color: rgba(16, 185, 129, 0.25);
    color: var(--accent-primary);
    border: 1px solid rgba(16, 185, 129, 0.5);
}

.practice-status-banner.status-warning {
    background-color: rgba(245, 158, 11, 0.2);
    color: var(--warning-primary);
    border: 1px solid rgba(245, 158, 11, 0.4);
}

.practice-variants-bar {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.75rem;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-sizing: border-box;
}

.practice-variants-list {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
    overflow-x: auto;
}

.variant-chip {
    padding: 0.2rem 0.55rem;
    font-size: 0.76rem;
    font-weight: 600;
    font-family: var(--font-mono);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.variant-chip:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
    background: var(--bg-surface-hover);
}

.variant-chip.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #ffffff;
    font-weight: 700;
}

.practice-hero-diagram-wrap {
    width: 64px;
    height: 64px;
    min-width: 64px;
    min-height: 64px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-sizing: border-box;
    box-shadow: none;
}

.practice-visual-hero-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.case-thumb-wrap {
    align-self: stretch;
    height: 100%;
    aspect-ratio: 1 / 1;
    min-width: 52px;
    max-width: 60px;
    flex-shrink: 0;
    border-radius: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    margin: 0;
    margin-right: 0.65rem;
    box-sizing: border-box;
}

.case-thumbnail {
    width: 100%;
    height: 100%;
    display: block;
}

/* ==========================================================================
   Scramble Overall Sequence Overview (Mini Bar under Reel)
   ========================================================================== */
.scramble-overall-container {
    width: 100%;
    margin-top: 0.45rem;
    padding: 0.35rem 0.55rem;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.25rem 0.38rem;
    box-sizing: border-box;
}

.overall-move-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 0.84rem;
    font-weight: 700;
    padding: 0.14rem 0.35rem;
    border-radius: 3px;
    color: var(--text-primary);
    background: transparent;
    transition: color 0.15s ease, opacity 0.15s ease;
    user-select: none;
    box-shadow: none !important;
    transform: none !important;
}

.overall-move-chip.done {
    opacity: 0.28;
    color: var(--text-muted);
}

.overall-move-chip.active {
    background: transparent !important;
    color: var(--accent-primary, #10B981) !important;
    font-weight: 800;
    border-bottom: 2px solid var(--accent-primary, #10B981);
    transform: none !important;
    box-shadow: none !important;
    border-radius: 0;
}

.overall-move-chip.pending {
    opacity: 0.88;
    color: var(--text-primary);
}

/* ==========================================================================
   Scramble & Solve Focus Modes (Distraction-Free Experience)
   ========================================================================== */

/* Scrambling Full-Screen Focus Mode:
   Scramble formula on top + Live 3D cube directly below, hiding all clutter */
body.is-scrambling {
    overflow-x: hidden;
}

/* Hide all irrelevant panels during scrambling */
body.is-scrambling .app-header,
body.is-scrambling .module-toggle-toolbar,
body.is-scrambling #main-solve-breakdown-card,
body.is-scrambling .sidebar-section,
body.is-scrambling #card-history-table,
body.is-scrambling #main-timer-container,
body.is-scrambling .timer-control-hint,
body.is-scrambling .inspection-banner,
body.is-scrambling #card-cube-views .collapsible-header,
body.is-scrambling #card-cube-views .cube-view-card:has(#canvas-2d),
body.is-scrambling #card-cube-views .cube-view-card:last-child,
body.is-scrambling #card-cube-views .cube-view-header {
    display: none !important;
}

/* Fullscreen app layout */
body.is-scrambling .app-main {
    grid-template-columns: 1fr !important;
    padding: 0.5rem 0.65rem !important;
    margin: 0 !important;
    min-height: 100vh !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    box-sizing: border-box !important;
}

body.is-scrambling .stage-section {
    width: 100% !important;
    max-width: 680px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 0.55rem !important;
    flex: 1 1 auto !important;
    box-sizing: border-box !important;
}

/* Top bar during full-screen scramble */
.scramble-fullscreen-bar {
    display: none;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.2rem 0.5rem 0.35rem 0.5rem;
    box-sizing: border-box;
}

body.is-scrambling .scramble-fullscreen-bar {
    display: flex !important;
}

.scramble-fullscreen-info {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--accent-primary, #10B981);
    letter-spacing: 0.04em;
}

.scramble-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10B981;
    box-shadow: 0 0 10px #10B981;
    animation: pulse-dot 1.5s infinite ease-in-out;
}

@keyframes pulse-dot {
    0%, 100% { transform: scale(1); opacity: 0.9; }
    50% { transform: scale(1.3); opacity: 0.4; }
}

.btn-exit-scramble-fs {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-secondary, #A1A1AA);
    font-size: 0.76rem;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-exit-scramble-fs:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #FFFFFF;
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-enter-scramble-fs {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: 0.5rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: var(--text-secondary, #A1A1AA);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.15rem 0.45rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    vertical-align: middle;
}

.btn-enter-scramble-fs:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #FFFFFF;
    border-color: rgba(255, 255, 255, 0.28);
}

body.is-scrambling .btn-enter-scramble-fs {
    display: none !important;
}

/* Scramble formula container in full-screen */
body.is-scrambling .arena-card {
    background: var(--bg-surface-elevated, rgba(28, 28, 30, 0.85)) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12) !important;
    border-radius: var(--radius-lg, 16px) !important;
    width: 100% !important;
    padding: 0.4rem 0.25rem !important;
    margin: 0 !important;
    display: block !important;
    z-index: 10;
}

body.is-scrambling #scramble-box {
    display: flex !important;
    width: 100% !important;
    padding: 0 !important;
}

body.is-scrambling .scramble-card {
    padding: 0.5rem 0.2rem 0.4rem 0.2rem !important;
}

body.is-scrambling .scramble-reel-viewport {
    height: clamp(52px, 12vw, 70px) !important;
}

body.is-scrambling .reel-step-item {
    width: clamp(64px, 16vw, 84px) !important;
    height: clamp(48px, 12vw, 64px) !important;
    font-size: clamp(2.0rem, 7vw, 2.7rem) !important;
    font-weight: 700 !important;
    color: var(--text-primary) !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    transform: none !important;
    line-height: 1 !important;
}

body.is-scrambling .reel-step-item.step-done {
    color: var(--text-muted) !important;
    opacity: 0.32 !important;
}

body.is-scrambling .reel-step-item.step-active {
    font-size: clamp(2.0rem, 7vw, 2.7rem) !important;
    font-weight: 700 !important;
    color: var(--text-primary) !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    transform: none !important;
    opacity: 1 !important;
    line-height: 1 !important;
}

/* 3D Live Cube positioned directly below the Scramble Box */
body.is-scrambling #card-cube-views {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    flex: 1 1 auto !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 auto !important;
}

body.is-scrambling #card-cube-views .collapsible-body {
    display: flex !important;
    width: 100% !important;
    height: 100% !important;
    padding: 0 !important;
    align-items: center !important;
    justify-content: center !important;
}

body.is-scrambling .cube-views-container {
    display: flex !important;
    grid-template-columns: 1fr !important;
    width: 100% !important;
    height: 100% !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0 !important;
    padding: 0 !important;
}

body.is-scrambling .cube-view-card:first-child {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 auto !important;
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

body.is-scrambling .cube-3d-stage {
    width: min(82vw, 340px) !important;
    height: min(46vh, 340px) !important;
    max-width: 340px !important;
    max-height: 340px !important;
    margin: 0 auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    pointer-events: auto !important;
}

/* Landscape Orientation Adaptations for Scramble Focus Mode (Side-by-Side Fullscreen) */
@media (orientation: landscape) {
    body.is-scrambling {
        overflow: hidden !important;
    }

    body.is-scrambling .app-main {
        padding: 0.35rem 0.65rem !important;
        margin: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100vh !important;
        min-height: 100vh !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
        box-sizing: border-box !important;
    }

    body.is-scrambling .stage-section {
        width: 100% !important;
        max-width: 1280px !important;
        height: 100% !important;
        max-height: 100vh !important;
        display: grid !important;
        grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr) !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0.85rem !important;
        padding: 0.2rem 0.4rem !important;
        box-sizing: border-box !important;
        flex-direction: unset !important;
        margin: 0 auto !important;
    }

    body.is-scrambling .arena-card {
        height: auto !important;
        max-height: 96vh !important;
        width: 100% !important;
        padding: 0.35rem 0.5rem !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        box-sizing: border-box !important;
    }

    body.is-scrambling .scramble-card {
        padding: 0.25rem 0.2rem !important;
    }

    body.is-scrambling .scramble-reel-viewport {
        height: clamp(52px, 15vh, 74px) !important;
    }

    body.is-scrambling .reel-step-item {
        font-size: clamp(1.8rem, 10vh, 2.6rem) !important;
    }

    body.is-scrambling .reel-slot.slot--2,
    body.is-scrambling .reel-slot.slot-2 {
        width: clamp(48px, 6vw, 64px);
        flex: 0 0 clamp(48px, 6vw, 64px);
    }
    body.is-scrambling .reel-slot.slot--1,
    body.is-scrambling .reel-slot.slot-1 {
        width: clamp(54px, 7vw, 70px);
        flex: 0 0 clamp(54px, 7vw, 70px);
    }

    body.is-scrambling #card-cube-views {
        width: 100% !important;
        height: 100% !important;
        max-height: 96vh !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
    }

    body.is-scrambling .cube-3d-stage {
        width: min(44vw, 84vh) !important;
        height: min(44vw, 84vh) !important;
        max-width: 380px !important;
        max-height: 84vh !important;
        margin: auto !important;
    }
}

@media (orientation: portrait) {
    body.is-scrambling .stage-section {
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* Solving Focus Mode: Hide EVERYTHING except the big timer */
body.is-solving .app-header,
body.is-solving .module-toggle-toolbar,
body.is-solving .card-cube-views,
body.is-solving .main-solve-breakdown-card,
body.is-solving .card-history-table,
body.is-solving .sidebar-section,
body.is-solving #scramble-box,
body.is-solving .live-stats-bar,
body.is-solving .timer-control-hint,
body.is-solving .inspection-banner {
    display: none !important;
}

body.is-solving .app-main {
    grid-template-columns: 1fr !important;
    padding: 0 !important;
    margin: 0 !important;
    min-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.is-solving .stage-section {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.is-solving .arena-card {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100%;
}

body.is-solving .timer-view {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

body.is-solving .timer-digits {
    font-size: clamp(4.5rem, 20vw, 10rem) !important;
    letter-spacing: -0.03em;
    color: var(--accent-primary, #10B981);
    text-shadow: 0 0 35px rgba(16, 185, 129, 0.6);
}

/* ==========================================================================
   Landscape Orientation Layout Optimization (Phones & Tablets)
   ========================================================================== */
@media (orientation: landscape) and (max-height: 580px) {
    .app-header {
        padding: 0.25rem 0.6rem;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
    }
    .app-nav-tabs {
        padding: 0 0.55rem;
        min-height: 34px;
        height: 34px;
    }
    .nav-tab-btn {
        padding: 0.2rem 0.5rem;
        font-size: 0.72rem;
        height: 29px;
        min-height: 29px;
    }
    .nav-tab-btn.active {
        height: 30px !important;
        min-height: 30px !important;
        margin-bottom: -1px !important;
    }
    .app-main {
        grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
        padding: 0.35rem 0.55rem;
        gap: 0.55rem;
        align-items: start;
    }
    .module-toggle-toolbar {
        min-height: 38px;
        height: 38px;
        max-height: 38px;
        padding: 0.1rem 0.35rem;
    }
    .module-chip-btn {
        padding: 0 0.3rem;
        font-size: 0.72rem;
    }
    .scramble-reel-viewport {
        height: 72px;
    }
    .reel-step-item {
        font-size: 1.45rem;
    }
    .timer-digits {
        font-size: clamp(2.8rem, 14vw, 5.5rem);
    }
}

/* ==========================================================================
   Trend Statistics Summary Card
   ========================================================================== */
.trend-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 0.5rem;
    width: 100%;
    margin-top: 0.85rem;
    box-sizing: border-box;
}

.trend-stat-card {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.6rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.trend-stat-label {
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.15rem;
}

.trend-stat-value {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-primary);
}

/* Practice Mode Enhanced Layout */
.practice-arena-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-bottom: 0.5rem;
}

.practice-history-list {
    max-height: 220px;
    overflow-y: auto;
    width: 100%;
}

/* ==========================================================================
   Clickable 7-Column History Table
   ========================================================================== */
.history-row-clickable {
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.1s ease;
}
.history-row-clickable:hover {
    background-color: rgba(59, 130, 246, 0.08);
}
.history-row-clickable:active {
    background-color: rgba(59, 130, 246, 0.16);
}

/* ==========================================================================
   CFOP cffffop Breakdown Table
   ========================================================================== */
.cffffop-table-wrapper {
    margin-top: 1rem;
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}
.cffffop-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.cffffop-table th, .cffffop-table td {
    padding: 0.6rem 0.85rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
.cffffop-table th {
    background-color: var(--bg-surface-elevated);
    color: var(--text-muted);
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}
.cffffop-row {
    transition: background-color 0.15s ease;
}
.cffffop-clickable {
    cursor: pointer;
}
.cffffop-clickable:hover {
    background-color: rgba(59, 130, 246, 0.1);
}
.cffffop-clickable:hover .cffffop-alg-link {
    opacity: 1;
    transform: translateX(2px);
}
.cffffop-color-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}
.cffffop-alg-link {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--accent-color, #3B82F6);
    background: rgba(59, 130, 246, 0.12);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    opacity: 0.8;
    transition: opacity 0.15s, transform 0.15s;
    display: inline-block;
}

/* ==========================================================================
   Alg Card Modal
   ========================================================================== */
.alg-card-body {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.alg-card-visual-row {
    display: flex;
    gap: 1.25rem;
    align-items: stretch;
    justify-content: center;
    background: var(--bg-surface-elevated);
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}
@media (max-width: 600px) {
    .alg-card-visual-row {
        flex-direction: column;
        align-items: center;
    }
}
.alg-card-3d-box, .alg-card-2d-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}
.alg-card-box-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}
.alg-card-3d-container {
    width: 180px;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
}
.alg-card-3d-container:active {
    cursor: grabbing;
}
.alg-card-2d-canvas {
    width: 140px;
    height: 140px;
    border-radius: var(--radius-sm);
}
.alg-card-form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}
.alg-card-form-row {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}
.alg-card-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1;
}
.alg-card-field label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}
.alg-card-field input, .alg-card-field textarea {
    padding: 0.55rem 0.75rem;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.95rem;
}
.alg-card-history-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.alg-card-history-title {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
}
.alg-card-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.alg-card-history-table th, .alg-card-history-table td {
    padding: 0.45rem 0.65rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
.history-alg-formula {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
