@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;700&display=swap');

/* ===== THEMES: every skin defines the full set; strawberry is the default ===== */
:root,
[data-skin="strawberry"] {
    --bg: #ffdde4;
    --floor: #b9db93;
    --side: #fff0f3;
    --sidetxt: #2f2a28;
    --card: #fff8e1;
    --bar: #fdeeb8;
    --line: #3b3a36;
    --shadow: #3b3a36;
    --accent: #b5d99c;
    --btn: #2f2a28;
    --ink: #2f2a28;
    --pt: #2f2a28;
    --box: #fffdf2;
    --pink: #f0668a;
    --hi: #ffe08a;
    --ad: rgba(255, 255, 255, .55);
    --d1: #ef7b82;
    --d2: #f4d35e;
    --d3: #a3b899;
    --r: 12px;
    --rb: 10px;
    --cta: #ffc928;
    --ctatxt: #4a2c22;
    --infobg: transparent;
    --backdrop: rgba(255, 150, 180, .35);
    --tag: "🐰 interval timer";
    --tilebg: #ffdde4;
    --page: linear-gradient(var(--bg) calc(100% - 44px), var(--line) calc(100% - 44px) calc(100% - 41px), var(--floor) calc(100% - 41px)) fixed
}

:root.dark,
[data-skin="strawberry"].dark {
    --bg: #e89aae;
    --floor: #c9576f;
    --side: #b8485e;
    --sidetxt: #fff;
    --card: #fbe4e1;
    --bar: #f6c9cc;
    --line: #b84a63;
    --shadow: #b84a63;
    --accent: #f27b97;
    --btn: #5c1f31;
    --ink: #8f3349;
    --pt: #8f3349;
    --box: #fff3f1;
    --pink: #e0436b;
    --hi: #ffe3a3;
    --ad: rgba(255, 255, 255, .45);
    --d1: #e0436b;
    --d2: #f7a8b8;
    --d3: #fff;
    --tilebg: #e89aae
}

[data-skin="bookish"] {
    --bg: #fff;
    --floor: #fff;
    --side: #fffdf2;
    --sidetxt: #1a1a1a;
    --card: #fffdf2;
    --bar: #ffe28a;
    --line: #1a1a1a;
    --shadow: #1a1a1a;
    --accent: #ffc62a;
    --btn: #1a1a1a;
    --ink: #1a1a1a;
    --pt: #1a1a1a;
    --box: #fff;
    --pink: #ff6a2b;
    --hi: #cfe8c3;
    --ad: rgba(255, 255, 255, .8);
    --d1: #ff6a2b;
    --d2: #ffc62a;
    --d3: #2e8b3a;
    --r: 12px;
    --rb: 10px;
    --cta: #2e8b3a;
    --ctatxt: #fff;
    --infobg: rgba(255, 255, 255, .85);
    --backdrop: rgba(30, 40, 80, .35);
    --tag: "📚 interval timer";
    --tilebg: url(bg-bookish.png) center/cover, #fff;
    --page: url(bg-bookish.png) center/cover fixed, #fff
}

[data-skin="bookish"].dark {
    --bg: #1f2540;
    --floor: #1f2540;
    --side: #161a30;
    --sidetxt: #f6f0d8;
    --card: #2b3253;
    --bar: #3a4474;
    --line: #f1e9c8;
    --shadow: #0d1020;
    --accent: #ffc62a;
    --btn: #1a1a1a;
    --ink: #f6f0d8;
    --pt: #f6f0d8;
    --box: #353d66;
    --pink: #ffc62a;
    --hi: #3f6b3a;
    --ad: rgba(255, 255, 255, .08);
    --cta: #ffc62a;
    --ctatxt: #1a1a1a;
    --infobg: rgba(20, 24, 45, .82);
    --tilebg: linear-gradient(rgba(22, 26, 50, .82), rgba(22, 26, 50, .82)), url(bg-bookish.png) center/cover, #1f2540;
    --page: linear-gradient(rgba(22, 26, 50, .82), rgba(22, 26, 50, .82)) fixed, url(bg-bookish.png) center/cover fixed, #1f2540
}

