/* ===== CSS VARIABLES / THEMES ===== */
:root {
    --primary: #00f0ff;
    --secondary: #7b2ff7;
    --accent: #ff00e5;
    --bg-dark: #0a0a1a;
    --bg-mid: #111133;
    --ring-size: min(80vmin, 500px);
    --text-glow: 0 0 20px var(--primary), 0 0 60px var(--primary);
}

[data-theme="fire-lava"] {
    --primary: #ff4500;
    --secondary: #ff8c00;
    --accent: #ffd700;
    --bg-dark: #1a0500;
    --bg-mid: #2d0a00;
}
[data-theme="ocean-calm"] {
    --primary: #00bcd4;
    --secondary: #0077b6;
    --accent: #90e0ef;
    --bg-dark: #001220;
    --bg-mid: #002233;
}
[data-theme="galaxy-purple"] {
    --primary: #bf5af2;
    --secondary: #5e17eb;
    --accent: #ff6ec7;
    --bg-dark: #0d001a;
    --bg-mid: #1a0033;
}
[data-theme="matrix-green"] {
    --primary: #00ff41;
    --secondary: #008f11;
    --accent: #00ff41;
    --bg-dark: #000a00;
    --bg-mid: #001a00;
}
[data-theme="sunset-gold"] {
    --primary: #f7b733;
    --secondary: #fc4a1a;
    --accent: #f953c6;
    --bg-dark: #1a0a00;
    --bg-mid: #2d1500;
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-dark);
    color: #fff;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    cursor: default;
}

.hidden { display: none !important; }

/* ===== BACKGROUND LAYERS ===== */
#particleCanvas {
    position: fixed; inset: 0;
    width: 100%; height: 100%;
    z-index: 0;
    pointer-events: none;
}

.bg-layer {
    position: fixed; inset: 0;
    width: 100%; height: 100%;
    pointer-events: none;
}

.bg-gradient {
    z-index: -3;
    background: radial-gradient(ellipse at 30% 50%, var(--bg-mid) 0%, var(--bg-dark) 70%);
    transition: background 1s ease;
}

.bg-orbs { z-index: -2; }

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
    animation: orbFloat 12s ease-in-out infinite alternate;
}
.orb-1 { width: 400px; height: 400px; background: var(--primary); top: -10%; left: -5%; animation-delay: 0s; }
.orb-2 { width: 350px; height: 350px; background: var(--secondary); bottom: -10%; right: -5%; animation-delay: -3s; }
.orb-3 { width: 250px; height: 250px; background: var(--accent); top: 50%; left: 60%; animation-delay: -6s; }
.orb-4 { width: 200px; height: 200px; background: var(--primary); bottom: 20%; left: 10%; animation-delay: -2s; opacity: 0.15; }
.orb-5 { width: 300px; height: 300px; background: var(--secondary); top: 10%; right: 30%; animation-delay: -8s; opacity: 0.2; }

@keyframes orbFloat {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -40px) scale(1.1); }
    66% { transform: translate(-20px, 20px) scale(0.95); }
    100% { transform: translate(10px, -10px) scale(1.05); }
}

.bg-grid {
    z-index: -1;
    opacity: 0.04;
    background-image:
        linear-gradient(var(--primary) 1px, transparent 1px),
        linear-gradient(90deg, var(--primary) 1px, transparent 1px);
    background-size: 60px 60px;
    animation: gridScroll 20s linear infinite;
}
@keyframes gridScroll {
    0% { background-position: 0 0; }
    100% { background-position: 60px 60px; }
}

.bg-noise {
    z-index: -1;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ===== SETUP PANEL ===== */
.setup-panel {
    position: fixed; inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.setup-card {
    background: rgba(15, 15, 40, 0.85);
    backdrop-filter: blur(30px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 28px;
    padding: 30px 40px;
    max-width: 950px; /* Widened for two columns */
    width: 100%;
    text-align: center;
    box-shadow: 0 25px 80px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.05);
    animation: cardIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 90vh; /* Prevent bleeding off screen */
    overflow-y: auto; /* Scroll inside if screen is extremely small */
}
.setup-card::-webkit-scrollbar { width: 6px; }
.setup-card::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 10px; }
@keyframes cardIn {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.setup-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 6px;
    letter-spacing: 2px;
}

.setup-subtitle {
    color: rgba(255,255,255,0.5);
    font-size: 0.95rem;
    margin-bottom: 20px;
}

/* Layout Columns */
.setup-columns {
    display: flex;
    gap: 40px;
    text-align: left;
}

.setup-col {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.design-col {
    border-left: 1px solid rgba(255,255,255,0.1);
    padding-left: 40px;
}

/* Time Input */
.time-input-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
}

.time-input-box label {
    display: block;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 8px;
}

.time-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.spin-btn {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--primary);
    font-size: 0.8rem;
    padding: 4px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}
