/* 造島工坊：三組底色 token（奶茶米／海霧藍／夜海） */
:root,
:root[data-theme="cream"] {
  --bg: #f6f0e4;
  --bg2: #efe6d4;
  --surface: #fffaf1;
  --ink: #3b3226;
  --muted: #74664f;
  --line: #e2d5bd;
  --primary: #2f7a6b;
  --primary-ink: #ffffff;
  --accent: #c86a22;
  --soft: #e6f1ec;
  --danger: #b4452f;
  --danger-soft: #fbe7e1;
  --shadow: 0 10px 30px rgba(80, 60, 30, .10);
  --shadow-sm: 0 2px 8px rgba(80, 60, 30, .08);
  color-scheme: light;
}
:root[data-theme="sea"] {
  --bg: #dcebee;
  --bg2: #cfe2e6;
  --surface: #f7fbfc;
  --ink: #1f3640;
  --muted: #4a6670;
  --line: #bcd6dc;
  --primary: #1f6f8b;
  --primary-ink: #ffffff;
  --accent: #b86a0e;
  --soft: #e3f1f5;
  --danger: #b2402e;
  --danger-soft: #f8e4df;
  --shadow: 0 10px 30px rgba(20, 60, 80, .12);
  --shadow-sm: 0 2px 8px rgba(20, 60, 80, .10);
  color-scheme: light;
}
:root[data-theme="night"] {
  --bg: #16222e;
  --bg2: #1c2b39;
  --surface: #213244;
  --ink: #e9eff3;
  --muted: #a9b9c5;
  --line: #36506a;
  --primary: #5cc8b0;
  --primary-ink: #0f1d26;
  --accent: #ffb65c;
  --soft: #24404a;
  --danger: #ff8a75;
  --danger-soft: #3a2a2c;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

:root { --gutter: clamp(16px, 2.6vw, 48px); }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.65 "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  transition: background .3s, color .3s;
}
a { color: var(--primary); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 6px 12px; z-index: 50; border-radius: 8px; }
.skip:focus { left: 8px; }
em { color: var(--danger); font-style: normal; }
code { padding: 1px 6px; border-radius: 6px; background: var(--bg2); font-size: 14px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

/* 頂列 */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 24px;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; min-width: 0; }
.brand-text strong { display: block; font-size: 20px; letter-spacing: 2px; line-height: 1.2; white-space: nowrap; }
.brand-text small { display: block; font-size: 12px; color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 8px; }
.theme-switch { display: flex; gap: 2px; padding: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; }
.theme-switch button {
  display: flex; align-items: center; gap: 6px; border: 0; background: transparent;
  min-height: 36px; padding: 4px 11px; border-radius: 999px; cursor: pointer; font-size: 14px;
}
.theme-switch i { width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(0,0,0,.25); flex: none; }
.theme-switch button[aria-pressed="true"] { background: var(--primary); color: var(--primary-ink); font-weight: 700; }
.theme-switch button:not([aria-pressed="true"]):hover { background: var(--soft); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 8px 16px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); cursor: pointer; font-weight: 500; white-space: nowrap;
  color: var(--ink); text-decoration: none;
  transition: transform .1s, background .2s, box-shadow .2s;
}
.btn:hover { background: var(--soft); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); box-shadow: var(--shadow-sm); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.big { min-height: 54px; padding: 12px 26px; font-size: 18px; font-weight: 700; border-radius: 14px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.btn.danger-btn { background: var(--danger); border-color: var(--danger); color: #fff; }
.icon-btn span[aria-hidden] { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 2px solid currentColor; font-weight: 700; font-size: 13px; }

.menu { position: relative; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 240px;
  display: grid; padding: 6px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); z-index: 40;
}
.menu-list button, .menu-list .as-btn {
  text-align: left; border: 0; background: transparent; padding: 11px 12px; border-radius: 8px; cursor: pointer; font-weight: 400; margin: 0; display: block;
}
.menu-list button:hover, .menu-list .as-btn:hover, .menu-list .as-btn:focus-visible { background: var(--soft); }
.menu-list .danger { color: var(--danger); }

/* 首屏 */
.hero { padding: 28px var(--gutter) 4px; }
.eyebrow { margin: 0 0 6px; color: var(--primary); font-weight: 700; font-size: 15px; letter-spacing: 1px; }
.hero h1 { margin: 0 0 14px; font-size: clamp(26px, 3.6vw, 40px); line-height: 1.35; font-weight: 900; }
.hl { color: var(--primary); background: linear-gradient(transparent 62%, color-mix(in srgb, var(--accent) 35%, transparent) 62%); padding: 0 2px; }
.flow { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0; padding: 0; margin: 0 0 18px; list-style: none; color: var(--muted); font-weight: 500; }
.flow li { display: flex; align-items: center; gap: 6px; }
.flow li:not(:last-child)::after { content: "→"; margin: 0 12px; color: var(--line); font-weight: 700; }
.flow b {
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 13px;
}
:root[data-theme="night"] .flow b { color: #1b1408; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; }

/* 版面 */
.layout {
  display: grid; grid-template-columns: 210px minmax(0, 1fr) minmax(340px, 34vw);
  gap: 24px; padding: 20px var(--gutter) 40px; align-items: start;
}
.steps { position: sticky; top: 84px; display: grid; gap: 4px; }
.progress { height: 6px; border-radius: 999px; background: var(--bg2); overflow: hidden; margin: 4px 4px 10px; }
.progress i { display: block; height: 100%; width: 0; background: var(--primary); border-radius: inherit; transition: width .4s; }
.steps button {
  display: flex; align-items: center; gap: 10px; text-align: left; min-height: 48px;
  padding: 8px 12px; border: 1px solid transparent; border-radius: 12px; background: transparent; cursor: pointer;
}
.steps button:hover { background: var(--surface); }
.steps button b {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--bg2); border: 1px solid var(--line); flex: none; font-size: 14px;
}
.steps button[aria-current="step"] { background: var(--surface); border-color: var(--line); font-weight: 700; box-shadow: var(--shadow-sm); }
.steps button[aria-current="step"] b { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.steps button.done b { background: var(--soft); border-color: var(--primary); color: var(--primary); font-size: 0; }
.steps button.done b::after { content: "✓"; font-size: 16px; font-weight: 700; }

.panel {
  position: relative;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  padding: 26px 26px 0; box-shadow: var(--shadow); min-width: 0; outline: none;
}
.step-no { margin: 0; color: var(--primary); font-weight: 700; font-size: 14px; letter-spacing: 1px; }
.step h2 { margin: 2px 0 4px; font-size: 26px; line-height: 1.35; }
.step h3 { margin: 26px 0 6px; font-size: 18px; }
.hint { margin: 0 0 16px; color: var(--muted); }
.hint.sub { margin: 18px 0 8px; }
.note { color: var(--muted); font-size: 14px; }

.field { display: grid; gap: 5px; margin-bottom: 16px; }
.field > label { font-weight: 700; }
.field small { color: var(--muted); font-size: 13px; }
.err { margin: 0; color: var(--danger); font-size: 14px; font-weight: 500; }
.err::before { content: "⚠ "; }
input:not([type]), input[type="text"], input[type="url"], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg);
  font-weight: 400; transition: border-color .2s, box-shadow .2s;
}
select { cursor: pointer; }
textarea { resize: vertical; line-height: 1.6; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent); }
input.invalid, textarea.invalid { border-color: var(--danger); background: var(--danger-soft); }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 400; margin: 0; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--primary); flex: none; cursor: pointer; }
.check small { display: block; color: var(--muted); font-size: 13px; }
.check.big { margin: 18px 0 4px; padding: 14px; border: 1px dashed var(--line); border-radius: 12px; }