[data-skin="mono"] {
    --bg: #ececec;
    --floor: #111;
    --side: #fff;
    --sidetxt: #111;
    --card: #fff;
    --bar: #f3f3f3;
    --line: #111;
    --shadow: transparent;
    --accent: #111;
    --btn: #fff;
    --ink: #111;
    --pt: #111;
    --box: #fff;
    --pink: #111;
    --hi: #d9d9d9;
    --ad: rgba(255, 255, 255, .7);
    --d1: #111;
    --d2: #888;
    --d3: #ccc;
    --r: 18px;
    --rb: 999px;
    --cta: #111;
    --ctatxt: #fff;
    --infobg: transparent;
    --backdrop: rgba(0, 0, 0, .35);
    --tag: "⏱ interval timer";
    --tilebg: #ececec;
    --page: var(--bg)
}

[data-skin="mono"].dark {
    --bg: #111;
    --floor: #f2f2f2;
    --side: #000;
    --sidetxt: #f2f2f2;
    --card: #1b1b1b;
    --bar: #262626;
    --line: #f2f2f2;
    --accent: #f2f2f2;
    --btn: #111;
    --ink: #f2f2f2;
    --pt: #f2f2f2;
    --box: #262626;
    --pink: #fff;
    --hi: #3a3a3a;
    --ad: rgba(255, 255, 255, .08);
    --d1: #fff;
    --d2: #aaa;
    --d3: #555;
    --cta: #fff;
    --ctatxt: #111;
    --tilebg: #111
}

[data-skin="coffee"] {
    --bg: #e6cdb0;
    --floor: #7a5240;
    --side: #f3e3cf;
    --sidetxt: #4a2e22;
    --card: #f6e6d2;
    --bar: #dcb996;
    --line: #6b4636;
    --shadow: #6b4636;
    --accent: #d7ae8a;
    --btn: #4a2e22;
    --ink: #4a2e22;
    --pt: #4a2e22;
    --box: #fff6ea;
    --pink: #b0603f;
    --hi: #f3d08f;
    --ad: rgba(255, 246, 234, .6);
    --d1: #c0725a;
    --d2: #e3b86f;
    --d3: #8f7a68;
    --r: 10px;
    --rb: 8px;
    --cta: #8a5a44;
    --ctatxt: #fff6ea;
    --infobg: transparent;
    --backdrop: rgba(60, 35, 25, .4);
    --tag: "☕ interval timer";
    --tilebg: #e6cdb0
}

[data-skin="coffee"].dark {
    --bg: #4f352b;
    --floor: #2e1c15;
    --side: #3b2820;
    --sidetxt: #f3e1cf;
    --card: #c9a688;
    --bar: #b08968;
    --line: #2e1c15;
    --shadow: #2e1c15;
    --accent: #e0b88f;
    --btn: #3a2219;
    --ink: #3a2219;
    --pt: #f3e1cf;
    --box: #ead7c0;
    --pink: #8a3f22;
    --hi: #f0d28f;
    --ad: rgba(234, 215, 192, .12);
    --d1: #a85a3f;
    --d2: #e0b878;
    --d3: #6e5545;
    --cta: #f0d28f;
    --ctatxt: #3a2219;
    --tilebg: #4f352b
}

/* ===== base ===== */
:root {
    box-sizing: border-box;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px)
}

* {
    box-sizing: inherit
}

html {
    scroll-padding-top: env(safe-area-inset-top, 0px)
}

body {
    margin: 0;
    color: var(--pt);
    font-family: 'Space Grotesk', system-ui, sans-serif;
    display: flex;
    min-height: 100vh;
    background: var(--page)
}

