@font-face { font-family: "Saira"; src: url("../fonts/SairaSemiCondensed-Regular.ttf") format("truetype"); font-weight: 400; font-display: block; }
@font-face { font-family: "Saira"; src: url("../fonts/SairaSemiCondensed-Bold.ttf") format("truetype"); font-weight: 700; font-display: block; }

:root {
  --bg: #f3f4f6;
  --panel: #ffffff;
  --border: #e3e5e9;
  --text: #1c1f24;
  --muted: #6b7280;
  --primary: #2f80d1;
  --primary-text: #ffffff;
  --hover: #eef2f7;
  --active: #dbe8f7;
  --stage: #e7e9ed;
  --banner: #fff6d6;
  --banner-text: #5c4a00;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121417; --panel: #1b1e23; --border: #2b3038; --text: #e8eaed; --muted: #9aa1ab;
    --primary: #4b97e6; --hover: #242931; --active: #22364d; --stage: #0d0f12;
    --banner: #3a3214; --banner-text: #f3e2a0;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121417; --panel: #1b1e23; --border: #2b3038; --text: #e8eaed; --muted: #9aa1ab;
  --primary: #4b97e6; --hover: #242931; --active: #22364d; --stage: #0d0f12;
  --banner: #3a3214; --banner-text: #f3e2a0;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC", "Hiragino Sans", "Noto Sans TC", "Noto Sans JP", "Microsoft JhengHei", sans-serif;
  display: flex;
  flex-direction: column;
}
h1 { font-size: 17px; margin: 0; font-weight: 700; letter-spacing: .02em; line-height: 1.2; }
h2 { font-size: 13px; margin: 0 0 10px; font-weight: 650; }
.muted { color: var(--muted); font-weight: 400; }
.small { font-size: 12px; }
.hint { color: var(--muted); font-size: 12px; margin: 6px 0 0; }
.site-footer {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 8px;
  padding: 10px 16px; padding-bottom: max(10px, env(safe-area-inset-bottom));
  font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); background: var(--panel);
}
.site-footer a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.site-footer a:hover { color: var(--primary); }
.footer-break { flex-basis: 100%; height: 0; }
.kofi-btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 13px; border-radius: 999px;
  background: var(--hover); color: var(--text) !important; border: 1px solid var(--border);
  text-decoration: none !important; font-weight: 600; font-size: 12px;
  transition: background .15s, border-color .15s, transform .15s;
}
.kofi-btn svg { color: #e9a23b; } /* 與 Logo、載入條相同的金色 */
.kofi-btn:hover { background: var(--active); border-color: #e9a23b; transform: translateY(-1px); }
.site-footer .kofi-btn { margin-left: 6px; }
.about .kofi-btn { margin-top: 14px; padding: 10px 20px; font-size: 14px; }
.back-to-top {
  position: fixed; right: 16px; bottom: max(20px, calc(env(safe-area-inset-bottom) + 12px)); z-index: 20;
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--panel); color: var(--text); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,.18); transition: transform .15s, background .15s;
}
.back-to-top:hover { background: var(--active); transform: translateY(-2px); }