/* 島型卡 */
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 255px), 1fr)); gap: 14px; }
.type-card {
  --c1: var(--primary); --c2: var(--accent);
  position: relative; display: grid; grid-template-columns: 56px 1fr; gap: 4px 14px; align-items: start; text-align: left;
  padding: 18px; border: 2px solid var(--line); border-radius: 16px; background: var(--bg); cursor: pointer;
  transition: border-color .2s, transform .15s, box-shadow .2s;
}
.type-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.type-card[aria-pressed="true"] { border-color: var(--primary); background: var(--soft); }
.type-card[aria-pressed="true"]::after {
  content: "✓ 已選"; position: absolute; top: 12px; right: 12px; padding: 2px 10px;
  background: var(--primary); color: var(--primary-ink); border-radius: 999px; font-size: 13px; font-weight: 700;
}
.type-card svg { grid-row: span 3; width: 56px; height: 56px; }
.type-card strong { font-size: 19px; padding-right: 64px; }
.type-card p { margin: 0; color: var(--muted); font-size: 15px; }
.type-card small { color: var(--primary); font-weight: 500; font-size: 14px; }

/* 島嶼表 */
.table-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.count { margin-left: auto; color: var(--muted); font-size: 14px; }
.paste-box { padding: 14px; margin-bottom: 14px; border: 1px dashed var(--primary); border-radius: 12px; background: var(--soft); }
.import-lead { margin: 0 0 10px; font-size: 15px; }
.import-steps { margin: 0 0 12px; padding: 0; list-style: none; display: grid; gap: 10px; }
.import-steps > li { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: start; padding: 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); }
.import-steps > li > div { display: grid; gap: 4px; }
.import-steps .no { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: #fff; font-size: 15px; }
.import-steps > li.done .no { background: var(--accent); }
.import-steps > li.done .no::before { content: "✓"; }
.import-steps > li.done .no { font-size: 0; }
.import-steps > li.done .no::before { font-size: 16px; }
.import-steps strong { font-size: 16px; }
.import-steps .btn { margin: 0; align-self: center; white-space: nowrap; }
.import-steps span { color: var(--muted); font-size: 14px; }
.import-steps .check { font-size: 14px; margin-top: 4px; }
#impNeedTpl { color: var(--accent); font-weight: 500; }
.imp-rules { margin: 2px 0 0; padding-left: 1.2em; font-size: 14px; color: var(--muted); display: grid; gap: 2px; }
.imp-rules b { color: var(--ink); }
.paste-alt summary { cursor: pointer; font-size: 14px; color: var(--muted); padding: 6px 0; }
.hint.or { margin: 6px 0 8px; font-size: 14px; }
@media (max-width: 860px) {
  .import-steps > li { grid-template-columns: 30px 1fr; }
  .import-steps .btn { grid-column: 1 / -1; justify-self: stretch; text-align: center; }
}
.row-end { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 10px; }
.island-table { display: grid; gap: 10px; }
.isle-row {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; align-items: start;
  padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg);
  transition: border-color .2s, box-shadow .2s;
}
.isle-row:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.isle-row.flash { animation: flash 1.2s; }
@keyframes flash { 0%, 40% { background: color-mix(in srgb, var(--accent) 22%, var(--bg)); } }
.isle-row.dragging { opacity: .5; }
.isle-row.drop-target { outline: 2px dashed var(--primary); }
.isle-row .side { display: grid; gap: 4px; justify-items: center; }
.isle-row .num {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary); color: var(--primary-ink); font-size: 14px; font-weight: 700; cursor: grab;
}
.isle-row .side button {
  width: 32px; height: 28px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; font-size: 13px; line-height: 1;
}
.isle-row .side button:disabled { opacity: .3; cursor: default; }
.isle-main { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.4fr); gap: 8px; }
.isle-more { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; grid-column: 1 / -1; margin-top: 2px; }
.isle-more .full { grid-column: 1 / -1; }
.mini { display: grid; gap: 3px; margin: 0; font-size: 13px; color: var(--muted); font-weight: 500; }
.mini input, .mini select, .mini textarea { min-height: 42px; padding: 8px 10px; color: var(--ink); font-size: 15px; }
.isle-actions { display: grid; gap: 6px; width: 76px; }
.isle-actions button {
  min-height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; font-size: 14px; white-space: nowrap;
}
.isle-actions .more[aria-expanded="true"] { background: var(--soft); border-color: var(--primary); color: var(--primary); }
.isle-actions .del { color: var(--danger); }
.isle-actions .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: 4px; vertical-align: middle; }
.center-island { margin-top: 18px; padding: 14px; border-radius: 14px; background: var(--soft); }

