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

body {
    font-family: 'Microsoft JhengHei', 'Noto Sans TC', sans-serif;
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    color: #eee;
    min-height: 100vh;
}

/* ===== Top Nav ===== */
.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 24px;
    background: rgba(0,0,0,0.3);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 2000;
}
.nav-brand {
    font-size: 20px;
    font-weight: bold;
    text-decoration: none;
    background: linear-gradient(90deg, #667eea, #f093fb, #43e97b, #ffd200, #667eea);
    background-size: 300% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: titleShimmer 6s ease-in-out infinite;
}
@keyframes titleShimmer {
    0%,100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}
.nav-right { display: flex; align-items: center; gap: 14px; }
.nav-user { color: #a78bfa; font-size: 13px; }
.nav-link {
    color: #888; text-decoration: none; font-size: 13px;
    padding: 4px 12px; border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px; transition: all 0.2s;
}
.nav-link:hover { color: #eee; border-color: rgba(102,126,234,0.4); background: rgba(102,126,234,0.1); }

/* ===== Main Layout ===== */
main {
    display: flex; flex-direction: column; align-items: center; padding: 20px;
}
#controls {
    display: flex; gap: 10px; margin-bottom: 10px;
    flex-wrap: wrap; justify-content: center; align-items: center;
}
.ctrl-sep { width: 1px; height: 20px; background: rgba(255,255,255,0.1); margin: 0 4px; }

.type-btn, .year-btn, .mode-btn {
    padding: 8px 22px;
    border: 2px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.04);
    color: #bbb; cursor: pointer; border-radius: 6px;
    font-size: 14px; font-weight: bold;
    transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
}
.type-btn:hover, .year-btn:hover, .mode-btn:hover {
    background: rgba(255,255,255,0.1); color: #fff; transform: translateY(-1px);
}
.type-btn:active, .year-btn:active, .mode-btn:active { transform: scale(0.95); transition-duration: 0.08s; }
.type-btn.active {
    background: linear-gradient(135deg, #f093fb, #667eea);
    border-color: transparent; color: #fff;
    box-shadow: 0 0 12px rgba(240,147,251,0.3);
}
.year-btn.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-color: transparent; color: #fff;
    box-shadow: 0 0 12px rgba(102,126,234,0.35);
}
.mode-btn.active {
    background: linear-gradient(135deg, #43e97b, #38f9d7);
    border-color: transparent; color: #0a2e1a;
    box-shadow: 0 0 12px rgba(67,233,123,0.3);
}

#back-btn {
    padding: 8px 22px;
    border: 2px solid rgba(239,83,80,0.4);
    background: rgba(239,83,80,0.1); color: #ef5350;
    cursor: pointer; border-radius: 6px;
    font-size: 14px; font-weight: bold;
    transition: all 0.3s; display: none;
}
#back-btn:hover { background: rgba(239,83,80,0.25); border-color: #ef5350; }

#breadcrumb {
    font-size: 12px; color: #777; margin-bottom: 12px; letter-spacing: 1px;
}
.bc-highlight { color: #a78bfa; font-weight: bold; }

/* ===== Map + Sidebar Grid ===== */
#main-layout {
    display: flex; gap: 24px; width: 100%; max-width: 1280px;
    align-items: flex-start; justify-content: center;
}
#map-area { flex-shrink: 0; position: relative; width: 640px; }
#sidebar {
    flex: 1; min-width: 300px; max-width: 480px;
    display: flex; flex-direction: column; gap: 14px;
}

