.weather-app {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

#weather-content {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.weather-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.weather-search {
    position: relative;
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.8rem 1.4rem;
    background: var(--pill-bg);
    border: 1px solid var(--pill-border);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-expressive);
    transition: border-color 0.3s ease;
}

.weather-search:focus-within {
    border-color: var(--border-hover);
}

.weather-search > .material-symbols-rounded {
    color: var(--text-secondary);
    flex-shrink: 0;
}

.weather-search input {
    flex: 1;
    min-width: 0;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 500;
}

.weather-search input::placeholder {
    color: var(--text-secondary);
}

.weather-suggestions {
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    right: 0;
    margin: 0;
    padding: 0.5rem;
    list-style: none;
    background: var(--bg-glass);
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    border: 1px solid var(--border-base);
    border-radius: 24px;
    box-shadow: var(--shadow-expressive);
    overflow: hidden auto;
    max-height: 320px;
    z-index: 300;
}

.weather-suggestions li {
    padding: 0.9rem 1.2rem;
    border-radius: 16px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    transition: background 0.2s;
}

.weather-suggestions li:hover,
.weather-suggestions li.active {
    background: var(--text-primary);
    color: var(--bg-base);
}

.weather-suggestions li[data-empty] {
    cursor: default;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
}

.weather-suggestions li[data-empty]:hover {
    background: none;
    color: var(--text-secondary);
}

.weather-suggestion-name {
    font-size: 0.95rem;
    font-weight: 700;
}

.weather-suggestion-meta {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    opacity: 0.75;
}

.weather-tool-btn {
    padding: 0.8rem 1.2rem;
}

.weather-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.2rem;
    padding: 4rem 2rem;
    border: 1.5px dashed var(--border-hover);
    border-radius: var(--radius-card);
    color: var(--text-secondary);
    text-align: center;
}

.weather-status .material-symbols-rounded {
    font-size: 2.4rem !important;
}

.weather-status p {
    max-width: 44ch;
    font-size: 0.95rem;
    line-height: 1.6;
}

.weather-status .btn-primary {
    padding: 0.9rem 2.2rem;
}

.spin {
    animation: weather-spin 1.2s linear infinite;
}

@keyframes weather-spin {
    to {
        transform: rotate(360deg);
    }
}

.weather-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
    gap: 2.5rem;
    align-items: stretch;
}

.weather-now {
    display: flex;
    flex-direction: column;
    gap: 2.2rem;
}

.weather-fx {
    position: fixed;
    inset: 0;
    z-index: 50;
    overflow: hidden;
    pointer-events: none;
}

.weather-fx canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.weather-now-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
}

.weather-now-meta {
    min-width: 0;
}

.weather-now-meta .heading-large {
    overflow-wrap: anywhere;
}

.weather-place-sub {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    flex-wrap: wrap;
    margin-top: 0.6rem;
}

.weather-place-tag {
    padding: 0.28rem 0.75rem;
    border: 1px solid var(--border-base);
    border-radius: var(--radius-pill);
    background: var(--accent-soft);
    font-family: var(--font-sans);
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--accent-iris);
    white-space: nowrap;
}

.weather-date,
.weather-region {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.weather-region[hidden] {
    display: none;
}

.weather-now-icon {
    font-size: 3.6rem !important;
    color: var(--accent-flame);
    flex-shrink: 0;
}

.weather-clock-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1.15rem 1.6rem;
    background: rgba(128, 128, 128, 0.08);
    border-radius: var(--radius-input);
}

.weather-clock-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
}

.weather-clock-group-place {
    align-items: flex-end;
    text-align: right;
}

.weather-time-label {
    font-family: var(--font-sans);
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-secondary);
}

.weather-place-time-line {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
}

.weather-place-clock {
    font-family: var(--font-mono);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.weather-tz-label {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--accent-iris);
}

.weather-tz-name {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.weather-clock {
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
    line-height: 1;
}

.weather-temp-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 2rem;
    flex-wrap: wrap;
    margin-top: auto;
}