/* 上傳 */
.drop {
  display: grid; place-items: center; gap: 4px; padding: 30px 16px; text-align: center; color: var(--primary);
  border: 2px dashed var(--primary); border-radius: 18px; background: var(--soft); cursor: pointer; transition: background .2s, transform .15s;
}
.drop:hover { transform: translateY(-1px); }
.drop strong { font-size: 20px; color: var(--ink); }
.drop span { color: var(--muted); }
.drop.over { background: color-mix(in srgb, var(--primary) 20%, var(--surface)); }
.size { color: var(--muted); font-size: 14px; margin: 10px 0 6px; }
.file-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.file-list li {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg);
}
.file-list .ext {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px;
  background: var(--primary); color: var(--primary-ink); font-size: 11px; font-weight: 700; text-transform: uppercase;
}
.file-list .ext.img { background: var(--accent); }
.file-list .meta { min-width: 0; }
.file-list .meta b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list .meta small { color: var(--muted); }
.file-list .meta input { margin-top: 6px; min-height: 38px; padding: 6px 10px; font-size: 14px; }
.file-list .del { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; min-height: 40px; padding: 0 12px; cursor: pointer; color: var(--danger); }

/* 配色 */
.theme-slots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.slot {
  position: relative; display: grid; gap: 10px; padding: 12px; border: 2px solid var(--line); border-radius: 16px; background: var(--bg);
}
.slot.default { border-color: var(--primary); }
.slot .badge { position: absolute; top: -12px; left: 12px; padding: 1px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--primary); color: var(--primary-ink); }
.slot .sw {
  position: relative; height: 76px; border-radius: 12px; border: 1px solid rgba(0,0,0,.12); overflow: hidden; cursor: pointer;
  display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 6px; font-weight: 700;
}
.slot .sw .bar { display: flex; gap: 6px; }
.slot .sw .bar i { width: 26px; height: 8px; border-radius: 4px; }
.slot .sw .pick { position: absolute; right: 6px; bottom: 6px; font-size: 11px; font-weight: 500; opacity: .75; }
.slot .sw input[type="color"] { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; border: 0; }
.slot .name { min-height: 38px; padding: 6px 10px; font-size: 15px; }
.slot .slot-moves { display: flex; gap: 6px; }
.slot .slot-moves button { flex: 1; min-height: 36px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; font-size: 13px; }
.slot .slot-moves button:disabled { opacity: .35; cursor: default; }
.row-gap { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 14px; }
.color { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 500; cursor: pointer; }
input[type="color"] { -webkit-appearance: none; appearance: none; width: 48px; height: 40px; border: 1px solid var(--line); border-radius: 10px; padding: 3px; background: var(--surface); cursor: pointer; }
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 7px; }
input[type="color"]::-moz-color-swatch { border: 0; border-radius: 7px; }
.presets { display: flex; flex-wrap: wrap; gap: 8px; }
.preset {
  display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 6px 14px 6px 8px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--bg); cursor: pointer;
}
.preset:hover { border-color: var(--primary); }
.preset span { display: flex; }
.preset i { width: 18px; height: 18px; border-radius: 50%; margin-right: -5px; border: 2px solid var(--surface); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 40px; padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); cursor: pointer;
}
.chip:hover { border-color: var(--primary); }
.chip[aria-pressed="true"] { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); font-weight: 700; }
.fixed-spec { list-style: none; margin: 0 0 10px; padding: 12px 14px; border-radius: 12px; background: var(--bg2); display: grid; gap: 4px; font-size: 15px; }
.fixed-spec b { color: var(--primary); }
.fixed-spec li:last-child b { color: var(--danger); }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 8px; }
.feature-grid .check { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); transition: border-color .2s, background .2s; }
.feature-grid .check:has(input:checked) { border-color: var(--primary); background: var(--soft); }