/* ===== Map SVG ===== */
.map-svg {
    background: rgba(0,0,0,0.2); border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.06);
    box-shadow: 0 0 30px rgba(102,126,234,0.08), 0 0 60px rgba(118,75,162,0.05);
    transition: box-shadow 0.5s; width: 100%; height: auto;
    cursor: grab;
    touch-action: none;
}
.map-svg:active { cursor: grabbing; }
.map-svg:hover {
    box-shadow: 0 0 40px rgba(102,126,234,0.15), 0 0 80px rgba(118,75,162,0.1);
}
.zoom-layer { will-change: transform; }
.zoom-controls {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 20;
    display: flex;
    gap: 6px;
    padding: 6px;
    background: rgba(15,12,41,0.65);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.25);
}
.zoom-btn {
    min-width: 30px;
    height: 30px;
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(255,255,255,0.06);
    color: #eee;
    border-radius: 7px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: all 0.2s;
}
.zoom-btn:hover {
    background: rgba(102,126,234,0.28);
    border-color: rgba(167,139,250,0.5);
}
.zoom-reset {
    padding: 0 9px;
    font-size: 12px;
    font-weight: 700;
}
.town-path {
    cursor: pointer;
    stroke: rgba(255,255,255,0.3); stroke-width: 0.8px;
    transition: filter 0.15s, stroke 0.15s;
    vector-effect: non-scaling-stroke;
}
.village-path {
    cursor: pointer;
    stroke: rgba(255,255,255,0.2); stroke-width: 0.5px;
    transition: filter 0.15s, stroke 0.15s;
    vector-effect: non-scaling-stroke;
}
.town-path:hover, .village-path:hover {
    filter: brightness(1.35) drop-shadow(0 0 6px rgba(255,255,255,0.35));
    stroke: rgba(255,255,255,0.9); stroke-width: 2px;
}
.town-path.selected, .village-path.selected {
    stroke: #ffd200; stroke-width: 2.5px;
    filter: brightness(1.15) drop-shadow(0 0 10px rgba(255,210,0,0.4));
}
.area-label {
    fill: #fff; font-weight: bold; text-anchor: middle;
    dominant-baseline: middle;
    pointer-events: none; paint-order: stroke;
    stroke: rgba(10,8,30,0.86); stroke-width: 3px;
    stroke-linejoin: round;
    font-size: 11px; letter-spacing: 0.2px;
}
.area-label.vill-label {
    font-size: 7px; stroke-width: 1.45px;
    letter-spacing: 0;
}

/* ===== Tooltip ===== */
#tooltip {
    position: fixed; display: none;
    background: rgba(15, 12, 41, 0.92);
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 14px; padding: 16px;
    pointer-events: auto; z-index: 1000;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5), inset 0 0 0 1px rgba(255,255,255,0.05);
    min-width: 240px; max-width: 340px;
}
#tooltip.councilor-tooltip {
    min-width: 320px;
    max-width: 440px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}
