:root {
    --bg: #f0f1f5;
    --surface: #ffffff;
    --surface2: #eef0f4;
    --border: #dfe1e6;
    --text: #1c1e26;
    --muted: #6b7080;
    --accent: #0d9488;
    --accent-hover: #0f766e;
    --accent-light: rgba(13,148,136,0.07);
    --red: #d93025;
    --red-bg: rgba(217,48,37,0.06);
    --yellow: #c47e0a;
    --yellow-bg: rgba(196,126,10,0.06);
    --orange: #c45d1a;
    --orange-bg: rgba(196,93,26,0.06);
    --green: #1a9960;
    --green-bg: rgba(26,153,96,0.07);
    --radius: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.07);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.08);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

.island {
    width: 100%;
    max-width: 780px;
    min-height: 100vh;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
}

.island-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    height: 48px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.nav-left { display: flex; align-items: center; gap: 0.75rem; }
.nav-right { display: flex; align-items: center; gap: 0.5rem; }

.logo {
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.1em;
    color: var(--accent);
    cursor: pointer;
    user-select: none;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: none;
    border: none;
    color: var(--muted);
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    transition: all 0.12s;
}
.btn-back:hover { color: var(--text); background: var(--surface2); }
.btn-back[hidden] { display: none; }

.user-badge {
    color: var(--muted);
    font-size: 0.75rem;
    padding: 0.15rem 0.55rem;
    background: var(--surface2);
    border-radius: 20px;
}

.nav-link {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    transition: all 0.12s;
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
}
.nav-link:hover { color: var(--text); background: var(--surface2); }

.island-content {
    padding: 1.25rem 1.5rem 2rem;
    flex: 1;
}

#view-home, #view-result {
    padding: 0 1.5rem 2rem;
    flex: 1;
}

.hero-title {
    text-align: center;
    padding: 2rem 0 1rem;
}

.hero-title h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--accent);
    margin-bottom: 0.2rem;
}

.hero-title p {
    font-size: 0.85rem;
    color: var(--muted);
}

.health-banner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: var(--red-bg);
    border: 1px solid rgba(217,48,37,0.15);
    border-radius: var(--radius);
    color: var(--red);
    font-size: 0.82rem;
    font-weight: 500;
    margin-bottom: 1rem;
    animation: fadeIn 0.3s;
}

.health-banner svg { flex-shrink: 0; opacity: 0.7; }

.input-card {
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--surface);
}

.input-card:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.input-card.drag-over {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-light);
}

.drop-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(13, 148, 136, 0.06);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.drop-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.drop-overlay-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 3rem 4rem;
    border: 3px dashed var(--accent);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.92);
    color: var(--accent);
    animation: dropPulse 2s ease-in-out infinite;
    user-select: none;
}

.drop-overlay-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.drop-overlay-hint {
    font-size: 0.82rem;
    color: var(--muted);
}

@keyframes dropPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.input-card[hidden] { display: none; }

.input-card-body {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    min-height: 88px;
}

.si-drop {
    flex: 0 0 130px;
    width: 130px;
    min-width: 130px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    padding: 0.6rem;
    background: var(--surface2);
    border-right: 1px solid var(--border);
    color: var(--muted);
    transition: all 0.2s;
    cursor: pointer;
    align-self: stretch;
    box-sizing: border-box;
}

.si-drop:hover { background: var(--accent-light); color: var(--accent); }
.si-drop.has-files { background: var(--accent-light); color: var(--accent); }
.si-drop svg { opacity: 0.4; }
.si-drop:hover svg, .si-drop.has-files svg { opacity: 0.8; }

.si-drop-label {
    font-size: 0.75rem;
    font-weight: 500;
    text-align: center;
}

.si-drop-hint {
    font-size: 0.68rem;
    color: var(--accent);
    font-weight: 600;
}

.si-drop-clear {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0 0.2rem;
    opacity: 0.5;
    transition: opacity 0.15s;
    vertical-align: middle;
    line-height: 1;
}

.si-drop-clear:hover {
    opacity: 1;
}

.si-text {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    position: relative;
    background: var(--surface);
}

.input-card .si-text textarea {
    flex: 0 0 auto;
    width: 100%;
    min-height: 0;
    border: 0;
    padding: 0.6rem 1rem;
    font-size: 0.84rem;
    font-family: inherit;
    resize: none;
    background: var(--surface);
    color: var(--text);
    line-height: 1.5;
    box-sizing: border-box;
    border-radius: 0;
    box-shadow: none;
    appearance: none;
    -webkit-appearance: none;
}

.input-card .si-text textarea:focus {
    outline: none;
    border: 0;
    box-shadow: none;
}
.input-card .si-text textarea::placeholder { color: #b0b4c0; }

.si-counter {
    position: absolute;
    right: 0.6rem;
    bottom: 0.35rem;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--accent);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
}

.si-counter.visible { opacity: 1; }

.input-card-footer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease, border-color 0.15s ease;
    border-top: 1px solid transparent;
}

.input-card-footer.visible {
    max-height: 500px;
    border-top-color: var(--border);
}

.input-card-footer-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem 0.85rem;
}

.si-actions-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

.si-options {
    display: none;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.si-options.visible { display: flex; }

.si-option {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    color: var(--muted);
    cursor: pointer;
    user-select: none;
    padding: 0.28rem 0.65rem;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--surface);
    transition: all 0.15s;
}

.si-option:hover {
    border-color: var(--accent);
    color: var(--text);
}

.si-option.checked {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}