/* 下載 */
.check-card { margin: 4px 0 18px; padding: 16px 18px; border-radius: 14px; background: var(--bg); border: 1px solid var(--line); }
.check-card h3 { margin: 0 0 8px; font-size: 17px; }
.check-card ul { margin: 0; padding-left: 0; list-style: none; display: grid; gap: 6px; }
.check-card li { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.check-card li::before { flex: none; font-weight: 700; }
.check-card li.ok::before { content: "✓"; color: var(--primary); }
.check-card li.warn::before { content: "!"; color: var(--accent); width: 1em; text-align: center; }
.check-card li.bad { color: var(--danger); font-weight: 700; }
.check-card li.bad::before { content: "✕"; }
.check-card li button { border: 0; background: none; color: var(--primary); text-decoration: underline; cursor: pointer; padding: 0; font-weight: 500; }
.download { display: flex; flex-wrap: wrap; gap: 12px; }
.success {
  margin-top: 16px; padding: 18px 20px; border-radius: 16px; outline: none;
  background: color-mix(in srgb, var(--primary) 14%, var(--surface)); border: 2px solid var(--primary);
  animation: pop .35s ease-out;
}
@keyframes pop { from { transform: scale(.97); opacity: 0; } }
.success h3 { margin: 0 0 8px; }
.success ol, .after ol { margin: 0; padding-left: 24px; display: grid; gap: 6px; }
.after { margin-top: 16px; padding: 16px 18px; border-radius: 16px; background: var(--soft); }
.after h3 { margin: 0 0 8px; font-size: 17px; }
.prompt {
  margin: 0 0 8px; padding: 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
  white-space: pre-wrap; word-break: break-word; font-family: inherit; font-size: 15px; line-height: 1.7;
}

/* 固定在面板下緣的步驟導覽 */
.step-nav {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  margin: 26px -26px 0; padding: 14px 26px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line); border-radius: 0 0 20px 20px;
}
.step-nav .saved { margin-right: auto; color: var(--muted); font-size: 13px; }
.step-nav .peek { display: none; }

