
.hud-timer {
    --hud-timer-w: clamp(156px, calc(28vw - 176px), 252px);
    --hud-timer-h: 392px;
    --hud-timer-ink: rgba(234, 243, 255, 0.92);
    --hud-timer-dim: rgba(234, 243, 255, 0.68);
    --hud-timer-line: rgba(234, 243, 255, 0.22);
    --hud-timer-on: rgba(234, 243, 255, 0.6);
    --hud-timer-cy: var(--mc-color, rgb(34, 211, 238));

    position: fixed;
    left: min(76px, max(20px, calc(3.6vw - 20px)));
    top: 34%;
    width: var(--hud-timer-w);
    height: var(--hud-timer-h);
    transform: translateY(-50%);
    pointer-events: none;
    font-family: var(--hud-font);
    color: var(--hud-timer-ink);
}

.hud-timer.is-min {
    height: auto;
}

.hud-timer__shell {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    padding: 12px 14px 13px;
    border: 1px solid var(--hud-timer-line);
    border-radius: 10px;
    background: var(--hud-cover, rgba(6, 10, 18, 0.86));
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25), 0 12px 34px rgba(0, 0, 0, 0.34);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    overflow: hidden;
    opacity: 1;
    transition: opacity 0.16s ease, transform 0.16s ease;
    pointer-events: auto;
}

.hud-timer.is-min .hud-timer__shell {
    opacity: 0;
    transform: scale(0.97);
    pointer-events: none;
}

.hud-timer__deco {
    position: absolute;
    inset: 4px;
    pointer-events: none;
}

.hud-timer__deco i {
    position: absolute;
    width: 11px;
    height: 11px;
    border: 1px solid var(--hud-timer-cy);
    opacity: 0.5;
}

.hud-timer__deco i:nth-child(1) { left: 0; top: 0; border-width: 1px 0 0 1px; }
.hud-timer__deco i:nth-child(2) { right: 0; top: 0; border-width: 1px 1px 0 0; }
.hud-timer__deco i:nth-child(3) { right: 0; bottom: 0; border-width: 0 1px 1px 0; }
.hud-timer__deco i:nth-child(4) { left: 0; bottom: 0; border-width: 0 0 1px 1px; }

.hud-timer__head {
    flex: 0 0 auto;
    display: flex;
    align-items: baseline;
    gap: 9px;
    padding-bottom: 9px;
    border-bottom: 1px solid var(--hud-timer-line);
}

.hud-timer__title {
    font-family: "Pixel CN", var(--hud-font);
    font-size: 18px;
    letter-spacing: 0.08em;
    white-space: nowrap;
}

.hud-timer__en {
    font-size: 10px;
    letter-spacing: 0.24em;
    color: var(--hud-timer-dim);
    text-transform: uppercase;
}

.hud-timer__min {
    margin-left: auto;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--hud-timer-line);
    border-radius: 5px;
    background: rgba(234, 243, 255, 0.06);
    color: var(--hud-timer-ink);
    cursor: pointer;
    transition: background-color 0.16s ease, border-color 0.16s ease;
}

.hud-timer__min:hover {
    background: rgba(234, 243, 255, 0.18);
    border-color: var(--hud-timer-on);
}

.hud-timer__min svg {
    width: 14px;
    height: 14px;
    display: block;
}

.hud-timer__body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
    padding-top: 11px;
}

.hud-timer__ring {
    position: relative;
    flex: 0 0 auto;
    width: 132px;
    height: 132px;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    cursor: pointer;
}

.hud-timer__ring svg {
    width: 100%;
    height: 100%;
    display: block;
}

.hud-timer__track,
.hud-timer__arc {
    fill: none;
    stroke-width: 3;
}

.hud-timer__track {
    stroke: var(--hud-timer-line);
}

.hud-timer__arc {
    stroke: var(--hud-timer-cy);
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: 60px 60px;
    transform-box: view-box;
    stroke-dasharray: 339.29;
    stroke-dashoffset: calc(339.29 * (1 - var(--hud-timer-p, 0)));
    transition: stroke-dashoffset 0.2s linear;
}

.hud-timer__mid {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    pointer-events: none;
}

.hud-timer__time {
    font-size: 30px;
    line-height: 1;
    letter-spacing: 0.04em;
    font-variant-numeric: tabular-nums;
}

