@font-face {
    font-family: "JetBrains Sans";
    src: url("fonts/JetBrainsSans-Regular.woff2");
}

@font-face {
    font-family: "JetBrains Mono";
    src: url("fonts/JetBrainsMono-Regular.woff2");
}

:root {
    --accent: #4ca6ff;
    --bg: #0b0b0d;
    --fg: rgba(255,255,255,0.92);
    --muted: rgba(255,255,255,0.6);
}

/* Ensure padding is included in the viewport height to avoid vertical overflow */
html { box-sizing: border-box; }
*, *::before, *::after { box-sizing: inherit; }

html, body {
    font-family: "JetBrains Sans", Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
    font-weight: 300;
    color: var(--fg);
    background-color: var(--bg);
    text-align: center;
}

body {
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Use dynamic viewport and border-box so padding doesn't create extra scroll */
    min-height: 100dvh;
    /* padding: 24px 16px 0 0; */
    padding: 24px 16px 0 16px;
}

h1 {
    font-size: 32px;
    line-height: 1.2;
    font-weight: 400;
    margin: 8px 0 24px;
}

#app { max-width: 900px; width: 100%; }
/* #app { max-width: 900px; width: 100%; flex: 1 0 auto; } */

/* Timer layout */
.timer { display: grid; gap: 20px; justify-items: center; }

.circle {
    --size: 260px;
    --progress: 0%;
    width: var(--size);
    height: var(--size);
    border-radius: 50%;
    display: grid;
    place-items: center;
    background:
      radial-gradient(circle at 50% 50%, rgba(0,0,0,0.35) 60%, rgba(0,0,0,0) 61%),
      conic-gradient(var(--accent) var(--progress, 0%), rgba(255,255,255,0.12) 0%);
    box-shadow: 0 0 0 1px rgba(255,255,255,0.15) inset, 0 10px 30px rgba(0,0,0,0.35);
}

.circle.complete { background:
      radial-gradient(circle at 50% 50%, rgba(0,0,0,0.35) 60%, rgba(0,0,0,0) 61%),
      conic-gradient(#2ecc71 100%, #2ecc71 0%);
}

.time { font-size: 56px; font-weight: 500; letter-spacing: 1px; text-align: center; }
.circle.complete .time { font-size: 42px; }

.controls { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: center; }
.controls .checkbox { color: var(--muted); display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: 14px; flex-basis: 100%; }

button {
    font-family: "JetBrains Mono", Inter, system-ui, sans-serif;
    background-color: rgba(25, 25, 28, 0.5);
    cursor: pointer;
    color: rgba(255, 255, 255, 1);
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.2);
    padding: 10px 16px;
    font-size: 16px;
}

button:disabled { opacity: 0.6; cursor: not-allowed; }

button:hover:not(:disabled) {
    background-image: radial-gradient(
            farthest-corner at 77% 83%,
            rgba(1, 197, 245, 0.5) 2%,
            rgba(1, 126, 254, 0.5) 28%,
            rgba(25, 25, 28, 0) 70%
    );
    border: 1px solid rgba(76, 166, 255, 0.35);
    background-clip: padding-box;
}

.status { color: var(--muted); display: grid; gap: 6px; width: 100%; max-width: 560px; }
.level-bar { height: 8px; width: 100%; background: rgba(255,255,255,0.12); border-radius: 6px; overflow: hidden; }
#levelBarFill { height: 100%; width: 0; background: var(--accent); transition: width 80ms linear; }

/* Slightly larger note shown on completion */
.status-note { font-size: 18px; font-weight: 400; color: var(--fg); }

.events { width: 100%; max-width: 560px; text-align: left; }
.events h2 { font-size: 18px; font-weight: 500; color: var(--muted); margin: 24px 0 8px; }
.events ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.events li { padding: 8px 10px; background: rgba(255,255,255,0.06); border-radius: 8px; border: 1px solid rgba(255,255,255,0.12); }
.events .timecode { color: var(--muted); }

.help { color: var(--muted); margin-top: 10px; }

@media (max-width: 480px) { .time { font-size: 44px; } .circle { --size: 220px; } }

/* Footer */
.site-footer {
    width: 100%;
    color: var(--muted);
    font-size: 12px;
    padding: 8px 0 12px;
    opacity: 0.85;
    /* Ensure the footer pushes to the bottom in the flex column layout */
    margin-top: auto;
    /* Respect iOS safe area while keeping a modest footer height */
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
}

.site-footer .footer-inner {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:visited { color: var(--muted); }
.site-footer a:hover { color: var(--fg); text-decoration: underline; }

/* Title emoji pulse while active */
@keyframes emoji-pulse {
    0% { opacity: 1; }
    50% { opacity: 0.45; }
    100% { opacity: 1; }
}
.title #titleEmoji.emoji-pulse { animation: emoji-pulse 2s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
    .title #titleEmoji.emoji-pulse { animation: none; }
}

/* Menu */
.menu { width: 100%; display: flex; justify-content: flex-end; margin-bottom: 6px; }
.menu details { position: relative; }
.menu summary {
    list-style: none;
    cursor: pointer;
    padding: 8px 12px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 10px;
    background: rgba(25,25,28,0.5);
    font-family: "JetBrains Mono", Inter, system-ui, sans-serif;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    user-select: none;
}

/* Hamburger icon (3 bars) */
.menu summary .hamburger {
    width: 18px;
    height: 2px;
    background: var(--fg);
    position: relative;
    border-radius: 2px;
    display: inline-block;
}
.menu summary .hamburger::before,
.menu summary .hamburger::after {
    content: "";
    position: absolute;
    left: 0;
    width: 18px;
    height: 2px;
    background: var(--fg);
    border-radius: 2px;
}
.menu summary .hamburger::before { top: -6px; }
.menu summary .hamburger::after { top: 6px; }

/* Mobile: show only hamburger on small screens */
@media (max-width: 600px) {
    .menu summary .label { display: none; }
    .menu summary { padding: 10px 12px; }
}
.menu details[open] summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-bottom-color: transparent; }
.menu ul {
    position: absolute;
    right: 0;
    margin: 0;
    padding: 8px 0;
    list-style: none;
    background: rgba(25,25,28,0.95);
    border: 1px solid rgba(255,255,255,0.2);
    border-top: 1px solid rgba(255,255,255,0.2);
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
    min-width: 160px;
}
.menu li { text-align: left; }
.menu a { display: block; padding: 8px 12px; color: var(--fg); text-decoration: none; }
.menu a:visited { color: var(--fg); }
.menu a:hover { background: rgba(255,255,255,0.08); }

/* Pulse red on reset */
@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 1px rgba(255,255,255,0.15) inset, 0 10px 30px rgba(0,0,0,0.35);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(231,76,60,0.45), 0 0 30px rgba(231,76,60,0.55), 0 10px 30px rgba(0,0,0,0.35);
    }
    100% {
        box-shadow: 0 0 0 1px rgba(255,255,255,0.15) inset, 0 10px 30px rgba(0,0,0,0.35);
    }
}

.circle.pulse-red {
    animation: pulse-red 400ms ease-in-out 1;
}


/* Global link colors for visibility */
a { color: #6464FF; }
a:visited { color: #995ECF; }