.si-option input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.si-option-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border);
    transition: background 0.15s;
    flex-shrink: 0;
}

.si-option.checked .si-option-dot {
    background: var(--accent);
}

.si-option-hint {
    font-size: 0.62rem;
    color: var(--yellow);
    font-style: italic;
    margin-left: -0.1rem;
}

.si-estimate {
    font-size: 0.72rem;
    color: var(--muted);
    text-align: center;
    min-height: 0;
    transition: opacity 0.15s;
}

.si-estimate:empty { display: none; }

.title-input {
    flex: 1;
    min-width: 0;
    padding: 0.45rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.8rem;
    font-family: inherit;
    color: var(--text);
    background: var(--surface2);
    transition: border-color 0.12s, background 0.12s;
}

.title-input:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.title-input::placeholder { color: #b0b4c0; }

.btn[hidden] { display: none; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: var(--radius);
    padding: 0.55rem 1.2rem;
    transition: all 0.15s;
}

.btn-lg {
    padding: 0.65rem 2.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-lg);
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(13,148,136,0.25); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.35; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: #bbb; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { opacity: 0.85; }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.78rem; }
.btn:disabled { opacity: 0.55; cursor: wait; pointer-events: none; }

.history-section { margin-top: 2rem; }

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.history-header > span {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.toggle-group {
    display: flex;
    gap: 2px;
    background: var(--surface2);
    border-radius: 6px;
    padding: 2px;
}

.toggle-btn {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 0.68rem;
    font-family: inherit;
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.12s;
    font-weight: 500;
}

.toggle-btn.active { background: var(--accent); color: #fff; }

.search-input {
    flex: 1;
    max-width: 200px;
    padding: 0.25rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.75rem;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    transition: border-color 0.12s, width 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
}

.search-input::placeholder { color: #b0b4c0; }

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

.history-list::-webkit-scrollbar { width: 4px; }
.history-list::-webkit-scrollbar-track { background: transparent; }
.history-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.hrow {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.1s;
    position: relative;
}

.hrow:hover { background: var(--surface2); }
.hrow.active { background: var(--accent-light); }

.hrow-id {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--muted);
    width: 32px;
    text-align: right;
    flex-shrink: 0;
}

.hrow-type {
    font-size: 0.8rem;
    font-weight: 500;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hrow-badge {
    display: inline-block;
    padding: 0.08rem 0.35rem;
    border-radius: 4px;
    font-size: 0.62rem;
    font-weight: 700;
    flex-shrink: 0;
}

.hb-done { background: var(--green-bg); color: var(--green); }
.hb-error { background: var(--red-bg); color: var(--red); }
.hb-cancelled { background: var(--surface2); color: var(--muted); }
.hb-pending { background: var(--accent-light); color: var(--accent); }

.hrow-date {
    font-size: 0.68rem;
    color: var(--muted);
    flex-shrink: 0;
    width: 72px;
    text-align: right;
}

.hrow-del {
    background: none;
    border: none;
    color: transparent;
    cursor: pointer;
    font-size: 0.82rem;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 4px;
    transition: all 0.12s;
    flex-shrink: 0;
}

.hrow:hover .hrow-del { color: var(--border); }
.hrow-del:hover { color: var(--red); background: var(--red-bg); }

.history-empty {
    text-align: center;
    padding: 1.25rem;
    font-size: 0.8rem;
    color: var(--muted);
}

.result-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin: 1.25rem 0;
    gap: 1rem;
    position: relative;
    z-index: 2;
}

.result-head h2 { font-size: 1.1rem; font-weight: 600; }

.result-progress-block {
    margin: 0 0 1.25rem;
    padding: 1rem 1.1rem;
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface2) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.progress-bar-track {
    position: relative;
    height: 8px;
    background: var(--surface2);
    border-radius: 9999px;
    overflow: hidden;
    margin-bottom: 0.65rem;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    min-width: 0;
    border-radius: 9999px;
    background: linear-gradient(90deg, var(--accent-hover) 0%, var(--accent) 45%, #14b8a6 100%);
    box-shadow: 0 0 12px rgba(13, 148, 136, 0.35);
    transition: width 0.45s cubic-bezier(0.33, 1, 0.68, 1);
    position: relative;
    overflow: hidden;
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        105deg,
        transparent 0%,
        rgba(255, 255, 255, 0.22) 45%,
        rgba(255, 255, 255, 0.38) 50%,
        rgba(255, 255, 255, 0.18) 55%,
        transparent 100%
    );
    background-size: 200% 100%;
    animation: progressShimmer 2.2s ease-in-out infinite;
    pointer-events: none;
}

@keyframes progressShimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

.progress-bar-track.is-indeterminate .progress-bar-fill {
    width: 32% !important;
    transition: none;
    animation: indeterminateSlide 1.5s ease-in-out infinite;
}

@keyframes indeterminateSlide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(320%); }
}

@media (prefers-reduced-motion: reduce) {
    .progress-bar-fill { transition: width 0.2s ease; }
    .progress-bar-fill::after { animation: none; opacity: 0; }
    .progress-bar-track.is-indeterminate .progress-bar-fill {
        width: 12% !important;
        animation: none;
        transform: translateX(0);
    }
    .result-loader-bar {
        width: 28%;
        animation: none;
        transform: none;
    }
}

.progress-caption {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text);
    letter-spacing: -0.01em;
    line-height: 1.45;
}

.progress-caption .progress-pct {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--accent);
}