.weather-temp-wrap {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
}

.weather-temp {
    font-family: var(--font-serif);
    font-size: clamp(4.5rem, 9vw, 7rem);
    font-weight: 600;
    line-height: 0.9;
    letter-spacing: -0.04em;
}

.weather-temp-unit {
    font-family: var(--font-sans);
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.weather-chips {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.9rem;
    margin-bottom: 0.5rem;
}

.weather-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.65rem 1.2rem;
    border: 1px solid var(--border-base);
    border-radius: var(--radius-pill);
    background: rgba(128, 128, 128, 0.07);
    font-family: var(--font-mono);
    font-size: 0.88rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.weather-chip .material-symbols-rounded {
    font-size: 1.05rem !important;
    color: var(--accent-iris);
}

.weather-chip-label {
    font-family: var(--font-sans);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.weather-chip-value {
    color: var(--text-primary);
}

.weather-unit-toggle {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.35rem;
    background: var(--pill-bg);
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    border: 1px solid var(--pill-border);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-expressive);
    flex-shrink: 0;
}

.weather-unit-toggle button {
    padding: 0.5rem 0.9rem;
    border-radius: var(--radius-pill);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
    transition: all 0.3s var(--transition-smooth);
}

.weather-unit-toggle button:not(.active):hover {
    color: var(--text-primary);
}

.weather-unit-toggle button.active {
    background: var(--text-primary);
    color: var(--bg-base);
}

.weather-updated {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-base);
    padding-top: 1.2rem;
}

.weather-week {
    display: flex;
    flex-direction: column;
}

.weather-week .label-micro {
    margin-bottom: 1.2rem;
}

.weather-week-list {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
}

.weather-week-list li {
    display: grid;
    grid-template-columns: 4rem 1fr auto;
    align-items: center;
    gap: 1rem;
    padding: 1.15rem 0;
    border-bottom: 1px solid var(--border-base);
}

.weather-week-list li:last-child {
    border-bottom: none;
}

.weather-day-name {
    font-size: 0.85rem;
    font-weight: 700;
}

.weather-day-icon {
    color: var(--accent-iris);
}

