:root {
    --wc-panel: rgba(255, 255, 255, 0.88);
    --wc-panel-strong: #ffffff;
    --wc-divider: #e5edf8;
    --wc-soft: #f5f8fd;
    --wc-night: #17253d;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --primary: #5f93ff;
    --primary-dark: #4d7fea;
    --background: #0f172a;
    --surface: #162033;
    --surface-soft: #1b2740;
    --text-primary: #edf4ff;
    --text-secondary: #9eacc2;
    --border: #2a3852;
    --shadow: 0 18px 44px rgba(0, 0, 0, 0.26);
    --wc-panel: rgba(22, 32, 51, 0.94);
    --wc-panel-strong: #162033;
    --wc-divider: #293752;
    --wc-soft: #1b2740;
    --wc-night: #0f1a2d;
}

.world-page {
    min-height: 100vh;
    background: radial-gradient(circle at 50% -8%, rgba(47, 115, 255, 0.09), transparent 35%), var(--background);
    color: var(--text-primary);
}

.world-topbar {
    width: min(1480px, calc(100% - 48px));
    min-height: 92px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.world-top-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ghost-link {
    padding: 10px 14px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 700;
    border-radius: 12px;
}

.ghost-link:hover,
.ghost-link:focus-visible {
    background: var(--surface-soft);
    color: var(--text-primary);
}

.world-layout {
    width: min(1480px, calc(100% - 48px));
    margin: 0 auto 36px;
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    gap: 22px;
}

.world-sidebar {
    min-height: calc(100vh - 128px);
}

.world-main {
    min-width: 0;
}

.world-heading {
    min-height: 104px;
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 28px;
    margin-bottom: 18px;
}

.world-heading h1 {
    margin: 0;
    font-size: clamp(30px, 3.4vw, 42px);
    line-height: 1;
    letter-spacing: -0.045em;
}

.world-heading p:not(.eyebrow) {
    margin: 10px 0 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.primary-button,
.secondary-button {
    min-height: 44px;
    border-radius: 13px;
    padding: 0 18px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.primary-button {
    border: 1px solid transparent;
    background: linear-gradient(135deg, var(--primary), #2b67ea);
    color: #ffffff;
    box-shadow: 0 12px 24px rgba(47, 115, 255, 0.22);
}

.primary-button:hover,
.secondary-button:hover {
    transform: translateY(-1px);
}

.secondary-button {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-primary);
}

.world-toolbar {
    padding: 14px;
    margin-bottom: 16px;
    border: 1px solid var(--wc-divider);
    border-radius: 18px;
    background: var(--wc-panel);
    box-shadow: 0 10px 24px rgba(30, 79, 196, 0.05);
    backdrop-filter: blur(12px);
}

.search-box,
.dialog-search {
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--wc-panel-strong);
}

.search-box:focus-within,
.dialog-search:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(47, 115, 255, 0.10);
}

.search-box > span,
.dialog-search > span {
    color: var(--text-secondary);
    font-size: 20px;
}

.search-box input,
.dialog-search input {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text-primary);
    font: inherit;
}

.search-box input::placeholder,
.dialog-search input::placeholder {
    color: var(--text-secondary);
}

.search-box kbd {
    min-width: 28px;
    padding: 4px 7px;
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    border-radius: 7px;
    color: var(--text-secondary);
    font-size: 11px;
    text-align: center;
}

.filter-tabs {
    display: inline-flex;
    gap: 4px;
    margin-top: 12px;
    padding: 3px;
    border-radius: 10px;
    background: var(--wc-soft);
}

.filter-tab {
    min-height: 34px;
    padding: 0 13px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.filter-tab.is-active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 5px 12px rgba(47, 115, 255, 0.18);
}

.city-list {
    display: grid;
    gap: 10px;
}