.blink { animation: blinkAnim 1.5s ease-in-out infinite; }
@keyframes blinkAnim { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.summary-cards { display: flex; gap: 0.75rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.summary-card { flex: 1; min-width: 100px; background: var(--surface2); border-radius: var(--radius); padding: 0.65rem 0.85rem; }
.sc-value { font-size: 1.3rem; font-weight: 700; line-height: 1.2; }
.sc-label { font-size: 0.7rem; color: var(--muted); margin-top: 0.1rem; }
.sc-green .sc-value { color: var(--green); }
.sc-red .sc-value { color: var(--red); }
.sc-accent .sc-value { color: var(--accent); }

.verdict-panel {
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
    border-left: 4px solid;
}
.verdict-red { background: var(--red-bg); border-color: var(--red); }
.verdict-yellow { background: var(--yellow-bg); border-color: var(--yellow); }
.verdict-green { background: var(--green-bg); border-color: var(--green); }

.verdict-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}
.verdict-icon { display: flex; align-items: center; flex-shrink: 0; }
.verdict-red .verdict-icon { color: var(--red); }
.verdict-yellow .verdict-icon { color: var(--yellow); }
.verdict-green .verdict-icon { color: var(--green); }
.verdict-title { font-size: 0.95rem; font-weight: 700; flex: 1; }
.verdict-copy-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--muted);
    width: 26px;
    height: 26px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    flex-shrink: 0;
    padding: 0;
}
.verdict-copy-btn:hover { color: var(--accent); border-color: var(--accent); }
.verdict-copy-btn.copied { color: var(--green); border-color: var(--green); }
.verdict-red .verdict-title { color: var(--red); }
.verdict-yellow .verdict-title { color: var(--yellow); }
.verdict-green .verdict-title { color: var(--green); }

.verdict-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--muted);
    margin-bottom: 0.45rem;
    flex-wrap: wrap;
}
.verdict-stats b { color: var(--text); }

.verdict-problem-points {
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 0.45rem;
    color: var(--red);
}
.verdict-pt {
    display: inline-block;
    background: var(--red);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.08rem 0.35rem;
    border-radius: 4px;
    margin: 0.05rem 0;
}

.verdict-list {
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.78rem;
}
.verdict-list li {
    padding: 0.18rem 0 0.18rem 1rem;
    position: relative;
}
.verdict-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.5em;
    width: 6px;
    height: 6px;
    border-radius: 50%;
}
.verdict-critical::before { background: var(--red); }
.verdict-warn::before { background: var(--yellow); }
.verdict-more {
    color: var(--muted);
    font-style: italic;
    padding-left: 1rem;
}

.verdict-list-warn { margin-top: 0.3rem; border-top: 1px solid var(--border); padding-top: 0.3rem; }
.verdict-warn-toggle {
    font-size: 0.72rem;
    color: var(--muted);
    cursor: pointer;
    user-select: none;
    padding: 0.15rem 0 0.15rem 1rem;
}
.verdict-warn-toggle:hover { color: var(--yellow); }

.section-toggle {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.section-toggle:hover { opacity: 0.8; }
.section-arrow {
    font-size: 0.65rem;
    color: var(--muted);
    margin-right: auto;
}
.section-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 0.3rem;
    border-radius: 9px;
    font-size: 0.62rem;
    font-weight: 700;
    color: #fff;
    margin-right: 0.25rem;
    flex-shrink: 0;
}
.badge-red { background: var(--red); }
.badge-yellow { background: var(--yellow); }
.badge-green { background: var(--green); }

.prox-card-critical { background: var(--red-bg); border-color: var(--red); }
.prox-card-warning { background: var(--orange-bg); border-color: var(--orange); }
.prox-obj-critical { color: var(--red); font-weight: 600; }
.prox-obj-warning { color: var(--text); }