#tooltip.councilor-tooltip .info-row { font-size: 13px; margin: 5px 0; }
#tooltip.councilor-tooltip .tip-title { font-size: 17px; }
.elected-mark {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 5px;
    border-radius: 999px;
    background: rgba(250, 204, 21, 0.18);
    color: #facc15;
    font-size: 10px;
    font-weight: 700;
}
.tip-title { font-size: 16px; font-weight: bold; color: #fff; margin-bottom: 4px; text-align: center; }
.tip-chart-wrap { margin: 8px 0; }
.tip-chart-wrap canvas { width: 100% !important; height: auto !important; }
.info-row {
    display: flex; align-items: center; gap: 6px; margin: 3px 0; font-size: 12px;
}
.color-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.info-name { color: #ccc; min-width: 60px; }
.info-votes { color: #aaa; margin-left: auto; }
.tip-summary {
    font-size: 11px; color: #888; text-align: center; margin-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.08); padding-top: 6px;
}

/* ===== Sidebar Panels ===== */
.panel {
    background: rgba(0,0,0,0.25); border: 1px solid rgba(255,255,255,0.08);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-radius: 12px; padding: 14px;
}
.panel h3 {
    font-size: 14px; margin-bottom: 10px; color: #e0d6ff; text-align: center;
}
.cand-row { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.cand-dot { width: 14px; height: 14px; border-radius: 3px; flex-shrink: 0; }
.cand-info { flex: 1; }
.cand-name { font-size: 14px; font-weight: bold; color: #eee; }
.cand-party { font-size: 11px; color: #999; }
.cand-votes { text-align: right; }
.cand-count { font-size: 15px; font-weight: bold; color: #eee; }
.cand-pct { font-size: 12px; color: #a78bfa; }
.cand-bar-wrap {
    height: 8px; background: rgba(255,255,255,0.06);
    border-radius: 4px; overflow: hidden; margin-top: 4px;
}
.cand-bar { height: 100%; border-radius: 4px; transition: width 0.6s ease; }
.summary-stats {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px;
}
.stat-item {
    text-align: center; padding: 6px;
    background: rgba(255,255,255,0.03); border-radius: 8px;
}
.stat-value { font-size: 18px; font-weight: bold; color: #a78bfa; }
.stat-label { font-size: 11px; color: #888; }

/* ===== Loading ===== */
.loading-overlay {
    position: absolute; inset: 0;
    background: rgba(15,12,41,0.7);
    display: flex; align-items: center; justify-content: center;
    border-radius: 14px; z-index: 100;
}
.spinner {
    width: 40px; height: 40px;
    border: 3px solid rgba(255,255,255,0.1); border-top-color: #667eea;
    border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Login Page ===== */
.login-container {
    display: flex; align-items: center; justify-content: center; min-height: 70vh;
}
.login-card {
    background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.1);
    backdrop-filter: blur(10px); border-radius: 16px; padding: 40px; width: 360px;
}
.login-card h2 { text-align: center; margin-bottom: 24px; color: #e0d6ff; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: #aaa; margin-bottom: 4px; }
.form-group input {
    width: 100%; padding: 10px 14px;
    background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px; color: #eee; font-size: 14px; outline: none;
    transition: border-color 0.2s;
}
.form-group input:focus { border-color: #667eea; }
.btn-primary {
    width: 100%; padding: 10px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none; border-radius: 8px; color: #fff;
    font-size: 15px; font-weight: bold; cursor: pointer; transition: opacity 0.2s;
}
.btn-primary:hover { opacity: 0.9; }
.btn-secondary {
    display: block; text-align: center; color: #667eea;
    text-decoration: none; font-size: 13px; margin-top: 12px; transition: color 0.2s;
}
.btn-secondary:hover { color: #a78bfa; }
.login-hint { text-align: center; font-size: 12px; color: #666; margin-top: 16px; }
.alert-error {
    background: rgba(239,83,80,0.15); border: 1px solid rgba(239,83,80,0.3);
    color: #ef5350; padding: 8px 12px; border-radius: 8px;
    font-size: 13px; margin-bottom: 16px; text-align: center;
}

/* ===== Detail Panel (Polling Stations) ===== */
#panel-detail,
#panel-local {
    max-height: 60vh;
    display: flex;
    flex-direction: column;
}
.detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.detail-header h3 {
    margin-bottom: 0;
    text-align: left;
    flex: 1;
}
.detail-close-btn {
    width: 26px; height: 26px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    color: #999; font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.detail-close-btn:hover {
    background: rgba(239,83,80,0.15);
    border-color: rgba(239,83,80,0.3);
    color: #ef5350;
}
#detail-body,
#local-body {
    overflow-y: auto;
    overflow-x: auto;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(167,139,250,0.3) transparent;
}
#detail-body::-webkit-scrollbar,
#local-body::-webkit-scrollbar { width: 5px; height: 5px; }
#detail-body::-webkit-scrollbar-thumb,
#local-body::-webkit-scrollbar-thumb { background: rgba(167,139,250,0.3); border-radius: 3px; }
#detail-body::-webkit-scrollbar-track,
#local-body::-webkit-scrollbar-track { background: transparent; }

.local-panel {
    margin-top: 0;
    padding-top: 0;
}
.local-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}
.local-header h4,
.local-card-title {
    color: #e0d6ff;
    font-size: 14px;
    font-weight: 700;
}
.save-status {
    color: #8ee6b1;
    font-size: 11px;
    min-height: 16px;
}
.local-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}
.local-add-card.is-hidden {
    display: none;
}
.local-panel.local-adding #local-influencer-list,
.local-panel.local-adding #influencer-detail-panel,
.local-panel.local-adding [data-action="toggle-add-influencer"] {
    display: none;
}
.local-panel.local-adding [data-person-form="influencer"].is-hidden,
.relationship-section.relationship-adding [data-person-form="relationship"].is-hidden {
    display: block;
}
.relationship-section.relationship-adding .relationship-list,
.relationship-section.relationship-adding [data-action="toggle-add-relationship"] {
    display: none;
}
.local-card,
.relationship-row {
    padding: 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
}
.local-card.active {
    border-color: rgba(167,139,250,0.45);
    background: rgba(167,139,250,0.08);
}
.relationship-row.active {
    border-color: rgba(167,139,250,0.35);
    background: rgba(167,139,250,0.07);
}
.influencer-detail-panel {
    margin-top: 12px;
}
.influencer-detail-card {
    border-color: rgba(67,233,123,0.28);
}
.local-detail-summary {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 8px 0 10px;
    padding: 8px 10px;
    background: rgba(0,0,0,0.18);
    border-radius: 9px;
}
.local-detail-summary strong {
    color: #fff;
    font-size: 15px;
}
.local-detail-summary span {
    color: #aaa;
    font-size: 12px;
}
.area-influence-section {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.area-influence-town {
    margin-top: 8px;
    padding: 9px;
    background: rgba(0,0,0,0.14);
    border-radius: 10px;
}
.area-influence-town-name {
    color: #a78bfa;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 6px;
}
.area-influence-village {
    padding: 7px 8px;
    border-radius: 8px;
    background: rgba(255,255,255,0.035);
    margin-top: 6px;
}
.area-influence-village.current {
    border: 1px solid rgba(67,233,123,0.35);
    background: rgba(67,233,123,0.08);
}
.area-influence-village strong {
    color: #eee;
    font-size: 13px;
}
.area-influence-village small {
    display: block;
    color: #999;
    font-size: 11px;
    margin-top: 3px;
}
.area-current-mark {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 5px;
    border-radius: 999px;
    color: #8ee6b1;
    background: rgba(67,233,123,0.14);
    font-size: 11px;
}
.local-card-head,
.local-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}
.local-card-foot {
    margin-top: 8px;
    margin-bottom: 0;
}
.local-form-actions,
.local-row-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
    margin-top: 10px;
}
.local-form-actions .local-btn.primary {
    margin-top: 0;
    width: auto;
    flex: 1;
}
.local-row-actions {
    margin-top: 0;
}
.local-card-name {
    flex: 1;
    padding: 0;
    border: 0;
    background: transparent;
    color: #fff;
    text-align: left;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}
.local-card-name small,
.relationship-person small,
.person-option small {
    display: block;
    color: #999;
    font-size: 11px;
    font-weight: 400;
    margin-top: 2px;
}
.local-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.local-summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
}
.local-summary-grid div {
    min-width: 0;
    padding: 7px 8px;
    background: rgba(0,0,0,0.16);
    border-radius: 8px;
}
.local-summary-grid span {
    display: block;
    color: #888;
    font-size: 11px;
    margin-bottom: 2px;
}
.local-summary-grid strong {
    display: block;
    color: #eee;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.local-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: #aaa;
    font-size: 11px;
}
.local-field-full {
    grid-column: 1 / -1;
}
.local-field input,
.local-field select,
.local-field textarea {
    width: 100%;
    padding: 8px 9px;
    background: rgba(10,8,30,0.65);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    color: #eee;
    font-size: 13px;
    outline: none;
}
.local-field input:focus,
.local-field select:focus,
.local-field textarea:focus {
    border-color: rgba(167,139,250,0.7);
}
.local-search-field {
    position: relative;
}
.person-suggestions {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 30;
    background: rgba(15,12,41,0.98);
    border: 1px solid rgba(167,139,250,0.25);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0,0,0,0.35);
}
.person-option {
    display: block;
    width: 100%;
    padding: 8px 10px;
    background: transparent;
    border: 0;
    color: #eee;
    text-align: left;
    cursor: pointer;
}
.person-option:hover {
    background: rgba(167,139,250,0.14);
}
.person-no-result,
.local-empty,
.local-error {
    padding: 10px;
    color: #999;
    font-size: 12px;
}
.local-error {
    color: #ff8a80;
}
.local-btn {
    padding: 6px 10px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.06);
    color: #ddd;
    border-radius: 7px;
    cursor: pointer;
    font-size: 12px;
}
.local-btn.primary {
    margin-top: 10px;
    width: 100%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    border-color: transparent;
}
.local-toggle-btn {
    margin-bottom: 12px;
}
.local-btn.danger {
    color: #ff8a80;
    border-color: rgba(239,83,80,0.25);
    background: rgba(239,83,80,0.08);
}
.relationship-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
}
.relationship-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.relationship-person {
    color: #fff;
    font-weight: 700;
    margin-bottom: 8px;
}
.relationship-meta {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.relationship-meta span {
    padding: 3px 7px;
    border-radius: 999px;
    color: #d8ccff;
    background: rgba(167,139,250,0.12);
    font-size: 11px;
}
.relationship-note {
    padding: 7px 8px;
    color: #bbb;
    background: rgba(0,0,0,0.14);
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.5;
    margin-bottom: 8px;
}
.relationship-subtitle {
    color: #aaa;
    font-size: 12px;
    font-weight: 700;
    margin: 8px 0 4px;
}
.relationship-influence .area-influence-town {
    margin-top: 6px;
}
.relationship-edit-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.ps-table {
    min-width: 100%;
    width: max-content;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}
.ps-table thead th {
    position: sticky;
    top: 0;
    background: rgba(15,12,41,0.95);
    backdrop-filter: blur(6px);
    color: #a78bfa;
    font-weight: 600;
    padding: 10px 14px;
    text-align: center;
    white-space: nowrap;
    border-bottom: 2px solid rgba(167,139,250,0.2);
    z-index: 2;
}
.ps-table thead th:first-child {
    text-align: left;
    padding-left: 14px;
    min-width: 110px;
}
.ps-table tbody tr {
    transition: background 0.15s;
}
.ps-table tbody tr:hover {
    background: rgba(167,139,250,0.08);
}
.ps-table tbody td {
    padding: 10px 14px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    color: #ccc;
    white-space: nowrap;
}
.ps-table tbody td:first-child {
    text-align: left;
    padding-left: 14px;
    font-weight: 600;
    color: #e0d6ff;
    white-space: nowrap;
}
.ps-table tbody tr:last-child td {
    border-bottom: none;
}
.ps-cell-votes {
    font-weight: 600;
    font-size: 14px;
    color: #eee;
}
.ps-cell-pct {
    font-size: 11px;
    color: #999;
    margin-top: 2px;
}
.ps-cell-winner .ps-cell-votes {
    color: #fff;
}
.ps-cell-winner {
    position: relative;
    border-radius: 4px;
}
.ps-cell-turnout {
    font-weight: 600;
    font-size: 14px;
    color: #a78bfa;
}
.ps-table tfoot td {
    padding: 10px 14px;
    text-align: center;
    border-top: 2px solid rgba(167,139,250,0.2);
    font-weight: 700;
    color: #e0d6ff;
    white-space: nowrap;
}
.ps-table tfoot td:first-child {
    text-align: left;
    padding-left: 14px;
}
.ps-cand-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}
.ps-cand-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    display: inline-block;
}
.ps-cand-name-text {
    font-size: 12px;
}
.village-path.active-village {
    stroke: #ffd200; stroke-width: 2.5px;
    filter: brightness(1.15) drop-shadow(0 0 10px rgba(255,210,0,0.4));
}


/* ===== Responsive ===== */
@media (max-width: 900px) {
    #main-layout { flex-direction: column; align-items: center; }
    #map-area { width: 100%; max-width: 500px; }
    #sidebar { max-width: 500px; width: 100%; }
    .type-btn, .year-btn, .mode-btn { padding: 6px 14px; font-size: 13px; }
    #back-btn { padding: 6px 14px; font-size: 13px; }
}
