/* 米特 App：手機優先的團服設計 App。顏色：米紙底、墨黑、珊瑚紅＋紙卡色。 */
:root {
  --paper: #f3efe7; --ink: #1b1d1b; --ink-2: #4b504a; --muted: #7a7f78; --line: #e6e1d6;
  --coral: #e2553a; --coral-2: #c2412a; --yellow: #fce7a6; --pink: #f9d3c8; --blue: #d6e4ef; --green: #dce7d6; --sand: #f2e3c9; --sand2: #e9e4da;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.5 "Mitt UI Noto TC", system-ui, -apple-system, "PingFang TC", "Microsoft JhengHei", sans-serif; overflow: hidden; overscroll-behavior: none; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.fill { fill: currentColor; stroke: none; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* 開場 */
.splash { position: fixed; inset: 0; z-index: 50; display: grid; place-content: center; justify-items: center; gap: 18px; background: var(--paper); transition: opacity .5s var(--ease), visibility .5s; }
body[data-ready="true"] .splash { opacity: 0; visibility: hidden; }
.splash-logo { width: 120px; height: 46px; background: var(--ink); -webkit-mask: url('/uiux-shared/mitt-master.svg') center/contain no-repeat; mask: url('/uiux-shared/mitt-master.svg') center/contain no-repeat; animation: pop .8s var(--ease) both; }
.splash-bar { width: 160px; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.splash-bar i { display: block; height: 100%; width: 8%; background: var(--coral); border-radius: 2px; transition: width .4s var(--ease); }
.splash-text { font-size: 13px; color: var(--muted); }
@keyframes pop { from { opacity: 0; transform: scale(.8); } }

/* 版面：手機 */
.app { position: fixed; inset: 0; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto auto; padding-top: env(safe-area-inset-top); }
.top { height: 56px; display: flex; align-items: center; gap: 4px; padding: 0 10px; z-index: 3; }
.icon-btn { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border: 0; border-radius: 14px; background: #fff; color: var(--ink); box-shadow: 0 1px 0 rgba(0,0,0,.05); transition: transform .15s var(--ease); }
.icon-btn.plain { background: transparent; box-shadow: none; width: 40px; }
.icon-btn:disabled { opacity: .3; }
.icon-btn:active { transform: scale(.92); }
.title-btn { flex: 1; min-width: 0; height: 44px; display: flex; align-items: center; justify-content: center; gap: 6px; border: 0; background: transparent; font-size: 16px; font-weight: 700; }
.title-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.title-btn svg { width: 15px; height: 15px; color: var(--muted); }
.done-btn { height: 40px; padding: 0 18px; border: 0; border-radius: 999px; background: var(--coral); color: #fff; font-size: 15px; font-weight: 700; flex: none; transition: transform .15s var(--ease), box-shadow .2s; }
.done-btn:active { transform: scale(.95); }
.done-btn[data-glow="true"] { box-shadow: 0 0 0 0 rgba(226,85,58,.5); animation: glow 2.4s 1s infinite; }
@keyframes glow { 0% { box-shadow: 0 0 0 0 rgba(226,85,58,.45); } 70% { box-shadow: 0 0 0 12px rgba(226,85,58,0); } 100% { box-shadow: 0 0 0 0 rgba(226,85,58,0); } }

/* 舞台與氣氛 */
.stage-wrap { position: relative; min-height: 0; overflow: hidden; background: var(--paper); transition: background .5s var(--ease); }
.stage-wrap[data-scene="paper"] { background: radial-gradient(circle at 50% 42%, #faf7f0, var(--paper) 70%); }
.stage-wrap[data-scene="sun"] { background: radial-gradient(70% 55% at 22% 12%, rgba(255,255,255,.85), rgba(255,255,255,0) 70%), linear-gradient(180deg, #fbe9c6, #efcf9c); }
.stage-wrap[data-scene="night"] { background: radial-gradient(circle at 18% 22%, rgba(255,196,110,.35), transparent 12%), radial-gradient(circle at 72% 14%, rgba(255,140,90,.3), transparent 10%), radial-gradient(circle at 44% 30%, rgba(160,200,255,.25), transparent 9%), radial-gradient(circle at 88% 38%, rgba(255,230,160,.3), transparent 11%), linear-gradient(180deg, #1f2645, #10131f); }
.stage-wrap[data-scene="shop"] { background: repeating-linear-gradient(90deg, var(--coral) 0 11.1%, #fffaf0 11.1% 22.2%) top/100% 64px no-repeat, linear-gradient(#efe6d8, #efe6d8); }
.stage-wrap[data-scene="court"] { background: radial-gradient(circle at 50% 46%, transparent 0 34%, rgba(255,255,255,.5) 34.3% 34.9%, transparent 35.2%), linear-gradient(transparent calc(46% - 2px), rgba(255,255,255,.5) calc(46% - 2px) calc(46% + 2px), transparent calc(46% + 2px)), #2f6b4f; }
.stage-wrap[data-scene="plain"] { background: #f7f6f2; }
.stage { position: absolute; inset: 0; touch-action: none; outline: none; cursor: grab; }
.stage.dragging { cursor: grabbing; }
.stage.over-object { cursor: move; }
.stage canvas { display: block; width: 100%; height: 100%; }
.sel { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; z-index: 2; }
.sel polygon { fill: none; stroke: #fff; stroke-width: 1.6; stroke-dasharray: 6 5; filter: drop-shadow(0 0 1.5px rgba(0,0,0,.6)); }
.handle { position: absolute; z-index: 3; width: 32px; height: 32px; margin: -16px 0 0 -16px; padding: 0; border: 0; border-radius: 50%; background: #fff; color: var(--ink); display: grid; place-items: center; box-shadow: 0 2px 8px rgba(0,0,0,.3); touch-action: none; }
.handle::before { content: ""; position: absolute; inset: -6px; }
.handle svg { width: 16px; height: 16px; stroke-width: 2.4; }
.h-size { background: var(--coral); color: #fff; }
.faces { position: absolute; top: 8px; left: 10px; z-index: 4; display: flex; padding: 3px; border-radius: 999px; background: #fff; box-shadow: 0 6px 16px -10px rgba(0,0,0,.4); }
.faces button { height: 34px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; font-size: 13px; font-weight: 700; color: var(--ink-2); transition: background .2s, color .2s; }
.faces button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.float { position: absolute; z-index: 4; }
.fit { top: 8px; right: 10px; width: 40px; height: 40px; border-radius: 50%; }
.fit svg { width: 19px; height: 19px; }
.hint { position: absolute; z-index: 4; left: 50%; bottom: 12px; margin: 0; transform: translate(-50%, 8px); max-width: calc(100% - 24px); padding: 7px 14px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; pointer-events: none; transition: opacity .3s, transform .35s var(--ease); }
.hint[data-show="true"] { opacity: 1; transform: translate(-50%, 0); }
.stage-wrap::after { content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none; background: radial-gradient(50% 40% at 50% 45%, rgba(255,255,255,.75), rgba(255,255,255,0) 70%); opacity: 0; }
.stage-wrap[data-flash="true"]::after { animation: flash .7s var(--ease); }
@keyframes flash { 30% { opacity: 1; } }
.burst-layer { position: absolute; inset: 0; pointer-events: none; z-index: 4; overflow: hidden; }
.burst-layer i { position: absolute; width: 8px; height: 8px; border-radius: 2px; animation: spark .9s var(--ease) forwards; }
@keyframes spark { to { transform: translate(var(--dx), var(--dy)) rotate(220deg) scale(.4); opacity: 0; } }

/* 選取工具列 */
.objbar { position: absolute; z-index: 5; left: 50%; bottom: 10px; transform: translateX(-50%); width: min(460px, calc(100% - 20px)); display: flex; justify-content: space-around; align-items: center; min-height: 58px; border-radius: 18px; background: #fff; box-shadow: 0 10px 26px -14px rgba(0,0,0,.45); animation: rise .25s var(--ease); }
body:not([data-selected=""]) .hint { bottom: 80px; }
.objbar button { flex: 1; min-width: 0; min-height: 50px; padding: 0; border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; white-space: nowrap; color: var(--ink); }
.objbar button svg { width: 20px; height: 20px; }
.objbar .danger { color: var(--coral-2); }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 10px); } }

/* 工具抽屜 */
.tray { position: relative; z-index: 5; background: #fff; border-radius: 22px 22px 0 0; box-shadow: 0 -14px 30px -24px rgba(0,0,0,.5); max-height: 46svh; display: flex; flex-direction: column; animation: up .3s var(--ease); }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.tray-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px 6px; }
.tray-head strong { font-size: 16px; }
.tray-close { border: 0; background: var(--paper); border-radius: 999px; height: 34px; padding: 0 14px; font-size: 13px; font-weight: 700; }
.panel { overflow-y: auto; padding: 4px 16px 14px; overscroll-behavior: contain; }
.panel-note { margin: 0 0 10px; font-size: 14px; color: var(--ink-2); }
.panel-note.small { font-size: 12.5px; color: var(--muted); }
.mini-label { margin: 8px 0 6px; font-size: 12px; font-weight: 700; color: var(--muted); }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 10px; }
.swatches.small { grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); }
.sw { aspect-ratio: 1; width: 100%; max-width: 46px; justify-self: center; border: 0; padding: 0; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0,0,0,.12), inset 0 -5px 9px rgba(0,0,0,.12); transition: transform .15s var(--ease); }
.sw[aria-checked="true"] { box-shadow: inset 0 0 0 1px rgba(0,0,0,.12), 0 0 0 3px #fff, 0 0 0 5px var(--ink); }
.sw:active { transform: scale(.9); }
.text-row { display: flex; gap: 8px; margin-bottom: 10px; }
.text-input { flex: 1; min-width: 0; display: flex; align-items: center; height: 50px; padding: 0 14px; border-radius: 14px; background: var(--paper); }
.text-input input { width: 100%; border: 0; background: transparent; font-size: 17px; font-weight: 700; outline: none; }
.text-input.big { height: 54px; margin: 10px 0 14px; }
.chip-btn { flex: none; height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font-size: 13.5px; font-weight: 700; }
.chip-btn.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.seg-tabs { display: flex; gap: 22px; padding: 2px 4px 8px; border-bottom: 1px solid #eeeae2; margin-bottom: 12px; }
.seg-tabs button { border: 0; background: none; padding: 4px 0 6px; font-size: 14px; color: var(--muted); font-weight: 500; border-bottom: 2.5px solid transparent; }
.seg-tabs button[aria-selected="true"] { color: var(--ink); font-weight: 900; border-bottom-color: var(--ink); }
.looks { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.look { display: grid; gap: 4px; padding: 6px; border: 0; border-radius: 14px; background: var(--ink); color: #b9bdb6; font-size: 11px; transition: transform .15s var(--ease); }
.look canvas { width: 100%; aspect-ratio: 2 / 1; display: block; }
.look[aria-pressed="true"] { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--coral); color: #fff; }
.look:active { transform: scale(.95); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chips button { flex: none; height: 38px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: 13.5px; font-weight: 500; }
.chips button[aria-pressed="true"], .chips button[aria-checked="true"] { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 700; }
.free-note { margin: 10px 0 10px; font-size: 12px; font-weight: 700; color: #2e6b4a; }
.stickers { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 12px 10px; }
.sticker { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px 6px; border: 0; border-radius: 12px; background: var(--tone); font-size: 11.5px; font-weight: 700; box-shadow: 0 3px 0 rgba(27,29,27,.1); transform: rotate(var(--turn)); transition: transform .18s var(--ease); }
.sticker canvas, .sticker img { width: 52px; height: 52px; object-fit: contain; }
.sticker:active { transform: rotate(0) scale(.92); }
.sticker.add { background: #fff; border: 1.5px dashed #c9c4b9; box-shadow: none; color: var(--ink-2); justify-content: center; }
.upload-big { width: 100%; display: flex; align-items: center; gap: 14px; padding: 16px; border: 1.5px dashed #c9c4b9; border-radius: 16px; background: #faf8f3; text-align: left; }
.upload-big svg { width: 30px; height: 30px; }
.upload-big span { display: grid; }
.upload-big small { color: var(--muted); font-size: 12.5px; }
.check-row { display: flex; align-items: center; gap: 10px; margin: 12px 0; font-size: 14px; }
.check-row input { width: 20px; height: 20px; accent-color: var(--ink); }
.logo-tools { display: flex; gap: 8px; margin-bottom: 10px; }
.templates { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.tpl { display: grid; gap: 4px; padding: 6px 6px 8px; border: 0; border-radius: 14px; background: var(--tone); font-size: 12px; font-weight: 700; box-shadow: 0 3px 0 rgba(27,29,27,.08); }
.tpl canvas { width: 100%; aspect-ratio: 1; display: block; border-radius: 10px; background: #1b1d1b; }
.scenes { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.scene { display: grid; gap: 6px; padding: 6px; border: 0; border-radius: 14px; background: #fff; box-shadow: inset 0 0 0 1px var(--line); font-size: 12.5px; font-weight: 700; }
.scene canvas { width: 100%; aspect-ratio: 4 / 5; border-radius: 10px; display: block; }
.scene[aria-checked="true"] { box-shadow: 0 0 0 2px var(--ink); }

/* 下方工具列 */
.tools { position: relative; z-index: 6; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; background: #fff; padding: 10px 6px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid #f0ece4; }
.tools::-webkit-scrollbar { display: none; }
/* 手機上 7 個工具平分寬度，全部一眼看得到，不用橫滑 */
.tools > button { flex: 1 1 0; min-width: 0; padding: 0; white-space: nowrap; border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; color: var(--ink); }
.tile { width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; transition: transform .18s var(--ease), box-shadow .2s; }
.tile b { font-size: 22px; font-weight: 900; }
.tile svg { width: 24px; height: 24px; }
.t-sand { background: var(--sand2); } .t-yellow { background: var(--yellow); } .t-pink { background: var(--pink); } .t-blue { background: var(--blue); } .t-green { background: var(--green); } .t-sand2 { background: var(--sand); }
.t-ink { background: var(--ink); color: var(--yellow); }
.tools > button[aria-pressed="true"] { color: var(--coral); font-weight: 700; }
.tools > button[aria-pressed="true"] .tile { box-shadow: 0 0 0 2px var(--coral); }
.tools > button:active .tile { transform: scale(.9); }
.tools > button[data-tool="magic"][data-rolling="true"] .tile svg { animation: wand .6s var(--ease); }
@keyframes wand { 40% { transform: rotate(-25deg) scale(1.2); } }
@media (max-width: 359px) { .tile { width: 40px; height: 40px; border-radius: 13px; } .objbar button { font-size: 10px; } }

/* 小提示：放在「正面／背面」那一排下面，不蓋住切換鈕 */
.toast { position: fixed; z-index: 60; left: 50%; top: calc(116px + env(safe-area-inset-top)); margin: 0; transform: translate(-50%, -8px); width: max-content; max-width: calc(100% - 32px); padding: 9px 16px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 13.5px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .25s, transform .35s var(--ease); text-align: center; }
.toast[data-show="true"] { opacity: 1; transform: translate(-50%, 0); }
.toast b { color: var(--yellow); }

/* 全螢幕頁：作品、比一比、完成 */
.screen { position: fixed; inset: 0; z-index: 20; background: var(--paper); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); animation: fadeup .35s var(--ease); }
@keyframes fadeup { from { opacity: 0; transform: translateY(16px); } }
.works-head { display: flex; justify-content: space-between; align-items: flex-end; padding: 18px 20px 8px; }
.kicker { margin: 0; font-size: 11px; font-weight: 700; letter-spacing: 3px; color: var(--muted); }
.works-head h1 { margin: 2px 0 0; font-size: 28px; font-weight: 900; }
.works-head .sub { margin: 2px 0 0; font-size: 13px; color: #6b7069; }
.install-banner { display: flex; align-items: center; gap: 12px; margin: 6px 18px 4px; padding: 10px 14px; border: 0; border-radius: 16px; background: var(--ink); color: #fff; text-align: left; }
.install-banner span:last-child { display: grid; }
.install-banner small { color: #c9ccc6; font-size: 12px; }
.mini-icon { width: 36px; height: 36px; border-radius: 10px; background: #fff; position: relative; flex: none; }
.mini-icon::after { content: ""; position: absolute; inset: 9px 5px; background: var(--ink); -webkit-mask: url('/uiux-shared/mitt-master.svg') center/contain no-repeat; mask: url('/uiux-shared/mitt-master.svg') center/contain no-repeat; }
.works-grid { flex: 1; overflow-y: auto; padding: 18px 18px 10px; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 22px 16px; align-content: start; }
.work { position: relative; border: 0; border-radius: 6px; background: #fff; padding: 10px 10px 12px; display: flex; flex-direction: column; gap: 6px; text-align: left; transform: rotate(var(--turn)); box-shadow: 0 4px 0 rgba(27,29,27,.08), 0 12px 24px -16px rgba(27,29,27,.4); transition: transform .2s var(--ease); }
.work::before { content: ""; position: absolute; top: -9px; left: 50%; width: 54px; height: 18px; margin-left: -27px; background: var(--tape); transform: rotate(-3deg); }
.work img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 4px; background: var(--tone); display: block; }
.work strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work small { display: flex; justify-content: space-between; font-size: 11.5px; color: #6b7069; }
.work small em { font-style: normal; color: var(--coral); font-weight: 700; }
.work-cell { position: relative; display: grid; min-width: 0; } /* 長作品名（30 字）不撐寬卡片：名稱在卡內用「…」收尾（Codex QA13-01） */
.work-cell > .work { min-width: 0; width: 100%; }
.work-more { position: absolute; top: -4px; right: -4px; z-index: 2; width: 38px; height: 38px; border: 0; border-radius: 50%; background: rgba(255,255,255,.95); color: #1b1d1b; font-size: 20px; font-weight: 700; line-height: 1; box-shadow: 0 3px 10px rgba(27,29,27,.18); cursor: pointer; }
.work-more:active { transform: scale(.94); }
#compareBtn:disabled { opacity: .5; cursor: default; }
.work[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--coral), 0 12px 24px -16px rgba(27,29,27,.4); }
.work:active { transform: rotate(0) scale(.97); }
.works-foot { display: flex; gap: 10px; padding: 12px 18px calc(16px + env(safe-area-inset-bottom)); }
.solid-btn, .outline-btn, .ghost-btn { flex: 1; min-height: 50px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; border-radius: 999px; font-size: 15px; font-weight: 700; text-decoration: none; transition: transform .15s var(--ease); }
.solid-btn { border: 0; background: var(--ink); color: #fff; }
.solid-btn.light { background: #fff; color: var(--ink); }
.solid-btn.line { background: #06a74f; }
.outline-btn { border: 1.5px solid var(--ink); background: transparent; color: var(--ink); }
.ghost-btn { border: 1px solid rgba(255,255,255,.3); background: transparent; color: #fff; }
.ghost-btn.dark { border-color: var(--line); color: var(--ink); }
.solid-btn:active, .outline-btn:active, .ghost-btn:active { transform: scale(.97); }
.link-btn { border: 0; background: none; color: rgba(255,255,255,.75); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; padding: 8px; }
.link-btn.dark { color: var(--ink-2); }
.row2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.compare-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; font-size: 18px; }
.compare-body { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 0 14px 20px; align-content: center; }
.compare-body figure { margin: 0; display: grid; gap: 8px; text-align: center; }
.compare-body img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; background: #fff; }

.finish { background: radial-gradient(90% 60% at 50% 30%, #2c2f2b 0%, #141614 100%); color: #fff; overflow-y: auto; }
.fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.finish-inner { position: relative; z-index: 1; min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 22px 20px calc(22px + env(safe-area-inset-bottom)); }
.finish-badge { margin: 0; display: inline-flex; align-items: center; gap: 6px; padding: 5px 14px 5px 10px; border-radius: 999px; background: rgba(252,231,166,.14); color: var(--yellow); font-size: 13px; font-weight: 700; letter-spacing: 2px; animation: fadeup .5s .1s var(--ease) both; }
.finish-badge svg { width: 16px; height: 16px; stroke-width: 2.6; }
.finish h2 { margin: 0; font-size: 24px; font-weight: 900; text-align: center; animation: fadeup .5s .18s var(--ease) both; }
.card-wrap { position: relative; width: min(320px, 74vw, calc((100svh - 330px) * .8)); aspect-ratio: 4 / 5; border-radius: 18px; overflow: hidden; box-shadow: 0 30px 60px -24px rgba(0,0,0,.8), 0 0 0 1px rgba(255,255,255,.08); animation: cardin .9s .2s var(--ease) both; }
.card-wrap img { width: 100%; height: 100%; display: block; object-fit: cover; }
.sheen { position: absolute; inset: 0; background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.5) 45%, transparent 60%); transform: translateX(-120%); animation: sheen 1.4s .9s var(--ease) both; mix-blend-mode: soft-light; }
@keyframes cardin { from { opacity: 0; transform: translateY(40px) scale(.9) rotate(-2deg); } }
@keyframes sheen { to { transform: translateX(120%); } }
.scenes-inline { justify-content: center; }
.scenes-inline button { background: transparent; color: #fff; border-color: rgba(255,255,255,.25); height: 34px; font-size: 12.5px; }
.scenes-inline button[aria-checked="true"] { background: var(--yellow); color: var(--ink); border-color: var(--yellow); }
.finish-actions { width: min(380px, 100%); display: grid; gap: 10px; margin-top: 4px; animation: fadeup .5s .45s var(--ease) both; }
.finish-actions .link-btn { justify-self: center; }

/* 底部對話框 */
.sheet { width: min(460px, 100vw); max-width: 100vw; margin: auto auto 0; padding: 22px 20px calc(18px + env(safe-area-inset-bottom)); border: 0; border-radius: 24px 24px 0 0; background: #fff; color: var(--ink); box-shadow: 0 -20px 40px -20px rgba(0,0,0,.4); }
.sheet::backdrop { background: rgba(20,22,20,.45); }
.sheet[open] { animation: up .3s var(--ease); }
.sheet h2 { margin: 0 0 6px; font-size: 20px; font-weight: 900; }
.sheet-lead { margin: 0 0 14px; font-size: 14px; color: var(--ink-2); }
.steps { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 14px; }
.steps li { display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; }
.steps .num { width: 30px; height: 30px; border-radius: 50%; background: var(--yellow); display: grid; place-items: center; font-weight: 900; font-size: 14px; }
.steps li > div { display: grid; gap: 8px; font-size: 14.5px; }
.steps small { font-size: 12px; color: var(--muted); }
.steps.simple li > div { display: flex; align-items: center; gap: 6px; min-height: 30px; }
.inline-ico { width: 18px; height: 18px; }
.menu-list { display: grid; gap: 4px; margin: 6px 0 8px; }
.menu-list button { min-height: 50px; border: 0; border-radius: 12px; background: var(--paper); font-size: 15px; font-weight: 700; text-align: left; padding: 0 16px; }
.menu-list .danger { color: var(--coral-2); }
#renameForm .row2 { margin-top: 4px; }

/* 桌機：左邊 3D、右邊工具 */
@media (min-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr) 420px; grid-template-rows: 64px auto minmax(0, 1fr) auto; grid-template-areas: "top top" "stage tools" "stage tray" "stage spare"; }
  .top { grid-area: top; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.6); padding: 0 18px; }
  .title-btn { justify-content: flex-start; padding-left: 8px; }
  .stage-wrap { grid-area: stage; grid-row: 2 / 5; }
  .tools { grid-area: tools; border-top: 0; border-left: 1px solid var(--line); padding: 14px 10px; flex-wrap: wrap; }
  .tools > button { flex: 1 0 52px; }
  .objbar { bottom: 18px; }
  .tray { grid-area: tray; max-height: none; border-radius: 0; box-shadow: none; border-left: 1px solid var(--line); animation: none; min-height: 0; }
  .tray-close { display: none; }
  .app::after { content: ""; grid-area: spare; background: #fff; border-left: 1px solid var(--line); }
  .hint { bottom: 18px; }
  .sheet { margin: auto; border-radius: 24px; }
  .works-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); padding: 24px 40px; }
  .works-head, .works-foot { padding-left: 40px; padding-right: 40px; }
  .works-foot { max-width: 640px; }
  .compare-body { max-width: 1000px; margin: 0 auto; width: 100%; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
@media (min-width: 900px) { .tools { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; } .tools > button { min-width: 0; } }

/* 圖示、外框 */
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 10px 8px; }
.icon-tile { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 2px 6px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font-size: 11.5px; font-weight: 600; color: var(--ink-2); transition: transform .15s var(--ease), border-color .2s; }
.icon-tile canvas, .icon-tile img { width: 44px; height: 44px; object-fit: contain; }
.icon-tile:hover { border-color: var(--ink); }
.icon-tile:active { transform: scale(.92); }
/* 選取物件的顏色窗 */
.color-pop { position: absolute; z-index: 6; left: 50%; bottom: 78px; transform: translateX(-50%); width: min(460px, calc(100% - 20px)); padding: 12px; border-radius: 18px; background: #fff; box-shadow: 0 12px 30px -14px rgba(0,0,0,.45); display: grid; gap: 10px; animation: rise .2s var(--ease); }
.color-pop .swatches { grid-template-columns: repeat(auto-fill, minmax(32px, 1fr)); gap: 8px; }
.sw.knock { position: relative; }
.sw.knock::after { content: "同"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; font-weight: 900; color: #fff; mix-blend-mode: difference; }
.color-pop .chips button { height: 34px; }
@media (min-width: 900px) { .color-pop { bottom: 86px; } }

/* 標誌預覽放大、顏色窗改成一排 */
#logoGrid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
#logoGrid .tpl canvas { aspect-ratio: 4 / 3; background: none; }
.color-pop { display: flex; align-items: center; gap: 10px; padding: 8px 10px; bottom: 76px; }
.color-pop .swatches { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; padding: 4px; }
.color-pop .swatches::-webkit-scrollbar { display: none; }
.color-pop .sw { flex: none; width: 32px; height: 32px; }
.color-pop .chips { flex: none; flex-wrap: nowrap; gap: 4px; }
.color-pop .chips button { height: 32px; padding: 0 10px; }