.map-container {
    height: 280px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.map-container .leaflet-container { height: 100%; width: 100%; isolation: isolate; }

.result-export-root { position: relative; z-index: 0; }

.section-block {
    background: var(--surface2);
    border-radius: var(--radius);
    padding: 0.65rem 0.85rem;
    margin-bottom: 0.6rem;
}

.section-block h3 { font-size: 0.8rem; font-weight: 600; margin: 0 0 0.4rem; }
.section-block h3.section-toggle { margin: 0; }
.section-block .section-body:not([hidden]) { margin-top: 0.4rem; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.35rem 0.55rem; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.78rem; }
th { color: var(--muted); font-weight: 600; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em; }

.dist-row-red { background: var(--red-bg); }
.dist-row-yellow { background: var(--yellow-bg); }
.dist-tag { display: inline-block; padding: 0.08rem 0.35rem; border-radius: 4px; font-size: 0.65rem; font-weight: 600; }
.dist-tag-red { background: var(--red); color: #fff; }
.dist-tag-yellow { background: var(--yellow); color: #fff; }
.dist-tag-green { background: var(--green); color: #fff; }

.warn-list { display: flex; flex-direction: column; gap: 0.25rem; }
.warn-item { padding: 0.4rem 0.65rem; border-radius: var(--radius); font-size: 0.78rem; border-left: 3px solid; }
.warn-red .warn-item { background: var(--red-bg); border-color: var(--red); }
.warn-yellow .warn-item { background: var(--yellow-bg); border-color: var(--yellow); }
.warn-orange .warn-item { background: var(--orange-bg); border-color: var(--orange); }

.prox-card { display: flex; flex-direction: column; gap: 0.35rem; align-items: stretch; }
.prox-point-label { font-weight: 600; font-size: 0.8rem; }
.prox-obj-list { margin: 0; padding-left: 1.1rem; font-size: 0.78rem; line-height: 1.45; }
.prox-obj-list li { margin: 0.2rem 0; }
.prox-zone-hint { color: var(--muted); }

.check-ok { padding: 0.4rem 0.65rem; border-radius: var(--radius); font-size: 0.78rem; color: var(--green); background: var(--green-bg); border-left: 3px solid var(--green); }

.coord-list { display: flex; flex-direction: column; gap: 0.15rem; }
.coord-row { display: flex; align-items: center; gap: 0.3rem; padding: 0.3rem 0; border-bottom: 1px solid var(--border); flex-wrap: nowrap; }
.coord-row:last-child { border-bottom: none; }
.coord-idx { font-size: 0.72rem; font-weight: 600; color: var(--muted); width: 24px; text-align: right; flex-shrink: 0; }
.coord-value { font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace; font-size: 0.78rem; font-weight: 500; white-space: nowrap; }
.coord-copy { background: none; border: 1px solid var(--border); color: var(--muted); width: 24px; height: 24px; border-radius: 5px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: all 0.15s; flex-shrink: 0; padding: 0; }
.coord-copy:hover { color: var(--accent); border-color: var(--accent); }
.coord-copy.copied { color: var(--green); border-color: var(--green); }
.coord-source { font-size: 0.68rem; color: var(--muted); margin-left: auto; word-break: break-all; flex-shrink: 1; min-width: 0; }
.coord-source-link { font-size: 0.68rem; color: var(--accent); margin-left: auto; word-break: break-all; text-decoration: none; flex-shrink: 1; min-width: 0; }
.coord-source-link:hover { text-decoration: underline; }
.coord-row-error { background: var(--red-bg); border-radius: 4px; padding-left: 0.4rem; padding-right: 0.4rem; }
.coord-value-error { font-size: 0.75rem; color: var(--red); font-style: italic; }
.coord-row-warning { background: var(--yellow-bg); border-radius: 4px; padding-left: 0.4rem; padding-right: 0.4rem; }
.coord-edit-btn { background: none; border: 1px solid var(--border); color: var(--muted); border-radius: 5px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: all 0.15s; flex-shrink: 0; padding: 0.15rem 0.4rem; font-size: 0.7rem; font-family: inherit; }
.coord-edit-btn:hover { color: var(--accent); border-color: var(--accent); }
.coord-save-btn { background: var(--accent); border: none; color: #fff; border-radius: 5px; cursor: pointer; padding: 0.15rem 0.5rem; font-size: 0.7rem; font-family: inherit; font-weight: 500; transition: opacity 0.15s; }
.coord-save-btn:hover { opacity: 0.85; }
.coord-cancel-btn { background: none; border: 1px solid var(--border); color: var(--muted); border-radius: 5px; cursor: pointer; padding: 0.15rem 0.4rem; font-size: 0.7rem; font-family: inherit; transition: all 0.15s; }
.coord-cancel-btn:hover { color: var(--red); border-color: var(--red); }
.coord-edit-input { width: 110px; padding: 0.2rem 0.4rem; border: 1px solid var(--border); border-radius: 5px; font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace; font-size: 0.78rem; color: var(--text); background: var(--surface); }
.coord-edit-input:focus { outline: none; border-color: var(--accent); }
.coord-retry-btn { background: none; border: 1px solid var(--border); color: var(--muted); border-radius: 5px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: all 0.15s; flex-shrink: 0; padding: 0.15rem 0.4rem; font-size: 0.7rem; font-family: inherit; }
.coord-retry-btn:hover { color: var(--accent); border-color: var(--accent); }
.coord-retry-btn:disabled { opacity: 0.5; cursor: default; }
.coord-error-reason { font-size: 0.62rem; color: var(--red); opacity: 0.8; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex-shrink: 1; min-width: 0; }
.retry-warning { background: var(--red-bg); border: 1px solid var(--red); border-radius: 6px; padding: 0.6rem 0.8rem; margin-bottom: 0.75rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; font-size: 0.8rem; color: var(--text); }
.retry-warning .retry-warn-text { flex: 1 1 auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.coord-row-retrying { opacity: 0.6; }
.coord-row-retrying::after { content: ''; display: inline-block; width: 12px; height: 12px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; margin-left: 4px; vertical-align: middle; }
.recheck-bar { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem; padding: 0.5rem 0; }

.append-panel { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 0.75rem; margin-bottom: 0.75rem; }
.append-textarea { width: 100%; min-height: 60px; resize: vertical; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 0.5rem 0.65rem; font: inherit; font-size: 0.82rem; color: var(--text); box-sizing: border-box; }
.append-textarea:focus { outline: none; border-color: var(--accent); }
.append-actions { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem; }
.append-status { font-size: 0.75rem; }

.coord-check {
    width: 14px;
    height: 14px;
    accent-color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
    margin: 0 0 0 -1px;
}

.coord-del-btn {
    background: none;
    border: 1px solid transparent;
    color: transparent;
    border-radius: 5px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    flex-shrink: 0;
    padding: 0.15rem 0.35rem;
}

.coord-row:hover .coord-del-btn { color: var(--muted); border-color: var(--border); }
.coord-del-btn:hover { color: var(--red); border-color: var(--red); background: var(--red-bg); }

.coord-row.selected { background: var(--accent-light); border-radius: 4px; padding-left: 0.4rem; padding-right: 0.4rem; }

.coord-bulk-bar {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.45rem 0.55rem;
    margin-bottom: 0.4rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    animation: fadeIn 0.2s;
}

.coord-bulk-bar[hidden] { display: none; }

.coord-select-all-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: var(--muted);
    cursor: pointer;
    user-select: none;
}

.coord-bulk-count {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    margin-left: auto;
}

.coord-renumber-label {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    color: var(--muted);
    cursor: pointer;
    user-select: none;
}

.coord-renumber-label input { accent-color: var(--accent); width: 14px; height: 14px; }

.dup-card { display: flex; flex-direction: column; gap: 0.2rem; }
.dup-label { font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; opacity: 0.7; }
.dup-text { font-size: 0.78rem; }
.dup-goto { background: none; border: 1px solid var(--yellow); color: var(--yellow); font-family: inherit; font-size: 0.72rem; font-weight: 500; padding: 0.2rem 0.55rem; border-radius: 5px; cursor: pointer; align-self: flex-start; transition: all 0.15s; margin-top: 0.15rem; }
.dup-goto:hover { background: var(--yellow); color: #fff; }
.hist-goto { border-color: var(--orange); color: var(--orange); }
.hist-goto:hover { background: var(--orange); color: #fff; }
.hist-coords { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 0.74rem; opacity: 0.85; }
.dup-disclaimer { font-size: 0.65rem; color: var(--muted); font-style: italic; margin-top: 0.15rem; }

#result-actions { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.export-btn { gap: 0.3rem; }
.export-btn svg { flex-shrink: 0; }

.dist-ok-toggle { cursor: pointer; color: var(--muted); user-select: none; transition: color 0.12s; font-size: 0.75rem; font-weight: 500; margin: 0.5rem 0 0; }
.dist-ok-toggle:hover { color: var(--text); }
.dist-ok-body { margin-top: 0.35rem; animation: fadeIn 0.2s; }

#progress-logs { margin-top: 0.75rem; }
#progress-logs-pre { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.65rem; font-size: 0.7rem; color: var(--muted); overflow-x: auto; white-space: pre-wrap; word-break: break-all; max-height: 300px; overflow-y: auto; }
.logs-toggle { cursor: pointer; color: var(--muted); user-select: none; transition: color 0.12s; font-size: 0.8rem; font-weight: 600; margin: 0; }
.logs-toggle:hover { color: var(--text); }
.logs-content { margin-top: 0.4rem; animation: fadeIn 0.2s; }
.logs-content pre { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.65rem; font-size: 0.7rem; color: var(--muted); overflow-x: auto; white-space: pre-wrap; word-break: break-all; max-height: 350px; overflow-y: auto; }

.muted { color: var(--muted); }

input[type="text"], input[type="password"], textarea {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.55rem 0.8rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-family: inherit;
    width: 100%;
    transition: border-color 0.15s;
}
input:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; }

.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1rem; }
.login-card { width: 100%; max-width: 340px; text-align: center; }
.login-logo { font-weight: 700; font-size: 2rem; letter-spacing: 0.1em; color: var(--accent); margin-bottom: 2rem; }
.login-card form { display: flex; flex-direction: column; gap: 0.7rem; }

.page-section { margin-bottom: 2.5rem; }
.page-section h2 { font-size: 1.15rem; font-weight: 600; margin-bottom: 1rem; }
.inline-form { display: flex; gap: 0.5rem; align-items: center; max-width: 500px; }
.inline-form input { flex: 1; }
.btn-icon { background: none; border: 1px solid var(--border); color: var(--muted); width: 28px; height: 28px; border-radius: 6px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 0.7rem; transition: all 0.15s; }
.btn-icon:hover { color: var(--text); border-color: #bbb; }
.settings-tabs { display: flex; gap: 0.4rem; margin-bottom: 1.5rem; border-bottom: 1px solid var(--border); }
.stab { background: none; border: none; color: var(--muted); font-family: inherit; font-size: 0.85rem; font-weight: 500; padding: 0.6rem 1rem; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all 0.15s; }
.stab.active { color: var(--accent); border-bottom-color: var(--accent); }
.stab:hover:not(.active) { color: var(--text); }
.settings-panel { display: none; }
.settings-panel.active { display: block; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.section-header h2 { font-size: 1.1rem; font-weight: 600; }
.prompt-sections { display: flex; flex-direction: column; gap: 0.75rem; }
.prompt-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow-sm); }
.prompt-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; gap: 0.5rem; }
.prompt-card-left { display: flex; align-items: center; gap: 0.4rem; flex: 1; }
.section-title { font-weight: 600; font-size: 0.85rem; flex: 1; min-width: 0; }
.section-content { width: 100%; margin-bottom: 0.5rem; font-size: 0.82rem; }
.toggle-label { display: inline-flex; align-items: center; cursor: pointer; }
.toggle-label input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.domains-list { display: flex; flex-direction: column; gap: 0.35rem; margin-top: 1rem; }
.domain-item { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem 0.75rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.85rem; box-shadow: var(--shadow-sm); }

.result-loader {
    height: 2px;
    background: var(--surface2);
    overflow: hidden;
    border-radius: 1px;
}

.result-loader[hidden] { display: none; }

.result-loader-bar {
    height: 100%;
    width: 32%;
    background: linear-gradient(90deg, var(--accent-hover) 0%, var(--accent) 100%);
    border-radius: 1px;
    animation: indeterminateSlide 1.5s ease-in-out infinite;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Guide page */

.guide-content {
    padding: 0 1.5rem 2.5rem;
    flex: 1;
}

.guide-hero {
    text-align: center;
    padding: 2rem 0 1.5rem;
}

.guide-hero h1 {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--accent);
}

.guide-hero p {
    font-size: 0.85rem;
    color: var(--muted);
    margin-top: 0.25rem;
}

.guide-section {
    margin-bottom: 2rem;
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.guide-section.gs-visible {
    opacity: 1;
    transform: translateY(0);
}

.guide-section h2 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.guide-subtitle {
    font-size: 0.82rem;
    color: var(--muted);
    margin-bottom: 0.85rem;
}

.guide-steps {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.guide-step {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.guide-step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.guide-step-body {
    flex: 1;
}

.guide-step-body strong {
    font-size: 0.88rem;
    display: block;
    margin-bottom: 0.15rem;
}

.guide-step-body p {
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 0.3rem;
}

.guide-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.3rem;
}

.guide-opt {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.76rem;
    color: var(--text);
    background: var(--surface2);
    padding: 0.35rem 0.65rem;
    border-radius: 8px;
}

.guide-opt svg { color: var(--accent); opacity: 0.7; }

.guide-tag {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
}

.guide-tag-accent { background: var(--accent-light); color: var(--accent); }
.guide-tag-yellow { background: var(--yellow-bg); color: var(--yellow); }

/* Pipeline */

.guide-pipeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
    padding-left: 16px;
}

.guide-pipeline::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: var(--border);
}

.gp-step {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.55rem 0;
    position: relative;
    transition: opacity 0.3s;
    opacity: 0.45;
}

.gp-step.active { opacity: 1; }

.gp-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--border);
    flex-shrink: 0;
    margin-top: 0.15rem;
    position: relative;
    z-index: 1;
    transition: background 0.3s, box-shadow 0.3s;
}

.gp-step.active .gp-dot {
    background: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-light);
}

.gp-label {
    font-size: 0.82rem;
    font-weight: 600;
}

.gp-desc {
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 0.1rem;
}

.gp-step > div:last-child:not(.gp-dot) {
    display: flex;
    flex-direction: column;
}

/* Guide demo blocks */

.guide-demo {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 1rem;
    border: 1px solid var(--border);
}

.guide-explain {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.guide-explain-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    color: var(--muted);
}

.guide-color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Legend */

.guide-legend {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin-top: 0.85rem;
}

.guide-legend-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.78rem;
    color: var(--text);
    line-height: 1.4;
}