.spin-btn:hover {
    background: rgba(255,255,255,0.12);
    border-color: var(--primary);
}

.time-input {
    font-family: 'Orbitron', sans-serif;
    font-size: 3rem;
    font-weight: 700;
    width: 120px;
    text-align: center;
    background: rgba(0,0,0,0.4);
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    color: #fff;
    padding: 12px 8px;
    outline: none;
    transition: border-color 0.3s;
    -moz-appearance: textfield;
}
.time-input::-webkit-inner-spin-button,
.time-input::-webkit-outer-spin-button { -webkit-appearance: none; }
.time-input:focus { border-color: var(--primary); box-shadow: 0 0 20px rgba(0,240,255,0.15); }

.time-separator {
    font-family: 'Orbitron', sans-serif;
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary);
    padding-top: 28px;
    animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0.3; } }

/* Presets */
.presets-row {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 28px;
}

.preset-btn {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 8px 18px;
    border-radius: 100px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    transition: all 0.25s;
}
.preset-btn:hover {
    background: var(--primary);
    color: #000;
    border-color: var(--primary);
    transform: scale(1.05);
}

/* Theme Selector */
.theme-selector h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: rgba(255,255,255,0.4);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.theme-count {
    font-size: 0.7rem;
    background: var(--primary);
    color: #000;
    padding: 2px 8px;
    border-radius: 100px;
    letter-spacing: 1px;
    font-weight: 700;
}

.theme-search-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.theme-search {
    flex: 1;
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    color: #fff;
    font-size: 0.85rem;
    padding: 8px 12px;
    outline: none;
    transition: border-color 0.2s;
}
.theme-search::placeholder { color: rgba(255,255,255,0.3); }
.theme-search:focus { border-color: var(--primary); }

.category-filter {
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    color: #fff;
    font-size: 0.8rem;
    padding: 8px 10px;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}
.category-filter:focus { border-color: var(--primary); }
.category-filter option { background: #111; color: #fff; }

.theme-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 7px;
    max-height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    margin-bottom: 20px;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) rgba(255,255,255,0.05);
}
.theme-grid::-webkit-scrollbar { width: 4px; }
.theme-grid::-webkit-scrollbar-track { background: rgba(255,255,255,0.04); border-radius: 4px; }
.theme-grid::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 4px; }

.theme-btn {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 7px 5px 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: 0;
}
.theme-btn span {
    font-size: 0.62rem;
    color: rgba(255,255,255,0.55);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    text-align: center;
    line-height: 1.2;
}
.theme-btn:hover { border-color: rgba(255,255,255,0.25); transform: translateY(-1px); background: rgba(255,255,255,0.06); }
.theme-btn.active { border-color: var(--primary); background: rgba(255,255,255,0.08); box-shadow: 0 0 12px rgba(0,240,255,0.15); }

.theme-preview {
    width: 100%;
    height: 26px;
    border-radius: 6px;
    flex-shrink: 0;
}
.theme-no-results {
    grid-column: 1/-1;
    text-align: center;
    color: rgba(255,255,255,0.3);
    font-size: 0.85rem;
    padding: 20px;
}

/* Sound Toggle */
.sound-toggle-row {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: auto;
    margin-bottom: 28px;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.6);
}
.toggle-label input { display: none; }

.toggle-slider {
    width: 42px;
    height: 22px;
    background: rgba(255,255,255,0.1);
    border-radius: 100px;
    position: relative;
    transition: background 0.3s;
}
.toggle-slider::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: transform 0.3s;
}
.toggle-label input:checked + .toggle-slider { background: var(--primary); }
.toggle-label input:checked + .toggle-slider::after { transform: translateX(20px); }