button,
.navbtn {
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    border: 2px solid var(--line);
    background: var(--accent);
    color: var(--btn);
    border-radius: var(--rb);
    padding: 8px 14px;
    text-transform: lowercase;
    font-size: 15px;
    box-shadow: 2px 2px 0 var(--shadow);
    transition: transform .08s, box-shadow .08s
}

.navbtn {
    display: block;
    text-align: center;
    text-decoration: none
}

button:hover,
.navbtn:hover {
    filter: brightness(1.05)
}

button:active,
.navbtn:active {
    transform: translate(2px, 2px);
    box-shadow: none
}

button:focus-visible,
input:focus-visible,
.navbtn:focus-visible {
    outline: 3px solid var(--pt);
    outline-offset: 2px
}

/* sidebar: screen-height, only the saved list scrolls */
#side {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    align-self: flex-start;
    width: 210px;
    background: var(--side);
    border-right: 2px solid var(--line);
    padding: 56px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
    transition: margin .25s, transform .25s
}

#side::before {
    content: var(--tag);
    position: absolute;
    top: 17px;
    left: 62px;
    font-size: 13px;
    color: var(--sidetxt)
}

#side .grow {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px
}

#side small,
#side a {
    color: var(--sidetxt)
}

#side a.navbtn {
    color: var(--btn)
}

.sv {
    background: none;
    color: var(--sidetxt);
    border: 0;
    box-shadow: none;
    text-align: left;
    text-transform: none;
    border-radius: 8px;
    padding: 6px
}

.sv:hover {
    background: rgba(128, 128, 128, .18);
    filter: none
}

body.col #side {
    margin-left: -210px
}

#menu {
    position: fixed;
    top: calc(10px + env(safe-area-inset-top, 0px));
    left: 12px;
    z-index: 10;
    background: var(--card);
    color: var(--ink);
    font-size: 24px;
    line-height: 1;
    padding: 2px 9px 5px;
    border-radius: 10px
}

main {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 130px;
    grid-template-rows: 90px 1fr 90px;
    gap: 16px;
    padding: 56px 16px 60px;
    min-width: 0
}

.ad {
    background: var(--ad);
    border-radius: var(--rb);
    display: grid;
    place-items: center;
    color: var(--pt);
    font-size: 12px;
    border: 2px dashed var(--line)
}

.ad.top {
    grid-column: 1/3
}

.ad.bot {
    grid-column: 1
}

.ad.right {
    grid-row: 2/4;
    grid-column: 2
}

.center {
    grid-column: 1;
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: center;
    justify-content: center;
    min-width: 0
}

.mid {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    min-width: 0;
    max-width: 100%
}

.presets {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 100%
}

.presets button {
    background: var(--box);
    color: var(--ink);
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 999px;
    white-space: nowrap
}

.presets button:hover {
    background: var(--accent);
    color: var(--btn)
}

/* window-style cards */
.card {
    position: relative;
    background: var(--card);
    color: var(--ink);
    border: 2px solid var(--line);
    border-radius: var(--r);
    padding: 48px 16px 16px;
    box-shadow: 4px 4px 0 var(--shadow)
}

.card::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 34px;
    border-bottom: 2px solid var(--line);
    border-radius: calc(var(--r) - 2px) calc(var(--r) - 2px) 0 0;
    background: radial-gradient(circle at 16px 50%, var(--d1) 0 6px, transparent 6.5px), radial-gradient(circle at 38px 50%, var(--d2) 0 6px, transparent 6.5px), radial-gradient(circle at 60px 50%, var(--d3) 0 6px, transparent 6.5px), var(--bar);
    font-size: 16px;
    line-height: 32px;
    text-align: right;
    padding-right: 12px;
    color: var(--ink)
}

#list::before {
    content: "intervals."
}

#timer::before {
    content: "timer."
}

#list {
    flex: 0 1 230px;
    min-width: 0;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-self: center
}

