* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif; background: #f5f7fa; min-height: 100vh; padding: 20px; color: #333; }
.container { max-width: 1400px; margin: 0 auto; }
header { text-align: center; color: #5a6c7d; margin-bottom: 30px; }
h1 { font-size: 2.5em; font-weight: 700; margin-bottom: 10px; }
.subtitle { font-size: 1.1em; font-weight: 300; color: #7a8a9a; }
.font-control { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 20px; font-size: .9em; color: #5a6c7d; }
a { color: #4f7396; }
.home-link { display: inline-block; margin-top: 12px; color: #7a9fc4; text-decoration: none; font-size: .95em; }
.home-link:hover { text-decoration: underline; }
h2 { font-size: 1.05em; color: #5a6c7d; }
.control-panel, .region-panel, .map-panel { background: white; border-radius: 12px; box-shadow: 0 2px 8px rgb(0 0 0 / 8%); }
.control-panel { padding: 22px 25px; margin-bottom: 20px; }
.panel-heading, .list-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-heading { margin-bottom: 16px; }
.hint, #result-count { font-size: .85em; color: #71859a; }
.inline-controls { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 7px; color: #5a6c7d; font-size: .88em; }
.search-field { flex: 1; min-width: 230px; }
select, input { padding: 10px 14px; border: 2px solid #d0dce8; border-radius: 8px; font: inherit; font-size: 1.05em; background: white; color: #37536e; min-height: 44px; }
select { min-width: 190px; max-width: 100%; }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #527fae; outline-offset: 3px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; min-height: 44px; border: 1px solid #adc2d9; border-radius: 8px; background: #d4e4f7; color: #37536e; text-decoration: none; cursor: pointer; font: inherit; font-size: .9em; font-weight: 500; }
.button:hover { background: #c4d9f0; }
.button.secondary { background: white; }
.button.secondary:hover { background: #e8f0f7; }
.workspace { display: grid; grid-template-columns: 268px minmax(0, 1fr); gap: 20px; align-items: start; }
.region-panel { position: sticky; top: 20px; overflow: hidden; }
.list-heading { padding: 18px; border-bottom: 1px solid #e8eef4; }
.region-list { max-height: 720px; overflow-y: auto; padding: 8px; scrollbar-width: thin; }
.region-group { padding: 13px 10px 7px; font-size: .75em; color: #7a8a9a; font-weight: 500; }
.region-button { display: block; width: 100%; text-align: left; background: white; border: 1px solid transparent; border-radius: 7px; padding: 10px 12px; font: inherit; font-size: .9em; color: #526b82; cursor: pointer; margin: 2px 0; }
.region-button:hover { background: #f0f5fa; }
.region-button[aria-current="true"] { background: #d4e4f7; border-color: #adc2d9; color: #37536e; font-weight: 700; }
.map-panel { padding: 25px; min-width: 0; }
.region-heading { border-bottom: 1px solid #e8eef4; padding-bottom: 16px; }
.region-title-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 14px; }
.eyebrow { color: #7a8a9a; font-size: .85em; margin-bottom: 5px; }
#region-title { color: #37536e; font-size: 1.7em; }
.region-counts { color: #71859a; font-size: .78em; }
.map-toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 4px 16px; margin: 10px 0; }
.map-intro { color: #71859a; font-size: .78em; line-height: 1.7; }
.map-option { display: inline-flex; align-items: center; gap: 9px; min-height: 44px; color: #37536e; cursor: pointer; font-size: .9em; }
.map-option input { width: 20px; height: 20px; min-height: 0; padding: 0; accent-color: #527fae; }
.map-controls { display: grid; gap: 8px; margin-bottom: 18px; }
.settings-panel { border: 1px solid #e0e8f0; border-radius: 8px; min-width: 0; }
.settings-panel summary { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 10px 14px; cursor: pointer; list-style: none; color: #526b82; font-size: .86em; border-radius: 8px; }
.settings-panel summary::-webkit-details-marker { display: none; }
.settings-panel summary:hover { background: #f5f8fb; }
.settings-panel summary::after { content: ''; width: 7px; height: 7px; flex-shrink: 0; border-right: 1.5px solid #71859a; border-bottom: 1.5px solid #71859a; transform: rotate(45deg); margin: -4px 2px 0 4px; }
.settings-panel[open] summary::after { transform: rotate(225deg); margin-top: 4px; }
.settings-panel[open] summary { border-bottom: 1px solid #edf1f5; border-radius: 8px 8px 0 0; background: #f8fafc; }
.summary-title { flex: 1; font-weight: 500; }
.summary-meta { max-width: 60%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #71859a; font-size: .9em; }
.settings-body { padding: 14px; }
.settings-body > .connection-help:first-child { margin-top: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.map-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.map-card { border: 1px solid #e0e8f0; border-radius: 10px; overflow: hidden; min-width: 0; }
.card-heading { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; background: #f8fafc; border-bottom: 1px solid #e8eef4; gap: 8px; }
h3 { font-size: .96em; color: #526b82; }
.badge { background: #e7eef7; color: #526b82; font-size: .73em; padding: 4px 8px; border-radius: 5px; white-space: nowrap; }
.map-open { display: block; width: 100%; aspect-ratio: 14 / 13; border: 0; background: white; cursor: zoom-in; padding: 7px; }
.map-open img { width: 100%; height: 100%; display: block; object-fit: contain; }
.card-actions { padding: 12px; display: flex; gap: 8px; border-top: 1px solid #edf1f5; }
.card-actions .button { flex: 1; min-height: 40px; font-size: .82em; padding: 8px; }
.empty { padding: 25px 18px; text-align: center; color: #71859a; line-height: 1.8; font-size: .9em; }
[hidden] { display: none !important; }
dialog { width: min(1100px, 95vw); max-height: 94vh; margin: auto; border: none; border-radius: 12px; padding: 18px; color: #37536e; }
dialog::backdrop { background: rgb(26 43 60 / 65%); }
.preview-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.preview-toolbar h2 { font-size: 1em; }
.preview-canvas { margin-top: 12px; overflow: auto; max-height: 72vh; }
.preview-canvas img { width: 100%; max-height: 72vh; display: block; object-fit: contain; }
.preview-canvas img.original-size { width: auto; height: auto; max-width: none; max-height: none; }
.preview-toolbar h2 { flex: 1; }
.preview-toolbar .button { flex-shrink: 0; }
.preview-note { text-align: center; font-size: .8em; color: #71859a; margin-top: 12px; }
body:has(dialog[open]) { overflow: hidden; }
@media (max-width: 900px) {
    .workspace { grid-template-columns: 220px minmax(0,1fr); gap: 14px; }
    .map-panel { padding: 18px; }
    .map-grid { gap: 12px; }
    .card-heading { padding: 12px 10px; flex-wrap: wrap; }
}
@media (max-width: 680px) {
    body { padding: 16px 12px; }
    h1 { font-size: 2em; }
    header { margin-bottom: 24px; }
    .control-panel { padding: 18px; }
    .field { width: 100%; }
    .search-field { min-width: 0; }
    .inline-controls .button { flex: 1; }
    .workspace { grid-template-columns: 1fr; }
    .region-panel { position: static; }
    .region-list { max-height: 190px; }
    .map-panel { padding: 18px 14px; }
    .map-grid { grid-template-columns: 1fr; }
    .map-intro { font-size: .73em; }
    .map-toolbar { gap: 0; }
    .settings-body .inline-controls .connection-field { flex-basis: 100%; }
    .card-heading { padding: 14px; }
    .preview-toolbar h2 { font-size: .85em; }
}
.connection-help { font-size: .8em; color: #71859a; line-height: 1.7; margin-top: 8px; }
.connected-regions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.connected-region { display: inline-flex; align-items: center; gap: 8px; border-radius: 7px; padding: 6px 10px; background: #e0ecf8; color: #37536e; font-size: .82em; }
.connected-region button { border: 0; background: transparent; color: inherit; min-width: 30px; min-height: 30px; cursor: pointer; font: inherit; }
button:disabled { cursor: default; opacity: .5; }
.connection-field { flex: 1; min-width: 0; }
#neighbor { width: 100%; }
.map-status { color: #526b82; font-size: .82em; line-height: 1.7; margin: 0 0 16px; }
.map-status:empty { display: none; }
.map-status .button { margin-left: 8px; }