.guide-legend-item strong {
    font-weight: 600;
}

.guide-legend-swatch {
    width: 20px;
    height: 16px;
    border-radius: 3px;
    flex-shrink: 0;
}

/* Map demo */

.guide-map-demo {
    height: 120px;
    background: var(--surface2);
    border-radius: var(--radius);
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
}

.guide-marker {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.guide-marker-green { background: #1a9960; left: 20%; top: 40%; }
.guide-marker-yellow { background: #c47e0a; }
.guide-marker-red { background: #d93025; }

.guide-map-line {
    position: absolute;
    left: 20%;
    top: 47%;
    width: 46%;
    height: 0;
    border-top: 2px dashed var(--red);
    opacity: 0.5;
    transform: rotate(-10deg);
    transform-origin: left center;
}

.guide-marker-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px var(--border);
}

.guide-marker-dot-line {
    background: transparent;
    border: none;
    box-shadow: none;
    width: 20px;
    height: 0;
    border-radius: 0;
    border-top: 2px dashed var(--red);
}

/* Badge grid */

.guide-badge-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.guide-badge-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.8rem;
}

.guide-badge-item .hrow-badge {
    min-width: 70px;
    text-align: center;
}

/* Guide alignment fix: align section-block and legend inside demo */

.guide-demo .section-block {
    padding-left: 0;
    padding-right: 0;
}

/* Guide TOC */

.guide-toc {
    margin-bottom: 2rem;
    background: var(--surface2);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
}

.guide-toc-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 0.6rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.guide-toc-cols {
    display: flex;
    gap: 1.5rem;
}

.guide-toc-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.guide-toc a {
    font-size: 0.78rem;
    color: var(--text);
    text-decoration: none;
    padding: 0.15rem 0;
    transition: color 0.15s;
}

.guide-toc a:hover { color: var(--accent); }

/* Guide text paragraphs */

.guide-text {
    font-size: 0.82rem;
    color: var(--text);
    line-height: 1.55;
    margin-bottom: 0.65rem;
}

.guide-text a { color: var(--accent); text-decoration: none; }
.guide-text a:hover { text-decoration: underline; }

/* Guide section h3 */

.guide-section h3 {
    font-size: 0.88rem;
    font-weight: 600;
    margin: 1rem 0 0.35rem;
}

/* Guide feature list */

.guide-feature-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    margin: 0.65rem 0;
}

.guide-feature {
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
    font-size: 0.8rem;
    line-height: 1.5;
}

.guide-feature-icon {
    flex-shrink: 0;
    width: 22px;
    text-align: center;
    font-size: 0.85rem;
    padding-top: 0.05rem;
}

.guide-feature strong {
    font-weight: 600;
}

.guide-feature div { flex: 1; }

/* Guide kbd */

.guide-section kbd {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    font-family: ui-monospace, 'SF Mono', monospace;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text);
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 4px;
    box-shadow: 0 1px 0 var(--border);
}

