body {
    font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #000205;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

body.popup-active {
    overflow: hidden;
}

#ambientGlow {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    filter: blur(140px);
    opacity: 0.18;
    transition: background 2s ease-in-out;
    border-radius: 50%;
}

.glow-cold {
    background: radial-gradient(circle, #0a1931 0%, transparent 75%);
}

@keyframes idleGlow {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 0.15; }
    100% { transform: translate(-50%, -50%) scale(1.1); opacity: 0.22; }
}

.animate-glow {
    animation: idleGlow 8s infinite alternate ease-in-out;
}

.seconds-text {
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 18px rgba(255,255,255,0.12), 0 0 80px rgba(255,165,60,0.05);
    -webkit-text-stroke: 0.3px rgba(255,255,255,0.06);
    letter-spacing: -0.05em;
    color: white;
}

.overlay-card {
    background: rgba(10, 10, 10, 0.9);
    backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
}

.hidden { display: none !important; }

.nav-item {
    color: #9ca3af;
    transition: all 0.18s ease;
    position: relative;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
}

.nav-item:hover,
.nav-item.popup-active {
    color: #fff;
    transform: translateY(-2px);
    background: rgba(249, 115, 22, 0.08);
    box-shadow: inset 0 0 0 1px rgba(249, 115, 22, 0.18);
}

.material-symbols-rounded {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 48;
    font-size: 1.05rem;
    line-height: 1;
    display: inline-block;
    vertical-align: middle;
    pointer-events: none;
}
.btn-icon { display:inline-block; width:1em; height:1em; line-height:1; }
.nav-icon { width: 1.25rem; height: 1.25rem; display:inline-flex; align-items:center; justify-content:center }
.repo-icon { width:28px; height:28px; display:inline-flex; align-items:center; justify-content:center }
.button-combo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
}
.button-combo.stack {
    flex-direction: column;
    gap: 2px;
    white-space: normal;
}
.button-label {
    font-size: 0.75rem;
    line-height: 1;
    font-weight: 800;
}
.button-icon {
    display:inline-flex;
    align-items:center;
    justify-content:center;
    line-height: 1;
}
.nav-label { display: none; }
.button-loading .button-icon,
.button-loading .btn-icon {
    animation: iconPulse 800ms ease-in-out infinite;
}
@keyframes iconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.18); }
}

.action-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(0, 2, 5, 0.45);
    backdrop-filter: blur(0px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease, backdrop-filter 220ms ease;
}

.action-backdrop.open {
    opacity: 1;
    pointer-events: auto;
    backdrop-filter: blur(22px);
}

.action-popup {
    position: fixed;
    inset: 0;
    z-index: 50;
    pointer-events: none;
}

.action-popup-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    margin: 0 14px;
    padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
    border-radius: 28px 28px 0 0;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(8, 10, 14, 0.92);
    backdrop-filter: blur(32px);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
    max-height: calc(100vh - 96px);
    overflow-y: auto;
    opacity: 0;
    --sheet-offset: 0px;
    transform: translateY(calc(100% + 24px));
    transition: transform 260ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 220ms ease;
    pointer-events: auto;
    touch-action: pan-y;
}

.action-popup.open .action-popup-panel {
    opacity: 1;
    transform: translateY(var(--sheet-offset));
}

.action-popup-handle {
    width: 72px;
    height: 12px;
    border-radius: 999px;
    background: rgba(255,255,255,0.18);
    margin: 2px auto 12px;
    padding: 4px 0;
    cursor: grab;
    pointer-events: auto;
    touch-action: none;
}

.action-popup-panel.dragging {
    transition: none !important;
}

.action-popup-panel[data-sheet-snap="peek"] .popup-copy {
    display: -webkit-box;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

.action-popup-panel[data-sheet-snap="mid"] .popup-copy {
    display: -webkit-box;
    line-clamp: 4;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    overflow: hidden;
}

.popup-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.popup-copy {
    color: #c7cbd1;
    line-height: 1.6;
    font-size: 0.95rem;
}

.popup-quote {
    border-left: 3px solid rgba(249, 115, 22, 0.5);
    background: rgba(255,255,255,0.04);
    padding: 14px 16px;
    border-radius: 0 18px 18px 0;
    color: #d8dbe0;
    font-style: italic;
}

.popup-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.popup-label {
    font-size: 10px;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: #6b7280;
    font-weight: 800;
}

.popup-input,
.popup-number-grid input {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 18px;
    padding: 14px 16px;
    color: #fff;
    font-size: 0.95rem;
    outline: none;
}

.popup-input:focus,
.popup-number-grid input:focus {
    border-color: rgba(249, 115, 22, 0.55);
    box-shadow: 0 0 0 1px rgba(249, 115, 22, 0.32);
}

.popup-number-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.popup-button,
.popup-button-secondary {
    width: 100%;
    border-radius: 18px;
    padding: 14px 16px;
    font-weight: 900;
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.popup-button {
    background: #fff;
    color: #05070b;
}

.popup-button-secondary {
    border: 1px solid rgba(249, 115, 22, 0.4);
    color: #fb923c;
    background: rgba(249, 115, 22, 0.08);
}

.popup-button:active,
.popup-button-secondary:active {
    transform: scale(0.98);
}

#timerContentView {
    transition: filter 220ms ease;
}

.popup-card {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    padding: 16px;
}

.popup-divider {
    height: 1px;
    background: rgba(255,255,255,0.08);
}

.popup-status {
    border-radius: 18px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    padding: 14px 16px;
    color: #d1d5db;
    font-size: 0.9rem;
}

.timer-tap-target {
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
    line-height: 1;
}

.timer-tap-target:focus-visible {
    outline: 2px solid rgba(249, 115, 22, 0.5);
    outline-offset: 12px;
    border-radius: 16px;
}

.digital-style {
    font-family: "SF Mono", SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    letter-spacing: -0.02em;
}

.popup-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.popup-chip {
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.04);
    color: #d1d5db;
    font-size: 0.82rem;
    padding: 10px 12px;
    font-weight: 700;
    transition: all 140ms ease;
}