.city-card {
    position: relative;
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto auto;
    grid-template-areas:
        "identity time state"
        "extra extra extra";
    align-items: center;
    gap: 14px 20px;
    padding: 16px 18px;
    border: 1px solid var(--wc-divider);
    border-radius: 16px;
    background: var(--wc-panel-strong);
    box-shadow: 0 8px 22px rgba(23, 42, 78, 0.045);
    transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.city-card { cursor: pointer; }
.city-card:focus-visible { outline: 3px solid rgba(47, 115, 255, 0.18); outline-offset: 2px; }
.city-card.weather-open-target { border-color: rgba(47, 115, 255, 0.34); }

.city-card:hover {
    transform: translateY(-1px);
    border-color: rgba(47, 115, 255, 0.28);
    box-shadow: 0 14px 30px rgba(23, 42, 78, 0.07);
}

.city-identity {
    grid-area: identity;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.city-flag {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid var(--wc-divider);
    background: var(--wc-soft);
    font-size: 22px;
}

.city-copy {
    min-width: 0;
}

.city-copy h2 {
    margin: 0;
    font-size: 15px;
    letter-spacing: -0.01em;
}

.city-copy p {
    margin: 3px 0 0;
    color: var(--text-secondary);
    font-size: 12px;
}

.city-time {
    grid-area: time;
    display: grid;
    justify-items: end;
    gap: 3px;
    white-space: nowrap;
}

.city-time strong {
    font-size: 22px;
    letter-spacing: -0.035em;
}

.city-time span {
    color: var(--text-secondary);
    font-size: 11px;
}

.city-state {
    grid-area: state;
    display: flex;
    align-items: center;
    justify-content: end;
    gap: 9px;
    min-width: 112px;
    color: var(--text-secondary);
    font-size: 11px;
    white-space: nowrap;
}

.day-night {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--wc-soft);
    font-size: 13px;
}

.day-night.is-day {
    color: #f3a11b;
}

.day-night.is-night {
    color: #8ca6dc;
    background: var(--wc-night);
}

.favorite-button,
.dialog-close {
    border: 0;
    background: transparent;
    cursor: pointer;
}

.favorite-button {
    padding: 5px;
    color: #9eabc0;
    font-size: 17px;
}

.favorite-button.is-favorite {
    color: var(--primary);
}

.city-extra {
    grid-area: extra;
    display: flex;
    align-items: center;
    gap: 16px;
    padding-top: 11px;
    border-top: 1px solid var(--wc-divider);
    color: var(--text-secondary);
    font-size: 11px;
}

.city-extra .remove-city {
    margin-left: auto;
    padding: 5px 8px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    cursor: pointer;
}

.city-extra .remove-city:hover {
    background: var(--wc-soft);
    color: var(--text-primary);
}

.world-empty,
.world-error {
    padding: 48px 24px;
    border: 1px dashed var(--border);
    border-radius: 18px;
    background: var(--wc-panel);
    text-align: center;
}

.world-error {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 14px;
    text-align: left;
    border-style: solid;
}

.world-empty.is-hidden,
.world-error.is-hidden {
    display: none;
}

.empty-icon,
.error-icon {
    width: 54px;
    height: 54px;
    margin: 0 auto 12px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--wc-soft);
    color: var(--primary);
    font-size: 24px;
}

.error-icon {
    margin: 0;
    background: #fff1f1;
    color: #df4747;
}

.world-empty h2,
.world-error h2 {
    margin: 0;
    font-size: 17px;
}

.world-empty p,
.world-error p {
    margin: 8px 0 18px;
    color: var(--text-secondary);
    font-size: 13px;
}

.city-dialog {
    width: min(660px, calc(100% - 28px));
    padding: 0;
    border: 0;
    border-radius: 22px;
    background: transparent;
}

.city-dialog::backdrop {
    background: rgba(10, 19, 35, 0.48);
    backdrop-filter: blur(4px);
}

.dialog-card {
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: var(--surface);
    color: var(--text-primary);
    box-shadow: 0 26px 80px rgba(8, 22, 48, 0.22);
}

.dialog-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.dialog-heading h2 {
    margin: 0;
    font-size: 24px;
}

.dialog-heading p:not(.eyebrow) {
    margin: 8px 0 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.dialog-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 25px;
}

.dialog-close:hover {
    background: var(--wc-soft);
}

.catalog-list {
    max-height: min(56vh, 520px);
    margin-top: 14px;
    overflow: auto;
    display: grid;
    gap: 8px;
    padding-right: 3px;
}

