/* ============================================================================
   塗り絵日本地図 — スタイル
   ========================================================================= */

:root {
  --font: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN",
          "Noto Sans JP", "Yu Gothic", Meiryo, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  --r-sm: 7px;
  --r-md: 11px;
  --r-lg: 16px;
  --rail: 296px;
  --topbar-h: 56px;
  --ease: cubic-bezier(.4, 0, .2, 1);
}

/* ── ダーク（既定） ─────────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:        #0a0d13;
  --bg-2:      #0f131c;
  --surface:   #141926;
  --surface-2: #1b2233;
  --line:      #232c40;
  --line-soft: #1a2130;
  --text:      #e8ecf5;
  --text-2:    #98a3ba;
  --text-3:    #647089;
  --accent:    #4f9cff;
  --accent-2:  #7db8ff;
  --accent-ink:#04101f;
  --danger:    #ff6b6b;
  --ok:        #34d399;

  --sea:       #0b1220;
  --sea-2:     #0d1626;
  --land:      #2b3446;
  --land-hi:   #39445c;
  --border-in: rgba(148,163,184,.30);
  --border-pref: rgba(186,205,235,.62);
  --border-coast: rgba(210,228,255,.85);
  --label:     #dbe4f2;
  --label-halo:#0b1220;
  --grat:      rgba(120,150,200,.09);
  --shadow:    0 18px 44px rgba(0,0,0,.55), 0 2px 8px rgba(0,0,0,.4);
}

/* ── ライト ───────────────────────────────────────────────────────── */
[data-theme="light"] {
  --bg:        #eef1f6;
  --bg-2:      #f6f8fb;
  --surface:   #ffffff;
  --surface-2: #f2f5f9;
  --line:      #dce2ec;
  --line-soft: #e9edf4;
  --text:      #161d2b;
  --text-2:    #5b6779;
  --text-3:    #8d99ac;
  --accent:    #1f6feb;
  --accent-2:  #175bc4;
  --accent-ink:#ffffff;
  --danger:    #d92b2b;
  --ok:        #0f9d63;

  --sea:       #dfe9f3;
  --sea-2:     #d6e3f0;
  --land:      #ffffff;
  --land-hi:   #eaf1fb;
  --border-in: rgba(70,90,120,.28);
  --border-pref: rgba(45,62,88,.55);
  --border-coast: rgba(28,42,66,.75);
  --label:     #1b2434;
  --label-halo:#ffffff;
  --grat:      rgba(70,110,160,.10);
  --shadow:    0 14px 36px rgba(30,45,70,.14), 0 1px 4px rgba(30,45,70,.08);
}

* { box-sizing: border-box; }

/* hidden 属性は必ず効かせる。
   ブラウザ標準の [hidden]{display:none} は作者スタイルに負けるため、
   display を持つ要素（.preflist など）が隠れなくなる事故を防ぐ。 */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
  overscroll-behavior: none;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  transition: background .35s var(--ease), color .35s var(--ease);
}

button, input, select { font: inherit; color: inherit; }
kbd {
  font: 500 11px/1.4 var(--mono);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--text-2);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ══════════════════════════ 起動画面 ═══════════════════════════════ */
.boot {
  position: fixed; inset: 0; z-index: 999;
  background: var(--bg);
  display: grid; place-items: center;
  transition: opacity .5s var(--ease), visibility .5s;
}
.boot.is-done { opacity: 0; visibility: hidden; }
.boot__inner { text-align: center; width: 260px; }
.boot__mark { color: var(--accent); margin-bottom: 14px; }
.boot__stroke {
  stroke-dasharray: 90;
  stroke-dashoffset: 90;
  animation: draw 1.6s var(--ease) infinite;
}
@keyframes draw {
  0%   { stroke-dashoffset: 90; opacity: .3; }
  55%  { stroke-dashoffset: 0;  opacity: 1; }
  100% { stroke-dashoffset: -90; opacity: .3; }
}
.boot__title { font-size: 17px; font-weight: 700; letter-spacing: .06em; margin-bottom: 20px; }
.boot__bar { height: 3px; background: var(--line); border-radius: 3px; overflow: hidden; }
.boot__bar span {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 3px;
  transition: width .3s var(--ease);
}
.boot__note { margin-top: 12px; font-size: 12px; color: var(--text-3); }