.popup-chip.active {
    border-color: rgba(249, 115, 22, 0.5);
    background: rgba(249, 115, 22, 0.12);
    color: #fdba74;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-radius: 16px;
    padding: 12px 14px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
}

.timer-mode-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-radius: 16px;
    padding: 12px 14px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
}

.timer-panel-hero {
    gap: 6px;
}

.settings-row p {
    margin: 0;
    font-size: 0.86rem;
    color: #d1d5db;
    font-weight: 600;
}

.settings-row small {
    display: block;
    margin-top: 2px;
    color: #6b7280;
    font-size: 0.72rem;
    font-weight: 500;
}

.switch {
    position: relative;
    width: 46px;
    height: 28px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(255,255,255,0.16);
    border-radius: 999px;
    transition: background 170ms ease;
}

.switch-slider:before {
    content: "";
    position: absolute;
    width: 22px;
    height: 22px;
    left: 3px;
    top: 3px;
    border-radius: 999px;
    background: #fff;
    transition: transform 170ms ease;
}

.switch input:checked + .switch-slider {
    background: rgba(249, 115, 22, 0.55);
}

.switch input:checked + .switch-slider:before {
    transform: translateX(18px);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 320px;
    overflow-y: auto;
}

.history-drawer {
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 18px;
    background: rgba(255,255,255,0.03);
    max-height: 0;
    overflow: hidden;
    transition: max-height 260ms ease, padding 220ms ease;
    padding: 0 12px;
}

.history-drawer.open {
    max-height: 360px;
    padding: 12px;
}

.history-drawer-toggle {
    width: 100%;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.03);
    color: #d1d5db;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 10px 12px;
    text-align: left;
}

.repo-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    opacity: 0.75;
    filter: brightness(0.72);
}

.quick-preset-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.smart-preset-chip {
    margin-top: 8px;
    width: 100%;
    border-radius: 12px;
    border: 1px dashed rgba(255,255,255,0.16);
    background: rgba(255,255,255,0.02);
    color: #9ca3af;
    font-size: 0.72rem;
    padding: 8px 10px;
    font-weight: 700;
    text-align: center;
}

.history-item {
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.78rem;
    color: #cdd3da;
}

.bottom-notification {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translate(-50%, 120%);
    width: min(420px, calc(100vw - 24px));
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(8, 10, 14, 0.95);
    backdrop-filter: blur(24px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
    z-index: 110;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    pointer-events: none;
    transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 180ms ease;
}

.bottom-notification.show {
    transform: translate(-50%, 0);
    opacity: 1;
    pointer-events: auto;
}

.notif-icon {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 900;
    flex-shrink: 0;
}

.notif-info .notif-icon { background: rgba(59,130,246,0.2); color: #93c5fd; }
.notif-success .notif-icon { background: rgba(34,197,94,0.2); color: #86efac; }
.notif-warning .notif-icon { background: rgba(245,158,11,0.2); color: #fcd34d; }

.notif-close {
    margin-left: auto;
    border: none;
    background: transparent;
    color: #9ca3af;
    font-weight: 900;
    font-size: 0.75rem;
    width: auto;
    height: auto;
    padding: 0;
    line-height: 1;
}

.date-popup {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: none;
    align-items: end;
    justify-content: center;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(8px);
    padding: 14px;
}

.date-popup.open {
    display: flex;
}

.date-popup-card {
    width: min(460px, 100%);
    border-radius: 24px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(8, 10, 14, 0.95);
    padding: 16px;
}

.date-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}

@media (prefers-reduced-motion: reduce) {
    .bottom-notification,
    .action-popup-panel,
    .action-backdrop {
        transition: none !important;
    }
}

.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.5;
}

@media (min-width: 768px) {
    .action-backdrop {
        background: rgba(0, 2, 5, 0.2);
    }

    .action-backdrop.open {
        backdrop-filter: none;
    }

    nav {
        z-index: 60;
    }

    body.popup-active #timerContentView {
        filter: blur(16px);
    }

    .action-popup-panel {
        left: var(--popup-left, 50%);
        top: var(--popup-top, 50%);
        right: auto;
        bottom: auto;
        width: min(480px, calc(100vw - 32px));
        margin: 0;
        padding: 18px 18px 20px;
        border-radius: 26px;
        max-height: min(70vh, 620px);
        transform: translateY(-8px) scale(0.98);
        --sheet-offset: 0px !important;
        touch-action: auto;
    }

    .action-popup.open .action-popup-panel {
        transform: translateY(0) scale(1);
    }

    .action-popup-handle {
        display: none;
    }
}