/* 預覽 */
.preview { position: sticky; top: 84px; display: grid; gap: 10px; }
.preview-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.preview-head span { color: var(--muted); font-size: 13px; }
.preview-head .what { display: inline-block; margin-left: 6px; padding: 1px 10px; border-radius: 999px; background: var(--soft); color: var(--primary); font-size: 13px; font-weight: 700; }
.stage {
  position: relative; aspect-ratio: 1 / 1; border-radius: 20px; overflow: hidden;
  border: 1px solid var(--line); box-shadow: var(--shadow); background: var(--bg2); touch-action: none; cursor: grab;
}
.stage:active { cursor: grabbing; }
.stage canvas { width: 100%; height: 100%; display: block; }
.labels { position: absolute; inset: 0; pointer-events: none; }
.labels button {
  position: absolute; transform: translate(-50%, -100%); white-space: nowrap; pointer-events: auto; cursor: pointer;
  padding: 3px 9px; border-radius: 9px; border: 1px solid rgba(0,0,0,.08); font-size: 12px; font-weight: 700;
  background: rgba(255,255,255,.94); color: #33302a; box-shadow: 0 2px 6px rgba(0,0,0,.18);
  transition: transform .15s, background .15s;
}
.labels button:hover { transform: translate(-50%, -100%) scale(1.08); }
.labels button.center { font-size: 13px; border: 2px solid var(--accent); cursor: default; }
.labels button.hot { background: var(--accent); color: #fff; transform: translate(-50%, -100%) scale(1.15); z-index: 2; }
.stage-reset {
  position: absolute; right: 10px; bottom: 10px; width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; font-size: 20px; box-shadow: var(--shadow-sm);
}
.no-webgl { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; text-align: center; color: var(--muted); margin: 0; }
.preview-theme { display: flex; gap: 6px; flex-wrap: wrap; }
.preview-theme button {
  display: flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 13px;
}
.preview-theme button i { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0,0,0,.2); }
.preview-theme button[aria-pressed="true"] { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary) inset; font-weight: 700; }
.preview-note { margin: 0; font-size: 13px; color: var(--muted); }

