/* ===== 画面のテーマ（設定 → 画面のテーマで選ぶ。アカウントに保存）=====
   asset-ledger の 12 のデザインと同じ名前・配色。標準は「モダン」（:root の値。内部の名前は ai）
   色は app.css の変数を html[data-theme="…"] で上書きし、形の違いはクラスごとに書く */

/* ---------- 設定画面：テーマの選択 ---------- */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.theme-card { display: grid; gap: 4px; text-align: left; padding: 12px; border: 2px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); cursor: pointer; font: inherit; }
.theme-card:hover { border-color: var(--accent-line); }
.theme-card.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.theme-swatch { position: relative; height: 64px; border-radius: 6px; overflow: hidden; border: 1px solid rgba(0,0,0,.12); margin-bottom: 6px; }
.theme-swatch > .sw-head { position: absolute; left: 0; right: 0; top: 0; height: 14px; }
.theme-swatch > .sw-side { position: absolute; left: 0; top: 14px; bottom: 0; width: 30%; }
.theme-swatch > .sw-accent { position: absolute; right: 10px; bottom: 10px; width: 30px; height: 14px; border-radius: 4px; }
.theme-swatch > .sw-line { position: absolute; left: 38%; right: 12px; top: 26px; height: 6px; border-radius: 3px; opacity: .35; }
.theme-name { font-weight: 700; font-size: 16px; }
.theme-desc { font-size: 13px; color: var(--muted); line-height: 1.5; }

/* ===================== ミニマル ===================== */
html[data-theme="minimal"] {
  --accent: #2563eb; --accent-hover: #1d4ed8; --accent-soft: #eef4ff; --accent-line: #bfd3fb;
  --head-bg: #ffffff; --head-text: #111827; --head-muted: #6b7280; --head-line: #e5e7eb; --head-input: #f3f4f6; --head-hover: #f3f4f6;
  --head-active-bg: #2563eb; --head-active-text: #ffffff; --head-border: 1px solid #e5e7eb;
  --nav-bg: #ffffff; --nav-bg-2: #f3f4f6; --nav-text: #374151; --nav-muted: #9ca3af; --nav-root: #111827; --nav-hover: #f3f4f6;
  --nav-active-bg: #eef4ff; --nav-active-text: #1d4ed8; --nav-active-bar: #2563eb; --nav-icon: #6b7280; --nav-folder-front: #f3f4f6;
  --nav-sep: 1px solid #e5e7eb; --nav-border: 1px solid #e5e7eb;
  --folder-back: #2563eb; --folder-front: #eef4ff; --folder-line: #2563eb; --bg-soft: #f8fafc;
}
html[data-theme="minimal"] .tree-row.active::before { display: none; }
html[data-theme="minimal"] .card, html[data-theme="minimal"] .modal { box-shadow: none; }