/* Guide hotkey table */

.guide-hotkey-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.guide-hotkey-table th {
    text-align: left;
    font-weight: 600;
    font-size: 0.72rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid var(--border);
}

.guide-hotkey-table td {
    padding: 0.5rem 0.5rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.guide-hotkey-table tr:last-child td { border-bottom: none; }

/* Guide formats demo */

.guide-formats {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.guide-formats code {
    font-family: ui-monospace, 'SF Mono', monospace;
    font-size: 0.76rem;
    color: var(--text);
    background: var(--surface2);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    display: inline-block;
}

/* Guide scenario demo */

.guide-scenario-demo {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.guide-scenario-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted);
}

.guide-scenario-opts {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

/* Guide bulk demo */

.guide-bulk-demo {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
}

.guide-bulk-label {
    font-size: 0.78rem;
    color: var(--muted);
    font-weight: 500;
}

/* Scenario selector */

.si-scenario {
    padding: 0.55rem 0 0.2rem;
}

.si-scenario-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 0.35rem;
}

.si-scenario-options {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.si-scenario-opt {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0.3rem 0.55rem;
    border-radius: 6px;
    transition: background 0.15s;
    color: var(--text);
}

.si-scenario-opt:hover { background: var(--surface2); }
.si-scenario-opt input[type="radio"] { accent-color: var(--accent); }

/* Image modal — split view */

.img-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.img-modal.visible { display: flex; }

.img-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
}

.img-modal-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    max-height: 92vh;
    border-radius: 14px;
    overflow: hidden;
    background: var(--surface);
    box-shadow: 0 12px 48px rgba(0,0,0,0.35);
}

