* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg: #0e0e14;
    --surface: #17171f;
    --surface-raised: #1e1e2a;
    --text: #e0e0e8;
    --text-muted: #7a7a90;
    --accent: #ffa726;
    --border: #28283a;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    -webkit-user-select: none;
    user-select: none;
}

/* ── Timezone Bars ── */

#timezone-bars {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 16px 16px 8px;
    gap: 10px;
    overflow-y: auto;
}

.tz-bar {
    position: relative;
    min-height: 74px;
    border-radius: 14px;
    overflow: hidden;
    cursor: default;
    flex-shrink: 0;
    box-shadow: 0 2px 12px rgba(0,0,0,0.35);
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.tz-bar:hover {
    transform: scale(1.018);
    box-shadow: 0 6px 28px rgba(0,0,0,0.55), 0 0 0 2px rgba(255,255,255,0.22);
    filter: brightness(1.18);
}

.tz-bar-active {
    transform: scale(0.97) !important;
    box-shadow: 0 1px 6px rgba(0,0,0,0.5), 0 0 0 2px rgba(255,255,255,0.4) !important;
    filter: brightness(0.82) !important;
    transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.08s ease !important;
}

.tz-bar-pressing {
    animation: pressRing 0.5s ease-out forwards;
}

@keyframes pressRing {
    0%   { box-shadow: 0 2px 12px rgba(0,0,0,0.35), 0 0 0 0px  rgba(255,255,255,0.55); }
    50%  { box-shadow: 0 2px 12px rgba(0,0,0,0.35), 0 0 0 8px  rgba(255,255,255,0.20); }
    100% { box-shadow: 0 2px 12px rgba(0,0,0,0.35), 0 0 0 14px rgba(255,255,255,0.0);  }
}

.tz-gradient {
    position: absolute;
    /* 3x wide so we can shift it left/right and always have coverage */
    width: 300%;
    top: 0; bottom: 0;
    left: -100%;
    background: repeating-linear-gradient(to right,
        #06101e 0%,
        #081630 3.33%,
        #0c2050 5.67%,
        #1a237e 7%,
        #6d3a0a 8%,
        #c85a10 8.67%,
        #e88a00 9.67%,
        #f5a623 11%,
        #ffc040 12.5%,
        #ffd070 14.67%,
        #ffe0a0 16.67%,
        #ffd070 18.67%,
        #ffc040 20.83%,
        #f5a623 22.33%,
        #e88a00 23.67%,
        #c85a10 24.67%,
        #6d3a0a 25.33%,
        #1a237e 26.33%,
        #0c2050 27.67%,
        #081630 30%,
        #06101e 33.333%
    );
    transition: transform 0.18s ease;
}

/* Inner sliding content: work-hours, midnight, hour ticks — all move with gradient */
.tz-slide {
    position: absolute;
    width: 300%;
    top: 0; bottom: 0;
    left: -100%;
    transition: transform 0.18s ease;
    pointer-events: none;
}

/* 9 AM – 5 PM working-hours band  (positions relative to one 33.333% day cycle) */
.tz-work-hours {
    position: absolute;
    top: 0; bottom: 0;
    border-left: 2px solid rgba(255,255,255,0.30);
    border-right: 2px solid rgba(255,255,255,0.30);
    background: rgba(255,255,255,0.07);
}

/* Midnight marker */
.tz-midnight {
    position: absolute;
    top: 0; bottom: 0;
    width: 2px;
    background: rgba(255,255,255,0.20);
}

/* Hour reference labels inside gradient */
.tz-hour-tick {
    position: absolute;
    bottom: 3px;
    transform: translateX(-50%);
    font-size: 9px;
    font-weight: 500;
    color: rgba(255,255,255,0.40);
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    letter-spacing: 0.02em;
}

/* Fixed center needle — stays at 50% */
.tz-now-needle {
    position: absolute;
    top: 0; bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 3px;
    background: #fff;
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(255,255,255,0.60);
    pointer-events: none;
    z-index: 4;
}

.tz-now-needle::before {
    content: '';
    position: absolute;
    top: -5px; left: 50%;
    transform: translateX(-50%);
    width: 11px; height: 11px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(255,255,255,0.5);
}

/* Text overlay */
.tz-label {
    position: relative;
    z-index: 3;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 18px;
    height: 100%;
    min-height: 74px;
}

.tz-info-left { display: flex; flex-direction: column; gap: 2px; }

.tz-name {
    font-weight: 700;
    font-size: 15px;
    color: #fff;
    text-shadow: 0 1px 5px rgba(0,0,0,0.75), 0 0 14px rgba(0,0,0,0.4);
}

.tz-abbr {
    font-size: 11px;
    font-weight: 500;
    color: rgba(255,255,255,0.65);
    text-shadow: 0 1px 4px rgba(0,0,0,0.7);
}

.tz-info-right { text-align: right; display: flex; flex-direction: column; gap: 2px; }

.tz-time {
    font-weight: 700;
    font-size: 22px;
    color: #fff;
    text-shadow: 0 1px 6px rgba(0,0,0,0.8), 0 0 16px rgba(0,0,0,0.4);
    font-variant-numeric: tabular-nums;
}

.tz-date {
    font-size: 11px;
    color: rgba(255,255,255,0.60);
    text-shadow: 0 1px 4px rgba(0,0,0,0.7);
}

/* ── Bottom Panel ── */

#bottom-panel {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 14px 20px 20px;
    flex-shrink: 0;
}