.hud-timer__state {
    font-size: 11px;
    letter-spacing: 0.12em;
    color: var(--hud-timer-dim);
}

.hud-timer.is-run .hud-timer__time {
    color: #ffffff;
    text-shadow: 0 0 8px var(--glow-dim, rgba(34, 211, 238, 0.45));
}

.hud-timer.is-run .hud-timer__arc {
    filter: drop-shadow(0 0 5px var(--glow-dim, rgba(34, 211, 238, 0.45)));
}

.hud-timer__modes,
.hud-timer__presets {
    flex: 0 0 auto;
    display: flex;
    gap: 6px;
}

.hud-timer__mode,
.hud-timer__preset {
    min-width: 52px;
    height: 26px;
    padding: 0 10px;
    border: 1px solid var(--hud-timer-line);
    border-radius: 5px;
    background: rgba(234, 243, 255, 0.05);
    color: var(--hud-timer-dim);
    font-family: var(--hud-font);
    font-size: 13px;
    letter-spacing: 0.06em;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.hud-timer__preset {
    min-width: 42px;
    height: 24px;
    padding: 0 8px;
    font-size: 12px;
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
}

.hud-timer__mode:hover,
.hud-timer__preset:hover {
    background: rgba(234, 243, 255, 0.16);
    border-color: var(--hud-timer-on);
    color: var(--hud-timer-ink);
}

.hud-timer__mode.is-on,
.hud-timer__preset.is-on {
    border-color: var(--hud-timer-cy);
    color: #ffffff;
    background: color-mix(in srgb, var(--hud-timer-cy) 18%, transparent);
}

.hud-timer__acts {
    flex: 0 0 auto;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 76px;
    gap: 7px;
}

.hud-timer__btn {
    height: 30px;
    border: 1px solid var(--hud-timer-cy);
    border-radius: 6px;
    background: color-mix(in srgb, var(--hud-timer-cy) 20%, transparent);
    color: #ffffff;
    font-family: var(--hud-font);
    font-size: 14px;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: background-color 0.16s ease, border-color 0.16s ease;
}

.hud-timer__btn:hover {
    background: color-mix(in srgb, var(--hud-timer-cy) 34%, transparent);
}

.hud-timer__btn--ghost {
    border-color: var(--hud-timer-line);
    background: rgba(234, 243, 255, 0.05);
    color: var(--hud-timer-dim);
    letter-spacing: 0.06em;
}

.hud-timer__btn--ghost:hover {
    background: rgba(234, 243, 255, 0.16);
    color: var(--hud-timer-ink);
}

.hud-timer__meta {
    flex: 0 0 auto;
    margin: 0;
    font-size: 11px;
    letter-spacing: 0.06em;
    color: rgba(234, 243, 255, 0.5);
    font-variant-numeric: tabular-nums;
}

.hud-timer.is-min {
    display: none;
}


@media (max-width: 1180px) {
    .hud-timer {
        display: none;
    }
}

@media (max-width: 1400px) {
    .hud-timer__shell {
        padding: 10px 11px 11px;
    }

    .hud-timer__en {
        display: none;
    }

    .hud-timer__title {
        font-size: 16px;
    }

    .hud-timer__ring {
        width: 102px;
        height: 102px;
    }

    .hud-timer__time {
        font-size: 23px;
    }

    .hud-timer__body {
        gap: 7px;
        padding-top: 9px;
    }

    .hud-timer__mode,
    .hud-timer__preset {
        min-width: 40px;
        height: 24px;
        padding: 0 6px;
        font-size: 12px;
    }

    .hud-timer__preset {
        min-width: 32px;
        font-size: 11px;
    }

    .hud-timer__btn {
        height: 28px;
        font-size: 13px;
        letter-spacing: 0.06em;
    }

    .hud-timer__acts {
        grid-template-columns: 1fr 56px;
    }

    .hud-timer__meta {
        font-size: 10px;
        letter-spacing: 0.02em;
    }
}

@media (max-height: 760px) {
    .hud-timer {
        --hud-timer-h: 352px;
    }

    .hud-timer__ring {
        width: 116px;
        height: 116px;
    }

    .hud-timer__time {
        font-size: 26px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hud-timer__shell,
    .hud-timer__arc {
        transition: none;
    }
}
