@import url('https://fonts.googleapis.com/css2?family=Oxanium:wght@200;400;600&family=Exo+2:wght@300;400;500;600&display=swap');

/* ─── Design Tokens — Dark (default) ────────────────── */
:root {
    --bg: #0b0b12;
    --surface: rgba(255, 255, 255, 0.035);
    --border: rgba(255, 255, 255, 0.08);
    --text: #e8e8f0;
    --muted: #5a5a7a;
    --time-grad: linear-gradient(160deg, #ffffff 0%, #a0a0c0 100%);
    --bg-grad:
        radial-gradient(ellipse 80% 50% at 50% -10%, rgba(80, 40, 160, 0.18) 0%, transparent 65%),
        radial-gradient(ellipse 60% 40% at 80% 110%, rgba(0, 180, 255, 0.07) 0%, transparent 60%),
        #0b0b12;
    --ring-bg-stroke: rgba(255, 255, 255, 0.06);
    --ring-thickness: 11px;
    --footer-color: rgba(255, 255, 255, 0.2);
    --bar-bg: rgba(255, 255, 255, 0.04);
    --bar-border: rgba(255, 255, 255, 0.08);
    --val-badge-bg: rgba(0, 0, 0, 0.3);
    --val-badge-border: rgba(255, 255, 255, 0.08);
}

/* ─── Design Tokens — Light ──────────────────────────── */
@media (prefers-color-scheme: light) {
    :root {
        --bg: #f0f0f8;
        --surface: rgba(0, 0, 0, 0.04);
        --border: rgba(0, 0, 0, 0.09);
        --text: #1a1a2e;
        --muted: #6a6a8a;
        --time-grad: linear-gradient(160deg, #1a1a2e 0%, #4a4a6a 100%);
        --bg-grad:
            radial-gradient(ellipse 80% 50% at 50% -10%, rgba(120, 80, 220, 0.08) 0%, transparent 65%),
            radial-gradient(ellipse 60% 40% at 80% 110%, rgba(0, 180, 255, 0.05) 0%, transparent 60%),
            #f0f0f8;
        --ring-bg-stroke: rgba(0, 0, 0, 0.1);
        --footer-color: rgba(0, 0, 0, 0.3);
        --bar-bg: rgba(0, 0, 0, 0.05);
        --bar-border: rgba(0, 0, 0, 0.09);
        --val-badge-bg: rgba(255, 255, 255, 0.6);
        --val-badge-border: rgba(0, 0, 0, 0.1);
    }

    /* Darker ring colours for contrast on light background */
    #month {
        --color: #006845;
    }

    /* deep emerald      */
    #day {
        --color: #6200aa;
    }

    /* deep violet       */
    #hour {
        --color: #005f9e;
    }

    /* deep ocean blue   */
    #minute {
        --color: #8a4d00;
    }

    /* deep amber        */
    #second {
        --color: #a80032;
    }

    /* deep crimson      */

    /* Ring glow softened for light bg */
    .progress-ring__circle {
        filter: drop-shadow(0 0 2px color-mix(in srgb, var(--color) 60%, transparent));
    }

    /* Center text: dark instead of white */
    .progress-info .value {
        color: #1a1a2e !important;
    }

    /* Bar fill: solid colour, no faded gradient */
    .progress-bar-fill {
        background: var(--color) !important;
        box-shadow: none !important;
    }

    /* Bar view — Day/Month/Year label */
    .progress-bar-content .label {
        color: #1a1a2e !important;
        font-weight: 600;
    }

    /* Bar view — percentage badge */
    .progress-bar-content .value {
        color: #1a1a2e !important;
        background: rgba(255, 255, 255, 0.88) !important;
        border-color: rgba(0, 0, 0, 0.15) !important;
        font-weight: 700;
    }
}