/* Scrubber — draggable track with fixed center needle */
#scrubber-container { position: relative; margin-bottom: 14px; }

#scrubber-label {
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 6px;
    min-height: 22px;
}

#scrubber-track {
    position: relative;
    width: 100%;
    height: 32px;
    border-radius: 8px;
    overflow: hidden;
    cursor: grab;
    border: 1px solid var(--border);
    touch-action: none;
}

#scrubber-track:active { cursor: grabbing; }

#scrubber-track-inner {
    position: absolute;
    width: 300%;
    top: 0; bottom: 0;
    left: -100%;
    background: repeating-linear-gradient(to right,
        #06101e 0%,
        #081630 3.33%,
        #0c2050 5.67%,
        #1a237e 7%,
        #6d3a0a 8%,
        #c85a10 8.67%,
        #e88a00 9.67%,
        #f5a623 11%,
        #ffc040 12.5%,
        #ffd070 14.67%,
        #ffe0a0 16.67%,
        #ffd070 18.67%,
        #ffc040 20.83%,
        #f5a623 22.33%,
        #e88a00 23.67%,
        #c85a10 24.67%,
        #6d3a0a 25.33%,
        #1a237e 26.33%,
        #0c2050 27.67%,
        #081630 30%,
        #06101e 33.333%
    );
    pointer-events: none;
}

#scrubber-needle {
    position: absolute;
    top: -2px; bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 3px;
    background: #fff;
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(255,255,255,0.60);
    pointer-events: none;
    z-index: 2;
}

#scrubber-needle::before {
    content: '';
    position: absolute;
    top: -3px; left: 50%;
    transform: translateX(-50%);
    width: 9px; height: 9px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(255,255,255,0.5);
}

#scrubber-ticks {
    position: relative;
    height: 18px;
    margin-top: 4px;
    font-size: 10px;
    color: var(--text-muted);
    pointer-events: none;
    overflow: hidden;
}

#scrubber-ticks span {
    position: absolute;
    transform: translateX(-50%);
    white-space: nowrap;
}

/* Controls */
#controls { display: flex; gap: 10px; justify-content: center; }

#controls button {
    padding: 10px 22px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    flex: 1;
    max-width: 180px;
    height: 40px;
    white-space: nowrap;
}

#controls button:active { transform: scale(0.96); }

#btn-add     { background: var(--accent); color: #1a1a20; }
#btn-add:hover { background: #ffb74d; }

#btn-now     { background: var(--surface-raised); color: var(--text); }
#btn-now:hover { background: #2a2a3a; }

#btn-share   { background: var(--surface-raised); color: var(--text); }
#btn-share:hover { background: #2a2a3a; }

/* ── Modal ── */

#modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(6px);
}

#modal-overlay.hidden { display: none; }

#modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 92%;
    max-width: 440px;
    max-height: 72vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0,0,0,0.55);
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(16px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

#modal-header {
    padding: 16px 20px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#modal-header h3 { font-size: 16px; font-weight: 700; }

#modal-close {
    background: none; border: none;
    color: var(--text-muted);
    font-size: 22px;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 6px;
    line-height: 1;
}

#modal-close:hover { background: var(--surface-raised); }

#tz-search {
    margin: 0 16px 10px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    outline: none;
}

#tz-search:focus { border-color: var(--accent); }

#tz-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 10px 14px;
}

.tz-option {
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.12s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tz-option:hover { background: rgba(255,167,38,0.14); }

.tz-option-offset {
    color: var(--text-muted);
    font-size: 12px;
    flex-shrink: 0;
    margin-left: 12px;
}

/* ── Context Menu ── */

#context-menu {
    position: fixed;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 4px;
    z-index: 200;
    box-shadow: 0 8px 28px rgba(0,0,0,0.55);
    min-width: 160px;
}

#context-menu.hidden { display: none; }

#context-menu button {
    display: block; width: 100%;
    padding: 10px 14px;
    background: none; border: none;
    color: #ff5252;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 7px;
    text-align: left;
}

#context-menu button:hover { background: rgba(255,82,82,0.12); }

/* ── Empty state ── */

.empty-hint {
    text-align: center;
    color: var(--text-muted);
    padding: 48px 20px;
    font-size: 15px;
}

/* ── Responsive ── */

@media (max-width: 600px) {
    .tz-bar  { min-height: 62px; }
    .tz-name { font-size: 13px; }
    .tz-time { font-size: 18px; }
    .tz-label { min-height: 62px; padding: 0 12px; }
    #controls { flex-wrap: wrap; }
    #controls button { flex: 1; min-width: 90px; padding: 10px 12px; }
}