/* ══════════════════════════ ヘッダ ═════════════════════════════════ */
.topbar {
  height: var(--topbar-h);
  flex: none;
  display: flex; align-items: center; gap: 16px;
  padding: 0 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: relative; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand__mark { color: var(--accent); flex: none; }
.brand__text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand__text strong { font-size: 14.5px; letter-spacing: .02em; white-space: nowrap; }
.brand__text span { font-size: 11px; color: var(--text-3); white-space: nowrap; }

/* 検索 */
.search { position: relative; flex: 1; max-width: 440px; margin: 0 auto; }
.search > svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search input {
  width: 100%; height: 36px;
  padding: 0 34px 0 34px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  outline: none;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.search input::-webkit-search-cancel-button { display: none; }
.search input:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.search input::placeholder { color: var(--text-3); }
.search__hint { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.search input:focus ~ .search__hint { opacity: 0; }

.search__results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
  max-height: 380px; overflow-y: auto;
  padding: 5px;
  z-index: 60;
}
.sres {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: var(--r-sm);
  cursor: pointer; white-space: nowrap;
}
.sres:hover, .sres.is-on { background: var(--surface-2); }
.sres__dot { width: 9px; height: 9px; border-radius: 50%; flex: none; border: 1px solid var(--line); }
.sres__name { font-weight: 600; }
.sres__name em { font-style: normal; color: var(--accent); }
.sres__pref { font-size: 11.5px; color: var(--text-3); margin-left: auto; padding-left: 12px; }
.sres__empty { padding: 14px; text-align: center; color: var(--text-3); font-size: 12.5px; }

.topbar__actions { display: flex; align-items: center; gap: 6px; flex: none; }
.topbar__sep { width: 1px; height: 22px; background: var(--line); margin: 0 3px; }

/* ボタン */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, opacity .15s, transform .08s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn--ghost { color: var(--text-2); border-color: var(--line); }
.btn--ghost:hover { background: var(--surface-2); color: var(--text); }
.btn--primary { background: var(--accent); color: var(--accent-ink); font-weight: 650; }
.btn--primary:hover { background: var(--accent-2); }
.btn--danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.btn--danger:hover { background: color-mix(in srgb, var(--danger) 14%, transparent); }
.btn--lg { height: 40px; padding: 0 18px; }
.btn:disabled { opacity: .35; cursor: default; pointer-events: none; }

/* 正方形のアイコンボタン（パネル開閉） */
.btn--sq { width: 34px; padding: 0; flex: none; }
/* 開いているときだけ、アイコンの左列を塗って状態を示す */
.btn__fill { opacity: 0; transition: opacity .18s var(--ease); }
[aria-expanded="true"] .btn__fill { opacity: 1; }

.iconbtn {
  width: 30px; height: 30px; border: none; background: transparent;
  color: var(--text-3); border-radius: var(--r-sm); cursor: pointer; font-size: 15px;
}
.iconbtn:hover { background: var(--surface-2); color: var(--text); }

.linkbtn {
  border: none; background: transparent; color: var(--accent);
  font-size: 12px; cursor: pointer; padding: 2px 4px; border-radius: 5px;
}
.linkbtn:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }

/* ══════════════════════════ レイアウト ═════════════════════════════ */
/* 畳んだパネルは負のマージンで画面外へ出るため、はみ出しを切っておく */
.shell { flex: 1; display: flex; min-height: 0; overflow: hidden; }

.panel {
  width: var(--rail); flex: none;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  transition: margin-left .3s var(--ease);
  z-index: 30;
}
.panel.is-hidden { margin-left: calc(var(--rail) * -1); }
.panel__scroll { overflow-y: auto; overflow-x: hidden; flex: 1; scrollbar-width: thin; }
.panel__scroll::-webkit-scrollbar { width: 9px; }
.panel__scroll::-webkit-scrollbar-thumb { background: var(--line); border-radius: 9px; border: 3px solid var(--surface); }

.sect { padding: 16px 16px 18px; border-bottom: 1px solid var(--line-soft); }
.sect--last { border-bottom: none; }
.sect__h {
  font-size: 10.5px; font-weight: 700; letter-spacing: .13em;
  text-transform: uppercase; color: var(--text-3);
  margin: 0 0 11px;
}
.sect__hrow { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 11px; }
.sect__hrow .sect__h { margin: 0; }
.hint { font-size: 11px; color: var(--text-3); margin: 10px 0 0; }

/* ツール */
.tools { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.tool {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 11px 6px 9px;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  color: var(--text-2);
  cursor: pointer;
  transition: all .15s var(--ease);
}
.tool:hover { color: var(--text); background: var(--land-hi); }
.tool span { font-size: 11.5px; font-weight: 600; }
.tool.is-on {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  color: var(--accent);
}

/* カテゴリ */
.cats { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.cat {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 8px 7px 9px;
  border-radius: var(--r-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .14s, border-color .14s;
}
.cat:hover { background: var(--surface-2); }
.cat.is-on { background: var(--surface-2); border-color: var(--line); }
.cat.is-on .cat__key { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.cat__chip {
  width: 17px; height: 17px; border-radius: 5px; flex: none;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.22), 0 1px 2px rgba(0,0,0,.18);
}
.cat__name { flex: 1; font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat__n { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.cat__key {
  font: 500 10px/1 var(--mono); color: var(--text-3);
  border: 1px solid var(--line); border-radius: 4px;
  width: 16px; height: 16px; display: grid; place-items: center; flex: none;
}
.cat__edit {
  border: none; background: transparent; color: var(--text-3);
  cursor: pointer; padding: 2px; border-radius: 4px; opacity: 0; flex: none;
  display: grid; place-items: center;
}
.cat:hover .cat__edit { opacity: 1; }
.cat__edit:hover { color: var(--text); background: var(--line); }

/* ゲージ */
.gauge { position: relative; width: 148px; margin: 4px auto 14px; }
.gauge__svg { width: 100%; display: block; transform: rotate(-90deg); }
.gauge__track { fill: none; stroke: var(--surface-2); stroke-width: 11; }
.gauge__fill {
  fill: none; stroke: var(--accent); stroke-width: 11; stroke-linecap: round;
  stroke-dasharray: 314.16; stroke-dashoffset: 314.16;
  transition: stroke-dashoffset .6s var(--ease), stroke .3s;
}
.gauge__mid {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  pointer-events: none;
}
.gauge__mid b { font-size: 27px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.gauge__mid b i { font-size: 14px; font-style: normal; font-weight: 600; color: var(--text-3); margin-left: 1px; }
.gauge__mid span { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; margin-top: 1px; }

.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.metric {
  background: var(--surface-2); border-radius: var(--r-sm);
  padding: 8px 10px; display: flex; flex-direction: column;
}
.metric span { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.metric small { font-size: 10.5px; color: var(--text-3); margin-top: 1px; }

.breakdown { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.bd { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.bd__chip { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.bd__name { color: var(--text-2); }
.bd__bar { flex: 1; height: 5px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.bd__bar i { display: block; height: 100%; border-radius: 5px; transition: width .5s var(--ease); }
.bd__n { font-variant-numeric: tabular-nums; color: var(--text-3); min-width: 34px; text-align: right; }

.wide {
  width: 100%; height: 34px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); cursor: pointer; color: var(--text-2);
  font-size: 12.5px; font-weight: 600;
  transition: background .15s, color .15s, border-color .15s;
}
.wide:hover { background: var(--land-hi); color: var(--text); }
.wide--danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 32%, transparent); }
.wide--danger:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.stack { display: flex; flex-direction: column; gap: 7px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }

.preflist { margin-top: 10px; display: flex; flex-direction: column; gap: 3px; max-height: 320px; overflow-y: auto; }
.pf { display: flex; align-items: center; gap: 8px; font-size: 12px; padding: 3px 2px; cursor: pointer; border-radius: 5px; }
.pf:hover { background: var(--surface-2); }
.pf__name { width: 62px; flex: none; color: var(--text-2); }
.pf__bar { flex: 1; height: 6px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.pf__bar i { display: block; height: 100%; background: var(--accent); border-radius: 6px; transition: width .5s var(--ease); }
.pf__n { font-variant-numeric: tabular-nums; color: var(--text-3); min-width: 46px; text-align: right; font-size: 11px; }
.pf.is-full .pf__name { color: var(--ok); font-weight: 700; }
.pf.is-full .pf__bar i { background: var(--ok); }

.credit { font-size: 10.5px; color: var(--text-3); margin: 14px 0 0; line-height: 1.6; }

/* ══════════════════════════ 地図 ═══════════════════════════════════ */
.stage { position: relative; flex: 1; min-width: 0; background: var(--sea); overflow: hidden; }
#map { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
#map.is-panning { cursor: grabbing; }
#map.is-pannable { cursor: grab; }

.tip {
  position: absolute; z-index: 20; pointer-events: none;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-sm); box-shadow: var(--shadow);
  padding: 7px 11px; font-size: 12.5px;
  transform: translate(12px, 12px);
  max-width: 240px;
}
.tip b { display: block; font-size: 13.5px; font-weight: 700; }
.tip small { color: var(--text-3); font-size: 11px; }
.tip .tip__cat { display: inline-flex; align-items: center; gap: 5px; margin-top: 4px; font-size: 11.5px; }
.tip .tip__cat i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

.zoomer {
  position: absolute; right: 14px; top: 14px; z-index: 15;
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); overflow: hidden; box-shadow: var(--shadow);
}
.zoomer button {
  width: 34px; height: 32px; border: none; background: transparent;
  color: var(--text-2); cursor: pointer; display: grid; place-items: center; font-size: 15px;
}
.zoomer button + button { border-top: 1px solid var(--line-soft); }
.zoomer button:hover { background: var(--surface-2); color: var(--text); }

.legendbox {
  position: absolute; left: 14px; bottom: 40px; z-index: 15;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 9px 12px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 5px;
  max-width: 200px;
}
.legendbox:empty { display: none; }
.legendbox__row { display: flex; align-items: center; gap: 7px; font-size: 11.5px; }
.legendbox__row i { width: 10px; height: 10px; border-radius: 3px; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.2); }
.legendbox__row span { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legendbox__row b { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--text-3); font-weight: 600; }

.statusbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 14;
  height: 26px; display: flex; align-items: center; gap: 9px;
  padding: 0 14px; font-size: 11px; color: var(--text-3);
  background: linear-gradient(to top, color-mix(in srgb, var(--bg) 82%, transparent), transparent);
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}
.statusbar__dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-3); opacity: .6; }
.statusbar .is-saving { color: var(--accent); }

/* ══════════════════════════ モーダル ═══════════════════════════════ */
.modal {
  position: fixed; inset: 0; z-index: 200;
  background: color-mix(in srgb, #000 55%, transparent);
  backdrop-filter: blur(3px);
  display: grid; place-items: center;
  padding: 20px;
  animation: fadein .18s var(--ease);
}
@keyframes fadein { from { opacity: 0; } }
.modal[hidden] { display: none; }
.modal__box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  width: 100%; max-width: 430px;
  max-height: 90vh; display: flex; flex-direction: column;
  animation: pop .22s var(--ease);
}
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }
.modal__box--wide { max-width: 900px; }
.modal__box--sm { max-width: 350px; }
.modal__h {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 14px 14px 18px; border-bottom: 1px solid var(--line-soft);
  flex: none;
}
.modal__h h3 { margin: 0; font-size: 15px; font-weight: 700; }
.modal__body { padding: 18px; overflow-y: auto; }
.modal__foot { display: flex; gap: 8px; margin-top: 18px; }
.modal__foot--split { justify-content: space-between; }
.modal__foot .btn { flex: 1; }
.modal__foot--split .btn { flex: none; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 11.5px; font-weight: 650; color: var(--text-2); }
.field input[type=text], .field select {
  height: 36px; padding: 0 11px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input[type=text]:focus, .field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

.swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.swatches button {
  aspect-ratio: 1; border-radius: 6px; border: 2px solid transparent; cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.18);
  transition: transform .12s;
}
.swatches button:hover { transform: scale(1.12); }
.swatches button.is-on { border-color: var(--text); transform: scale(1.12); }
.customcolor {
  display: flex; align-items: center; gap: 9px; margin-top: 11px;
  font-size: 12px; color: var(--text-2); cursor: pointer;
}
.customcolor input[type=color] {
  width: 34px; height: 26px; padding: 0; border: 1px solid var(--line);
  border-radius: 6px; background: none; cursor: pointer;
}

.checks { display: flex; flex-direction: column; gap: 9px; margin: 4px 0 0; }
.check { display: flex; align-items: center; gap: 9px; font-size: 12.5px; cursor: pointer; color: var(--text-2); }
.check input, .opt input { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; flex: none; }

.opt {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 11px 0; border-bottom: 1px solid var(--line-soft); cursor: pointer;
}
.opt:first-child { padding-top: 0; }
.opt span { display: flex; flex-direction: column; gap: 2px; }
.opt b { font-size: 13px; font-weight: 650; }
.opt small { font-size: 11.5px; color: var(--text-3); line-height: 1.5; }

.shortcuts { margin-top: 16px; }
.shortcuts h4 { font-size: 10.5px; letter-spacing: .13em; text-transform: uppercase; color: var(--text-3); margin: 0 0 9px; }
.shortcuts dl { display: grid; grid-template-columns: auto 1fr; gap: 7px 14px; margin: 0; font-size: 12px; }
.shortcuts dt { display: flex; gap: 3px; }
.shortcuts dd { margin: 0; color: var(--text-3); }

/* 書き出し */
.export { display: grid; grid-template-columns: 1fr 300px; gap: 20px; }
.export__preview {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 12px;
  display: grid; place-items: center; min-height: 340px;
  background-image:
    linear-gradient(45deg, var(--line-soft) 25%, transparent 25%, transparent 75%, var(--line-soft) 75%),
    linear-gradient(45deg, var(--line-soft) 25%, transparent 25%, transparent 75%, var(--line-soft) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 8px 8px;
}
#exportPreview { max-width: 100%; max-height: 62vh; border-radius: 5px; box-shadow: 0 6px 20px rgba(0,0,0,.28); }
.export__form { display: flex; flex-direction: column; }
.export .modal__foot { flex-direction: column; margin-top: auto; padding-top: 18px; }

/* トースト */
.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%) translateY(8px);
  background: var(--surface); border: 1px solid var(--line);
  color: var(--text); padding: 10px 18px; border-radius: 999px;
  box-shadow: var(--shadow); font-size: 13px; font-weight: 600;
  z-index: 500; opacity: 0; transition: opacity .22s, transform .22s var(--ease);
  pointer-events: none; display: flex; align-items: center; gap: 8px;
}
.toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast[hidden] { display: none; }
.toast.is-err { border-color: var(--danger); color: var(--danger); }

/* ══════════════════════════ 狭い画面 ═══════════════════════════════ */
@media (max-width: 900px) {
  :root { --rail: 270px; }
  .panel {
    position: absolute; left: 0; top: 0; bottom: 0;
    box-shadow: var(--shadow);
  }
  .panel.is-hidden { margin-left: calc(var(--rail) * -1); box-shadow: none; }
  .shell { position: relative; }
  .brand__text { display: none; }
  .export { grid-template-columns: 1fr; }
  .export__preview { min-height: 200px; }
  #exportPreview { max-height: 34vh; }
}
@media (max-width: 620px) {
  .topbar { gap: 8px; padding: 0 10px; }
  .search { max-width: none; }
  .search__hint { display: none; }
  #btnExport span { display: none; }
  #btnUndo, #btnRedo { display: none; }
  .legendbox { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