.rep {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    background: var(--accent);
    color: var(--btn);
    border: 2px solid var(--line);
    border-radius: var(--rb);
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 500
}

.rep input {
    flex-shrink: 0;
    min-width: 0;
    width: 46px;
    text-align: center;
    font: inherit;
    border: 2px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: #2f2a28
}

.iv {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--box);
    color: var(--ink);
    border: 2px solid var(--line);
    border-radius: var(--rb);
    padding: 6px 10px;
    font-size: 13px;
    cursor: pointer
}

.iv span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap
}

.iv.on {
    background: var(--hi);
    box-shadow: 2px 2px 0 var(--shadow)
}

.iv.done span {
    text-decoration: line-through;
    opacity: .55
}

.iv i {
    background: none;
    border: 0;
    cursor: pointer;
    font-style: normal;
    padding: 0
}

.add {
    align-self: flex-start;
    font-size: 13px;
    padding: 4px 12px
}

.add.cta {
    align-self: stretch;
    text-align: center;
    font-size: 14px;
    padding: 10px 12px;
    background: var(--cta);
    color: var(--ctatxt);
    font-weight: 700;
    animation: pulse 2s ease-in-out infinite
}

@keyframes pulse {

    0%,
    100% {
        box-shadow: 2px 2px 0 var(--shadow), 0 0 0 0 color-mix(in srgb, var(--cta) 75%, transparent)
    }

    50% {
        box-shadow: 2px 2px 0 var(--shadow), 0 0 0 10px color-mix(in srgb, var(--cta) 0%, transparent)
    }
}

@media(prefers-reduced-motion:reduce) {
    .add.cta {
        animation: none
    }
}

#timer {
    flex: 1 1 340px;
    max-width: 340px;
    min-width: 0;
    min-height: 300px;
    text-align: center
}

#timer h2 {
    margin: 6px 26px 14px 0;
    font-weight: 500
}

#nm {
    background: transparent;
    border: 0;
    border-bottom: 2px dashed var(--line);
    color: var(--ink);
    font: inherit;
    font-weight: 500;
    font-size: clamp(15px, 4vw, 22px);
    text-align: center;
    width: 100%;
    min-width: 0;
    outline: none
}

#nm::placeholder {
    color: var(--ink);
    opacity: .45
}

#save {
    position: absolute;
    top: 42px;
    right: 10px;
    background: none;
    border: 0;
    box-shadow: none;
    font-size: 26px;
    padding: 0;
    color: var(--pink)
}

.digits {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
    color: var(--ink)
}

.digits b {
    background: var(--box);
    border: 2px solid var(--line);
    border-radius: 12px;
    box-shadow: 3px 3px 0 var(--shadow);
    width: clamp(40px, 11vw, 72px);
    height: clamp(56px, 14vw, 92px);
    display: grid;
    place-items: center;
    font-size: clamp(28px, 8vw, 52px);
    font-weight: 500;
    color: var(--ink)
}

.digits b.m {
    width: auto;
    min-width: 72px;
    padding: 0 10px
}

.digits u {
    text-decoration: none;
    font-size: 42px;
    color: var(--ink)
}

.btns {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: nowrap
}

.btns button {
    flex: 1;
    min-width: 0;
    font-size: clamp(13px, 3.6vw, 17px);
    padding: 10px 6px
}

#repLine {
    margin-top: 16px;
    color: var(--ink);
    font-size: clamp(12px, 3.4vw, 15px)
}

dialog {
    border: 2px solid var(--line);
    border-radius: var(--r);
    background: var(--card);
    color: var(--ink);
    font-family: inherit;
    padding: 22px;
    box-shadow: 4px 4px 0 var(--shadow)
}

dialog::backdrop {
    background: var(--backdrop)
}

dialog label {
    display: block;
    margin: 10px 0 4px;
    font-size: 14px
}

dialog input {
    font: inherit;
    padding: 6px;
    border-radius: 8px;
    border: 2px solid var(--line);
    background: #fff;
    color: #2f2a28;
    width: 100%
}