.weather-day-temps {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-family: var(--font-mono);
    font-size: 0.88rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.weather-day-temps b {
    color: var(--text-primary);
    font-weight: 700;
}

.weather-day-temps .material-symbols-rounded {
    font-size: 0.85rem !important;
    color: var(--text-secondary);
}

.weather-day-temps .weather-day-hi .material-symbols-rounded {
    color: var(--accent-flame);
}

.weather-day-temps .weather-day-lo .material-symbols-rounded {
    color: var(--accent-iris);
}

.weather-hours {
    padding: 2rem;
}

.weather-hours .label-micro {
    margin-bottom: 1.2rem;
}

.weather-hours-scroll {
    overflow-x: auto;
    padding-bottom: 0.4rem;
}

.weather-hours-inner {
    position: relative;
    width: max-content;
    min-width: 100%;
    height: 220px;
}

.weather-hours-chart {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
    z-index: 2;
}

.weather-hours-chart .wxh-line {
    fill: none;
    stroke: url(#wxh-line-grad);
    stroke-width: 2.5;
    stroke-linecap: round;
}

.weather-hours-chart .wxh-line-stop-a {
    stop-color: var(--accent-flame);
}

.weather-hours-chart .wxh-line-stop-b {
    stop-color: var(--accent-iris);
}

.weather-hours-chart .wxh-dot {
    stroke: var(--bg-base);
    stroke-width: 1.5;
}

.weather-hours-list {
    list-style: none;
    margin: 0;
    padding: 0;
    height: 100%;
    display: flex;
    gap: 1rem;
}

.weather-hours-list li {
    min-width: 5rem;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 1.1rem 0.7rem;
    background: rgba(128, 128, 128, 0.05);
    border: 1px solid var(--border-base);
    border-radius: 20px;
}

.weather-hour-top,
.weather-hour-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.55rem;
}

.weather-hour-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.weather-hour-icon {
    color: var(--accent-iris);
}

.weather-hour-temp {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 700;
}

.weather-hour-precip {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: var(--text-secondary);
    min-height: 1em;
    white-space: nowrap;
}

.weather-toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.weather-toast {
    background: var(--text-primary);
    color: var(--bg-base);
    padding: 1.2rem 1.8rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.6;
    border-radius: 20px;
    transform: translateX(120%);
    transition: transform 0.5s var(--transition-smooth);
    box-shadow: var(--shadow-expressive);
    max-width: min(440px, calc(100vw - 4rem));
}

.weather-toast.show {
    transform: translateX(0);
}

.weather-fx-prompt {
    background: var(--text-primary);
    color: var(--bg-base);
    padding: 1.2rem 1.5rem;
    font-family: var(--font-sans);
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.55;
    border-radius: 20px;
    transform: translateX(120%);
    transition: transform 0.5s var(--transition-smooth);
    box-shadow: var(--shadow-expressive);
    max-width: min(380px, calc(100vw - 4rem));
}

.weather-fx-prompt.show {
    transform: translateX(0);
}

.fx-lag-actions {
    display: flex;
    gap: 0.6rem;
    margin-top: 0.9rem;
    justify-content: flex-end;
}

.fx-lag-actions button {
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.45rem 1.2rem;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-base);
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.fx-lag-actions button[data-lag-yes] {
    background: var(--accent-iris);
    border-color: var(--accent-iris);
    color: #fff;
}

body.dark-mode .fx-lag-actions button[data-lag-yes] {
    color: var(--bg-base);
}

@media (max-width: 900px) {
    .weather-toolbar {
        flex-wrap: wrap;
    }

    .weather-search {
        min-width: 100%;
    }

    .weather-tool-btn {
        flex: 1;
        justify-content: center;
    }

    .weather-unit-toggle {
        flex: 1;
        justify-content: center;
    }

    .weather-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .weather-hours-inner {
        height: 180px;
    }

    .weather-clock {
        font-size: 1.6rem;
    }

    .weather-temp {
        font-size: clamp(3.8rem, 16vw, 5.5rem);
    }
}

.weather-map-card {
    padding: 2rem;
}

.weather-map {
    height: 340px;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    z-index: 1;
    background: rgba(128, 128, 128, 0.08);
}

.weather-map .leaflet-container {
    height: 100%;
    width: 100%;
    font-family: var(--font-sans);
}

.weather-map .leaflet-control-attribution {
    background: rgba(20, 18, 26, 0.72);
    color: rgba(255, 255, 255, 0.75);
    font-size: 10px;
}

.weather-map .leaflet-control-attribution a {
    color: rgba(255, 255, 255, 0.9);
}

.weather-map .leaflet-bar a {
    background: rgba(20, 18, 26, 0.82);
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.weather-map .leaflet-bar a:hover {
    background: rgba(20, 18, 26, 0.95);
}

.weather-map-marker {
    background: none;
    border: none;
}

.weather-map-marker .wm-dot {
    position: absolute;
    left: 0;
    top: 0;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent-flame);
    border: 3px solid #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
    transform: translate(-50%, -50%);
}

.weather-map-marker .wm-label {
    position: absolute;
    left: 12px;
    top: -14px;
    white-space: nowrap;
    background: rgba(20, 18, 26, 0.82);
    color: #fff;
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 600;
    padding: 4px 11px;
    border-radius: 999px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.weather-map-marker .wm-label::before {
    content: '';
    position: absolute;
    left: -4px;
    top: 50%;
    width: 8px;
    height: 8px;
    background: inherit;
    transform: translateY(-50%) rotate(45deg);
    border-radius: 2px;
}

@media (max-width: 900px) {
    .weather-map {
        height: 260px;
    }
}

.fx-fog {
    position: absolute;
    inset: -12%;
    opacity: 0;
    transition: opacity 1.6s ease;
}

.weather-fx.fx-fog-on .fx-fog {
    opacity: 1;
}

.fx-fog .fog-band {
    position: absolute;
    left: -15%;
    width: 130%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: blur(26px) brightness(var(--fx-fog-bright, 1));
    will-change: transform, opacity;
}

.fx-fog .fog-band-a {
    top: 2%;
    height: 50%;
    background-image: url(img/cloud-0.png);
    opacity: 0.55;
    animation: fog-drift-a 36s ease-in-out infinite alternate, fog-breathe 9s ease-in-out infinite alternate;
}

.fx-fog .fog-band-b {
    top: 32%;
    height: 46%;
    background-image: url(img/cloud-1.png);
    opacity: 0.6;
    animation: fog-drift-b 52s ease-in-out infinite alternate-reverse, fog-breathe 13s ease-in-out infinite alternate-reverse;
}

.fx-fog .fog-band-c {
    top: 58%;
    height: 42%;
    background-image: url(img/cloud-2.png);
    opacity: 0.5;
    animation: fog-drift-c 66s ease-in-out infinite alternate, fog-breathe 17s ease-in-out infinite alternate;
}

@keyframes fog-drift-a {
    from {
        transform: translateX(-7%) scale(1.05);
    }
    to {
        transform: translateX(13%) scale(1);
    }
}

@keyframes fog-drift-b {
    from {
        transform: translateX(9%) scale(1);
    }
    to {
        transform: translateX(-14%) scale(1.08);
    }
}

@keyframes fog-drift-c {
    from {
        transform: translateX(-10%) scale(1.06);
    }
    to {
        transform: translateX(12%) scale(1);
    }
}

@keyframes fog-breathe {
    from {
        opacity: 0.65;
    }
    to {
        opacity: 1;
    }
}

body.dark-mode {
    --fx-fog-bright: 1.05;
}

body.light-mode {
    --fx-fog-bright: 0.78;
}

/* ---------- AI weather analysis ---------- */

.weather-ai-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.4rem;
}

.weather-ai-body {
    min-height: 96px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.ai-run-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    align-self: flex-start;
}

.ai-loading {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.ai-result {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.ai-result-col {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    min-width: 0;
}

.ai-result-col .label-micro {
    margin-bottom: 0.2rem;
}

.ai-row {
    display: flex;
    gap: 0.8rem;
    align-items: flex-start;
}

.ai-row-icon {
    color: var(--accent-iris);
    font-size: 20px;
    margin-top: 2px;
    flex-shrink: 0;
}

.ai-row-text {
    min-width: 0;
}

.ai-row-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.ai-row-text p {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--text-primary);
    overflow-wrap: break-word;
}

.ai-result-foot {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    margin-top: 1.6rem;
    padding-top: 1.1rem;
    border-top: 1px solid var(--border-base);
}

.ai-model-caption {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-disclaimer {
    font-size: 0.7rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.ai-error-action {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.ai-error-detail {
    align-self: stretch;
}

.ai-error-detail summary {
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.ai-error-detail pre {
    margin: 0.6rem 0 0;
    padding: 0.9rem 1.1rem;
    background: var(--pill-bg);
    border: 1px solid var(--border-base);
    border-radius: 14px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    line-height: 1.5;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 200px;
    overflow: auto;
}

.ai-privacy-note {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    margin: 1rem 0 0;
    padding: 0.9rem 1.1rem;
    border: 1px dashed var(--border-hover);
    border-radius: 16px;
    font-size: 0.78rem;
    line-height: 1.55;
    color: var(--text-secondary);
}

.ai-privacy-note .material-symbols-rounded {
    color: var(--accent-iris);
    font-size: 18px;
    margin-top: 1px;
    flex-shrink: 0;
}

.ai-provider-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.6rem;
    margin: 0.6rem 0 0.4rem;
}

.ai-provider-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
    padding: 0.8rem 0.4rem 0.7rem;
    background: var(--pill-bg);
    border: 1px solid var(--pill-border);
    border-radius: 16px;
    cursor: pointer;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.7rem;
    font-weight: 600;
    transition: border-color 0.25s ease, color 0.25s ease;
}

.ai-provider-chip:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.ai-provider-chip.active {
    border-color: var(--accent-iris);
    color: var(--text-primary);
    background: var(--accent-soft);
}

.ai-provider-chip img {
    width: 20px;
    height: 20px;
    display: block;
}

body.dark-mode .ai-provider-chip img {
    filter: invert(1);
    opacity: 0.92;
}

.ai-provider-chip .material-symbols-rounded {
    font-size: 20px;
}

.ai-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 0.9rem;
    min-width: 0;
}

.ai-field-label {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    margin: 0;
}

#ai-config > p.ai-field-label {
    margin: 1.5rem 0 0;
}

.ai-field input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.75rem 1.1rem;
    background: var(--pill-bg);
    border: 1px solid var(--pill-border);
    border-radius: 14px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.25s ease;
}

.ai-field input:focus {
    border-color: var(--border-hover);
}

.ai-field input::placeholder {
    color: var(--text-secondary);
    opacity: 0.65;
}

.ai-field-hint {
    font-size: 0.68rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.ai-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.9rem;
}

@media (max-width: 900px) {
    .ai-result {
        grid-template-columns: 1fr;
        gap: 1.4rem;
    }

    .ai-result-foot {
        flex-direction: column;
        gap: 0.3rem;
        align-items: flex-start;
    }

    .ai-disclaimer {
        white-space: normal;
    }

    .ai-provider-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .ai-field-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

}

.ai-modal-overlay[hidden],
.ai-privacy-note[hidden] {
    display: none;
}

/* ---------- AI mode toggle & connection test ---------- */

.ai-mode-toggle button {
    padding: 0.45rem 1.05rem;
    font-size: 0.78rem;
}

.ai-byok-recommend {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    margin: 0 0 0.8rem;
    padding: 0.9rem 1.1rem;
    border: 1px solid var(--border-hover);
    border-radius: 16px;
    background: var(--accent-soft);
    font-size: 0.78rem;
    line-height: 1.55;
    color: var(--text-primary);
}

.ai-byok-recommend .material-symbols-rounded {
    color: var(--accent-iris);
    font-size: 18px;
    margin-top: 1px;
    flex-shrink: 0;
}

.ai-test-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.2rem;
}

