:root {
    /* Brand Colors - Dark Neon Theme */
    --bg-main: #050505;
    --bg-secondary: #0a0a0a;
    --text-primary: #ffffff;
    --text-secondary: #8892b0;
    --text-muted: #4a5568;

    /* Accents */
    --accent-cyan: #00f0ff;
    --accent-purple: #bd00ff;
    --accent-success: #00ff9d;
    --accent-warning: #ffbf00;

    /* Functional Modes */
    --mode-focus: var(--accent-cyan);
    --mode-short: var(--accent-purple);
    --mode-long: var(--accent-success);

    /* Glass & Surface */
    --glass-bg: rgba(20, 20, 20, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.03);
    --surface-hover: rgba(255, 255, 255, 0.05);

    /* Shadows / Glows */
    --glow-focus: 0 0 30px rgba(0, 240, 255, 0.15);
    --glow-text: 0 0 10px rgba(255, 255, 255, 0.1);

    /* Spacing & Radius */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 9999px;

    /* Transitions */
    --ease-out: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --ease-elastic: cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(189, 0, 255, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(0, 240, 255, 0.05) 0%, transparent 40%);
}

/* --- Typography --- */
h1,
h2,
h3,
h4 {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5em;
    letter-spacing: -0.02em;
}

h1 {
    font-size: 3.5rem;
    line-height: 1.1;
    background: linear-gradient(135deg, #fff 0%, #a5a5a5 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

h2 {
    font-size: 2rem;
}

p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* --- Util Classes --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.flex-col {
    display: flex;
    flex-direction: column;
}

.text-center {
    text-align: center;
}

.hidden {
    display: none !important;
    opacity: 0;
    pointer-events: none;
}

.btn-reset {
    background: none;
    border: none;
    font: inherit;
    cursor: pointer;
    outline: none;
}

/* --- Components: Buttons --- */
.btn-primary {
    background: var(--text-primary);
    color: var(--bg-main);
    padding: 1rem 2.5rem;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 1.1rem;
    transition: transform 0.2s var(--ease-out), box-shadow 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(45deg, var(--accent-cyan), var(--accent-purple));
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 40px -10px rgba(255, 255, 255, 0.3);
}

.btn-primary:hover::before {
    opacity: 0.1;
}

.btn-glass {
    background: var(--glass-highlight);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-full);
    transition: 0.3s;
    backdrop-filter: blur(10px);
}

.btn-glass:hover {
    background: var(--surface-hover);
    border-color: rgba(255, 255, 255, 0.2);
}

/* --- Components: Cards --- */
.card-glass {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(24px);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

/* --- Hero Section --- */
#hero-section {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 10;
}

.hero-content {
    text-align: center;
    max-width: 600px;
    animation: fadeIn 0.8s var(--ease-out);
}

.hero-subtitle {
    font-size: 1.25rem;
    margin-bottom: 2.5rem;
    color: var(--text-secondary);
}

/* --- App Layout --- */
#app-section {
    min-height: 100vh;
    display: none;
    /* JS will toggle */
    flex-direction: column;
    animation: slideUp 0.6s var(--ease-out);
}

#app-section.active {
    display: flex;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    position: sticky;
    top: 0;
    z-index: 50;
    background: linear-gradient(to bottom, var(--bg-main) 0%, transparent 100%);
}

.app-logo {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.app-logo span {
    color: var(--mode-focus);
}

/* --- Timer Core --- */
.timer-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Timer Ring */
.timer-visual {
    position: relative;
    width: 380px;
    height: 380px;
    margin-bottom: 2rem;
}

.ring-svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
    overflow: visible;
}

.ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.03);
    stroke-width: 8;
}

.ring-progress {
    fill: none;
    stroke: var(--mode-focus);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 1006;
    /* 2*PI*160 */
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.5s linear, stroke 0.3s;
    filter: drop-shadow(0 0 8px var(--mode-focus));
}

.timer-text-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.time-big {
    font-size: 6.5rem;
    font-weight: 300;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.time-label {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.2rem;
    color: var(--text-secondary);
    margin-top: 1rem;
}

/* Controls */
.timer-controls {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    z-index: 20;
}

.btn-control-lg {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--text-primary);
    color: var(--bg-main);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: 0.3s;
}

.btn-control-lg:hover {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.btn-control-sm {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.btn-control-sm:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

/* --- Modes --- */
.mode-tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.5rem;
    border-radius: 100px;
    margin-bottom: 3rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.tab-btn {
    padding: 0.6rem 1.5rem;
    border-radius: 100px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: 0.3s;
}

.tab-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    font-weight: 600;
}

.action-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--accent-cyan);
    transition: all 0.2s var(--ease-out);
}

.action-icon:hover {
    background: var(--accent-cyan);
    color: var(--bg-main);
    transform: scale(1.1);
}