dialog .row {
    display: flex;
    gap: 8px
}

dialog .acts {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    justify-content: center
}

#toast {
    position: fixed;
    left: 50%;
    bottom: 56px;
    transform: translateX(-50%);
    background: var(--card);
    color: var(--ink);
    border: 2px solid var(--line);
    box-shadow: 3px 3px 0 var(--shadow);
    padding: 10px 18px;
    border-radius: var(--r);
    opacity: 0;
    transition: .3s;
    pointer-events: none;
    font-size: 14px;
    z-index: 20
}

#toast.show {
    opacity: 1
}

/* text pages */
.info,
.page {
    font-family: inherit;
    color: var(--pt);
    background: var(--infobg);
    border-radius: var(--r)
}

.info {
    grid-column: 1/-1;
    max-width: 680px;
    margin: 8px auto 24px;
    padding: 14px 18px;
    line-height: 1.6;
    font-size: 15px
}

.info h1 {
    font-size: 22px;
    margin: 0 0 8px
}

.info h2 {
    font-size: 17px;
    margin: 18px 0 6px
}

.info a,
.page a {
    color: var(--pt);
    text-decoration: underline
}

.page {
    max-width: 680px;
    margin: 40px auto;
    padding: 14px 20px;
    line-height: 1.7
}

.page.wide {
    max-width: 940px
}

/* themes page */
.tgrid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 22px;
    margin-top: 18px
}

.tgrid h2 {
    font-size: 17px;
    margin: 0 0 8px
}

.tiles {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px
}

.tile {
    display: block;
    width: 100%;
    padding: 10px;
    background: var(--tilebg, var(--bg));
    color: var(--pt);
    border-radius: var(--r);
    text-align: left;
    box-shadow: 3px 3px 0 var(--shadow)
}

.tile[aria-pressed="true"] {
    outline: 3px solid var(--pt);
    outline-offset: 3px
}

.tile .mini {
    background: var(--card);
    border: 2px solid var(--line);
    border-radius: 10px;
    overflow: hidden
}

.tile .mb {
    height: 18px;
    border-bottom: 2px solid var(--line);
    background: radial-gradient(circle at 10px 50%, var(--d1) 0 4px, transparent 4.5px), radial-gradient(circle at 24px 50%, var(--d2) 0 4px, transparent 4.5px), radial-gradient(circle at 38px 50%, var(--d3) 0 4px, transparent 4.5px), var(--bar)
}

.tile .mc {
    display: flex;
    gap: 6px;
    padding: 8px
}

.tile .mc i {
    flex: 1;
    height: 18px;
    border: 2px solid var(--line);
    border-radius: var(--rb);
    background: var(--accent)
}

.tile b {
    display: block;
    margin-top: 8px;
    font-weight: 500;
    font-size: 13px
}

@media(max-width:820px) {
    #side {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        height: 100vh;
        height: 100dvh;
        overflow-y: auto;
        z-index: 5
    }

    body.col #side {
        margin-left: 0;
        transform: translateX(-100%)
    }

    main {
        grid-template-columns: 1fr
    }

    .ad.right {
        display: none
    }

    .ad.top,
    .ad.bot {
        grid-column: 1
    }
}

@media(max-width:520px) {
    .card {
        padding: 44px 10px 10px
    }

    .btns {
        gap: 6px
    }

    .rep {
        font-size: 10px;
        padding: 6px
    }

    .rep input {
        width: 34px
    }

    .iv {
        font-size: 11px;
        padding: 5px 7px
    }

    .digits {
        gap: 6px
    }

    .digits u {
        font-size: 28px
    }

    .presets {
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: flex-start;
        width: 100%;
        padding-bottom: 4px
    }
}

/* TEMPORARY: hide ad boxes until AdSense approves the site */
.ad {
    display: none
}

main {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto
}

#noads {
    display: none
}