.catalog-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px;
    border: 1px solid var(--wc-divider);
    border-radius: 13px;
    background: var(--surface);
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
}

.catalog-item:hover {
    border-color: rgba(47, 115, 255, 0.30);
    background: var(--wc-soft);
}

.catalog-item .city-flag {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
    font-size: 20px;
}

.catalog-item strong,
.catalog-item small {
    display: block;
}

.catalog-item small {
    margin-top: 3px;
    color: var(--text-secondary);
    font-size: 11px;
}

.catalog-add {
    color: var(--primary);
    font-size: 20px;
    font-weight: 800;
}

.catalog-empty {
    padding: 28px 16px;
    color: var(--text-secondary);
    text-align: center;
    font-size: 13px;
}

@media (max-width: 1060px) {
    .world-topbar,
    .world-layout {
        width: min(100% - 32px, 980px);
    }

    .world-layout {
        grid-template-columns: 198px minmax(0, 1fr);
    }

    .city-card {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "identity time"
            "state state"
            "extra extra";
    }

    .city-state {
        justify-content: flex-start;
    }
}

@media (max-width: 780px) {
    .world-topbar {
        min-height: 76px;
    }

    .brand-copy span,
    .world-top-actions .ghost-link,
    .world-sidebar {
        display: none;
    }

    .world-layout {
        display: block;
        width: min(100% - 22px, 720px);
        margin-bottom: 84px;
    }

    .world-heading {
        min-height: 0;
        align-items: start;
        margin-bottom: 16px;
        padding-top: 8px;
    }

    .world-heading h1 {
        font-size: 30px;
    }

    .primary-button {
        min-height: 42px;
        padding: 0 14px;
    }

    .world-toolbar {
        border-radius: 15px;
    }

    .filter-tab {
        padding: 0 10px;
        font-size: 11px;
    }

    .city-card {
        padding: 14px;
        border-radius: 15px;
    }

    .city-time strong {
        font-size: 19px;
    }

    .city-extra {
        flex-wrap: wrap;
        gap: 8px 13px;
    }

    .city-extra .remove-city {
        margin-left: 0;
    }

    .world-mobile-nav {
        display: grid;
    }

    .world-error {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .error-icon {
        margin: 0 auto;
    }
}

@media (max-width: 480px) {
    .world-topbar {
        width: calc(100% - 22px);
    }

    .world-heading {
        gap: 12px;
    }

    .world-heading p:not(.eyebrow) {
        max-width: 250px;
        line-height: 1.45;
    }

    .primary-button {
        white-space: nowrap;
        font-size: 12px;
    }

    .city-card {
        grid-template-columns: 1fr;
        grid-template-areas:
            "identity"
            "time"
            "state"
            "extra";
    }

    .city-time {
        justify-items: start;
    }

    .city-state {
        justify-content: flex-start;
    }

    .dialog-card {
        padding: 16px;
        border-radius: 18px;
    }
}

/* Extended World Clock controls */
.local-clock-hero {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 16px;
    padding: 24px 26px;
    border: 1px solid var(--wc-divider);
    border-radius: 20px;
    background: linear-gradient(135deg, var(--wc-panel-strong), var(--wc-soft));
    box-shadow: 0 14px 34px rgba(23, 42, 78, 0.06);
}
.local-place { font-size: 18px; font-weight: 900; letter-spacing: -0.02em; }
.local-place span { color: var(--text-secondary); font-size: 13px; font-weight: 700; margin-left: 5px; }
.local-time { margin-top: 6px; font-size: clamp(34px, 5vw, 50px); line-height: .95; font-weight: 900; letter-spacing: -0.05em; }
.local-date { margin-top: 8px; color: var(--text-secondary); font-size: 13px; }
.local-clock-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; align-self: center; }
.local-clock-meta > span:not(.local-indicator) { padding: 8px 11px; border-radius: 10px; background: var(--surface-soft); border: 1px solid var(--border); color: var(--text-secondary); font-size: 11px; font-weight: 800; }
.local-indicator { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: var(--wc-soft); border: 1px solid var(--wc-divider); font-size: 18px; }

