:root {
  --primary: #176b57; --surface: #fff; --soft: #f5f8f7; --border: #d9e3df;
  --text: #182723; --muted: #5b6d67; --fude: #e68a00; --registry: #7045c7;
  --header-height: 56px; --panel-width: 390px;
  font-family: "Noto Sans JP", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; color: var(--text); background: #e8efec; }
button, input, select { font: inherit; }
button, select, input[type="checkbox"], input[type="range"] { cursor: pointer; }
.app-shell { display: flex; flex-direction: column; height: 100%; }
.app-header {
  align-items: center; background: linear-gradient(120deg, #0e594b, #176b57 62%, #305c7a);
  box-shadow: 0 2px 12px rgb(15 55 46 / 25%); color: #fff; display: flex;
  flex: 0 0 var(--header-height); gap: 14px; padding: 0 16px; position: relative; z-index: 10;
}
.portal-link {
  align-items: center; border: 1px solid rgb(255 255 255 / 28%); border-radius: 999px;
  color: rgb(255 255 255 / 84%); display: flex; font-size: .78rem; font-weight: 700;
  gap: 5px; padding: 5px 10px; text-decoration: none;
}
.portal-link:hover { background: rgb(255 255 255 / 12%); color: #fff; }
.portal-link svg { fill: currentColor; height: 15px; width: 15px; }
.title-block { min-width: 0; }
.title-block h1 { font-size: 1.05rem; line-height: 1.25; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.title-block p { color: rgb(255 255 255 / 68%); font-size: .71rem; margin: 2px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-count { background: rgb(255 255 255 / 14%); border-radius: 999px; font-size: .73rem; font-weight: 700; margin-left: auto; padding: 5px 10px; white-space: nowrap; }
.workspace { display: flex; flex: 1; min-height: 0; position: relative; }
.side-panel {
  background: var(--surface); border-right: 1px solid var(--border); display: flex;
  flex: 0 0 var(--panel-width); flex-direction: column; min-width: 0; overflow: hidden;
  transition: flex-basis .2s ease, border-color .2s ease; z-index: 5;
}
.workspace.panel-collapsed .side-panel { border-color: transparent; flex-basis: 0; }
.panel-tabs { background: var(--soft); border-bottom: 1px solid var(--border); display: flex; flex: 0 0 auto; }
.tab-button { background: transparent; border: 0; border-bottom: 3px solid transparent; color: var(--muted); flex: 1; font-size: .8rem; font-weight: 700; padding: 12px 4px 10px; }
.tab-button:hover { background: #eaf2ef; color: var(--primary); }
.tab-button.active { background: #fff; border-bottom-color: var(--primary); color: var(--primary); }
.tab-panel { display: none; flex: 1; min-height: 0; }
.tab-panel.active { display: flex; }
.panel-scroll { flex: 1; overflow: auto; padding: 15px; scrollbar-color: #c3d0cb transparent; scrollbar-width: thin; }
.control-section { border-bottom: 1px solid #e7eeeb; margin: 0 0 17px; padding: 0 0 17px; }
.control-section:last-child { border-bottom: 0; margin-bottom: 0; }
.control-section.compact { display: grid; gap: 6px; }
.control-section h2, .detail-card h2, .guide-content h2 { color: #3f554e; font-size: .78rem; letter-spacing: .04em; margin: 0 0 10px; text-transform: uppercase; }
.layer-card { background: #fbfcfc; border: 1px solid var(--border); border-radius: 9px; box-shadow: 0 1px 3px rgb(20 50 40 / 4%); padding: 11px 12px; }
.layer-card + .layer-card { margin-top: 9px; }
.layer-card.fude-card { border-left: 4px solid var(--fude); }
.layer-card.registry-card { border-left: 4px solid var(--registry); }
.layer-heading, .range-row, .legend-row, .inline-controls, .check-row { align-items: center; display: flex; }
.layer-heading { gap: 8px; justify-content: space-between; }
.switch-label { align-items: center; display: flex; font-size: .85rem; font-weight: 700; gap: 7px; }
.switch-label input, .check-row input { accent-color: var(--primary); height: 16px; width: 16px; }
.data-badge { background: #fff2dd; border-radius: 999px; color: #8c5500; font-size: .64rem; font-weight: 700; padding: 3px 7px; }
.data-badge.registry { background: #f0eafb; color: #573397; }
.legend-row { color: var(--muted); font-size: .72rem; gap: 5px; margin: 9px 0 7px 23px; }
.legend-row .swatch:not(:first-child) { margin-left: 8px; }
.swatch { border-radius: 2px; display: inline-block; height: 11px; width: 18px; }
.swatch.paddy { background: rgb(34 139 217 / 48%); border: 1px solid #1671b2; }
.swatch.field { background: rgb(245 158 11 / 48%); border: 1px solid #c77700; }
.swatch.registry { background: rgb(112 69 199 / 10%); border: 2px solid #7045c7; }
.range-row { color: var(--muted); font-size: .72rem; gap: 8px; }
.range-row span { width: 42px; }
.range-row input { accent-color: var(--primary); flex: 1; }
.range-row output { font-variant-numeric: tabular-nums; text-align: right; width: 34px; }
.field-label { color: var(--muted); display: block; font-size: .72rem; font-weight: 600; margin-bottom: 5px; }
select, input[type="search"] { background: #fff; border: 1px solid #bfcfc9; border-radius: 7px; color: var(--text); min-height: 36px; padding: 7px 9px; width: 100%; }
select:focus, input[type="search"]:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgb(23 107 87 / 12%); outline: none; }
.inline-controls { gap: 7px; }
.inline-controls select, .inline-controls input { flex: 1; min-width: 0; }
.small-button { align-items: center; background: #fff; border: 1px solid #aec2ba; border-radius: 7px; color: #29473e; display: inline-flex; font-size: .76rem; font-weight: 700; justify-content: center; min-height: 36px; padding: 8px 11px; text-decoration: none; white-space: nowrap; }
.small-button:hover { background: #edf4f1; border-color: var(--primary); }
.small-button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.small-button:disabled { cursor: default; opacity: .45; }
.check-row { color: var(--muted); font-size: .73rem; gap: 6px; margin-top: 9px; }
.hint { color: #71827c; font-size: .7rem; line-height: 1.5; margin: 7px 0 0; }
.hint.error { color: #b3261e; }
.search-results { display: grid; gap: 5px; margin-top: 8px; max-height: 230px; overflow: auto; }
.search-result { background: #fff; border: 1px solid var(--border); border-radius: 7px; color: var(--text); padding: 8px 9px; text-align: left; }
.search-result:hover { background: #f0f6f4; border-color: #8eb0a5; }
.search-result strong { display: block; font-size: .76rem; }
.search-result span { color: var(--muted); display: block; font-size: .67rem; margin-top: 2px; }
.selection-summary { background: #e8f4ef; border: 1px solid #b9d9ce; border-radius: 8px; color: #215f50; font-size: .78rem; line-height: 1.6; margin-bottom: 12px; padding: 10px 11px; }
.selection-summary.empty { background: #f4f6f5; border-color: var(--border); color: var(--muted); }
.detail-card { border: 1px solid var(--border); border-radius: 9px; margin-bottom: 10px; overflow: hidden; padding: 12px; }
.detail-card h2 { align-items: center; display: flex; margin-bottom: 9px; }
.detail-mark { border-radius: 50%; height: 9px; margin-right: 7px; width: 9px; }
.detail-mark.fude { background: var(--fude); }
.detail-mark.registry { background: var(--registry); }
.empty-detail { color: #8a9893; font-size: .75rem; padding: 7px 0; }
.detail-card dl { display: grid; grid-template-columns: 96px 1fr; margin: 0; }
.detail-card dt, .detail-card dd { border-top: 1px solid #edf1ef; font-size: .73rem; margin: 0; overflow-wrap: anywhere; padding: 7px 3px; }
.detail-card dt { color: var(--muted); }
.detail-card dd { color: var(--text); font-weight: 600; }
.detail-actions { display: flex; gap: 7px; margin-top: 12px; }
.detail-actions > * { flex: 1; }
.guide-content { color: #455a53; font-size: .78rem; line-height: 1.75; }
.guide-content ol { margin: 0 0 18px; padding-left: 1.5rem; }
.guide-content li + li { margin-top: 6px; }
.notice { background: #f4f7f6; border: 1px solid var(--border); border-radius: 8px; margin-top: 10px; padding: 11px; }
.notice strong { color: #324a42; }
.notice p { margin: 5px 0 0; }
.map-panel { flex: 1; min-width: 0; position: relative; }
#map { height: 100%; width: 100%; }
.panel-toggle { background: #fff; border: 1px solid #c9d6d1; border-left: 0; border-radius: 0 7px 7px 0; box-shadow: 2px 2px 7px rgb(20 40 35 / 14%); color: var(--primary); font-size: 1.5rem; height: 44px; left: 0; position: absolute; top: 14px; width: 28px; z-index: 3; }
.map-message, .zoom-note, .map-legend { backdrop-filter: blur(5px); background: rgb(255 255 255 / 92%); border: 1px solid rgb(190 205 199 / 90%); border-radius: 7px; box-shadow: 0 3px 12px rgb(20 45 37 / 12%); position: absolute; z-index: 2; }
.map-message { bottom: 12px; color: var(--muted); font-size: .69rem; left: 12px; max-width: calc(100% - 24px); padding: 6px 9px; }
.map-message.error { color: #a4251e; }
.zoom-note { color: #765016; display: none; font-size: .7rem; left: 50%; padding: 6px 10px; top: 12px; transform: translateX(-50%); }
.zoom-note.visible { display: block; }
.map-legend { bottom: 12px; display: flex; gap: 10px; padding: 6px 8px; right: 12px; }
.map-legend span { align-items: center; color: var(--muted); display: flex; font-size: .65rem; gap: 4px; }
.map-legend .swatch { height: 9px; width: 14px; }
.esri-ui-top-right { top: 8px; }
.esri-widget--button { border: 1px solid #c7d4cf; box-shadow: 0 2px 8px rgb(20 40 35 / 12%); }
.esri-view .esri-view-surface--inset-outline:focus::after { outline: none; }
@media (max-width: 760px) {
  :root { --panel-width: min(88vw, 370px); --header-height: 54px; }
  .app-header { gap: 8px; padding: 0 9px; }
  .portal-link { padding: 6px; }
  .portal-link span, .header-count { display: none; }
  .title-block h1 { font-size: .9rem; }
  .title-block p { font-size: .63rem; }
  .side-panel { bottom: 0; box-shadow: 4px 0 18px rgb(20 40 35 / 18%); left: 0; position: absolute; top: 0; }
  .workspace.panel-collapsed .side-panel { box-shadow: none; }
  .panel-toggle { top: 10px; }
  .map-legend { display: none; }
}