/* --- Task List Panel --- */
.tasks-panel {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 350px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.tasks-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.tasks-body {
    padding: 1rem;
}

.task-item {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
    margin-bottom: 0.5rem;
    border-radius: 8px;
    border: 1px solid transparent;
    transition: 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.task-item:hover {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
}

.task-check {
    width: 22px;
    height: 22px;
    border: 2px solid var(--text-secondary);
    border-radius: 50%;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: 0.2s;
}

.task-check:hover {
    border-color: var(--accent-cyan);
}

.task-check.completed {
    border-color: var(--accent-success);
    background: rgba(0, 255, 157, 0.1);
}

.task-check.completed::after {
    content: '✓';
    color: var(--accent-success);
    font-weight: bold;
    font-size: 14px;
}


/* --- Modals --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    width: 90%;
    max-width: 500px;
    padding: 0;
    animation: scaleUp 0.3s var(--ease-out);
    overflow: hidden;
}

.modal-lg {
    max-width: 700px;
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.5rem;
    margin: 0;
}

.close-modal-btn {
    font-size: 1.2rem;
    color: var(--text-secondary);
    transition: 0.2s;
}

.close-modal-btn:hover {
    color: var(--text-primary);
    transform: rotate(90deg);
}

.modal-body {
    padding: 2rem;
}

.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
}

/* Forms */
.setting-group {
    margin-bottom: 1.5rem;
}

.setting-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.setting-group input {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    padding: 0.8rem;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    transition: 0.2s;
}

.setting-group input:focus {
    border-color: var(--mode-focus);
    outline: none;
    background: rgba(255, 255, 255, 0.03);
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.toggle-switch {
    width: 50px;
    height: 26px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 100px;
    position: relative;
    cursor: pointer;
    transition: 0.3s;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: 0.3s ease;
}

.toggle-switch.active {
    background: var(--mode-focus);
}

.toggle-switch.active::after {
    transform: translateX(24px);
}

/* Stats Visuals */
.stats-overview {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-box {
    background: rgba(255, 255, 255, 0.03);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    text-align: center;
}

.stat-num {
    display: block;
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
}

.stat-lbl {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(20, 1fr);
    gap: 4px;
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
}

.day-cell {
    aspect-ratio: 1;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.05);
}

.day-cell.l1 {
    background: rgba(0, 240, 255, 0.3);
}

.day-cell.l2 {
    background: rgba(0, 240, 255, 0.6);
}

.day-cell.l3 {
    background: rgba(0, 240, 255, 0.9);
    box-shadow: 0 0 5px rgba(0, 240, 255, 0.5);
}

.heatmap-legend {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    align-items: center;
}

.legend-scale {
    display: flex;
    gap: 3px;
}

.legend-scale span {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

.l0 {
    background: rgba(255, 255, 255, 0.05);
}

.l1 {
    background: rgba(0, 240, 255, 0.3);
}

.l2 {
    background: rgba(0, 240, 255, 0.6);
}

.l3 {
    background: rgba(0, 240, 255, 0.9);
}


/* --- Animations --- */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes scaleUp {
    from {
        transform: scale(0.95);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 240, 255, 0.4);
    }

    70% {
        box-shadow: 0 0 0 20px rgba(0, 240, 255, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(0, 240, 255, 0);
    }
}

.pulse-active .btn-control-lg {
    animation: pulse 2s infinite;
}

/* Queries based on dynamic screen sizes */
/* Queries based on dynamic screen sizes */
@media (max-width: 768px) {
    h1 {
        font-size: 2.5rem;
    }

    /* Allow scrolling on mobile/tablet */
    #app-section {
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
        padding-bottom: 2rem;
    }

    .timer-container {
        justify-content: flex-start;
        padding-top: 3rem;
        flex: 0 0 auto;
        /* Allow it to take natural height */
        margin-bottom: 2rem;
    }

    .timer-visual {
        width: 300px;
        height: 300px;
    }

    .time-big {
        font-size: 5rem;
    }

    /* Stack the tasks panel below the timer */
    .tasks-panel {
        position: relative;
        left: auto;
        right: auto;
        bottom: auto;
        width: 90%;
        max-width: 500px;
        margin: 0 auto;
        max-height: none;
        /* Let it grow naturally */
    }

    .modal-content {
        width: 95%;
        max-height: 90vh;
        overflow-y: auto;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 2rem;
    }

    .app-header {
        padding: 1rem;
    }

    .timer-visual {
        width: 260px;
        height: 260px;
    }

    .time-big {
        font-size: 4rem;
    }

    .mode-tabs {
        margin-bottom: 2rem;
        padding: 0.3rem;
        transform: scale(0.95);
    }

    .tab-btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }

    .timer-controls {
        gap: 1rem;
    }

    .btn-control-lg {
        width: 70px;
        height: 70px;
        font-size: 1.2rem;
    }

    .modal-header {
        padding: 1rem;
    }

    .modal-body {
        padding: 1rem;
    }

    .heatmap-grid {
        grid-template-columns: repeat(10, 1fr);
        /* Reduce columns for small screens */
    }
}

/* --- Mode State Color Overrides --- */
body[data-mode="short"] .ring-progress {
    stroke: var(--mode-short);
    filter: drop-shadow(0 0 8px var(--mode-short));
}

body[data-mode="short"] .app-logo span {
    color: var(--mode-short);
}

body[data-mode="short"] .time-big {
    text-shadow: 0 0 30px rgba(189, 0, 255, 0.3);
}

body[data-mode="short"] .toggle-switch.active {
    background: var(--mode-short);
}

body[data-mode="long"] .ring-progress {
    stroke: var(--mode-long);
    filter: drop-shadow(0 0 8px var(--mode-long));
}

body[data-mode="long"] .app-logo span {
    color: var(--mode-long);
}

body[data-mode="long"] .time-big {
    text-shadow: 0 0 30px rgba(0, 255, 157, 0.3);
}

body[data-mode="long"] .toggle-switch.active {
    background: var(--mode-long);
}

/* Active Tab Indicator Color */
body[data-mode="short"] .tab-btn.active {
    color: var(--mode-short);
    background: rgba(189, 0, 255, 0.1);
}

body[data-mode="long"] .tab-btn.active {
    color: var(--mode-long);
    background: rgba(0, 255, 157, 0.1);
}