/* User-selectable Local Time styles */
.local-time { min-height: 54px; display: inline-flex; align-items: center; }
.local-style-standard { font-size: clamp(34px, 5vw, 50px); line-height: .95; font-weight: 900; letter-spacing: -0.05em; }
.local-style-big-bold { font-size: clamp(42px, 6.2vw, 66px); font-weight: 950; letter-spacing: -0.075em; line-height: .9; }
.local-style-compact { padding: 8px 10px; border-radius: 10px; background: var(--surface-soft); border: 1px solid var(--border); font: 800 20px/1.1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: -.04em; }
.local-style-minimal { font-size: clamp(31px, 4.2vw, 44px); font-weight: 600; letter-spacing: -0.065em; }
.local-style-elegant { font-family: Georgia, 'Times New Roman', serif; font-size: clamp(35px, 4.8vw, 50px); font-weight: 600; letter-spacing: .015em; }
.local-style-glass { padding: 14px 18px; border-radius: 18px; color: #fff; background: linear-gradient(135deg, rgba(47,115,255,.85), rgba(117,78,255,.56)); border: 1px solid rgba(255,255,255,.28); box-shadow: inset 0 1px 0 rgba(255,255,255,.30), 0 14px 28px rgba(30,79,196,.18); backdrop-filter: blur(12px); font-size: clamp(30px, 4.4vw, 48px); font-weight: 900; letter-spacing: -.06em; }
.local-style-neon { padding: 13px 16px; border-radius: 14px; background: #091220; border: 1px solid rgba(85,175,255,.28); color: #9fe2ff; box-shadow: inset 0 0 22px rgba(0,190,255,.12), 0 0 24px rgba(0,168,255,.13); font: 900 clamp(27px,4.2vw,44px)/1 ui-monospace, SFMono-Regular, Menlo, monospace; text-shadow: 0 0 8px rgba(133,220,255,.95); letter-spacing: -.05em; }
.local-style-terminal { padding: 13px 16px; border-radius: 10px; background: #111; border: 1px solid #2d5939; color: #86ff9a; font: 850 clamp(27px,4vw,43px)/1 ui-monospace, SFMono-Regular, Menlo, monospace; text-shadow: 0 0 8px rgba(134,255,154,.55); letter-spacing: -.035em; }
.local-style-pill { padding: 10px 18px; border-radius: 999px; background: var(--surface-soft); border: 1px solid var(--border); box-shadow: 0 10px 20px rgba(15,31,58,.08); font-size: clamp(26px,4vw,40px); font-weight: 900; letter-spacing: -.05em; }
.local-style-split { gap: 7px; font: 950 clamp(34px,5vw,52px)/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: -.08em; }
.local-style-gradient { font-size: clamp(34px,5vw,50px); font-weight: 950; letter-spacing: -.07em; background: linear-gradient(90deg, #2f73ff, #7c55ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.local-style-retro { padding: 12px 15px; border-radius: 9px; background: #111; color: #fff; box-shadow: 0 9px 0 #222, 0 15px 22px rgba(0,0,0,.15); font: 950 clamp(29px,4.4vw,46px)/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .045em; }
.local-style-soft-glow { font-size: clamp(35px,5vw,50px); font-weight: 900; color: var(--primary); text-shadow: 0 0 18px rgba(47,115,255,.22); letter-spacing: -.06em; }
.local-style-outline { font-size: clamp(35px,5vw,50px); font-weight: 950; letter-spacing: -.02em; color: transparent; -webkit-text-stroke: 1.35px var(--text-primary); }
.local-style-analog-classic, .local-style-analog-modern { width: 132px; height: 132px; min-height: 132px; justify-content: center; }
.local-analog-clock { position: relative; width: 124px; height: 124px; border-radius: 50%; }
.local-analog-clock.is-classic { background: radial-gradient(circle, #fff 0 70%, #edf1f7 71% 100%); border: 4px solid #dfe5ee; color: #1b2b45; box-shadow: 0 12px 25px rgba(15,31,58,.10); }
.local-analog-clock.is-modern { background: radial-gradient(circle, #111a2c 0 67%, #0a1020 68% 100%); border: 3px solid #31415e; color: #e8f0ff; box-shadow: inset 0 0 0 5px rgba(110,145,210,.08), 0 0 22px rgba(70,146,255,.12); }
.local-analog-clock .analog-mark { position: absolute; font-size: 10px; font-weight: 900; }
.local-analog-clock .analog-mark.top { top: 9px; left: 50%; transform: translateX(-50%); }
.local-analog-clock .analog-mark.right { right: 9px; top: 50%; transform: translateY(-50%); }
.local-analog-clock .analog-mark.bottom { bottom: 9px; left: 50%; transform: translateX(-50%); }
.local-analog-clock .analog-mark.left { left: 9px; top: 50%; transform: translateY(-50%); }
.local-analog-hand { position: absolute; left: 50%; bottom: 50%; width: 3px; border-radius: 999px; transform-origin: 50% 100%; transform: translateX(-50%) rotate(0deg); }
.local-analog-hand.hour { height: 34px; background: currentColor; }
.local-analog-hand.minute { height: 46px; background: currentColor; opacity: .95; }
.local-analog-hand.second { height: 50px; width: 1px; background: #d73f55; }
.local-analog-dot { position: absolute; width: 8px; height: 8px; left: 50%; top: 50%; transform: translate(-50%, -50%); border-radius: 50%; background: currentColor; }
.local-analog-clock.is-modern .local-analog-dot { box-shadow: 0 0 0 2px rgba(255,255,255,.08), 0 0 13px rgba(104,184,255,.95); }

.popular-panel { margin-top: 13px; padding-top: 13px; border-top: 1px solid var(--wc-divider); }
.popular-label { margin-bottom: 8px; color: var(--text-secondary); font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.popular-tabs { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.popular-tab { min-height: 34px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text-secondary); font: inherit; font-size: 11px; font-weight: 800; white-space: nowrap; cursor: pointer; }
.popular-tab:hover { color: var(--text-primary); border-color: rgba(47, 115, 255, .35); }
.popular-tab.is-active { border-color: var(--primary); background: var(--primary); color: #fff; }
.list-controls { display: flex; gap: 10px; justify-content: flex-end; margin-top: 12px; flex-wrap: wrap; }
.list-controls label { display: flex; align-items: center; gap: 7px; color: var(--text-secondary); font-size: 11px; font-weight: 800; }
.list-controls select { min-height: 34px; padding: 0 9px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text-primary); font: inherit; font-size: 11px; font-weight: 800; }
.list-summary { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 12px 0; padding: 0 2px; }
.list-summary strong { display: block; font-size: 14px; }
.list-summary span { color: var(--text-secondary); font-size: 11px; }
.list-summary > span { padding: 6px 9px; border-radius: 9px; background: var(--wc-soft); white-space: nowrap; }
.world-utc { display: flex; justify-content: space-between; gap: 16px; margin-top: 16px; padding: 13px 15px; border: 1px solid var(--wc-divider); border-radius: 13px; background: var(--wc-panel); color: var(--text-secondary); font-size: 11px; }
.world-utc strong { color: var(--text-primary); font-weight: 800; text-align: right; }

.city-list { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.city-card { min-width: 0; }
.capital-badge { display: inline-block; margin-left: 5px; padding: 2px 5px; border-radius: 5px; background: var(--wc-soft); border: 1px solid var(--wc-divider); color: var(--text-secondary); font-size: 8px; font-weight: 900; text-transform: uppercase; vertical-align: 2px; }
.add-inline { min-height: 28px; padding: 0 9px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text-primary); font: inherit; font-size: 10px; font-weight: 900; cursor: pointer; }
.catalog-item em { margin-left: 5px; font-size: 8px; font-style: normal; color: var(--primary); }

@media (min-width: 1100px) {
    .city-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1450px) {
    .city-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
    .local-clock-hero { padding: 19px; flex-direction: column; }
    .local-style-analog-classic, .local-style-analog-modern { width: 108px; height: 108px; min-height: 108px; }
    .local-analog-clock { width: 102px; height: 102px; }
    .local-clock-meta { justify-content: flex-start; }
    .world-utc { flex-direction: column; gap: 5px; }
    .world-utc strong { text-align: left; }
    .list-summary { align-items: flex-start; }
}