.ai-test-btn {
    padding: 0.65rem 1.4rem;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-hover);
    background: transparent;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.25s ease, border-color 0.25s ease;
}

.ai-test-btn:hover:not(:disabled) {
    border-color: var(--accent-iris);
}

.ai-test-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.ai-test-result {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.ai-latency-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px currentColor;
}

.ai-latency-dot.tier-great {
    background: #2ea043;
    color: #2ea043;
}

.ai-latency-dot.tier-good {
    background: #c9c53a;
    color: #c9c53a;
}

.ai-latency-dot.tier-slow {
    background: #e0821e;
    color: #e0821e;
}

.ai-latency-dot.tier-dead {
    background: #9b1c2e;
    color: #9b1c2e;
}

html.light-mode .ai-latency-dot.tier-great {
    background: #1a7f37;
    color: #1a7f37;
}

html.light-mode .ai-latency-dot.tier-good {
    background: #b0ab1f;
    color: #b0ab1f;
}

html.light-mode .ai-latency-dot.tier-slow {
    background: #d97706;
    color: #d97706;
}

html.light-mode .ai-latency-dot.tier-dead {
    background: #8b1a2f;
    color: #8b1a2f;
}

.ai-latency-ms {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-primary);
}

.ai-test-error {
    margin: 0.6rem 0 0;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--border-base);
    border-radius: 12px;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    line-height: 1.5;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 120px;
    overflow: auto;
}

