:root {
    color-scheme: dark;
    --red: #f21c32;
    --muted: #bcb2b5;
    --bg: #0b090a;
}
* {
    box-sizing: border-box;
}
body {
    margin: 0;
    font-family:
        Inter,
        system-ui,
        -apple-system,
        sans-serif;
    background:
        radial-gradient(ellipse at 0 0, #50090e 0, transparent 30%),
        radial-gradient(ellipse at 100% 55%, #4d0a10 0, transparent 44%),
        var(--bg);
    color: #fff;
    min-height: 100vh;
}
body:before {
    content: "";
    position: fixed;
    z-index: -1;
    left: -20%;
    top: 52%;
    width: 140%;
    height: 25vh;
    background: linear-gradient(180deg, #b50b1b, #31080d 65%, transparent);
    border-top: 2px solid #ff4553;
    border-radius: 50%;
    transform: rotate(-7deg);
    opacity: 0.65;
}
header {
    max-width: 1320px;
    margin: auto;
    padding: 24px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}
.brand {
    font-weight: 850;
    font-size: 28px;
    letter-spacing: -1.5px;
    white-space: nowrap;
}
.brand span,
.brand b {
    color: var(--red);
}
a {
    color: inherit;
    text-decoration: none;
}
nav {
    display: flex;
    gap: 28px;
    align-items: center;
}
nav a {
    font-size: 15px;
    font-weight: 650;
    padding: 12px 0;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}
nav a.active {
    border-color: var(--red);
    color: #ff6a78;
}
.btn,
button {
    font: inherit;
    cursor: pointer;
}
.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    border: 1px solid #665155;
    border-radius: 40px;
    padding: 13px 25px;
    background: #211719;
    color: white;
    font-weight: 750;
    min-height: 48px;
}
.primary {
    background: linear-gradient(150deg, #ff3347, #bd0718);
    border: 1px solid #ff4656;
    box-shadow: 0 6px 24px #e30a2433;
}
.btn:hover:not(:disabled) {
    filter: brightness(1.22);
}
button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 3px solid #ff8c96;
    outline-offset: 4px;
}
main {
    max-width: 1180px;
    margin: auto;
    padding: 42px 24px 0;
}
.page[hidden],
[hidden] {
    display: none !important;
}
.hero {
    display: grid;
    grid-template-columns: 1.35fr 1fr;
    align-items: center;
    gap: 30px;
    margin: 15px 0 30px;
}
.eyebrow {
    display: inline-block;
    border: 1px solid #a6202c;
    background: #3e0d14;
    border-radius: 30px;
    padding: 9px 16px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1.4px;
    color: #ffc4c9;
}
h1 {
    font-size: clamp(38px, 5.2vw, 76px);
    letter-spacing: -0.045em;
    line-height: 1.08;
    margin: 20px 0;
}
em {
    color: var(--red);
    font-style: italic;
}
p {
    color: var(--muted);
    line-height: 1.6;
    font-size: 18px;
}
.actions {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 25px;
}
.art svg {
    width: 100%;
    max-height: 340px;
    filter: drop-shadow(0 0 40px #f21c3244);
}
.intro {
    text-align: center;
    margin: 10px auto 38px;
}
.intro p {
    margin: 0;
}
.panel {
    position: relative;
    max-width: 980px;
    margin: auto;
    padding: 36px 40px;
    border: 1px solid #f04453;
    border-radius: 32px;
    background:
        radial-gradient(ellipse at 100% 100%, #600b13aa, transparent 55%),
        linear-gradient(140deg, #2b1c20ed, #110d0fee 55%);
    box-shadow:
        inset 0 0 34px #ff17221c,
        0 0 42px #ff172222;
    text-align: center;
}
.panel h2 {
    font-size: 20px;
    margin: 0 0 24px;
}
.digits {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 16px auto;
}
.digit {
    min-width: 0;
    flex: 1;
    max-width: 205px;
    background: linear-gradient(160deg, #250c10, #100c0e);
    border: 1px solid #a61b29;
    border-radius: 23px;
    padding: 19px 10px 15px;
    box-shadow: inset 0 0 22px #ff132323;
}
.digit strong {
    display: block;
    font-variant-numeric: tabular-nums;
    font-size: clamp(30px, 7vw, 92px);
    line-height: 1.1;
    font-weight: 800;
    letter-spacing: -0.04em;
}
.digit small {
    display: block;
    color: var(--muted);
    margin-top: 8px;
    font-size: 15px;
}
.colon {
    font-size: clamp(20px, 4vw, 50px);
    color: #ffb5bb;
    font-weight: 700;
}
.home-panel .digit strong {
    font-size: clamp(28px, 5vw, 65px);
}
.sub-link {
    display: inline-block;
    margin-top: 12px;
    color: #ff9fa8;
    font-weight: 650;
}
.features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin: 44px auto;
}
.features article {
    display: flex;
    align-items: center;
    gap: 15px;
}
.features i {
    font-style: normal;
    font-size: 27px;
    border: 1px solid #bc1929;
    border-radius: 50%;
    background: #4b0b13;
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.features small {
    display: block;
    color: var(--muted);
    margin-top: 5px;
}
.clock-meta,
.duration,
.event-form {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    margin: 28px 0 0;
}
.tabs {
    display: flex;
    gap: 5px;
    max-width: 500px;
    margin: 0 auto 26px;
    border-radius: 40px;
    background: #21191c;
    padding: 5px;
}
.tabs button {
    flex: 1;
    border: 0;
    background: transparent;
    color: #ddd;
    border-radius: 32px;
    padding: 13px;
    font-weight: 700;
}
.tabs button[aria-pressed="true"] {
    background: #ce1023;
    color: white;
}
.duration label,
.event-form label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
    color: var(--muted);
    font-size: 14px;
}
input,
select {
    font: inherit;
    color: white;
    background: #160f12;
    border: 1px solid #785058;
    border-radius: 10px;
    padding: 12px;
    min-width: 0;
}
.duration input {
    width: 100px;
}
.event-form {
    align-items: end;
    margin: 0 0 30px;
}
.event-form input {
    width: 100%;
}
.centered {
    justify-content: center;
}
#timerStatus,
#eventStatus {
    font-size: 15px;
    min-height: 24px;
}
footer {
    text-align: center;
    color: #a99da0;
    font-size: 13px;
    padding: 22px 16px 30px;
}
@media (max-width: 780px) {
    header {
        flex-wrap: wrap;
        padding: 18px 20px;
    }
    .top {
        display: none;
    }
    nav {
        width: 100%;
        gap: 20px;
        overflow: auto;
    }
    nav a {
        font-size: 14px;
    }
    main {
        padding: 20px 16px 0;
    }
    .hero {
        grid-template-columns: 1fr;
        gap: 0;
    }
    .art svg {
        max-height: 210px;
    }
    .panel {
        padding: 24px 14px;
        border-radius: 22px;
    }
    .features {
        grid-template-columns: 1fr;
        gap: 18px;
        margin: 32px 12px;
    }
    .digits {
        gap: 5px;
    }
    .digit {
        padding: 17px 4px;
        border-radius: 13px;
    }
    .digit small {
        font-size: 12px;
    }
    .btn {
        padding: 12px 18px;
    }
    .clock-meta {
        flex-direction: column;
        gap: 12px;
    }
    .event-form label {
        width: 100%;
    }
    .duration {
        gap: 10px;
    }
    .duration input {
        width: 80px;
    }
}
@media (prefers-reduced-motion: reduce) {
    * {
        scroll-behavior: auto;
    }
}

/* Adaptive viewport layout — no forced clipping or nested page scrolling. */
:root {
    --button-height: clamp(34px, calc(25px + 1.5vh), 40px);
    --button-x: clamp(12px, 1.6vw, 20px);
    --space: clamp(12px, 2vh, 24px);
}
html {
    min-height: 100%;
}
body {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}
header {
    width: 100%;
    flex: 0 0 auto;
    margin: 0 auto;
    padding: var(--space) clamp(16px, 3vw, 32px);
}
main {
    width: 100%;
    min-width: 0;
    flex: 1 0 auto;
    margin: 0 auto;
    padding: var(--space) clamp(16px, 3vw, 24px) 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}
footer {
    flex: 0 0 auto;
    padding: 12px 16px;
}
nav {
    gap: clamp(12px, 2vw, 28px);
    flex-wrap: wrap;
}
nav a {
    padding: 8px 0;
}
.btn,
.tabs button {
    box-sizing: border-box;
    min-height: var(--button-height);
    height: auto;
    padding: 0 var(--button-x);
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.25;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
}
.tabs button {
    min-width: 0;
    padding: 4px 10px;
}
.hero {
    margin: 0 0 var(--space);
    gap: var(--space);
}
h1 {
    font-size: clamp(32px, min(5vw, 7.5vh), 68px);
    margin: 12px 0;
}
p {
    font-size: clamp(15px, 1.6vw, 18px);
    margin: 10px 0;
}
.eyebrow {
    padding: 6px 12px;
}
.art {
    min-width: 0;
    text-align: center;
}
.art svg {
    display: block;
    margin: auto;
    max-height: clamp(150px, 28vh, 300px);
}
.actions {
    margin-top: var(--space);
    gap: 10px;
}
.intro {
    margin: 0 auto var(--space);
}
.panel {
    width: 100%;
    padding: clamp(14px, 2.5vh, 30px) clamp(14px, 3vw, 36px);
    border-radius: 24px;
}
.panel h2 {
    margin: 0 0 12px;
    overflow-wrap: anywhere;
}
.digits {
    gap: clamp(4px, 1vw, 12px);
    margin: 10px auto;
}
.digit {
    padding: clamp(8px, 1.5vh, 16px) 4px;
    border-radius: 16px;
}
.digit strong {
    font-size: clamp(22px, min(6.6vw, 9vh), 82px);
    overflow-wrap: anywhere;
}
.home-panel .digit strong,
#event .digit strong {
    font-size: clamp(20px, min(5vw, 7vh), 64px);
}
.digit small {
    margin-top: 4px;
    font-size: clamp(11px, 1.3vw, 14px);
}
.features {
    width: 100%;
    gap: var(--space);
    margin: var(--space) auto;
}
.features i {
    width: 44px;
    height: 44px;
    font-size: 22px;
}
.features article {
    min-width: 0;
    gap: 10px;
}
.features small {
    margin-top: 3px;
}
.clock-meta,
.duration {
    margin-top: 14px;
    gap: 12px;
}
.tabs {
    margin-bottom: 12px;
}
.event-form {
    margin: 0 0 16px;
    gap: 12px;
}
.event-form label {
    min-width: 0;
    max-width: 100%;
}
input,
select {
    padding: 8px 10px;
    max-width: 100%;
}
#timerStatus,
#eventStatus {
    margin: 8px 0;
    min-height: 20px;
}
@media (max-height: 700px) and (min-width: 781px) {
    header {
        padding-block: 10px;
    }
    main {
        padding-top: 10px;
    }
    .hero p {
        margin: 6px 0;
    }
    .features {
        margin-block: 12px;
    }
    .features i {
        width: 36px;
        height: 36px;
    }
    .intro {
        margin-bottom: 12px;
    }
    footer {
        padding-block: 8px;
    }
}
@media (max-width: 780px) {
    header {
        gap: 8px 16px;
    }
    header .top {
        display: inline-flex;
        margin-left: auto;
    }
    nav {
        order: 1;
        width: 100%;
        overflow: visible;
        gap: 6px 16px;
    }
    main {
        justify-content: flex-start;
    }
    .hero {
        grid-template-columns: 1fr;
    }
    .features {
        grid-template-columns: 1fr;
        margin-inline: 0;
    }
    .event-form label {
        width: 100%;
    }
    .art svg {
        max-height: 170px;
    }
    .clock-meta label {
        max-width: 100%;
    }
    .duration input {
        width: 76px;
    }
    .actions .btn {
        flex: 1 1 auto;
    }
}
@media (pointer: coarse) {
    /* Preserve usable touch targets even when the visual button is compact. */
    .btn,
    .tabs button {
        min-height: max(40px, var(--button-height));
    }
}
@media (max-width: 360px) {
    .brand {
        font-size: 23px;
    }
    .btn,
    .tabs button {
        font-size: 12px;
        padding-inline: 10px;
    }
    nav a {
        font-size: 13px;
    }
    .duration input {
        width: 65px;
    }
    .colon {
        font-size: 16px;
    }
    .digit strong {
        font-size: 22px;
    }
    .home-panel .digit strong,
    #event .digit strong {
        font-size: 20px;
    }
}

.sound-settings {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.sound-toggle[aria-pressed="true"] {
    border-color: #a52b39;
}
.sound-settings .btn {
    font-size: 12px;
}

.volume-setting {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    max-width: 100%;
    flex-wrap: wrap;
}
.volume-setting input[type="range"] {
    width: 90px;
    min-width: 0;
    height: 24px;
    padding: 0;
    accent-color: #ef233c;
}
.volume-setting output {
    min-width: 36px;
    font-variant-numeric: tabular-nums;
}

/* V6 — layered clock depth. Shared by all four clock displays. */
.panel {
    box-shadow:
        0 20px 52px -24px rgba(0, 0, 0, 0.95),
        0 0 32px -8px rgba(242, 28, 50, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.09),
        inset 0 0 28px rgba(242, 28, 50, 0.06);
}
.digit {
    background: linear-gradient(160deg, #30151b 0%, #190f13 44%, #0c090b 100%);
    border-color: #a62b3b;
    box-shadow:
        0 9px 16px -7px rgba(0, 0, 0, 0.85),
        0 0 16px -5px rgba(242, 28, 50, 0.34),
        inset 0 1px 0 rgba(255, 255, 255, 0.13),
        inset 0 -5px 16px rgba(0, 0, 0, 0.3);
}
.digit strong {
    color: #fff;
    text-shadow:
        0 3px 3px rgba(0, 0, 0, 0.72),
        0 0 13px rgba(255, 62, 81, 0.36),
        0 0 26px rgba(242, 28, 50, 0.14);
}
.colon {
    text-shadow: 0 0 12px rgba(255, 51, 71, 0.5);
}
@media (max-width: 480px) {
    .panel {
        box-shadow:
            0 10px 22px -12px #000,
            0 0 14px -6px #f21c3240,
            inset 0 1px 0 #ffffff16;
    }
    .digit {
        box-shadow:
            0 5px 10px -5px #000,
            0 0 10px -4px #f21c3240,
            inset 0 1px 0 #ffffff20;
    }
    .digit strong {
        text-shadow:
            0 2px 2px #000a,
            0 0 8px #ff3e5155;
    }
}

/* V7 — stronger visible depth and red glow, without changing layout. */
.panel {
    border-color: #ff5364;
    box-shadow:
        0 24px 42px -12px #000c,
        0 0 18px #ff233b77,
        0 0 48px #ff193b35,
        inset 0 1px 1px #ffffff40,
        inset 0 0 26px #ff243b24;
}
.digit {
    background: linear-gradient(155deg, #49212a 0%, #221217 42%, #0c080a 100%);
    border-color: #df4356;
    box-shadow:
        0 12px 18px -4px #000e,
        0 0 12px #ff284b66,
        0 0 28px #ff173b33,
        inset 0 2px 2px #ffffff30,
        inset 0 -8px 16px #0009;
}
.digit strong {
    text-shadow:
        0 3px 0 #6d2835,
        0 6px 8px #000b,
        0 0 14px #ff52677a,
        0 0 26px #ff263f40;
}
.colon {
    text-shadow:
        0 0 9px #ff5267aa,
        0 0 20px #ff263f66;
}
@media (max-width: 600px) {
    .panel {
        box-shadow:
            0 12px 24px -8px #000c,
            0 0 16px #ff233b66,
            inset 0 1px 1px #ffffff30;
    }
    .digit {
        box-shadow:
            0 7px 12px -3px #000d,
            0 0 12px #ff284b55,
            inset 0 1px 2px #ffffff30,
            inset 0 -5px 10px #0008;
    }
}

/* V8 — move time zone control above the clock for cleaner hierarchy. */
.clock-toolbar {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 0 18px;
}
.clock-zone {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid rgba(255, 91, 108, 0.35);
    border-radius: 16px;
    background: linear-gradient(
        180deg,
        rgba(53, 24, 28, 0.85),
        rgba(22, 14, 16, 0.92)
    );
    box-shadow:
        0 8px 18px -10px rgba(0, 0, 0, 0.85),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    color: #f7e5e7;
    font-size: 14px;
    font-weight: 650;
}
.clock-zone span {
    color: #ffd5da;
    white-space: nowrap;
}
.clock-zone select {
    min-width: min(300px, 58vw);
    background: rgba(14, 10, 11, 0.92);
    border-color: rgba(255, 96, 116, 0.45);
    box-shadow:
        0 0 0 1px rgba(255, 43, 68, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.clock-meta {
    margin-top: 18px;
}
.clock-meta #dateText {
    display: inline-block;
    color: #efe3e5;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
}
@media (max-width: 780px) {
    .clock-toolbar {
        margin-bottom: 14px;
    }
    .clock-zone {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
        padding: 10px 12px;
        gap: 8px;
    }
    .clock-zone select {
        flex: 1 1 220px;
        min-width: 0;
        width: 100%;
    }
    .clock-meta #dateText {
        display: block;
        width: 100%;
    }
}

/* V9 — dedicated settings page */
.settings-panel {
    max-width: 760px;
    text-align: left;
    display: grid;
    gap: var(--space);
}
.setting-group {
    min-width: 0;
    padding: clamp(12px, 2vh, 22px);
    border: 1px solid #69404a;
    border-radius: 16px;
    background: #160e12b0;
}
.setting-group h2 {
    margin: 0 0 4px;
    color: #fff;
}
.setting-group p {
    margin: 0 0 12px;
    font-size: 14px;
}
.settings-panel .clock-toolbar {
    justify-content: flex-start;
    margin: 0;
}
.settings-panel .clock-zone {
    max-width: 100%;
    padding: 6px 10px;
    flex-wrap: wrap;
}
.settings-panel .clock-zone select {
    min-width: 0;
    max-width: 100%;
}
.settings-panel .sound-settings {
    justify-content: flex-start;
    margin: 0 0 12px;
}
.settings-panel .volume-setting input[type="range"] {
    width: clamp(90px, 18vw, 180px);
}
@media (max-width: 480px) {
    .settings-panel .sound-settings .btn {
        flex: 1 1 auto;
    }
    .settings-panel .volume-setting {
        width: 100%;
    }
    .settings-panel .clock-zone {
        width: 100%;
    }
}

/* V10 — settings sound controls: buttons and volume on separate rows. */
.settings-panel .sound-settings {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 0 0 14px;
}
.settings-panel .sound-settings .btn {
    min-width: 0;
    width: 100%;
    font-size: clamp(11px, 1.3vw, 13px);
    padding-inline: clamp(4px, 1vw, 12px);
    overflow-wrap: anywhere;
}
.settings-panel .volume-row {
    width: 100%;
}
.settings-panel .volume-row .volume-setting {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) 42px;
    align-items: center;
    gap: 10px;
    width: 100%;
    font-size: 13px;
}
.settings-panel .volume-row .volume-setting input[type="range"] {
    width: 100%;
    margin: 0;
}
.settings-panel .volume-row output {
    text-align: right;
}

/* V12: event setup outside countdown panel */
#event > .event-form {
    width: 100%;
    max-width: 980px;
    margin: 0 auto clamp(14px, 2.4vh, 24px);
    align-items: end;
    gap: 12px;
}
#event > .event-form input {
    min-height: var(--button-height);
}
@media (max-width: 780px) {
    #event > .event-form {
        gap: 10px;
    }
    #event > .event-form .btn {
        width: 100%;
    }
}

/* V13: timer tabs and controls moved outside the clock panel. */
.timer-layout {
    max-width: 980px;
    margin: 0 auto;
    display: grid;
    gap: 14px;
}
.timer-tabs {
    width: min(100%, 520px);
    margin: 0 auto;
}
.timer-panel {
    margin-top: 0;
}
.timer-panel .duration {
    margin-top: 0;
    margin-bottom: 12px;
}
.timer-panel #timerStatus {
    margin-bottom: 0;
}
.timer-controls {
    margin-top: 0;
    justify-content: center;
}
.timer-controls .btn {
    min-width: 150px;
}
@media (max-width: 780px) {
    .timer-layout {
        gap: 12px;
    }
    .timer-tabs {
        width: 100%;
    }
    .timer-controls {
        width: 100%;
        gap: 10px;
    }
    .timer-controls .btn {
        min-width: 0;
        flex: 1 1 calc(33.333% - 8px);
    }
}
@media (max-width: 480px) {
    .timer-controls .btn {
        flex: 1 1 100%;
    }
}

/* V14 — consistent compact spacing below navigation on all pages. */
main {
    padding-top: clamp(12px, 2.5vh, 28px);
}
@media (max-height: 700px) {
    main {
        padding-top: 10px;
    }
}