/* Start Button */
.start-btn {
    position: relative;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 4px;
    padding: 18px 60px;
    border: none;
    border-radius: 100px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s;
    text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.start-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 40px rgba(0,240,255,0.3), 0 10px 30px rgba(0,0,0,0.3);
}
.start-btn:active { transform: scale(0.98); }

.start-btn-glow {
    position: absolute;
    inset: -2px;
    border-radius: 100px;
    background: linear-gradient(135deg, var(--primary), var(--accent), var(--secondary));
    z-index: -1;
    filter: blur(15px);
    opacity: 0.5;
    animation: glowPulse 2s ease-in-out infinite;
}
@keyframes glowPulse { 0%, 100% { opacity: 0.3; } 50% { opacity: 0.7; } }

/* ===== TIMER DISPLAY ===== */
.timer-display {
    position: fixed; inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.5s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Ring Container */
.timer-ring-container {
    position: relative;
    width: var(--ring-size);
    height: var(--ring-size);
}

.timer-ring {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    filter: drop-shadow(0 0 15px rgba(0,240,255,0.3));
}

.ring-glow {
    fill: none;
    stroke: var(--primary);
    stroke-width: 4;
    opacity: 0.15;
    filter: blur(8px);
}

.ring-bg {
    fill: none;
    stroke: rgba(255,255,255,0.06);
    stroke-width: 8;
}

.ring-progress {
    fill: none;
    stroke: url(#ringGradient);
    stroke-width: 10;
    stroke-linecap: round;
    stroke-dasharray: 1131;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.1s linear;
    filter: drop-shadow(0 0 8px var(--primary));
}

.ring-inner {
    fill: none;
    stroke: rgba(255,255,255,0.03);
    stroke-width: 1;
    stroke-dasharray: 4 8;
}

/* Timer Text */
.timer-text-container {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.timer-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 6px;
    color: rgba(255,255,255,0.4);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.timer-digits {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(4rem, 12vmin, 7rem);
    font-weight: 900;
    color: #fff;
    text-shadow: var(--text-glow);
    line-height: 1;
    letter-spacing: 4px;
    transition: text-shadow 0.3s;
    transform: scale(var(--font-scale, 1));
}

.timer-ms {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(1.2rem, 3vmin, 1.8rem);
    font-weight: 400;
    color: var(--primary);
    opacity: 0.6;
    margin-top: 4px;
    transform: scale(var(--font-scale, 1));
}

/* Timer Controls - Hidden for clean screen recording */
.timer-controls {
    display: none !important;
}

/* ===== TIME'S UP OVERLAY ===== */
.times-up-overlay {
    position: fixed; inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease;
}

.times-up-content {
    text-align: center;
    animation: timesUpBounce 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes timesUpBounce {
    from { opacity: 0; transform: scale(0.5); }
    to { opacity: 1; transform: scale(1); }
}

.times-up-flash {
    position: fixed; inset: 0;
    animation: flash 0.6s ease-out;
    pointer-events: none;
}
@keyframes flash {
    0% { background: var(--primary); opacity: 0.6; }
    100% { background: transparent; opacity: 0; }
}

.times-up-text {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(3rem, 10vw, 6rem);
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 40px var(--primary), 0 0 80px var(--primary), 0 0 120px var(--accent);
    animation: textPulse 1s ease-in-out infinite;
    letter-spacing: 6px;
}
@keyframes textPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.03); }
}

.times-up-emoji {
    font-size: 4rem;
    margin: 20px 0;
    animation: shake 0.5s ease-in-out infinite;
}
@keyframes shake {
    0%, 100% { transform: rotate(0); }
    25% { transform: rotate(-15deg); }
    75% { transform: rotate(15deg); }
}

.times-up-btn {
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 3px;
    padding: 14px 40px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 100px;
    background: transparent;
    color: #fff;
    cursor: pointer;
    margin-top: 20px;
    transition: all 0.3s;
}
.times-up-btn:hover {
    background: #fff;
    color: #000;
    border-color: #fff;
}

/* ===== URGENCY EFFECTS ===== */
.timer-display.urgent .timer-digits {
    color: #ff3333;
    text-shadow: 0 0 30px #ff3333, 0 0 60px #ff0000;
    animation: urgentPulse 0.5s ease-in-out infinite;
}
@keyframes urgentPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
}