@media (max-width: 900px) {
    .weather-ai-head {
        flex-wrap: wrap;
    }

}

/* ---------- inline BYOK config & summary ---------- */

.ai-config {
    display: flex;
    flex-direction: column;
}

.ai-config .ai-byok-recommend,
.ai-config .ai-privacy-note {
    margin-top: 0;
}

.ai-config .ai-privacy-note {
    margin-top: 0.7rem;
}

.ai-config-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 1.1rem;
}

.ai-config-actions .btn-primary {
    padding: 0.6rem 1.8rem;
}

.ai-config-actions .btn-primary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.ai-recommend {
    color: var(--accent-iris);
    font-size: 0.6rem;
    font-weight: 700;
    margin-left: 3px;
}

.ai-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 0.85rem 1.2rem;
    background: var(--pill-bg);
    border: 1px solid var(--pill-border);
    border-radius: 18px;
}

.ai-summary-info {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-width: 0;
}

.ai-summary-info img {
    width: 18px;
    height: 18px;
    display: block;
    flex-shrink: 0;
}

body.dark-mode .ai-summary-info img {
    filter: invert(1);
    opacity: 0.92;
}

.ai-summary-info .material-symbols-rounded {
    font-size: 18px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.ai-summary-text {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-summary .ai-latency-dot {
    width: 9px;
    height: 9px;
    flex-shrink: 0;
}

.ai-summary .ai-latency-ms {
    font-size: 0.68rem;
    color: var(--text-secondary);
}

.ai-change-btn {
    padding: 0.4rem 1rem;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-base);
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    transition: color 0.25s ease, border-color 0.25s ease;
}

.ai-change-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
}

