:root {
    --primary: #01c1fc;
    --secondary: #5dc6f3;
    --accent: #7be0ff;
    --surface: rgba(255, 255, 255, .09);
    --text-primary: #fff;
    --text-secondary: rgba(255, 255, 255, .72);
    --border-color: rgba(255, 255, 255, .28);
    --menu-bg: rgba(10, 14, 20, .95);
    --overlay: rgba(0, 0, 0, .4);
    --hover: rgba(255, 255, 255, .16)
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Poppins, sans-serif
}

body {
    min-height: 100vh;
    background-image: url('image.png');
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    color: var(--text-primary);
    overflow-x: hidden
}

#bg {
    position: fixed;
    inset: 0;
    background: #0b0d10 center/cover no-repeat;
    z-index: -2
}

#veil {
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: -1;
    transition: background .4s
}

main {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4.5rem 1rem 1.5rem
}

.view {
    width: 100%;
    max-width: 460px;
    text-align: center
}

.view[hidden] {
    display: none
}

.status {
    font-size: .8rem;
    letter-spacing: 3px;
    color: var(--accent);
    font-weight: 600
}

.main-time {
    font-family: "Poppins" !important;
    font-size: clamp(3.6rem, 15vw, 8rem);
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: 2px
}

.current-row {
    margin: .4rem 0;
    color: var(--text-secondary);
    opacity: .85
}

.info {
    font-size: .85rem;
    color: var(--text-secondary);
    margin-bottom: 1.3rem;
    min-height: 1.4em
}

.actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px
}

.btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: .85rem;
    font-weight: 500;
    padding: .55rem 1.1rem;
    border-radius: 30px;
    cursor: pointer;
    transition: .15s;
    text-transform: uppercase;
    letter-spacing: 1px;
    min-height: 44px
}

.btn:hover:not(:disabled) {
    background: var(--hover)
}

.btn:active:not(:disabled) {
    transform: scale(.96)
}

.btn:disabled {
    opacity: .35;
    cursor: not-allowed
}

.btn:focus-visible,
#menuBtn:focus-visible,
#menu button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px
}

.btn.primary {
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    border: none;
    font-weight: 600
}

.btn.end {
    margin-top: 1rem;
    border-color: var(--secondary)
}

#menuBtn {
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 30;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--surface);
    color: var(--text-primary);
    font-size: 1.3rem;
    cursor: pointer;
    backdrop-filter: blur(8px)
}

#menu {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(300px, 82vw);
    background: var(--menu-bg);
    border-right: 1px solid var(--border-color);
    z-index: 40;
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transform: translateX(-105%);
    transition: transform .28s ease, visibility .28s;
    visibility: hidden
}

#menu.open {
    transform: none;
    visibility: visible
}

#menu h2 {
    margin: .4rem 0 1rem;
    font-weight: 600
}

#menu button {
    background: none;
    border: none;
    color: var(--text-primary);
    text-align: left;
    padding: .75rem .9rem;
    border-radius: 12px;
    font-size: .95rem;
    cursor: pointer
}

#menu button:hover {
    background: var(--hover)
}

#scrim {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    z-index: 35;
    opacity: 0;
    pointer-events: none;
    transition: .28s
}

#scrim.open {
    opacity: 1;
    pointer-events: auto
}

.page {
    text-align: left;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 1.6rem;
    padding: 1.4rem;
    backdrop-filter: blur(10px)
}

.page h1 {
    font-size: 1.4rem;
    margin-bottom: 1rem
}

.page p,
.muted {
    color: var(--text-secondary);
    font-size: .9rem
}

.grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin: 1rem 0
}

.stat {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: .8rem
}

.stat b {
    display: block;
    font-size: 1.35rem
}

.stat span {
    font-size: .75rem;
    color: var(--text-secondary)
}

.bar {
    height: 10px;
    border-radius: 9px;
    background: var(--surface);
    overflow: hidden;
    margin: .4rem 0 1rem
}

.bar i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent))
}

.row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: .6rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: .88rem
}

.card {
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: .8rem;
    margin-bottom: 10px;
    cursor: pointer;
    background: var(--surface)
}

.card small {
    color: var(--text-secondary)
}

.det {
    display: none;
    margin-top: .6rem
}

.card.open .det {
    display: block
}

.btns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 1rem
}

label {
    display: block;
    font-size: .85rem;
    margin: .9rem 0 .3rem
}

input[type=number],
input[type=file] {
    width: 100%;
    padding: .5rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--surface);
    color: var(--text-primary)
}

input[type=range],
input[type=color] {
    width: 100%
}

dialog {
    margin: auto;
    border: 1px solid var(--border-color);
    border-radius: 1.4rem;
    background: var(--menu-bg);
    color: var(--text-primary);
    padding: 1.3rem;
    width: min(420px, 92vw)
}

dialog::backdrop {
    background: rgba(0, 0, 0, .6)
}

dialog img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 12px;
    margin-top: .8rem
}

.err {
    color: #ff9b9b;
    font-size: .85rem;
    margin-top: .5rem
}

#toast {
    position: fixed;
    bottom: 22px;
    left: 50%;
    transform: translate(-50%, 30px);
    background: var(--menu-bg);
    border: 1px solid var(--border-color);
    padding: .7rem 1.1rem;
    border-radius: 30px;
    opacity: 0;
    transition: .3s;
    z-index: 60;
    font-size: .88rem;
    max-width: 90vw;
    pointer-events: none
}

#toast.show {
    opacity: 1;
    transform: translate(-50%, 0)
}