.timer-display.urgent .ring-progress {
    stroke: #ff3333 !important;
    filter: drop-shadow(0 0 15px #ff3333);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 850px) {
    .setup-columns { flex-direction: column; gap: 20px; }
    .design-col { border-left: none; padding-left: 0; border-top: 1px solid rgba(255,255,255,0.1); padding-top: 20px; }
    .setup-card { max-width: 600px; padding: 25px; }
}
@media (max-width: 640px) {
    .setup-card { padding: 28px 20px; border-radius: 20px; }
    .setup-title { font-size: 1.4rem; }
    .time-input { font-size: 2.2rem; width: 90px; padding: 10px 4px; }
    .time-separator { font-size: 2.2rem; }
    .theme-grid { grid-template-columns: repeat(2, 1fr); }
    .start-btn { padding: 14px 40px; font-size: 1rem; }
    .presets-row { gap: 6px; }
    .preset-btn { padding: 6px 12px; font-size: 0.8rem; }
    .design-grid { grid-template-columns: 1fr; }
}

/* ===== NEW DESIGN CONTROLS ===== */
.yt-templates-section {
    margin-bottom: 25px;
}
.yt-templates-section h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: rgba(255,255,255,0.4);
    margin-bottom: 12px;
}
.yt-template-btn {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    font-weight: 700;
}
.yt-template-btn:hover {
    background: #fff;
    color: #000;
}

.design-controls {
    margin-top: 10px;
    margin-bottom: 25px;
    padding-top: 15px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.design-controls h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: rgba(255,255,255,0.4);
    margin-bottom: 12px;
}

.design-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.control-group {
    display: flex;
    flex-direction: column;
    text-align: left;
    gap: 5px;
}

.control-group label {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.6);
    letter-spacing: 1px;
}

.control-group select {
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    color: #fff;
    font-size: 0.8rem;
    padding: 8px;
    outline: none;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
}
.control-group select:focus { border-color: var(--primary); }
.control-group select option { background: #111; }

.randomize-btn {
    width: 100%;
    padding: 10px;
    background: rgba(255,255,255,0.05);
    border: 1px dashed rgba(255,255,255,0.2);
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    font-size: 0.8rem;
    letter-spacing: 1px;
    transition: all 0.2s;
}
.randomize-btn:hover {
    background: rgba(255,255,255,0.1);
    border-color: var(--primary);
    color: var(--primary);
}

/* ===== TIMER SHAPES ===== */
/* Text Only */
body.shape-text-only .timer-ring { display: none; }
body.shape-text-only .timer-digits { font-size: clamp(6rem, 20vmin, 12rem); }

/* Premium TI Text (Old Design) */
body.shape-ti-premium .timer-ring { display: none; }
body.shape-ti-premium .timer-label, body.shape-ti-premium .timer-ms { display: none; }
body.shape-ti-premium .timer-digits { 
    font-size: clamp(8rem, 25vmin, 15rem);
    color: #fff;
    -webkit-text-stroke: 1.2vmin var(--bg-dark);
    text-stroke: 1.2vmin var(--bg-dark);
    text-shadow: 
        0px 0px 2vmin rgba(0,0,0,0.9),
        0px 0px 5vmin rgba(0,0,0,0.9),
        0px 0px 10vmin var(--primary),
        0.5vmin 0.5vmin 2vmin var(--bg-mid);
}

/* Thick Ring */
body.shape-ring-thick .ring-progress { stroke-width: 25; filter: none; }
body.shape-ring-thick .ring-bg { stroke-width: 25; stroke: rgba(255,255,255,0.1); }
body.shape-ring-thick .ring-glow, body.shape-ring-thick .ring-inner, body.shape-ring-thick .tick-marks { display: none; }

/* Dashed Ring */
body.shape-ring-dashed .ring-progress { stroke-dasharray: 20 10; stroke-width: 12; }
body.shape-ring-dashed .ring-bg { stroke-dasharray: 20 10; stroke-width: 12; }

/* Pie Chart */
body.shape-pie .ring-progress { stroke-width: 360; stroke-dasharray: 1131; }
body.shape-pie .ring-bg { stroke-width: 360; stroke: rgba(255,255,255,0.05); }
body.shape-pie .ring-glow, body.shape-pie .ring-inner, body.shape-pie .tick-marks { display: none; }

/* Linear Bottom */
body.shape-linear-bottom .timer-ring { display: none; }
body.shape-linear-bottom .timer-text-container { position: relative; }
body.shape-linear-bottom .timer-digits { font-size: clamp(5rem, 15vmin, 10rem); }

.linear-progress-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 15px;
    background: rgba(255,255,255,0.05);
    z-index: 20;
}
.linear-progress-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    box-shadow: 0 -5px 15px rgba(0,0,0,0.5), 0 0 10px var(--primary);
    transform-origin: left;
    transition: transform 0.1s linear;
}