/* 使用教學 */
.tutorial { margin: 8px 0 0; padding: 32px var(--gutter) 8px; outline: none; }
.tut-body { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); gap: 20px; align-items: start; }
.tutorial h2 { margin: 0 0 6px; font-size: clamp(24px, 3vw, 32px); }
.tut-lead { margin: 0 0 18px; color: var(--muted); }
.video-wrap {
  position: relative; border-radius: 20px; overflow: hidden; background: #111;
  box-shadow: var(--shadow); border: 1px solid var(--line); aspect-ratio: 16 / 9;
}
.video-wrap video { display: block; width: 100%; height: 100%; object-fit: contain; background: #111; }
.tut-steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.tut-steps li { display: flex; gap: 12px; padding: 12px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.tut-steps b {
  flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary); color: var(--primary-ink); font-size: 15px;
}
.tut-steps strong { display: block; margin-bottom: 2px; }
.tut-steps p { margin: 0; color: var(--muted); font-size: 15px; }
.tutorial h3 { margin: 28px 0 10px; font-size: 20px; }
.faq { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); gap: 8px; align-items: start; }
.faq details { border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.faq summary {
  list-style: none; cursor: pointer; padding: 14px 44px 14px 16px; font-weight: 700; position: relative; min-height: 48px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "＋"; position: absolute; right: 16px; top: 13px; color: var(--primary); font-weight: 700; }
.faq details[open] summary::after { content: "－"; }
.faq details p { margin: 0; padding: 0 16px 14px; color: var(--muted); }
@media (max-width: 1200px) { .tut-body { grid-template-columns: minmax(0, 1fr); } .tut-steps { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); } }
@media (max-width: 860px) {
  .tutorial { padding: 24px 12px 4px; }
  .tut-steps { grid-template-columns: minmax(0, 1fr); }
  .video-wrap { border-radius: 14px; }
  .hero-cta .btn.ghost { flex-basis: 100%; }
}

