﻿/* ===== TUdi WebGIS 主样式 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: "Segoe UI", "Microsoft YaHei", sans-serif; background: #f0f2f5; }

.header { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 16px 24px; box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.header h1 { font-size: 22px; margin-bottom: 4px; }
.header p { font-size: 12px; opacity: 0.85; }

.container { display: flex; height: calc(100vh - 80px); }

.sidebar { width: 380px; min-width: 380px; background: white; padding: 16px; overflow-y: auto; box-shadow: 2px 0 8px rgba(0,0,0,0.05); }

#map { flex: 1; height: 100%; position: relative; }

/* Step indicator */
#stepIndicator { display: flex; justify-content: space-between; margin-bottom: 16px; }
.step { flex: 1; text-align: center; padding: 8px 4px; font-size: 11px; color: #bbb; border-bottom: 3px solid #e0e0e0; cursor: default; transition: all 0.3s; }
.step.active { color: #667eea; border-bottom-color: #667eea; font-weight: 600; }
.step.completed { color: #4caf50; border-bottom-color: #4caf50; }
.step-num { display: inline-block; width: 22px; height: 22px; line-height: 22px; border-radius: 50%; background: #e0e0e0; color: #999; font-size: 11px; font-weight: 700; margin-right: 2px; transition: all 0.3s; }
.step.active .step-num { background: #667eea; color: white; }
.step.completed .step-num { background: #4caf50; color: white; }

.step-content { display: none; }
.step-content.active { display: block; animation: fadeIn 0.3s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.step-desc { font-size: 13px; color: #999; margin-bottom: 12px; }

.form-row { margin-bottom: 12px; }
.form-row label { display: block; font-size: 13px; font-weight: 600; color: #555; margin-bottom: 4px; }
.form-row input, .form-row select { width: 100%; padding: 8px 10px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; transition: border 0.2s; }
.form-row input:focus, .form-row select:focus { outline: none; border-color: #667eea; box-shadow: 0 0 0 3px rgba(102,126,234,0.1); }

.nav-buttons { display: flex; gap: 8px; margin-top: 16px; }
.nav-buttons button { flex: 1; padding: 10px; border: none; border-radius: 8px; background: #667eea; color: white; font-size: 14px; font-weight: 600; cursor: pointer; transition: background 0.2s, transform 0.1s; }
.nav-buttons button:hover { background: #5a6fd6; }
.nav-buttons button:active { transform: scale(0.97); }
.nav-buttons button:disabled { background: #ccc; cursor: not-allowed; }

/* Indicator cards */
.indicator-card { border: 1px solid #e8e8e8; border-radius: 10px; padding: 12px; margin-bottom: 10px; cursor: pointer; transition: all 0.2s; }
.indicator-card:hover { border-color: #667eea; box-shadow: 0 2px 8px rgba(102,126,234,0.1); }
.indicator-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.indicator-name { font-weight: 600; font-size: 14px; }
.indicator-vs { font-size: 11px; color: #aaa; }

.grade-selector { display: flex; gap: 4px; flex-wrap: wrap; }
.grade-btn { flex: 1; min-width: 36px; text-align: center; padding: 6px 4px; border: 2px solid #e0e0e0; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.grade-btn:hover { border-color: #667eea; background: #f0f2ff; }
.grade-btn.selected { background: #667eea; color: white; border-color: #667eea; }

/* Results */
.result-card { background: #fafafa; border-radius: 12px; padding: 16px; margin-bottom: 12px; }
.result-score { text-align: center; font-size: 36px; font-weight: 700; margin: 8px 0; }
.result-bar { width: 100%; height: 8px; border-radius: 4px; margin: 12px 0; }

.rec-item { padding: 8px 10px; background: #fff8e1; border-radius: 6px; margin-bottom: 6px; font-size: 13px; line-height: 1.5; }

.info-text { text-align: center; color: #999; font-size: 13px; padding: 16px; }

/* Record list */
.record-item { padding: 10px; border-bottom: 1px solid #f0f0f0; cursor: pointer; transition: background 0.2s; }
.record-item:hover { background: #f8f9ff; }
.rec-score { font-weight: 700; font-size: 13px; }
.rec-date { font-size: 11px; color: #bbb; }

/* Photo section */
.photo-section {
    border-top: 1px solid var(--line);
    padding-top: 12px;
    text-align: center;
}
.photo-section .secondary-action {
    font-size: 15px;
    padding: 12px;
}
.photo-preview {
    margin-top: 10px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--line);
}
.photo-preview img {
    width: 100%;
    display: block;
}
.photo-actions {
    display: flex;
    gap: 8px;
    padding: 8px;
    background: #f8faf8;
}
.photo-actions button {
    flex: 1;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: white;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}
.photo-actions button:hover {
    background: #f0f0f0;
}
/* Camera modal */
.camera-modal-content {
    max-width: 500px;
    text-align: center;
}
.modal-header-camera {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.modal-header-camera h3 {
    margin: 0;
    font-size: 18px;
}
.camera-body {
    min-height: 300px;
    background: #1a1a1a;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.camera-body video,
.camera-body canvas {
    width: 100%;
    display: block;
}
.camera-placeholder {
    color: #999;
    text-align: center;
    padding: 40px;
}
.camera-footer {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    justify-content: center;
}
.btn-camera {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}
.btn-camera:active { transform: scale(0.97); }
.btn-camera:first-child { background: #eef2f7; color: #334155; }
.btn-camera:first-child:hover { background: #dde5ef; }
.btn-capture { background: #667eea; color: white; }
.btn-capture:hover { background: #5a6fd6; }
.btn-confirm { background: var(--brand); color: white; }
.btn-confirm:hover { background: var(--brand-dark); }

@media (max-width: 900px) {
    .camera-body { min-height: 220px; }
    .btn-camera { padding: 14px; font-size: 16px; }
}

/* Modal */
.modal { display: none; position: fixed; z-index: 2000; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); }
.modal-content { background: white; margin: 8% auto; padding: 24px; border-radius: 12px; width: 90%; max-width: 500px; max-height: 70vh; overflow-y: auto; animation: slideUp 0.3s ease; }
@keyframes slideUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
.modal-close { float: right; font-size: 22px; cursor: pointer; color: #aaa; }
.modal-close:hover { color: #333; }

/* Map control buttons on the map (basemap toggle & layer selector) */
.map-control-btn {
    position: absolute;
    z-index: 1000;
    background: white;
    color: #333;
    width: 34px;
    height: 34px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    line-height: 34px;
    text-align: center;
    box-shadow: 0 1px 5px rgba(0,0,0,0.2);
    transition: background 0.2s;
    user-select: none;
    border: 1px solid rgba(0,0,0,0.2);
}
.map-control-btn:hover {
    background: #f5f5f5;
}

#locateBtn {
    top: 260px;
    left: 390px;
    font-size: 16px;
    line-height: 34px;
}

#baseMapBtn {
    top: 175px;
    left: 390px;
}

#layerSelectorBtn {
    top: 217px;
    left: 390px;
}

/* Base map menu panel */
.base-map-menu {
    position: absolute;
    top: 175px;
    left: 430px;
    z-index: 1000;
    width: 200px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    overflow: hidden;
    animation: slideDown 0.2s ease;
}

/* Layer menu panel */
.layer-menu {
    position: absolute;
    top: 259px;
    left: 390px;
    z-index: 1000;
    width: 260px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    overflow: hidden;
    animation: slideDown 0.2s ease;
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.layer-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}
.layer-menu-header h3 {
    margin: 0;
    font-size: 15px;
}
.layer-menu-close {
    cursor: pointer;
    font-size: 18px;
    opacity: 0.8;
    transition: opacity 0.2s;
}
.layer-menu-close:hover {
    opacity: 1;
}
.layer-list {
    max-height: 300px;
    overflow-y: auto;
    padding: 8px;
}
.layer-item {
    padding: 10px 12px;
    margin: 4px 0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
    border-left: 3px solid transparent;
}
.layer-item:hover {
    background: #f0f0ff;
}
.layer-item.active {
    background: #e8ebff;
    border-left-color: #667eea;
    font-weight: 600;
    color: #667eea;
}
.layer-item.clear-layer {
    color: #ef5350;
    border-top: 1px solid #eee;
    margin-top: 8px;
    padding-top: 12px;
    text-align: center;
    font-weight: 600;
}
.layer-item.clear-layer:hover {
    background: #fff0f0;
}
.layer-opacity {
    padding: 10px 14px;
    border-top: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #666;
}
.layer-opacity input[type="range"] {
    flex: 1;
    accent-color: #667eea;
}
.layer-info {
    padding: 0 14px 12px;
    border-top: 1px solid #eee;
}
.click-value-card {
    margin-top: 8px;
    padding: 10px 12px;
    background: #f8f9ff;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #d0d4f7;
}
.click-value-card strong {
    display: block;
    font-size: 13px;
    color: #666;
    margin-bottom: 4px;
}
.click-value-card span {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: #667eea;
}
/* AI Report Styles */
@keyframes spin { to { transform: rotate(360deg); } }
.ai-report-content { max-width: 860px; }
.modal-header-ai {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid #e8edf5;
}
.modal-header-ai h2 { margin: 0; font-size: 22px; color: #243044; }
.ai-report-body {
    max-height: 64vh;
    overflow-y: auto;
    padding: 20px 8px 20px 0;
    background: #fff;
}
.ai-report-loading { text-align: center; padding: 40px; color: #6b7280; }
.ai-report-rendered {
    max-width: 760px;
    margin: 0 auto;
    color: #263238;
    font-size: 15px;
    line-height: 1.9;
}
.ai-report-rendered h2 {
    position: relative;
    font-size: 20px;
    color: #1f4f82;
    margin: 26px 0 12px;
    padding: 0 0 10px 14px;
    border-bottom: 1px solid #dfe7f2;
}
.ai-report-rendered h2::before {
    content: "";
    position: absolute;
    left: 0;
    top: 4px;
    width: 4px;
    height: 20px;
    border-radius: 2px;
    background: #2f80ed;
}
.ai-report-rendered h3 {
    font-size: 17px;
    color: #334155;
    margin: 18px 0 8px;
}
.ai-report-rendered p { margin: 10px 0; text-align: justify; }
.ai-report-rendered ul,
.ai-report-rendered ol {
    margin: 10px 0 14px;
    padding-left: 24px;
}
.ai-report-rendered li { margin-bottom: 8px; }
.ai-report-rendered strong { color: #b42318; font-weight: 700; }
.ai-error { color: #ef5350; padding: 20px; text-align: center; }
.modal-footer-ai {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 14px;
    border-top: 1px solid #e8edf5;
}
.btn-ai-pdf,
.btn-ai-copy,
.btn-ai-close {
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}
.btn-ai-pdf { background: #1f7a4d; color: #fff; }
.btn-ai-copy { background: #2f80ed; color: #fff; }
.btn-ai-close { background: #eef2f7; color: #334155; }
.btn-ai-pdf:hover { background: #17643f; }
.btn-ai-copy:hover { background: #2468c8; }
.btn-ai-close:hover { background: #dde5ef; }

/* Refined decision-support UI */
:root {
    --brand: #1f7a4d;
    --brand-dark: #155f3b;
    --accent: #2f80ed;
    --ink: #1f2933;
    --muted: #667085;
    --line: #d9e2ec;
    --surface: #ffffff;
    --soft: #f5f8fb;
    --warn: #f59e0b;
    --danger: #d92d20;
    --good: #17803d;
}
body { background: #eef3f0; color: var(--ink); }
.header {
    background: #153f2c;
    border-bottom: 3px solid #62b37f;
    box-shadow: 0 2px 12px rgba(21,63,44,0.18);
}
.header h1 { font-size: 21px; letter-spacing: 0; }
.header p { color: #d8eadf; opacity: 1; }
.section-heading { margin-top: 20px; }
.status-note {
    padding: 10px 12px;
    background: #eef6f1;
    border: 1px solid #cfe3d6;
    border-radius: 8px;
    margin-bottom: 12px;
    color: #355f45;
    font-size: 13px;
}
.secondary-action {
    width: 100%;
    margin-bottom: 12px;
    padding: 10px;
    border: none;
    border-radius: 8px;
    background: #e8f3ec;
    color: var(--brand-dark);
    font-weight: 700;
    cursor: pointer;
}
.secondary-action:hover { background: #d9ebdf; }
#recordList {
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid #edf2f7;
    border-radius: 8px;
    background: #fff;
}
.ai-action-panel {
    margin-top: 16px;
    padding: 18px;
    text-align: center;
    background: linear-gradient(180deg, #f5fbf7 0%, #ffffff 100%);
    border: 1px solid rgba(31,122,77,0.24);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(31,122,77,0.1);
}
.ai-action-panel p {
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
}
#aiLoading {
    margin-top: 10px;
    color: var(--muted);
    font-size: 13px;
}
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 8px;
    border: 3px solid #bdd9c8;
    border-top-color: var(--brand);
    border-radius: 50%;
    vertical-align: middle;
    animation: spin 0.8s linear infinite;
}
.layer-info #layerStat {
    font-size: 12px;
    color: #667085;
    text-align: center;
    margin: 10px 0;
}
.sidebar {
    background: #fbfdfc;
    border-right: 1px solid #dce7df;
    box-shadow: 2px 0 14px rgba(31,41,51,0.08);
}
.step {
    color: #7b8794;
    border-bottom-color: #d9e2ec;
}
.step.active {
    color: var(--brand);
    border-bottom-color: var(--brand);
}
.step.completed {
    color: var(--good);
    border-bottom-color: var(--good);
}
.step.active .step-num { background: var(--brand); }
.step.completed .step-num { background: var(--good); }
.form-row input,
.form-row select {
    border-color: #cfd9e3;
    background: #fff;
    border-radius: 8px;
}
.form-row input:focus,
.form-row select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(31,122,77,0.12);
}
.nav-buttons button {
    background: var(--brand);
    border-radius: 8px;
}
.nav-buttons button:hover { background: var(--brand-dark); }
#btnSave { background: var(--brand) !important; }
#btnAiAnalyze {
    background: var(--brand) !important;
    width: 100%;
    min-height: 58px;
    padding: 16px 18px !important;
    border: none;
    border-radius: 10px !important;
    color: #fff;
    font-size: 18px !important;
    font-weight: 800 !important;
    letter-spacing: 0;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(31,122,77,0.28) !important;
    transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
#btnAiAnalyze:hover {
    background: var(--brand-dark) !important;
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(31,122,77,0.34) !important;
}
#btnAiAnalyze:active {
    transform: translateY(0);
    box-shadow: 0 5px 14px rgba(31,122,77,0.24) !important;
}
#btnAiAnalyze:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.indicator-progress {
    position: sticky;
    top: -16px;
    z-index: 3;
    margin-bottom: 12px;
    padding: 12px;
    background: rgba(251,253,252,0.96);
    border: 1px solid var(--line);
    border-radius: 8px;
    backdrop-filter: blur(6px);
}
.indicator-progress > div:first-child {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    font-size: 13px;
}
.indicator-progress span { color: var(--muted); }
.indicator-progress-track {
    height: 8px;
    background: #e7eef5;
    border-radius: 999px;
    overflow: hidden;
}
.indicator-progress-track i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--brand), #62b37f);
    border-radius: inherit;
    transition: width 0.25s ease;
}
.indicator-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 4px solid #cbd5e1;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 1px 3px rgba(31,41,51,0.04);
}
.indicator-card:hover {
    border-color: #9bb7ce;
    border-left-color: var(--accent);
    box-shadow: 0 4px 14px rgba(31,41,51,0.08);
}
.indicator-card:hover .indicator-help-icon {
    opacity: 1;
    transform: scale(1);
}
.indicator-help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-left: 6px;
    border-radius: 50%;
    background: #d9e2ec;
    color: #667085;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    opacity: 0.6;
    transform: scale(0.85);
    transition: opacity 0.2s, transform 0.2s, background 0.2s, color 0.2s;
    vertical-align: middle;
    line-height: 16px;
    position: relative;
    user-select: none;
}
.indicator-help-icon:hover {
    background: var(--accent);
    color: #fff;
    opacity: 1;
}
.indicator-help-icon::after {
    content: "点击查看详细评级说明";
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #1f2933;
    color: #fff;
    font-size: 11px;
    font-weight: 400;
    white-space: nowrap;
    padding: 5px 10px;
    border-radius: 6px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 10;
}
.indicator-help-icon:hover::after {
    opacity: 1;
}
.indicator-help-icon::before {
    content: "?";
    font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
    line-height: 16px;
}
.indicator-help-icon:hover::before {
    content: "i";
    font-style: italic;
    font-weight: 700;
}
.indicator-card.score-0 { border-left-color: #D32F2F; background: #fff5f5; }
.indicator-card.score-1 { border-left-color: #F44336; background: #fff8f8; }
.indicator-card.score-2 { border-left-color: #FF9800; background: #fffbf0; }
.indicator-card.score-3 { border-left-color: #66BB6A; background: #f6fdf7; }
.indicator-card.score-4 { border-left-color: #2E7D32; background: #f0faf2; }
.indicator-header {
    align-items: flex-start;
    gap: 12px;
}
.indicator-name {
    display: block;
    color: var(--ink);
    font-size: 15px;
}
.indicator-vs {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}
.indicator-score-badge {
    flex: 0 0 auto;
    min-width: 54px;
    padding: 5px 8px;
    border-radius: 999px;
    background: #eef4f0;
    color: var(--brand-dark);
    text-align: center;
    font-size: 12px;
    font-weight: 700;
}
.grade-selector {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    margin-top: 10px;
}
.grade-btn {
    min-width: 0;
    padding: 8px 4px;
    border: 1px solid #cfd9e3;
    border-radius: 8px;
    background: #fff;
    color: #344054;
    line-height: 1.1;
}
.grade-btn span {
    display: block;
    font-size: 15px;
    font-weight: 800;
}
.grade-btn small {
    display: block;
    margin-top: 3px;
    font-size: 11px;
    color: #667085;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.grade-btn:hover {
    border-color: var(--brand);
    background: #f0f8f3;
}
.grade-btn.selected {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}
.grade-btn.selected small { color: #e8f5ed; }
.grade-0.selected { background: #D32F2F; border-color: #D32F2F; }
.grade-0.selected small { color: #ffcdd2; }
.grade-1.selected { background: #F44336; border-color: #F44336; }
.grade-1.selected small { color: #ffcdd2; }
.grade-2.selected { background: #FF9800; border-color: #FF9800; }
.grade-2.selected small { color: #fff3e0; }
.grade-3.selected { background: #66BB6A; border-color: #66BB6A; }
.grade-3.selected small { color: #e8f5e9; }
.grade-4.selected { background: #2E7D32; border-color: #2E7D32; }
.grade-4.selected small { color: #e8f5e9; }

.results-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}
.summary-card {
    padding: 12px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
}
.summary-card span,
.summary-card em {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-style: normal;
}
.summary-card strong {
    display: block;
    margin: 5px 0 2px;
    font-size: 26px;
    line-height: 1;
}
.summary-card.primary {
    border-color: rgba(31,122,77,0.3);
    background: #f2faf5;
}
.result-card.refined {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
}
.result-card-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 13px;
}
.result-card-title strong { font-size: 15px; }
.result-card.refined .result-bar {
    position: relative;
    height: 10px;
    background: linear-gradient(90deg, #D32F2F 0%, #D32F2F 20%, #F44336 20%, #F44336 40%, #FF9800 40%, #FF9800 60%, #66BB6A 60%, #66BB6A 80%, #2E7D32 80%, #2E7D32 100%);
}
.result-card.refined .result-bar i {
    position: absolute;
    top: -5px;
    width: 12px;
    height: 20px;
    margin-left: -6px;
    border: 2px solid #fff;
    border-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}
.result-scale {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    color: var(--muted);
    font-size: 11px;
}
.recommendation-panel {
    margin-top: 12px;
    padding: 14px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
}
.section-title {
    margin-bottom: 10px;
    color: var(--ink);
    font-weight: 800;
}
.rec-item.refined {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    background: transparent;
    border-top: 1px solid #edf2f7;
}
.rec-item.refined span {
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff4e5;
    color: #9a5b00;
    text-align: center;
    line-height: 24px;
    font-weight: 800;
    font-size: 12px;
}
.rec-item.refined p {
    margin: 4px 0 0;
    color: var(--muted);
    line-height: 1.55;
}
.recommendation-panel.is-good {
    background: #f2faf5;
    border-color: rgba(31,122,77,0.24);
}

.ai-report-content {
    width: min(92vw, 920px);
    border-radius: 10px;
}
.modal-header-ai {
    background: #f7faf8;
    margin: -24px -24px 0;
    padding: 18px 24px;
}
.ai-report-body {
    padding: 22px 10px 22px 0;
}
.ai-report-rendered {
    background: #fff;
    padding: 6px 4px;
}
.modal-footer-ai {
    background: #fbfdfc;
    margin: 0 -24px -24px;
    padding: 14px 24px;
}

/* Mobile and narrow-screen layout */
@media (max-width: 900px) {
    .header {
        padding: 12px 14px;
    }
    .header h1 {
        font-size: 18px;
        line-height: 1.25;
    }
    .header p {
        margin-top: 4px;
        font-size: 11px;
        line-height: 1.45;
    }
    .container {
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - 82px);
    }
    #map {
        order: 1;
        flex: none;
        width: 100%;
        height: 38vh;
        min-height: 260px;
        border-bottom: 1px solid #dce7df;
    }
    .sidebar {
        order: 2;
        width: 100%;
        min-width: 0;
        max-height: none;
        padding: 14px;
        overflow: visible;
        border-right: none;
        box-shadow: none;
    }
    #stepIndicator {
        position: sticky;
        top: 0;
        z-index: 20;
        margin: -14px -14px 14px;
        padding: 10px 10px 8px;
        background: rgba(251,253,252,0.96);
        border-bottom: 1px solid #dce7df;
        backdrop-filter: blur(8px);
    }
    .step {
        padding: 7px 2px;
        font-size: 10px;
        line-height: 1.2;
    }
    .step-num {
        display: block;
        margin: 0 auto 4px;
    }
    .nav-buttons {
        position: sticky;
        bottom: 0;
        z-index: 15;
        margin: 16px -14px -14px;
        padding: 10px 14px;
        background: rgba(251,253,252,0.96);
        border-top: 1px solid #dce7df;
        backdrop-filter: blur(8px);
    }
    .nav-buttons button {
        min-height: 44px;
    }
    .map-control-btn {
        width: 34px;
        height: 34px;
        line-height: 34px;
        font-size: 12px;
        padding: 0;
    }
    #locateBtn {
        top: 30px;
        right: 10px;
        left: auto;
        font-size: 16px;
        line-height: 34px;
    }
    #baseMapBtn {
        top: 74px;
        right: 10px;
        left: auto;
    }
    #layerSelectorBtn {
        top: 116px;
        right: 10px;
        left: auto;
    }
    .base-map-menu {
        top: 116px;
        right: 10px;
        left: auto;
        width: 200px;
    }
    .layer-menu {
        top: 158px;
        right: 10px;
        left: auto;
        width: 260px;
        max-height: calc(38vh - 70px);
    }
    .layer-list {
        max-height: 150px;
    }
    .indicator-progress {
        top: 74px;
        margin-left: -2px;
        margin-right: -2px;
    }
    .indicator-card {
        padding: 13px;
    }
    .indicator-header {
        display: grid;
        grid-template-columns: 1fr auto;
    }
    .grade-selector {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 5px;
    }
    .grade-btn {
        min-height: 50px;
        padding: 8px 2px;
    }
    .grade-btn span {
        font-size: 16px;
    }
    .grade-btn small {
        font-size: 10px;
    }
    .results-summary {
        grid-template-columns: 1fr;
    }
    .summary-card {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
        column-gap: 12px;
    }
    .summary-card strong {
        grid-row: 1 / span 2;
        grid-column: 2;
        margin: 0;
        font-size: 28px;
    }
    .ai-action-panel {
        padding: 16px;
    }
    #btnAiAnalyze {
        min-height: 62px;
        font-size: 18px !important;
    }
    .modal {
        background: rgba(15,23,42,0.48);
    }
    .modal-content {
        width: calc(100vw - 20px);
        max-width: none;
        max-height: calc(100vh - 24px);
        margin: 12px auto;
        padding: 18px;
        border-radius: 10px;
    }
    .ai-report-content {
        width: calc(100vw - 16px);
        height: calc(100vh - 16px);
        max-height: none;
        display: flex;
        flex-direction: column;
        margin: 8px auto;
        padding: 18px;
    }
    .modal-header-ai {
        margin: -18px -18px 0;
        padding: 14px 18px;
    }
    .modal-header-ai h2 {
        font-size: 18px;
    }
    .ai-report-body {
        flex: 1;
        max-height: none;
        padding: 16px 4px 16px 0;
    }
    .ai-report-rendered {
        font-size: 14px;
        line-height: 1.8;
    }
    .ai-report-rendered h2 {
        font-size: 18px;
    }
    .ai-report-rendered h3 {
        font-size: 16px;
    }
    .modal-footer-ai {
        position: sticky;
        bottom: -18px;
        display: grid;
        grid-template-columns: 1fr 1fr;
        margin: 0 -18px -18px;
        padding: 12px 18px;
    }
    .modal-footer-ai .btn-ai-close {
        grid-column: 1 / span 2;
    }
    .btn-ai-pdf,
    .btn-ai-copy,
    .btn-ai-close {
        min-height: 44px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 16px;
    }
    .header p {
        display: none;
    }
    .container {
        min-height: calc(100vh - 51px);
    }
    #map {
        height: 34vh;
        min-height: 220px;
    }
    .map-control-btn {
        width: 34px;
        height: 34px;
        line-height: 34px;
        font-size: 12px;
        padding: 0;
    }
    #locateBtn {
        top: 30px;
        right: 10px;
        left: auto;
        font-size: 16px;
        line-height: 34px;
    }
    #baseMapBtn {
        top: 74px;
        right: 10px;
        left: auto;
    }
    #layerSelectorBtn {
        top: 116px;
        right: 10px;
        left: auto;
    }
    .step {
        font-size: 9px;
    }
    .step-num {
        width: 20px;
        height: 20px;
        line-height: 20px;
    }
    .form-row input,
    .form-row select {
        min-height: 42px;
    }
    .indicator-header {
        grid-template-columns: 1fr;
    }
    .indicator-score-badge {
        justify-self: start;
        margin-top: 8px;
    }
    .grade-selector {
        gap: 4px;
    }
    .grade-btn {
        min-height: 48px;
    }
    .grade-btn small {
        display: none;
    }
    .summary-card strong {
        font-size: 24px;
    }
    .rec-item.refined {
        gap: 8px;
    }
}