/* ===== BACKGROUND PATTERNS ===== */
.pattern-layer {
    position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; opacity: 0.05; pointer-events: none;
}
body.pattern-dots .bg-grid {
    background-image: radial-gradient(var(--primary) 2px, transparent 2px);
    background-size: 30px 30px;
}
body.pattern-hex .bg-grid {
    background-image: url("data:image/svg+xml,%3Csvg width='40' height='69.28203230275509' viewBox='0 0 40 69.28203230275509' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M40 17.32050807568877l-20 11.547005383792516L0 17.32050807568877V-5.773502691896258l20-11.547005383792516 20 11.547005383792516zM40 51.96152422706631l-20 11.547005383792516L0 51.96152422706631V28.867513459481245l20-11.547005383792516 20 11.547005383792516z' fill='none' stroke='%23ffffff' stroke-width='1' stroke-opacity='1'/%3E%3C/svg%3E");
    opacity: 0.08;
    animation: none;
}
body.pattern-none .bg-orbs, body.pattern-none .bg-grid, body.pattern-none .bg-noise { display: none; }
body.pattern-grid .bg-orbs { display: none; }
body.pattern-orbs .bg-grid { opacity: 0.02; }

/* ===== FONT STYLES ===== */
body.font-orbitron .timer-digits { font-family: 'Orbitron', sans-serif; }
body.font-bebas .timer-digits { font-family: 'Bebas Neue', cursive; letter-spacing: 8px; font-weight: normal; }
body.font-inter .timer-digits { font-family: 'Inter', sans-serif; font-weight: 700; letter-spacing: 0px; }
body.font-mono .timer-digits { font-family: 'Courier New', Courier, monospace; font-weight: bold; letter-spacing: -2px; }