/* ===================== レトロ（ドット絵風・紺と黄） ===================== */
html[data-theme="retro"] {
  --accent: #1f4e78; --accent-hover: #17324f; --accent-soft: #e8f0f8; --accent-line: #b9cde2;
  --head-bg: #1f4e78; --head-muted: #cfe0f1; --head-input: #17324f; --head-hover: #17324f; --head-active-bg: #ffc000; --head-active-text: #17324f;
  --head-shadow: 0 3px 0 #ffc000;
  --nav-bg: #17324f; --nav-bg-2: #214466; --nav-text: #e6eef7; --nav-root: #ffc000; --nav-hover: #214466;
  --nav-active-bg: #ffc000; --nav-active-text: #17324f; --nav-active-bar: transparent; --nav-active-shadow: 3px 3px 0 #0b1a2a;
  --nav-icon: #ffc000; --nav-folder-front: #fff3c4; --nav-sep: 2px dashed #335a80; --nav-radius: 0;
  --folder-back: #1f4e78; --folder-front: #fff3c4; --folder-line: #1f4e78; --bg: #f4f6f9; --bg-soft: #eaeef3; --radius: 2px;
}
html[data-theme="retro"] .tree-row.active .fi, html[data-theme="retro"] .tree-row.active .tree-area-icon { --folder-back: #17324f; color: #17324f; }
html[data-theme="retro"] .btn, html[data-theme="retro"] .input, html[data-theme="retro"] .card, html[data-theme="retro"] .modal, html[data-theme="retro"] .chip, html[data-theme="retro"] .tpl-card { border-radius: 2px; }
html[data-theme="retro"] .btn-primary, html[data-theme="retro"] .card, html[data-theme="retro"] .modal { box-shadow: 3px 3px 0 #17324f; }
html[data-theme="retro"] .page-title, html[data-theme="retro"] .site-name, html[data-theme="retro"] .modal-title { font-family: "MS Gothic", "Osaka-Mono", var(--mono); letter-spacing: .04em; }
html[data-theme="retro"] .badge { border-radius: 2px; }

/* ===================== ダーク・ネオン ===================== */
html[data-theme="dark"] {
  color-scheme: dark;
  --accent: #22d3ee; --accent-hover: #06b6d4; --accent-soft: #10242c; --accent-line: #155e75; --on-accent: #0b0d12;
  --head-bg: #0d0f14; --head-text: #e5e9ee; --head-muted: #8b949e; --head-line: #1f2937; --head-input: #161b22; --head-hover: #161b22;
  --head-active-bg: #22d3ee; --head-active-text: #0b0d12; --head-border: 1px solid rgba(34,211,238,.35);
  --nav-bg: #0d0f14; --nav-bg-2: #161b22; --nav-text: #c9d1d9; --nav-muted: #6e7681; --nav-root: #f472b6; --nav-hover: #161b22;
  --nav-active-bg: #161b22; --nav-active-text: #ffffff; --nav-active-bar: #22d3ee; --nav-icon: #22d3ee; --nav-folder-front: #10242c;
  --nav-sep: 1px solid #21262d; --nav-border: 1px solid #1f2937;
  --bg: #0b0d12; --panel: #11151c; --input-bg: #0d1117; --bg-soft: #161b22; --bg-hover: #1b2230; --line: #222a35; --line-strong: #30363d;
  --text: #e5e9ee; --muted: #8b949e; --code-bg: #1b2230; --pre-bg: #05070a; --pre-text: #c9d1d9; --toast-bg: #161b22;
  --danger: #f472b6; --danger-soft: #2a1220; --ok: #4ade80; --ok-soft: #10261a; --ok-line: #14532d; --warn: #fbbf24; --warn-soft: #2a2110; --warn-line: #4a3a10;
  --info: #93c5fd; --info-soft: #0f1d33; --info-line: #1e3a5f;
  --folder-back: #22d3ee; --folder-front: #10242c; --folder-line: #22d3ee; --file-bg: #161b22; --file-line: #3b4553;
  --shadow: 0 0 0 1px #222a35, 0 10px 30px rgba(0,0,0,.6);
}
html[data-theme="dark"] .tree-row.active .tree-label { text-shadow: 0 0 6px rgba(34,211,238,.8); }
html[data-theme="dark"] .brand-logo { filter: drop-shadow(0 0 5px rgba(34,211,238,.8)); }
html[data-theme="dark"] .btn-primary { box-shadow: 0 0 10px rgba(34,211,238,.45); }
html[data-theme="dark"] .page-title.accent { border-left-color: #f472b6; }
html[data-theme="dark"] .tree-root { font-family: Consolas, "Courier New", monospace; }
html[data-theme="dark"] .modal-backdrop { background: rgba(0,0,0,.7); }
html[data-theme="dark"] .badge-mock { background: #2a2110; color: #fbbf24; border-color: #4a3a10; }

/* ===================== かわいい ===================== */
html[data-theme="cute"] {
  --accent: #ff7aa2; --accent-hover: #f25a8a; --accent-soft: #ffeef4; --accent-line: #ffc6d8;
  --head-bg: #f78fb3; --head-text: #ffffff; --head-muted: #ffe8f0; --head-line: rgba(255,255,255,.5); --head-input: rgba(255,255,255,.25); --head-hover: rgba(255,255,255,.2);
  --head-active-bg: #ffffff; --head-active-text: #d94f7c; --head-shadow: 0 3px 0 #ffd0df;
  --nav-bg: #fff7ef; --nav-bg-2: #ffeef3; --nav-text: #5b4a52; --nav-muted: #b08f9c; --nav-root: #d94f7c; --nav-hover: #ffeef3;
  --nav-active-bg: #ffe3ec; --nav-active-text: #3d2f35; --nav-active-bar: #ff8fb1; --nav-icon: #ff8fb1; --nav-folder-front: #ffeef4;
  --nav-sep: 1px dashed #f2cfdb; --nav-border: 1px solid #f6dfe6; --nav-radius: 14px;
  --bg: #fff7fa; --bg-soft: #fff0f5; --bg-hover: #ffeef4; --line: #f6dbe5; --line-strong: #efc3d3; --text: #4a3a42; --muted: #9b8590;
  --folder-back: #ff8fb1; --folder-front: #ffeef4; --folder-line: #ff8fb1; --toast-bg: #5b4a52; --pre-bg: #5b4a52;
}
html[data-theme="cute"] .btn, html[data-theme="cute"] .badge, html[data-theme="cute"] .search-input { border-radius: 999px; }
html[data-theme="cute"] .input { border-radius: 12px; }
html[data-theme="cute"] .card, html[data-theme="cute"] .tpl-card, html[data-theme="cute"] .icon-item { border-radius: 18px; }
html[data-theme="cute"] .card { box-shadow: 0 3px 10px rgba(255,143,177,.14); }
html[data-theme="cute"] .modal { border-radius: 24px; }
html[data-theme="cute"] .page-title::after { content: " ♡"; color: #ff8fb1; font-weight: 400; }
html[data-theme="cute"] .tree-root::before { content: "♥"; color: #ff8fb1; font-size: 12px; margin-right: 2px; }
html[data-theme="cute"] .toast { border-radius: 999px; }

/* ===================== 和モダン ===================== */
html[data-theme="wa"] {
  --mincho: "Yu Mincho", "Hiragino Mincho ProN", "MS PMincho", serif;
  --accent: #2b3a55; --accent-hover: #1b2740; --accent-soft: #ece4d2; --accent-line: #c9bb98;
  --head-bg: #2b3a55; --head-text: #f5efe1; --head-muted: #c9c0ad; --head-line: rgba(245,239,225,.35); --head-input: #1f2b41; --head-hover: #1f2b41;
  --head-active-bg: #b7282e; --head-active-text: #ffffff;
  --nav-bg: #f5efe1; --nav-bg-2: #ebe1c8; --nav-text: #2b3a55; --nav-muted: #8a7f6a; --nav-root: #b7282e; --nav-hover: rgba(183,40,46,.06);
  --nav-active-bg: #ebe1c8; --nav-active-text: #1b2740; --nav-active-bar: #b7282e; --nav-icon: #b7282e; --nav-folder-front: #fbf8f0;
  --nav-sep: 1px solid #d9ccae; --nav-border: 1px solid #d9ccae; --nav-radius: 2px;
  --bg: #f3eee2; --panel: #fbf8f0; --input-bg: #fffdf7; --bg-soft: #ece4d2; --bg-hover: #efe7d4; --line: #ddd2b8; --line-strong: #cbbd9c;
  --text: #2b3a55; --muted: #7b7466; --danger: #b7282e; --radius: 2px;
  --folder-back: #2b3a55; --folder-front: #f3eee2; --folder-line: #2b3a55; --toast-bg: #2b3a55; --pre-bg: #2b3a55;
}
html[data-theme="wa"] .sidebar { background-image: radial-gradient(rgba(138,127,106,.1) 1px, transparent 1px); background-size: 6px 6px; }
html[data-theme="wa"] .page-title, html[data-theme="wa"] .site-name, html[data-theme="wa"] .tree, html[data-theme="wa"] .admin-nav,
html[data-theme="wa"] .modal-title, html[data-theme="wa"] .md h1, html[data-theme="wa"] .md h2, html[data-theme="wa"] .wiki-title, html[data-theme="wa"] .card h2 { font-family: var(--mincho); }
html[data-theme="wa"] .site-name, html[data-theme="wa"] .tree-root { letter-spacing: .15em; }
html[data-theme="wa"] .page-title.accent { border-left-color: #b7282e; }
html[data-theme="wa"] .card, html[data-theme="wa"] .modal, html[data-theme="wa"] .tpl-card, html[data-theme="wa"] .chip, html[data-theme="wa"] .badge { border-radius: 2px; box-shadow: none; }
html[data-theme="wa"] .badge-read, html[data-theme="wa"] .badge-ver { background: #b7282e; }
html[data-theme="wa"] .md h2 { border-bottom: 2px solid #b7282e; }

/* ===================== 手書きノート ===================== */
html[data-theme="note"] {
  --hand: "UD Digi Kyokasho N-R", "UD デジタル 教科書体 N-R", "UD Digi Kyokasho NK-R", "Yu Gothic UI", sans-serif;
  --font: var(--hand);
  --accent: #2f6fb3; --accent-hover: #255a92; --accent-soft: #eef4fb; --accent-line: #b8d0ea;
  --head-bg: #3b4a5a; --head-muted: #c7d0da; --head-input: #2f3b48; --head-hover: #2f3b48; --head-active-bg: #fff27a; --head-active-text: #333;
  --nav-bg: #fffdf6; --nav-bg-2: #f6f1e2; --nav-text: #333333; --nav-muted: #9a9384; --nav-root: #e53935; --nav-hover: rgba(255,242,122,.4);
  --nav-active-bg: transparent; --nav-active-text: #111; --nav-active-bar: transparent; --nav-icon: #333; --nav-folder-front: #fffdf6;
  --nav-sep: 1px solid #e8e1cf; --nav-border: 1px solid #e8e1cf; --nav-radius: 0;
  --bg: #fffdf6; --bg-soft: #f8f4e8; --bg-hover: #fff9d6; --line: #e3dccb; --line-strong: #b9b2a2; --text: #333333; --muted: #7a7568; --danger: #e53935;
  --folder-back: #2f6fb3; --folder-front: #fffdf6; --folder-line: #333; --file-line: #333; --toast-bg: #fffdf6; --toast-text: #333;
}
html[data-theme="note"] .main, html[data-theme="note"] .sidebar { background-image: repeating-linear-gradient(transparent 0 31px, #e3ecf7 31px 32px); background-attachment: local; }
html[data-theme="note"] .sidebar { background-image: linear-gradient(90deg, transparent 6px, rgba(229,57,53,.45) 6px 7px, transparent 7px 9px, rgba(229,57,53,.45) 9px 10px, transparent 10px), repeating-linear-gradient(transparent 0 44px, #cddcf0 44px 45px); }
html[data-theme="note"] .tree-row.active .tree-label { background: linear-gradient(transparent 55%, #fff27a 55%); padding: 0 2px; }
html[data-theme="note"] .page-title, html[data-theme="note"] .md h1 { display: inline-block; background: linear-gradient(transparent 60%, #fff27a 60%); padding: 0 4px; border-left: 0; }
html[data-theme="note"] .card, html[data-theme="note"] .modal { border: 1.5px solid #333; border-radius: 6px 12px 7px 10px; box-shadow: 2px 3px 0 rgba(0,0,0,.12); }
html[data-theme="note"] .btn { border: 1.5px solid #333; border-radius: 10px 6px 11px 7px; }
html[data-theme="note"] .input { border-radius: 6px 9px 7px 8px; }
html[data-theme="note"] .table th { color: #333; background: linear-gradient(transparent 62%, #fff6a6 62%); }
html[data-theme="note"] .toast { border: 1.5px solid #333; box-shadow: 2px 2px 0 #333; }

/* ===================== ポップ ===================== */
html[data-theme="pop"] {
  --accent: #ff5fa2; --accent-hover: #ff3d8c; --accent-soft: #fff1a8; --accent-line: #111; --on-accent: #111;
  --head-bg: #111111; --head-text: #ffffff; --head-muted: #ffd23f; --head-line: #ffd23f; --head-input: #2a2a2a; --head-hover: #2a2a2a;
  --head-active-bg: #ffd23f; --head-active-text: #111; --head-shadow: 0 4px 0 #ffd23f;
  --nav-bg: #fff3c4; --nav-bg-2: #ffe08a; --nav-text: #111111; --nav-muted: #6b5a1e; --nav-root: #111; --nav-hover: #ffe08a;
  --nav-active-bg: #ff7eb6; --nav-active-text: #111; --nav-active-bar: transparent; --nav-active-shadow: 3px 3px 0 #111, inset 0 0 0 2px #111;
  --nav-icon: #111; --nav-folder-front: #ffffff; --nav-sep: 2px solid #111; --nav-border: 3px solid #111; --nav-radius: 10px;
  --bg: #fffbea; --bg-soft: #fff1a8; --bg-hover: #fff6c9; --line: #ece1b8; --line-strong: #111; --text: #111111; --muted: #5c5a52;
  --folder-back: #3ec1ff; --folder-front: #ffffff; --folder-line: #111; --file-line: #111; --toast-bg: #111;
}
html[data-theme="pop"] .tree-row { font-weight: 700; }
html[data-theme="pop"] .page-title { display: inline-block; background: #ffd23f; padding: 2px 12px; border: 2.5px solid #111 !important; border-radius: 10px; box-shadow: 3px 3px 0 #111; }
html[data-theme="pop"] .card, html[data-theme="pop"] .tpl-card { border: 2.5px solid #111; border-radius: 14px; box-shadow: 4px 4px 0 #111; }
html[data-theme="pop"] .modal { border: 3px solid #111; border-radius: 16px; box-shadow: 6px 6px 0 #111; }
html[data-theme="pop"] .btn { border: 2px solid #111; border-radius: 10px; font-weight: 700; box-shadow: 2px 2px 0 #111; }
html[data-theme="pop"] .btn:active { transform: translate(2px, 2px); box-shadow: none; }
html[data-theme="pop"] .input { border: 2px solid #111; }
html[data-theme="pop"] .table th { color: #111; background: #fff1a8; border-bottom: 2px solid #111; }
html[data-theme="pop"] .badge { border: 1.5px solid #111; border-radius: 6px; }
html[data-theme="pop"] .chip.active, html[data-theme="pop"] .tab.active { box-shadow: 2px 2px 0 #111; }
html[data-theme="pop"] .toast { border: 2px solid #ffd23f; box-shadow: 3px 3px 0 #ff5fa2; }

/* ===================== 黒板 ===================== */
html[data-theme="chalk"] {
  color-scheme: dark;
  --hand: "UD Digi Kyokasho N-R", "UD デジタル 教科書体 N-R", "Yu Gothic UI", sans-serif;
  --font: var(--hand);
  --accent: #f4e07a; --accent-hover: #f8ea9c; --accent-soft: #375a46; --accent-line: rgba(241,239,228,.35); --on-accent: #28402f;
  --head-bg: #7a5230; --head-text: #fdf6e6; --head-muted: #e8d3b0; --head-line: rgba(253,246,230,.4); --head-input: #5e3e23; --head-hover: #5e3e23;
  --head-active-bg: #f4e07a; --head-active-text: #28402f; --head-shadow: 0 4px 0 #5e3e23;
  --nav-bg: #28402f; --nav-bg-2: #31503b; --nav-text: #e9e7dc; --nav-muted: #a8b5a5; --nav-root: #f4e07a; --nav-hover: rgba(255,255,255,.05);
  --nav-active-bg: transparent; --nav-active-text: #ffffff; --nav-active-bar: transparent; --nav-active-shadow: inset 0 0 0 2px rgba(244,224,122,.85);
  --nav-icon: #9fd3f0; --nav-folder-front: #28402f; --nav-sep: 1px dashed rgba(255,255,255,.25); --nav-border: 12px solid #7a5230; --nav-radius: 40% 30% 45% 35% / 60% 50% 55% 45%;
  --bg: #2f4a3a; --panel: #2c4636; --input-bg: #28402f; --bg-soft: #375a46; --bg-hover: #3a5f4a; --line: rgba(241,239,228,.24); --line-strong: rgba(241,239,228,.45);
  --text: #f1efe4; --muted: #b9c4b5; --code-bg: #28402f; --pre-bg: #1f3326; --pre-text: #f1efe4; --toast-bg: #22382b;
  --danger: #f5a8bf; --danger-soft: #5a3340; --ok: #b8e08f; --ok-soft: #2e4a33; --ok-line: #4d6b45; --warn: #f4c27a; --warn-soft: #4a4a2a; --warn-line: #6a6a3a;
  --info: #9fd3f0; --info-soft: #2a4650; --info-line: #3f6470;
  --folder-back: #9fd3f0; --folder-front: #2f4a3a; --folder-line: #f1efe4; --file-bg: #2f4a3a; --file-line: #f1efe4; --shadow: 0 0 0 1px rgba(241,239,228,.2);
}
html[data-theme="chalk"] .main { border: 10px solid #7a5230; border-left: 0; border-right: 0; }
html[data-theme="chalk"] .card, html[data-theme="chalk"] .modal, html[data-theme="chalk"] .tpl-card { border: 1.5px dashed rgba(241,239,228,.5); }
html[data-theme="chalk"] .page-title, html[data-theme="chalk"] .md h1, html[data-theme="chalk"] .md h2 { color: #f4e07a; text-shadow: 0 0 1px rgba(244,224,122,.6); }
html[data-theme="chalk"] .page-title.accent { border-left: 0; text-decoration: underline wavy rgba(244,224,122,.6); text-underline-offset: 8px; padding-left: 0; }
html[data-theme="chalk"] .btn-primary { color: #28402f; }

/* ===================== コルクボード ===================== */
html[data-theme="cork"] {
  --hand: "UD Digi Kyokasho N-R", "UD デジタル 教科書体 N-R", "Yu Gothic UI", sans-serif;
  --accent: #b5462f; --accent-hover: #943925; --accent-soft: #f6ecd6; --accent-line: #e0c79c;
  --head-bg: #6b4423; --head-text: #fff3e0; --head-muted: #e9c99a; --head-line: rgba(233,201,154,.5); --head-input: #563519; --head-hover: #563519;
  --head-active-bg: #fff59d; --head-active-text: #3b2a1a;
  --nav-bg: #c8955a; --nav-bg-2: #b98549; --nav-text: #3b2a1a; --nav-muted: #3b2a1a; --nav-root: #3b2a1a; --nav-hover: rgba(255,255,255,.35);
  --nav-active-bg: #fff59d; --nav-active-text: #3b2a1a; --nav-active-bar: transparent; --nav-active-shadow: 2px 3px 5px rgba(0,0,0,.32);
  --nav-icon: #6b4423; --nav-folder-front: #fffdf5; --nav-sep: 2px dashed rgba(59,42,26,.35); --nav-border: 10px solid #7a4e2a; --nav-radius: 1px;
  --bg: #c8955a; --panel: #fffdf5; --bg-soft: #f6ecd6; --bg-hover: #fbf3df; --line: #e7dcc4; --line-strong: #cbb894; --text: #3b2a1a; --muted: #7a6650;
  --folder-back: #b5462f; --folder-front: #fff59d; --folder-line: #6b4423;
}
html[data-theme="cork"] .sidebar, html[data-theme="cork"] .main { background-color: #c8955a; background-image: radial-gradient(rgba(90,55,25,.35) 1px, transparent 1.5px), radial-gradient(rgba(255,235,200,.3) 1px, transparent 1.5px); background-size: 7px 7px, 11px 11px; background-position: 0 0, 3px 5px; }
html[data-theme="cork"] .tree-root { display: inline-flex; background: #d9b98c; box-shadow: 1px 2px 3px rgba(0,0,0,.3); font-family: var(--hand); }
html[data-theme="cork"] .tree-row.active { transform: rotate(-1deg); }
html[data-theme="cork"] .tree-row.active::after { content: ""; position: absolute; right: 10px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ff8a80, #c62828); box-shadow: 1px 2px 2px rgba(0,0,0,.4); }
html[data-theme="cork"] .card, html[data-theme="cork"] .modal, html[data-theme="cork"] .tpl-card { border: 0; border-radius: 1px; box-shadow: 2px 4px 8px rgba(0,0,0,.35); }
html[data-theme="cork"] .page-title { display: inline-block; background: #fff59d; padding: 6px 16px; border-left: 0 !important; box-shadow: 2px 3px 6px rgba(0,0,0,.3); transform: rotate(-1deg); font-family: var(--hand); }
html[data-theme="cork"] .toolbar, html[data-theme="cork"] .statusbar { background: rgba(255,253,245,.92); }
html[data-theme="cork"] .content { background: rgba(255,253,245,.9); margin: 12px; border-radius: 2px; box-shadow: 2px 4px 8px rgba(0,0,0,.3); }

/* ===================== 廃墟 ===================== */
html[data-theme="ruins"] {
  --accent: #8a3d14; --accent-hover: #6b3518; --accent-soft: #d9d3c4; --accent-line: #a4501f; --on-accent: #f3e6d0;
  --head-bg: #4a3a2e; --head-text: #e8dcc6; --head-muted: #c4b59c; --head-line: rgba(232,220,198,.3); --head-input: #3b2e24; --head-hover: #3b2e24;
  --head-active-bg: #6b3518; --head-active-text: #f3e6d0; --head-border: 0; --head-shadow: 0 4px 0 #2a2926;
  --nav-bg: #3b3a36; --nav-bg-2: #4a4843; --nav-text: #c9c6bd; --nav-muted: #a29c8d; --nav-root: #6d8f3e; --nav-hover: rgba(255,255,255,.05);
  --nav-active-bg: #6b3518; --nav-active-text: #f3e6d0; --nav-active-bar: transparent; --nav-active-shadow: inset 0 0 0 1px rgba(0,0,0,.4), 2px 2px 0 rgba(0,0,0,.35);
  --nav-icon: #a8a395; --nav-folder-front: #5f5b52; --nav-sep: 1px solid rgba(255,255,255,.08); --nav-border: 4px solid #2a2926; --nav-radius: 0;
  --bg: #8d8a83; --panel: #e6e2d8; --input-bg: #efebe2; --bg-soft: #d9d3c4; --bg-hover: #ddd7c9; --line: #c4bdae; --line-strong: #a8a395;
  --text: #2b2a27; --muted: #5f5b52; --danger: #9c2b1c; --ok: #4d6b2a; --radius: 0;
  --folder-back: #6b3518; --folder-front: #d9d3c4; --folder-line: #2b2a27; --toast-bg: #3b3a36;
}
html[data-theme="ruins"] .main { background-image: linear-gradient(115deg, transparent 48%, rgba(0,0,0,.18) 49%, transparent 50%), linear-gradient(35deg, transparent 70%, rgba(0,0,0,.12) 71%, transparent 72%), radial-gradient(rgba(0,0,0,.08) 1px, transparent 1.5px); background-size: 600px 400px, 500px 500px, 5px 5px; }
html[data-theme="ruins"] .sidebar { background-image: linear-gradient(180deg, rgba(109,143,62,.25), transparent 30%); }
html[data-theme="ruins"] .tree-row.active .fi, html[data-theme="ruins"] .tree-row.active .tree-area-icon { animation: ruins-flicker 6s infinite; }
@keyframes ruins-flicker { 0%, 93%, 100% { opacity: 1; } 94% { opacity: .3; } 95% { opacity: 1; } 96% { opacity: .5; } }
@media (prefers-reduced-motion: reduce) { html[data-theme="ruins"] .tree-row.active .fi, html[data-theme="ruins"] .tree-row.active .tree-area-icon { animation: none; } }
html[data-theme="ruins"] .card, html[data-theme="ruins"] .modal, html[data-theme="ruins"] .btn, html[data-theme="ruins"] .input, html[data-theme="ruins"] .tpl-card, html[data-theme="ruins"] .chip, html[data-theme="ruins"] .badge { border-radius: 0; }
html[data-theme="ruins"] .page-title.accent { border-left: 0; padding-bottom: 10px; border-bottom: 10px solid transparent; border-image: repeating-linear-gradient(-45deg, #f1c40f 0 12px, #222 12px 24px) 10; }
html[data-theme="ruins"] .card { box-shadow: 3px 3px 0 rgba(0,0,0,.25); }

/* ===================== 大正浪漫 ===================== */
html[data-theme="taisho"] {
  --mincho: "Yu Mincho", "Hiragino Mincho ProN", "MS PMincho", serif;
  --accent: #6c2c2f; --accent-hover: #521f22; --accent-soft: #f3e6d2; --accent-line: #c5a05a;
  --head-bg: #6c2c2f; --head-text: #fffaf0; --head-muted: #e8d3a2; --head-line: #c5a05a; --head-input: #521f22; --head-hover: #521f22;
  --head-active-bg: #c5a05a; --head-active-text: #3a2a24; --head-border: 4px double #c5a05a;
  --nav-bg: #f6efe2; --nav-bg-2: #fffaf0; --nav-text: #3a2a24; --nav-muted: #7a4171; --nav-root: #6c2c2f; --nav-hover: #fffaf0;
  --nav-active-bg: #6c2c2f; --nav-active-text: #fffaf0; --nav-active-bar: transparent; --nav-active-shadow: inset 0 0 0 3px #f6efe2, inset 0 0 0 4px #c5a05a;
  --nav-icon: #7a4171; --nav-folder-front: #fffaf0; --nav-sep: 3px double #c5a05a; --nav-border: 3px double #6c2c2f; --nav-radius: 2px;
  --bg: #f6efe2; --panel: #fffaf0; --bg-soft: #f3e6d2; --bg-hover: #f7ecda; --line: #d8c7a6; --line-strong: #b49a6a; --text: #3a2a24; --muted: #7d6a58;
  --danger: #9e2a2b; --ok: #2f5d50; --radius: 2px;
  --folder-back: #6c2c2f; --folder-front: #f6efe2; --folder-line: #6c2c2f; --toast-bg: #6c2c2f; --pre-bg: #3a2a24;
}
html[data-theme="taisho"] .page-title, html[data-theme="taisho"] .site-name, html[data-theme="taisho"] .tree, html[data-theme="taisho"] .admin-nav,
html[data-theme="taisho"] .modal-title, html[data-theme="taisho"] .md h1, html[data-theme="taisho"] .md h2, html[data-theme="taisho"] .wiki-title, html[data-theme="taisho"] .card h2 { font-family: var(--mincho); }
html[data-theme="taisho"] .page-title { letter-spacing: .12em; color: #6c2c2f; }
html[data-theme="taisho"] .site-name { letter-spacing: .25em; }
html[data-theme="taisho"] .tree-root { letter-spacing: .3em; }
html[data-theme="taisho"] .tree-row.active .fi { --folder-back: #e8d3a2; --folder-front: #6c2c2f; --folder-line: #e8d3a2; }
html[data-theme="taisho"] .card, html[data-theme="taisho"] .tpl-card { border: 3px double #b49a6a; border-radius: 3px; box-shadow: none; }
html[data-theme="taisho"] .modal { border: 3px double #6c2c2f; border-radius: 4px; }
html[data-theme="taisho"] .btn, html[data-theme="taisho"] .input, html[data-theme="taisho"] .chip, html[data-theme="taisho"] .badge { border-radius: 2px; }
html[data-theme="taisho"] .md h2 { border-bottom: 3px double #c5a05a; }

/* 印刷（PDF 保存）はテーマにかかわらず白地に黒 */
@media print { html[data-theme] { --text: #000; --bg: #fff; --panel: #fff; } }