.img-modal-image {
    flex: 1 1 auto;
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a1a1a;
    overflow: hidden;
    position: relative;
}

.img-modal-image img {
    max-width: 100%;
    max-height: 65vh;
    display: block;
    object-fit: contain;
    transition: opacity 0.15s ease;
}

.img-modal-image img.loading {
    opacity: 0;
}

.img-modal-image.loading-state::before {
    content: 'Загрузка изображения...';
    position: absolute;
    color: rgba(255,255,255,0.4);
    font-size: 0.8rem;
    top: calc(50% + 28px);
}

.img-modal-image.loading-state::after {
    content: '';
    position: absolute;
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255,255,255,0.15);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    top: calc(50% - 24px);
}

.img-modal-image.no-image::before {
    content: 'Изображение недоступно';
    position: absolute;
    color: rgba(255,255,255,0.35);
    font-size: 0.85rem;
}

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

.img-modal-info {
    flex: 0 0 auto;
    padding: 14px 18px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    min-height: 52px;
}

.img-modal-idx {
    font-weight: 700;
    color: var(--accent);
    font-size: 0.9rem;
    flex-shrink: 0;
}

.img-modal-coords {
    font-family: ui-monospace, 'SF Mono', monospace;
    font-size: 0.85rem;
    color: var(--text);
    letter-spacing: 0.02em;
    word-break: break-all;
}

.img-modal-source {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--muted);
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 0;
}

.img-modal-source a {
    color: var(--accent);
    text-decoration: none;
}

.img-modal-source a:hover { text-decoration: underline; }

.img-modal-nav {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.img-modal-nav button {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    padding: 0;
    transition: background 0.15s;
}

.img-modal-nav button:hover { background: var(--surface2); }
.img-modal-nav button:disabled { opacity: 0.3; cursor: default; }

.img-modal-pos {
    font-size: 0.7rem;
    color: var(--muted);
    min-width: 36px;
    text-align: center;
}

.img-modal-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.5);
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: background 0.15s;
}

.img-modal-close:hover { background: rgba(0,0,0,0.7); }

.img-modal-coords-failed { color: var(--red); font-style: italic; font-size: 0.8rem; }

#img-modal-coord-area {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

/* Coord preview button */

.coord-preview-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    padding: 2px;
    display: inline-flex;
    align-items: center;
    border-radius: 4px;
    transition: color 0.15s;
}

.coord-preview-btn:hover { color: var(--accent); }

.section-copy-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--muted);
    width: 24px;
    height: 24px;
    border-radius: 5px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    vertical-align: middle;
    margin-left: 0.4rem;
    padding: 0;
}

.section-copy-btn:hover { color: var(--accent); border-color: var(--accent); }
.section-copy-btn.copied { color: var(--green); border-color: var(--green); }

/* Proximity map icons */

.prox-map-icon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.35);
}

.prox-map-icon-label {
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
    text-shadow: 0 0 2px rgba(0,0,0,0.3);
}

/* Proximity partial warning */

.prox-partial-warn {
    background: var(--orange-bg);
    color: var(--orange);
    border: 1px solid rgba(196,93,26,0.2);
    border-radius: var(--radius);
    padding: 0.55rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

/* Measure tool */

.leaflet-measure-btn a {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    font-size: 16px;
    line-height: 30px;
    text-decoration: none;
    color: #333;
    background: #fff;
    border-radius: 4px;
    transition: background 0.15s;
}

.leaflet-measure-btn a:hover { background: #f4f4f4; }

.measure-label span {
    background: rgba(255,255,255,0.92);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: #0d9488;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    white-space: nowrap;
    pointer-events: none;
}

.dist-line-label {
    text-align: center;
    pointer-events: none;
}
.dist-line-label span {
    background: rgba(255,255,255,0.88);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    color: #555;
    box-shadow: 0 1px 2px rgba(0,0,0,0.12);
    white-space: nowrap;
    pointer-events: none;
}
.dist-line-label-red span {
    color: #d93025;
    font-weight: 700;
}

.measure-total-label span {
    background: #0d9488;
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    white-space: nowrap;
    pointer-events: none;
}

/* Layer control styling */

.leaflet-control-layers {
    border-radius: 8px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12) !important;
    padding: 6px 10px !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 12px !important;
}

.leaflet-control-layers-overlays label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 0;
    cursor: pointer;
}