/* splash */
.splash {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: var(--panel); transition: opacity .55s ease, visibility .55s;
}
.splash-out { opacity: 0; visibility: hidden; }
.splash-inner { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 24px; }
.splash-mark { position: relative; width: 104px; height: 104px; animation: splash-pop .8s cubic-bezier(.2, .9, .3, 1.2) both; }
.splash-mark img { width: 100%; height: 100%; display: block; }
.splash-glint {
  position: absolute; top: 4%; right: 6%; width: 34%; height: 34%; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 228, 140, .95) 0%, rgba(255, 210, 90, .35) 40%, transparent 70%);
  animation: splash-glint 1.6s ease-in-out .5s infinite;
  mix-blend-mode: screen; pointer-events: none;
}
.splash-name {
  margin: 18px 0 0; font-size: 30px; font-weight: 700; letter-spacing: .18em; padding-left: .18em;
  color: var(--text); animation: splash-rise .7s ease .35s both;
}
.splash-sub {
  margin: 8px 0 0; font-size: 14px; letter-spacing: .12em; color: var(--muted);
  animation: splash-rise .7s ease .55s both;
}
.splash-bar {
  display: block; width: 120px; height: 2px; margin-top: 22px; border-radius: 2px;
  background: var(--border); overflow: hidden; animation: splash-rise .5s ease .7s both;
}
.splash-bar span {
  display: block; width: 40%; height: 100%; border-radius: 2px;
  background: linear-gradient(90deg, #f6c453, #e9a23b);
  animation: splash-load 1.1s ease-in-out infinite;
}
@keyframes splash-pop { from { opacity: 0; transform: scale(.72); } to { opacity: 1; transform: scale(1); } }
@keyframes splash-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes splash-glint { 0%, 100% { opacity: .15; transform: scale(.7); } 50% { opacity: 1; transform: scale(1.15); } }
@keyframes splash-load { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
@media (prefers-reduced-motion: reduce) {
  .splash *, .splash-mark { animation: none !important; }
}

/* translate banner */
.banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 16px; background: var(--banner); color: var(--banner-text); font-size: 13px;
}
.banner-link { color: inherit; font-weight: 650; }
.banner-close { margin-left: auto; border: 0; background: transparent; color: inherit; font-size: 18px; cursor: pointer; line-height: 1; }

/* top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--panel); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { flex: none; }
.tagline { margin: 0; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand h1 ruby rt { font-size: 9px; font-weight: 500; letter-spacing: .2em; color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.mini-select {
  font: inherit; font-size: 12px; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: 7px; padding: 6px 8px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 8px; padding: 8px 14px;
  font: inherit; font-weight: 550; cursor: pointer; user-select: none;
  color: var(--text); background: transparent; white-space: nowrap;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--primary-text); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn-secondary { background: var(--hover); border-color: var(--border); }
.btn-ghost { border-color: var(--border); }
.btn-ghost:hover, .btn-secondary:hover:not(:disabled) { background: var(--active); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* layout */
.layout {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 340px;
  gap: 12px; padding: 12px;
}
.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; overflow: auto; min-height: 0;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.panel-head h2 { margin: 0; }
.group + .group { margin-top: 22px; }

/* photo list */
.url-form { display: flex; gap: 6px; margin-bottom: 4px; }
.url-form input {
  flex: 1; min-width: 0; font: inherit; font-size: 12px; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: 7px; padding: 6px 8px;
}
.url-form input:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.url-hint { margin: 0 0 10px; font-size: 11px; }
.photo-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.photo-item {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 6px; border-radius: 8px; cursor: pointer; border: 1px solid transparent;
}
.photo-item:hover { background: var(--hover); }
.photo-item.active { background: var(--active); border-color: var(--primary); }
.photo-item img { width: 52px; height: 52px; object-fit: cover; border-radius: 6px; background: var(--stage); display: block; }
.photo-item .name { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-item .meta { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-item .remove {
  border: 0; background: transparent; color: var(--muted); font-size: 18px; line-height: 1;
  width: 28px; height: 28px; border-radius: 6px; cursor: pointer;
}
.photo-item .remove:hover { background: var(--border); color: var(--text); }

/* stage */
.stage-panel {
  min-height: 0; display: flex; flex-direction: column;
  background: var(--stage); border-radius: var(--radius); overflow: hidden; position: relative;
  border: 2px dashed transparent;
}
.stage-panel.dragging { border-color: var(--primary); background: var(--active); }
.dropzone { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; }
.dz-title { font-size: 18px; font-weight: 600; margin: 0 0 6px; }
.stage { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.stage-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; }
.stage-toolbar .seg { flex: none; }
.dims { font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; }

.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 2px; }
.seg-btn { white-space: nowrap; border: 0; background: transparent; color: var(--text); padding: 5px 14px; border-radius: 6px; font: inherit; cursor: pointer; }
.seg-btn.active { background: var(--primary); color: var(--primary-text); }

.canvas-wrap { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 8px 16px 16px; }
#preview { max-width: 100%; max-height: 100%; display: block; box-shadow: 0 4px 24px rgba(0,0,0,.18); }

.crop-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.crop-area {
  flex: 1; min-height: 0; position: relative; margin: 8px 16px; touch-action: none; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
#crop-img { max-width: 100%; max-height: 100%; display: block; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.crop-box {
  position: absolute; border: 1.5px solid #fff; cursor: move; touch-action: none;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.55);
}
.crop-box .grid {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(to right, transparent calc(33.33% - .5px), rgba(255,255,255,.5) calc(33.33% - .5px), rgba(255,255,255,.5) calc(33.33% + .5px), transparent calc(33.33% + .5px), transparent calc(66.66% - .5px), rgba(255,255,255,.5) calc(66.66% - .5px), rgba(255,255,255,.5) calc(66.66% + .5px), transparent calc(66.66% + .5px)),
    linear-gradient(to bottom, transparent calc(33.33% - .5px), rgba(255,255,255,.5) calc(33.33% - .5px), rgba(255,255,255,.5) calc(33.33% + .5px), transparent calc(33.33% + .5px), transparent calc(66.66% - .5px), rgba(255,255,255,.5) calc(66.66% - .5px), rgba(255,255,255,.5) calc(66.66% + .5px), transparent calc(66.66% + .5px));
}
.crop-box .h { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; }
.crop-box .h::after { content: ""; position: absolute; inset: 6px; background: #fff; border-radius: 2px; box-shadow: 0 0 2px rgba(0,0,0,.6); }
.crop-box .nw { left: 0; top: 0; cursor: nwse-resize; }
.crop-box .n  { left: 50%; top: 0; cursor: ns-resize; }
.crop-box .ne { left: 100%; top: 0; cursor: nesw-resize; }
.crop-box .e  { left: 100%; top: 50%; cursor: ew-resize; }
.crop-box .se { left: 100%; top: 100%; cursor: nwse-resize; }
.crop-box .s  { left: 50%; top: 100%; cursor: ns-resize; }
.crop-box .sw { left: 0; top: 100%; cursor: nesw-resize; }
.crop-box .w  { left: 0; top: 50%; cursor: ew-resize; }
.crop-box.locked .n, .crop-box.locked .e, .crop-box.locked .s, .crop-box.locked .w { display: none; }

.crop-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 16px 14px; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; flex: 1 1 auto; min-width: 0; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--border); background: var(--panel); color: var(--text);
  border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 12px; cursor: pointer;
}
.chip.active { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.crop-actions { display: flex; gap: 8px; }

/* settings */
.field { margin-bottom: 12px; min-width: 0; }
.field > label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.field input:not([type=range]):not([type=checkbox]), .field select {
  width: 100%; font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: 7px; padding: 7px 9px; min-width: 0;
}
.field input:focus, .field select:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.field input[type=range] { width: 100%; accent-color: var(--primary); }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.row select, .row input { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; column-gap: 10px; }
.grid2 .full { grid-column: 1 / -1; }
.export-row { display: flex; gap: 8px; flex-wrap: wrap; }
.export-row { display: grid; grid-template-columns: 1fr 1fr; }
.export-row .btn { flex: 1; min-width: 0; white-space: normal; text-align: center; }
.status { font-size: 12px; min-height: 18px; margin: 8px 0 0; flex: 1; }
.progress { width: 100%; height: 6px; margin-top: 10px; accent-color: var(--primary); }
.mt-s { margin-top: 10px; }
.play-btn { min-width: 40px; font-size: 12px; }

.toggles { display: flex; flex-wrap: wrap; gap: 6px; }
.toggle { position: relative; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.toggle span {
  display: inline-block; border: 1px solid var(--border); background: var(--bg); color: var(--text);
  border-radius: 999px; padding: 4px 11px; font-size: 12px; user-select: none;
}
.toggle input:checked + span { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.toggle input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.check { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; margin-top: 10px; cursor: pointer; }
.check input { margin: 2px 0 0; accent-color: var(--primary); }

/* tablet: settings move below */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 220px minmax(0, 1fr); grid-template-rows: minmax(420px, 1fr) auto; }
  .settings-panel { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; }
  .settings-panel .group + .group { margin-top: 0; }
}

/* 預覽區的讀取提示 */
.stage-busy {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 5;
  display: flex; align-items: center; gap: 10px; max-width: calc(100% - 32px);
  padding: 8px 14px; border-radius: 999px; background: rgba(15, 18, 24, .82); color: #fff;
  font-size: 12px; box-shadow: 0 4px 16px rgba(0,0,0,.25); backdrop-filter: blur(6px);
}
.stage-busy span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spinner {
  width: 14px; height: 14px; flex: none; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.3); border-top-color: #f6c453; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 共用：只在手機顯示的元素 ---------- */
@media (min-width: 721px) { .mobile-only { display: none !important; } }
.dz-add {
  width: 64px; height: 64px; border-radius: 50%; border: 0; margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  background: var(--primary); color: var(--primary-text); box-shadow: 0 6px 20px rgba(47, 128, 209, .35);
}
.dz-add:active { transform: scale(.96); }
.sheet { display: none; }

/* ---------- 手機：App 介面 ---------- */
@media (max-width: 720px) {
  :root { --tabbar-h: 58px; }
  html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
  body { display: flex; flex-direction: column; height: 100dvh; -webkit-tap-highlight-color: transparent; }
  .banner { font-size: 12px; padding: 6px 12px; }

  /* 頂部 App Bar */
  .topbar {
    position: static; flex: none; gap: 8px;
    padding: max(8px, env(safe-area-inset-top)) 12px 8px;
    border-bottom: 1px solid var(--border);
  }
  .brand img { width: 30px; height: 30px; }
  .brand h1 { font-size: 18px; }
  .tagline, .topbar .mini-select { display: none; }
  .topbar-actions { gap: 8px; }
  .add-btn {
    width: 40px; height: 40px; padding: 0; border-radius: 50%;
    background: var(--hover); color: var(--text); border: 1px solid var(--border);
  }
  .add-btn .btn-label { display: none; }
  .save-top { height: 40px; padding: 0 18px; border-radius: 999px; }

  /* 主要區域：預覽 → 縮圖列 → 工具面板 */
  .layout { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0; gap: 0; }
  .stage-panel {
    order: 1; flex: 0 0 auto; height: 44dvh; min-height: 240px;
    border-radius: 0; border: 0;
  }
  .stage-toolbar { padding: 8px 12px 0; }
  .canvas-wrap { padding: 6px 12px 10px; }
  #preview { box-shadow: 0 2px 12px rgba(0,0,0,.18); }
  .dims { font-size: 11px; line-height: 1.3; }
  .dropzone { padding: 16px 24px; }
  .dz-title { font-size: 16px; }
  .dz-desc { font-size: 12px; }

  .list-panel {
    order: 2; flex: none; overflow: visible; border-radius: 0; border: 0;
    border-bottom: 1px solid var(--border); padding: 8px 12px;
  }
  .list-panel { display: flex; align-items: center; gap: 8px; }
  .list-panel .panel-head { order: 2; margin: 0; flex: none; }
  .list-panel .panel-head h2 { display: none; }
  .list-panel .photo-list { order: 1; flex: 1; min-width: 0; }
  #remove-all { min-height: 32px; padding: 4px 10px; font-size: 12px; border-radius: 999px; }
  .url-form, .url-hint { display: none; }
  .photo-list { flex-direction: row; overflow-x: auto; gap: 8px; padding: 4px 4px 2px 0; scrollbar-width: none; }
  .photo-list::-webkit-scrollbar { display: none; }
  .photo-item { grid-template-columns: 1fr; position: relative; padding: 2px; flex: none; border-radius: 10px; }
  .photo-item img { width: 56px; height: 56px; border-radius: 8px; }
  .photo-item .name, .photo-item .meta { display: none; }
  .photo-item .remove {
    position: absolute; top: -4px; right: -4px; width: 22px; height: 22px; font-size: 14px;
    background: var(--panel); border: 1px solid var(--border); border-radius: 50%;
  }
  .list-panel:has(.photo-list:empty) { display: none; }

  .settings-panel {
    order: 3; flex: 1; min-height: 0; overflow-y: auto; display: block;
    border-radius: 0; border: 0; padding: 16px 16px 28px;
    -webkit-overflow-scrolling: touch;
  }
  /* 依底部分頁只顯示對應的設定 */
  .settings-panel .group { display: none; }
  .settings-panel[data-tab="frame"] .group[data-tab="frame"],
  .settings-panel[data-tab="info"] .group[data-tab="info"],
  .settings-panel[data-tab="place"] .group[data-tab="place"],
  .settings-panel[data-tab="export"] .group[data-tab="export"],
  .settings-panel[data-tab="more"] .group[data-tab="more"] { display: block; animation: tab-in .2s ease; }
  .settings-panel .group[hidden] { display: none !important; }
  .settings-panel .group + .group { margin-top: 26px; }
  .settings-panel h2 { font-size: 15px; margin-bottom: 12px; }

  /* 觸控尺寸；輸入框 16px 避免 iOS 自動放大 */
  .field input:not([type=range]):not([type=checkbox]), .field select { font-size: 16px; padding: 10px 12px; border-radius: 10px; }
  .seg { border-radius: 10px; }
  .seg-btn { padding: 8px 16px; min-height: 36px; }
  .seg-full { display: flex; }
  .seg-full .seg-btn { flex: 1; }
  .toggle span { padding: 7px 14px; font-size: 13px; }
  .btn { min-height: 44px; border-radius: 12px; }
  .btn-sm { min-height: 36px; }
  .stage-toolbar .btn-sm, .play-btn { min-height: 32px; }
  .export-row { gap: 10px; }

  .crop-area { margin: 6px 8px; }
  .crop-controls { padding: 4px 8px 8px; gap: 6px; }
  .crop-actions { width: 100%; }
  .crop-actions .btn { flex: 1; min-height: 40px; }

  /* 底部分頁列 */
  .tabbar {
    display: flex; flex: none;
    padding: 4px 4px max(6px, env(safe-area-inset-bottom));
    background: var(--panel); border-top: 1px solid var(--border);
  }
  .tab {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-height: 50px; border: 0; background: transparent; color: var(--muted);
    font: inherit; font-size: 11px; cursor: pointer; border-radius: 10px;
  }
  .tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .tab[aria-selected="true"] { color: var(--primary); }
  .tab[aria-selected="true"] svg { stroke-width: 2.2; }
  .tab:active { background: var(--hover); }

  .site-footer { display: none; }
  .back-to-top { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px); width: 40px; height: 40px; }

  /* 「更多」分頁的關於區塊 */
  .about { text-align: center; margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--border); }
  .about img { display: block; margin: 0 auto 8px; }
  .about-name { font-weight: 700; margin: 0 0 6px; }
  .about p { margin: 4px 0; }
  .about a { color: inherit; }

  /* 「加入」底部選單 */
  .sheet[open] {
    display: block; position: fixed; inset: auto 0 0 0; margin: 0; width: 100%; max-width: none;
    border: 0; border-radius: 18px 18px 0 0; padding: 8px 16px max(16px, env(safe-area-inset-bottom));
    background: var(--panel); color: var(--text); box-shadow: 0 -8px 30px rgba(0,0,0,.25);
    animation: sheet-up .22s ease;
  }
  .sheet::backdrop { background: rgba(0,0,0,.4); }
  .sheet-handle { width: 40px; height: 5px; border-radius: 3px; background: var(--border); margin: 4px auto 12px; }
  .sheet-title { font-size: 15px; text-align: center; margin: 0 0 12px; }
  .sheet-item {
    display: flex; align-items: center; gap: 14px; width: 100%; min-height: 54px; padding: 0 14px;
    border: 0; border-radius: 12px; background: var(--bg); color: var(--text); font: inherit; font-size: 16px;
    cursor: pointer; margin-bottom: 8px; text-align: left;
  }
  .sheet-item svg { width: 24px; height: 24px; fill: none; stroke: var(--primary); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
  .sheet-url { display: flex; gap: 8px; margin: 4px 0 12px; }
  .sheet-url input {
    flex: 1; min-width: 0; font: inherit; font-size: 16px; color: var(--text); background: var(--bg);
    border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px;
  }
  .sheet-cancel {
    width: 100%; min-height: 50px; border: 0; border-radius: 12px; background: transparent;
    color: var(--primary); font: inherit; font-size: 16px; font-weight: 600; cursor: pointer;
  }
}

@keyframes tab-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .sheet[open], .settings-panel .group { animation: none !important; } }