/* ===== ANIMATED PATTERN KEYFRAMES ===== */
        @keyframes rotateBg   { from { background-position: 0 0;       } to { background-position: 200vw 200vw; } }
        @keyframes rotateHue  { from { filter: hue-rotate(0deg);       } to { filter: hue-rotate(360deg); } }
        @keyframes pulsePat   { 0%,100%{ background-size:60px 60px; } 50%{ background-size:90px 90px; } }
        @keyframes driftX     { 0%{ background-position:0 0; } 100%{ background-position:400px 0; } }
        @keyframes driftY     { 0%{ background-position:0 0; } 100%{ background-position:0 400px; } }
        @keyframes driftDiag  { 0%{ background-position:0 0; } 100%{ background-position:300px 300px; } }
        @keyframes scalePulse { 0%,100%{ transform:scale(1); } 50%{ transform:scale(1.08); } }
        @keyframes brightPulse{ 0%,100%{ filter:brightness(1); } 50%{ filter:brightness(1.5); } }
        @keyframes satPulse   { 0%,100%{ filter:saturate(1); } 50%{ filter:saturate(3); } }
        @keyframes spinBg     { from{ background-position:0 0; } to{ background-position:-400px 400px; } }
        @keyframes zigDrift   { 0%{ background-position:0 0,0 0,0 0,0 0; } 100%{ background-position:160px 0,160px 0,160px 0,160px 0; } }
        @keyframes radialPulse{ 0%,100%{ background-size:50px 50px; } 50%{ background-size:100px 100px; } }
        @keyframes conicSpin  { from{ background:conic-gradient(from 0deg, var(--c1) 0deg 60deg,var(--c2) 60deg 120deg,var(--c3) 120deg 180deg,var(--c4) 180deg 240deg,var(--c5) 240deg 300deg,var(--c6) 300deg 360deg); } }
        @keyframes glowPulse  { 0%,100%{ box-shadow:inset 0 0 120px rgba(255,255,255,0); } 50%{ box-shadow:inset 0 0 120px rgba(255,255,255,0.15); } }
        @keyframes flashStars { 0%,100%{ opacity:1; } 50%{ opacity:0.4; } }
        @keyframes waveShift  { 0%{ background-position:0 0,50px 50px; } 100%{ background-position:100px 100px,150px 150px; } }
        @keyframes inkBleed   { 0%,100%{ filter:blur(0px) brightness(1); } 50%{ filter:blur(4px) brightness(1.4); } }
        @keyframes neonFlicker{ 0%,100%{ opacity:1; } 92%{ opacity:1; } 93%{ opacity:0.5; } 96%{ opacity:1; } 97%{ opacity:0.3; } } 
        @keyframes auroraDrift{ 0%{ background-position:0% 50%; } 50%{ background-position:100% 50%; } 100%{ background-position:0% 50%; } }
        @keyframes plasma     { 0%{ filter:hue-rotate(0deg) saturate(2); } 100%{ filter:hue-rotate(360deg) saturate(2); } }
        @keyframes blobDrift  { 0%,100%{ background-position:20% 30%, 80% 70%, 50% 90%; } 50%{ background-position:30% 60%, 70% 30%, 40% 50%; } }
        @keyframes stripeScroll{from{ background-position:0 0; } to{ background-position:0 200px; } }
        @keyframes checkGrow  { 0%,100%{ background-size:60px 60px; } 50%{ background-size:80px 80px; } }
        @keyframes ringExpand { 0%{ background-size:30px 30px; } 100%{ background-size:90px 90px; } } 
        @keyframes triSpin    { from{ background-position:0% 0%; } to{ background-position:100% 100%; } }
        @keyframes holoPulse  { 0%{ filter:hue-rotate(0deg) brightness(1.1); } 100%{ filter:hue-rotate(360deg) brightness(1.3); } }
        @keyframes neonScroll { from{ background-position:0 0,0 0; } to{ background-position:80px 80px,0 0; } }
        @keyframes matrixFall { from{ background-position:0 0; } to{ background-position:0 500px; } }
        @keyframes twistGrad  { 0%{ background-position:0% 0%; } 100%{ background-position:100% 100%; } }

        /* Animated pattern helper classes */
        .ap-hue-rotate  { animation: rotateHue   8s linear infinite; }
        .ap-hue-fast    { animation: rotateHue   3s linear infinite; }
        .ap-drift-diag  { animation: driftDiag  12s linear infinite; }
        .ap-drift-x     { animation: driftX     10s linear infinite; }
        .ap-drift-y     { animation: driftY     10s linear infinite; }
        .ap-pulse-pat   { animation: pulsePat    4s ease-in-out infinite; }
        .ap-glow-pulse  { animation: glowPulse   3s ease-in-out infinite; }
        .ap-bright-pulse{ animation: brightPulse  5s ease-in-out infinite; }
        .ap-sat-pulse   { animation: satPulse     4s ease-in-out infinite; }
        .ap-spin-bg     { animation: spinBg      20s linear infinite; }
        .ap-zig-drift   { animation: zigDrift    10s linear infinite; }
        .ap-radial-pulse{ animation: radialPulse  5s ease-in-out infinite; }
        .ap-aurora      { background-size: 300% 300% !important; animation: auroraDrift 10s ease infinite; }
        .ap-plasma      { animation: plasma      10s linear infinite; }
        .ap-blob        { animation: blobDrift    8s ease-in-out infinite; }
        .ap-stripe-scroll{ animation: stripeScroll 5s linear infinite; }
        .ap-check-grow  { animation: checkGrow    4s ease-in-out infinite; }
        .ap-neon-flicker{ animation: neonFlicker  4s step-end infinite; }
        .ap-holo        { animation: holoPulse    6s linear infinite; }
        .ap-neon-scroll { animation: neonScroll   8s linear infinite; }
        .ap-matrix      { animation: matrixFall   6s linear infinite; }
        .ap-twist-grad  { background-size: 200% 200% !important; animation: twistGrad  10s ease infinite; }
        .ap-wave-shift  { animation: waveShift    7s linear infinite; }
        .ap-flash-stars { animation: flashStars   2s ease-in-out infinite; }
        .ap-neon-drift  { animation: driftDiag   15s linear infinite, rotateHue 12s linear infinite; }
    