/* Dual modal (image + map) */

.img-modal-dual {
    position: relative;
    display: flex;
    gap: 12px;
    max-width: min(1100px, 96vw);
    max-height: 92vh;
    z-index: 1;
}

.img-modal-panel {
    max-width: min(560px, 52vw);
}

.img-modal-map-panel {
    flex: 0 0 auto;
    width: min(480px, 40vw);
    border-radius: 14px;
    overflow: hidden;
    background: var(--surface);
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 48px rgba(0,0,0,0.35);
}

.img-modal-map-panel.no-coords {
    display: flex;
    align-items: center;
    justify-content: center;
}

.img-modal-map {
    flex: 1;
    min-height: 300px;
}

.img-modal-map .leaflet-container {
    height: 100%;
    width: 100%;
    border-radius: 14px;
}

.preview-map-empty {
    color: var(--muted);
    font-size: 0.85rem;
    text-align: center;
    padding: 2rem;
}

@media (max-width: 900px) {
    .img-modal-dual {
        flex-direction: column;
        max-width: min(560px, 96vw);
    }
    .img-modal-panel {
        max-width: 100%;
    }
    .img-modal-map-panel {
        width: 100%;
        height: 220px;
    }
}

@media (max-width: 600px) {
    .island { box-shadow: none; }
    #view-home, #view-result { padding: 0 1rem 1.5rem; }
    .hero-title { padding: 1.5rem 0 1rem; }
    .hero-title h1 { font-size: 1.5rem; }
    .input-card-body { flex-direction: column; min-height: auto; }
    .si-drop {
        flex: 0 0 auto;
        width: 100%;
        min-width: 0;
        align-self: stretch;
        border-right: none;
        border-bottom: 1px solid var(--border);
        flex-direction: row;
        gap: 0.5rem;
        padding: 0.6rem;
    }
    .si-actions-row { flex-direction: column; }
    .si-actions-row .title-input { width: 100%; }
    .summary-cards { flex-direction: column; }
    .verdict-stats { flex-direction: column; gap: 0.25rem; }
    .inline-form { flex-direction: column; }
    .inline-form input { width: 100%; }
    .island-nav { padding: 0 1rem; }
    .guide-content { padding: 0 1rem 2rem; }
    .guide-hero { padding: 1.25rem 0 1rem; }
    .guide-hero h1 { font-size: 1.3rem; }
    .guide-options { flex-direction: column; }
    .guide-toc-cols { flex-direction: column; gap: 0.5rem; }
    .guide-hotkey-table { font-size: 0.72rem; }
    .guide-hotkey-table th, .guide-hotkey-table td { padding: 0.35rem 0.3rem; }
    .guide-feature { font-size: 0.76rem; }
}

/* ===== Heatmap page ===== */

body:has(.heatmap-page) {
    justify-content: stretch;
}

.heatmap-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    max-width: 100%;
}

.heatmap-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    height: 52px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    z-index: 1000;
}

.heatmap-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text);
    letter-spacing: -0.01em;
}

.heatmap-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.heatmap-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.hm-panel {
    background: var(--surface2);
    border-radius: var(--radius);
    padding: 0.85rem;
}

.hm-panel-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    margin-bottom: 0.6rem;
}

.hm-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.hm-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
}

.hm-stat-val {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
}

.hm-stat-label {
    font-size: 0.65rem;
    color: var(--muted);
}

.hm-filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.hm-period-btn,
.hm-mode-btn {
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.3rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    transition: all 0.15s;
}

.hm-period-btn:hover,
.hm-mode-btn:hover {
    color: var(--text);
    border-color: var(--accent);
}

.hm-period-btn.active,
.hm-mode-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.hm-select {
    width: 100%;
    font-family: inherit;
    font-size: 0.8rem;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    outline: none;
}

.hm-select:focus { border-color: var(--accent); }

.hm-radius-wrap {
    margin-top: 0.6rem;
}

.hm-radius-label {
    font-size: 0.75rem;
    color: var(--muted);
    display: block;
    margin-bottom: 0.3rem;
}

.hm-range {
    width: 100%;
    accent-color: var(--accent);
    height: 4px;
}

.heatmap-map {
    flex: 1;
    min-height: 0;
}

.heatmap-map .leaflet-container {
    height: 100%;
    width: 100%;
}

.hm-point-marker {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    border: 1.5px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

@media (max-width: 700px) {
    .heatmap-body { flex-direction: column; }
    .heatmap-sidebar {
        width: 100%;
        max-height: 200px;
        border-right: none;
        border-bottom: 1px solid var(--border);
        flex-direction: row;
        flex-wrap: wrap;
        overflow-x: auto;
    }
    .hm-panel { min-width: 200px; flex: 1; }
    .heatmap-nav { padding: 0 0.75rem; }
    .heatmap-title { font-size: 0.85rem; }
}

/* Album inline options */

.si-album-opts {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.35rem;
}

.si-album-opts[hidden] {
    display: none;
}

.si-album-label {
    font-size: 0.78rem;
    color: var(--muted);
    margin-right: 0.15rem;
}

.si-album-count {
    font-size: 0.78rem;
    padding: 0.2rem 0.35rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--fg);
    cursor: pointer;
    min-width: 3rem;
    transition: opacity 0.15s;
}

.si-album-count:disabled {
    opacity: 0.35;
    cursor: default;
}