@media (max-width: 900px) {
    .weather-ai-head {
        flex-wrap: wrap;
        gap: 0.8rem;
    }

    .ai-summary {
        flex-wrap: wrap;
    }
}


/* ---------- AI error card ---------- */

.ai-error-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1.1rem;
    padding: 1.3rem 1.5rem;
    border-radius: 20px;
}

.ai-error-card.tone-flame {
    background: color-mix(in srgb, var(--accent-flame) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent-flame) 38%, transparent);
}

.ai-error-card.tone-iris {
    background: var(--accent-soft);
    border: 1px solid color-mix(in srgb, var(--accent-iris) 38%, transparent);
}

.ai-error-head {
    display: flex;
    gap: 0.95rem;
    align-items: flex-start;
}

.ai-error-icon-badge {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tone-flame .ai-error-icon-badge {
    background: color-mix(in srgb, var(--accent-flame) 16%, transparent);
    color: var(--accent-flame);
}

.tone-iris .ai-error-icon-badge {
    background: color-mix(in srgb, var(--accent-iris) 18%, transparent);
    color: var(--accent-iris);
}

.ai-error-card p {
    margin: 0;
    padding-top: 0.35rem;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.75;
    color: var(--text-primary);
}

.ai-error-card .ai-error-action {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.ai-error-card .ai-error-detail {
    align-self: stretch;
}

.ai-error-card .ai-error-detail summary {
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.ai-error-card .ai-error-detail pre {
    margin: 0.6rem 0 0;
    padding: 0.9rem 1.1rem;
    background: var(--pill-bg);
    border: 1px solid var(--border-base);
    border-radius: 14px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    line-height: 1.5;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 180px;
    overflow: auto;
}


/* ---------- AI section transitions ---------- */

.weather-ai-body,
.ai-summary,
.ai-config {
    transition: opacity 0.2s ease, transform 0.2s var(--transition-smooth);
}

.ai-fading {
    opacity: 0 !important;
    transform: translateY(8px);
}

@keyframes aiFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-fade-in {
    animation: aiFadeIn 0.45s var(--transition-smooth) both;
}

@media (prefers-reduced-motion: reduce) {
    .ai-fade-in {
        animation: none;
    }

    .weather-ai-body,
    .ai-summary,
    .ai-config {
        transition: none;
    }
}