.foot { margin: 24px 0 0; padding: 0 var(--gutter) 40px; color: var(--ink); }
.foot-grid { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(320px, 1fr); gap: 18px; align-items: start; }
@media (min-width: 1201px) {
  .author { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 4px 28px; align-items: start; }
  .author > h2, .author > .author-name, .author > h3, .author > .contact { grid-column: 1 / -1; }
  .author-card { grid-column: 1; }
  .author .author-grid { grid-column: 2; grid-template-columns: minmax(0, 1fr); margin: 0; }
  .author .author-grid h3 { margin-top: 0; }
  .author .author-grid > div + div h3 { margin-top: 14px; }
}
@media (max-width: 1200px) { .foot-grid { grid-template-columns: minmax(0, 1fr); } }
.foot h2 { font-size: 24px; margin: 0 0 10px; text-align: center; }
.foot h3 { font-size: 17px; margin: 18px 0 6px; }
.author, .license {
  padding: 28px; margin-bottom: 18px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.author-name { text-align: center; font-size: 20px; font-weight: 700; margin: 0 0 14px; }
.author-card { display: block; width: 100%; height: auto; margin: 0 auto; border-radius: 14px; }
.author-grid { display: grid; grid-template-columns: 1fr 1.6fr; gap: 0 28px; margin: 6px 0 0; }
.author ul, .license ul { margin: 0; padding-left: 20px; display: grid; gap: 2px; }
.author > h3 { text-align: center; }
.contact { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.contact .btn { text-decoration: none; color: var(--ink); }
.license { margin: 0; }
.license .ban { list-style: none; padding-left: 0; }
.signature { text-align: center; color: var(--muted); font-size: 14px; padding-top: 10px; border-top: 1px solid var(--line); }
.signature b { color: var(--ink); font-size: 16px; }
.signature p { margin: 6px 0; }
.to-top { display: inline-block; margin: 4px 0; }
@media (max-width: 860px) {
  .foot { padding: 0 12px 32px; }
  .author, .license { padding: 20px 16px; }
  .author-grid { grid-template-columns: 1fr; }
  .contact .btn { width: 100%; white-space: normal; }
}

dialog {
  max-width: 560px; width: calc(100% - 32px); border: 1px solid var(--line); border-radius: 20px;
  background: var(--surface); color: var(--ink); padding: 26px; box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(10, 20, 25, .45); backdrop-filter: blur(2px); }
dialog h2 { margin-top: 0; }
.help-list { padding-left: 22px; display: grid; gap: 6px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translate(-50%, 30px); opacity: 0;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 18px; border-radius: 14px; background: var(--ink); color: var(--bg);
  transition: opacity .25s, transform .25s; z-index: 60; pointer-events: none;
  width: max-content; max-width: calc(100vw - 32px);
  box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { border: 0; background: none; color: var(--accent); font-weight: 700; cursor: pointer; text-decoration: underline; padding: 4px; }
:root:not([data-theme="night"]) .toast button { color: #ffc47a; }

/* 響應式 */
@media (max-width: 1180px) {
  .layout { grid-template-columns: minmax(0, 1fr) minmax(300px, 360px); }
  .steps { grid-column: 1 / -1; position: static; display: flex; overflow-x: auto; gap: 6px; padding-bottom: 4px; scrollbar-width: none; }
  .steps .progress { display: none; }
  .steps button { flex: none; }
}
@media (max-width: 860px) {
  .topbar { padding: 8px 12px; gap: 8px; }
  .brand img { width: 30px; height: 30px; }
  .brand-text strong { font-size: 17px; letter-spacing: 1px; }
  .brand-text small, .theme-switch span, .top-actions .lbl { display: none; }
  .top-actions { gap: 6px; }
  .theme-switch button { padding: 4px 8px; min-height: 34px; }
  .top-actions .btn { min-height: 38px; padding: 6px 10px; font-size: 14px; }
  .hero { padding: 18px 16px 0; }
  .flow { font-size: 14px; }
  .flow li:not(:last-child)::after { margin: 0 6px; }
  .hero-cta .btn { flex: 1; }
  .layout { grid-template-columns: minmax(0, 1fr); padding: 12px 12px 32px; gap: 12px; }
  .steps button { padding: 6px 10px; min-height: 44px; }
  .steps button span { display: none; }
  .steps button[aria-current="step"] span { display: inline; }
  .stage { aspect-ratio: 4 / 3; }
  .panel { padding: 20px 16px 0; border-radius: 18px; }
  .step h2 { font-size: 22px; }
  .step-nav { margin: 22px -16px 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-radius: 0 0 18px 18px; }
  .step-nav .saved { display: none; }
  .step-nav .peek { display: inline-flex; margin-right: auto; }
  .grid2, .type-grid, .feature-grid, .isle-main, .isle-more { grid-template-columns: minmax(0, 1fr); }
  .isle-row { grid-template-columns: 36px minmax(0, 1fr); }
  .isle-actions { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; width: auto; }
  .theme-slots { grid-template-columns: minmax(0, 1fr); }
  .type-card { grid-template-columns: 48px 1fr; padding: 16px; }
  .type-card svg { width: 48px; height: 48px; }
  .download .btn.big { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}