/* ─── Reset & Base ───────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    color: var(--text);
    font-family: "Exo 2", sans-serif;
    font-weight: 400;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100svh;
    background: var(--bg-grad);
    overflow-x: hidden;
}

/* ─── Layout ─────────────────────────────────────────── */
.app-container {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 960px;
    width: 100%;
    padding: 3rem 2rem;
    animation: pageReveal 0.9s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ─── Animations ─────────────────────────────────────── */
@keyframes pageReveal {
    from {
        opacity: 0;
        transform: translateY(24px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ─── Header ─────────────────────────────────────────── */
.header {
    margin-bottom: 3.5rem;
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: 1.25rem;
    padding: 1.25rem 1.5rem;
    transition: border-color 0.25s ease, background 0.25s ease;
    animation: fadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
}

.header:hover {
    border-color: var(--border);
    background: var(--surface);
}

.header:active {
    transform: scale(0.985);
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.06);
    transition: transform 0.1s ease, border-color 0.1s, background 0.1s;
}

/* ─── Time Display ───────────────────────────────────── */
.time-display {
    font-family: "Oxanium", monospace;
    font-size: clamp(3rem, 9vw, 5.5rem);
    font-weight: 200;
    margin: 0;
    letter-spacing: 0.04em;
    line-height: 1;
    /* Soft white gradient text */
    background: var(--time-grad);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-variant-numeric: tabular-nums;
    text-shadow: none;
}

.date-display {
    font-size: clamp(0.7rem, 2vw, 0.85rem);
    color: var(--muted);
    margin: 0.9rem 0 0;
    text-transform: uppercase;
    letter-spacing: 0.25em;
    font-weight: 500;
}

/* ─── Progress Grid ──────────────────────────────────── */
.progress-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2.25rem;
}

.progress-row {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 2.25rem;
}

/* ─── Progress Item (Ring Card) ──────────────────────── */
.progress-item {
    position: relative;
    width: 162px;
    height: 162px;
    display: flex;
    justify-content: center;
    align-items: center;
    /* Subtle glass card behind each dial */
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
        border-color 0.3s ease;
}

.progress-item:hover {
    transform: scale(1.05);
    border-color: color-mix(in srgb, var(--color) 35%, transparent);
}

/* ─── SVG Ring ───────────────────────────────────────── */
.progress-ring {
    transform: rotate(-90deg);
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.progress-ring__bg {
    stroke: var(--ring-bg-stroke);
    stroke-width: var(--ring-thickness);
}

.progress-ring__circle {
    stroke-width: var(--ring-thickness);
    /* Glow on the active stroke */
    filter: drop-shadow(0 0 4px color-mix(in srgb, var(--color) 70%, transparent));
    stroke-dasharray: 440;
    stroke-dashoffset: 440;
}

/* ─── Ring Center Text ───────────────────────────────── */
.progress-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 2;
    pointer-events: none;
}

.progress-info .value {
    font-family: "Oxanium", monospace;
    font-size: 1.15rem;
    font-weight: 400;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.progress-info .label {
    font-size: 0.65rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.18em;
    margin-top: 7px;
    font-weight: 500;
}

/* ─── Footer ─────────────────────────────────────────── */
.app-footer {
    position: fixed;
    bottom: 1.75rem;
    left: 0;
    width: 100%;
    color: var(--footer-color);
    font-size: 0.68rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    text-align: center;
    z-index: 10;
    pointer-events: none;
    animation: fadeUp 1s cubic-bezier(0.16, 1, 0.3, 1) 0.5s both;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
}

.app-footer p {
    margin: 0;
    background: var(--time-grad);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    opacity: 0.55;
}

.footer-divider {
    display: block;
    width: 15%;
    height: 1px;
    background: var(--footer-color);
    opacity: 0.5;
}

/* ─── Progress Bar (Bar View) ────────────────────────── */
.progress-bar {
    display: none;
    width: 100%;
    height: 3.25rem;
    background: var(--bar-bg);
    border: 1px solid var(--bar-border);
    border-radius: 1rem;
    position: relative;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, color-mix(in srgb, var(--color) 60%, transparent), var(--color));
    width: 0%;
    box-shadow: 0 0 12px color-mix(in srgb, var(--color) 40%, transparent),
        inset 0 0 20px color-mix(in srgb, var(--color) 15%, transparent);
    border-radius: inherit;
    transition: none;
}

.progress-bar-content {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.25rem;
    z-index: 2;
}

.progress-bar-content .label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.85);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-weight: 500;
}

.progress-bar-content .value {
    font-family: "Oxanium", monospace;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    font-variant-numeric: tabular-nums;
    background: var(--val-badge-bg);
    padding: 0.2rem 0.65rem;
    border-radius: 0.5rem;
    border: 1px solid var(--val-badge-border);
}

/* ─── Responsive — Tablet ────────────────────────────── */
@media (max-width: 768px) {
    .app-container {
        padding: 2.5rem 1.5rem;
        width: 100%;
    }

    .progress-item {
        width: 132px;
        height: 132px;
    }

    .progress-grid,
    .progress-row {
        gap: 1.5rem;
    }
}

/* ─── Responsive — Mobile ────────────────────────────── */
@media (max-width: 480px) {
    :root {
        --ring-thickness: 10px;
    }

    .app-container {
        padding: 2rem 1rem;
    }

    .header {
        margin-bottom: 2rem;
        border-color: transparent !important;
        background: transparent !important;
    }

    .header:active {
        transform: scale(0.985);
    }

    .progress-grid {
        gap: 1.25rem;
        width: 100%;
    }

    .progress-row {
        width: 100%;
        justify-content: space-evenly;
        gap: 0;
    }

    .progress-row:first-child {
        justify-content: center;
        gap: 1.5rem;
    }

    .progress-item {
        width: 102px;
        height: 102px;
    }

    .progress-info .value {
        font-size: 0.9rem;
    }

    .progress-info .label {
        font-size: 0.6rem;
    }

    .app-footer {
        bottom: 0.875rem;
        font-size: 0.6rem;
    }
}

/* ─── Bar View Overrides (always last) ───────────────── */
.view-bars .progress-ring,
.view-bars .progress-info {
    display: none;
}

.view-bars .progress-bar {
    display: block;
}

.view-bars .progress-grid,
.view-bars .progress-row,
.view-bars .progress-row:first-child {
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    margin: 0 auto;
    justify-content: flex-start;
}

.view-bars .progress-item {
    width: 100%;
    max-width: 100%;
    height: auto;
    background: none;
    border: none;
    border-radius: 0;
}

.view-bars .progress-item:hover {
    transform: none;
}

@media (max-width: 768px) {
    .view-bars .progress-bar {
        height: 2.85rem;
    }
}