/* MochiStamp：创作页（index.html）、积分明细（credits.html）、法务页（privacy / terms / tokushoho）共用 */
:root {
  --font: "Hiragino Sans","Hiragino Kaku Gothic ProN","Yu Gothic UI","Yu Gothic",Meiryo,"Noto Sans JP",-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  --bg: #f7f8fa; --surface: #fff; --fg: #1c2230; --sub: #6b7484; --muted: #f2f4f6; --border: #e6e9ee; --border-strong: #cfd5dd;
  --primary: #4fb24e; --primary-hover: #3b9e3c; --tint: #edf8ee; --warn: #b7791f; --warn-bg: #fff7e6; --danger: #d64545; --danger-bg: #fdeeee;
  --gift: #d9480f; --gift-bg: #fff4e6;
  --talk: #7494c0; --dark: #22252b; --radius: 10px; --shadow: 0 10px 30px -18px #1c223040; --bar-h: 76px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
html[lang="en"] { --font: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Hiragino Sans","Noto Sans JP",sans-serif; }
html[lang="zh-CN"] { --font: "PingFang SC","Hiragino Sans GB","Microsoft YaHei","Noto Sans SC",-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.6 var(--font); }
body.app { padding-bottom: calc(var(--bar-h) + 24px + env(safe-area-inset-bottom)); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; }
h1, h2, h3 { margin: 0; }
a { color: var(--primary-hover); }
svg.lucide { width: 16px; height: 16px; stroke-width: 2; flex: none; }
[hidden] { display: none !important; }
.spin { animation: spin 1s linear infinite; }
.sp { display: none; }

/* nav */
.nav { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 20px; height: 56px; padding: 0 24px; background: #ffffffe8; backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; color: inherit; text-decoration: none; }
.brand img { width: 28px; height: 28px; border-radius: 8px; }
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-links a { padding: 6px 10px; border-radius: 8px; color: var(--sub); text-decoration: none; font-size: 13px; }
.nav-links a:hover { background: var(--muted); color: var(--fg); }
.nav-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.credit-badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; background: var(--tint); color: var(--primary-hover); font-size: 12px; font-weight: 700; white-space: nowrap; text-decoration: none; }
.credit-badge:hover { background: #dcf1dd; }
.credit-badge svg { width: 13px; height: 13px; }
.job-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: 12px; }
.lang-switch { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 8px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--sub); }
.lang-switch select { border: 0; background: none; font-size: 12px; font-weight: 600; color: var(--fg); padding: 2px 2px; outline: none; cursor: pointer; }
.lang-switch svg { width: 14px; height: 14px; }

.account-btn { display: inline-flex; align-items: center; gap: 6px; max-width: 180px; padding: 3px 10px 3px 3px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: 12px; font-weight: 600; }
.account-btn:hover { background: var(--muted); }
.account-btn img, .account-btn .initial { width: 26px; height: 26px; border-radius: 50%; flex: none; object-fit: cover; }
.account-btn .initial { display: flex; align-items: center; justify-content: center; background: var(--tint); color: var(--primary-hover); }
.account-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px; }
.account-head img { width: 36px; height: 36px; border-radius: 50%; }
.account-head b { display: block; font-size: 13px; }
.account-head small { color: var(--sub); font-size: 11px; word-break: break-all; }
/* Google sign-in button (Google branding: white, grey border, the four-colour G) */
.gsi-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 40px; padding: 0 16px; border: 1px solid #747775; border-radius: 20px; background: #fff; color: #1f1f1f; font: 500 14px/20px Roboto, var(--font); text-decoration: none; white-space: nowrap; }
.gsi-btn:hover { background: #f6f8fb; box-shadow: 0 1px 3px #3c40434d; }
.gsi-btn.small { height: 34px; padding: 0 12px; font-size: 13px; }
.gsi-btn.disabled { opacity: .45; cursor: default; box-shadow: none; }
.login-box { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 18px 0 10px; }
.login-terms { font-size: 11px; color: var(--sub); text-align: center; margin: 8px 0 0; }
.login-terms a { color: var(--sub); }
.save-nudge { display: grid; gap: 8px; justify-items: start; margin-top: 14px; padding: 10px 12px; border-radius: 12px; background: var(--muted); font-size: 12px; color: var(--sub); }
.save-nudge.in-dialog { grid-template-columns: 1fr auto; align-items: center; margin: 0 0 12px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: var(--radius); border: 1px solid transparent; padding: 10px 18px; font-weight: 700; white-space: nowrap; text-decoration: none; }
.btn.primary { background: var(--primary); color: #fff; box-shadow: 0 6px 14px -6px #4fb24e99; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.primary:disabled { background: #a9d6a8; box-shadow: none; cursor: default; }
.btn.ghost { background: var(--surface); border-color: var(--border-strong); color: var(--fg); }
.btn.ghost:hover { background: var(--muted); }
.btn.small { padding: 5px 10px; font-size: 12px; font-weight: 600; }
.btn.big { padding: 13px 26px; font-size: 16px; }
.btn.pulse { animation: pulse 1.2s ease-out 2; }
.link-btn { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 2px 4px; color: var(--primary-hover); font-size: 12px; font-weight: 600; }
.link-btn:hover { text-decoration: underline; }
.link-btn:disabled { color: var(--sub); text-decoration: none; cursor: default; }
.link-btn.danger { color: var(--danger); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; border: 0; background: none; color: var(--sub); }
.icon-btn:hover { background: var(--muted); color: var(--fg); }

/* hero + layout */
.hero { max-width: 1180px; margin: 28px auto 18px; padding: 0 24px; }
.hero h1 { font-size: 30px; letter-spacing: .01em; }
.hero p { margin: 8px 0 0; color: var(--sub); max-width: 760px; }
.workspace { max-width: 1180px; margin: 0 auto; padding: 0 24px; display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.ws-main { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.ws-side { position: sticky; top: 72px; display: flex; flex-direction: column; gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px; box-shadow: var(--shadow); }
.card h2 { font-size: 15px; margin-bottom: 12px; }

/* A. character */
.start-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.start-chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); font-size: 13px; font-weight: 600; color: var(--sub); }
.start-chip.on { border-color: var(--primary); background: var(--tint); color: var(--primary-hover); }
.start-chip:hover:not(.on) { background: var(--muted); }
.char-row { display: grid; gap: 16px; }
.ref-field { display: flex; flex-direction: column; gap: 6px; }
.upload-area { display: inline-flex; align-items: center; gap: 12px; width: min(360px, 100%); padding: 14px 16px; border: 1.5px dashed var(--border-strong); border-radius: 14px; background: var(--muted); text-align: left; }
.upload-area:hover { border-color: var(--primary); background: var(--tint); }
.upload-area b { display: block; font-size: 13px; }
.upload-area small { display: block; color: var(--sub); font-size: 11px; letter-spacing: .03em; }
.upload-icon { flex: none; width: 40px; height: 40px; border-radius: 10px; background: var(--surface); box-shadow: 0 1px 3px #0000001a; display: flex; align-items: center; justify-content: center; color: var(--primary); }
.upload-icon svg { width: 18px; height: 18px; }
.ref-preview { display: flex; align-items: center; gap: 12px; width: min(360px, 100%); padding: 8px 8px 8px 8px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.ref-thumb { position: relative; flex: none; width: 56px; height: 56px; border-radius: 10px; overflow: hidden; background: var(--muted); }
.ref-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ref-thumb.checking::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, #fff0, #fff9, #fff0); animation: shimmer 1s infinite; }
.ref-meta { flex: 1; min-width: 0; }
.ref-meta b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ref-meta small { color: var(--sub); font-size: 11px; }
.desc-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.desc-label { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--sub); }
.desc-label .req { font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--warn-bg); color: var(--warn); }
.desc-label .req.done { background: var(--muted); color: var(--sub); font-weight: 600; }
.desc-input { display: flex; align-items: center; gap: 8px; border: 1.5px solid var(--border); background: var(--muted); border-radius: var(--radius); padding: 0 10px; transition: border-color .15s, background .15s; }
.desc-input:focus-within { border-color: var(--primary); background: var(--surface); }
.desc-input input { flex: 1; min-width: 0; border: 0; background: none; padding: 10px 0; outline: none; }
.desc-input input::placeholder, .desc-input textarea::placeholder { color: #a3abb7; }
.desc-input.multi { position: relative; align-items: stretch; padding: 0 10px 18px; }
.desc-input textarea { flex: 1; min-width: 0; min-height: 66px; max-height: 200px; border: 0; background: none; padding: 10px 0 0; outline: none; resize: none; font: inherit; line-height: 1.6; }
.desc-count { position: absolute; right: 10px; bottom: 4px; color: var(--sub); font-size: 11px; font-variant-numeric: tabular-nums; }
.desc-input.need { border-color: var(--warn); background: var(--warn-bg); animation: shake .4s ease-in-out; }
.tag { flex: none; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: var(--tint); color: var(--primary-hover); }
.field-note { font-size: 11px; color: var(--sub); margin: 2px 0 0; }
.field-note.warn { color: var(--warn); margin-top: 8px; }

/* B. style strip */
.style-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.style-tile { flex: 0 0 92px; border: 1.5px solid var(--border); border-radius: 12px; background: var(--surface); padding: 4px 4px 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--sub); }
.style-tile img { width: 76px; height: 76px; object-fit: contain; }
.style-tile.on { border-color: var(--primary); background: var(--tint); color: var(--primary-hover); }
.style-tile:hover:not(.on) { border-color: var(--border-strong); }
.style-tile span { text-align: center; line-height: 1.25; }

/* C. text */
.lines-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.lines-head h2 { margin: 0; }
.count-seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; }
.count-seg button { position: relative; border: 0; border-right: 1px solid var(--border); background: var(--surface); padding: 6px 14px; font-weight: 700; font-size: 13px; color: var(--sub); }
.count-seg button:last-child { border-right: 0; }
.count-seg button.on { background: var(--tint); color: var(--primary-hover); }
.count-seg .lock { position: absolute; top: 1px; right: 2px; color: var(--warn); line-height: 0; }
.count-seg .lock svg { width: 9px; height: 9px; }
.count-select { display: none; }
.lines-sub { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 6px 0 12px; font-size: 12px; color: var(--sub); }
#sheets.readonly { opacity: .65; }
.sheet { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px 12px; margin-bottom: 10px; background: #fcfdfd; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.sheet-title { font-size: 12px; font-weight: 700; }
.sheet-title small { font-weight: 500; color: var(--sub); margin-left: 6px; }
.menu-btn { display: inline-flex; align-items: center; gap: 2px; border: 0; background: none; color: var(--primary-hover); font-size: 12px; font-weight: 700; padding: 2px 4px; border-radius: 6px; }
.menu-btn:hover { background: var(--tint); }
.chips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.chip { position: relative; display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 26px 6px 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); text-align: left; cursor: text; transition: border-color .15s, box-shadow .15s; }
.chip:hover { border-color: var(--border-strong); }
.chip .no { flex: none; font-size: 10px; color: var(--sub); font-variant-numeric: tabular-nums; }
.chip .txt { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-all; }
.chip .txt.empty { color: var(--sub); font-weight: 500; font-size: 11px; }
.chip .act { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; border-radius: 6px; border: 0; background: none; color: var(--sub); display: flex; align-items: center; justify-content: center; opacity: 0; }
.chip:hover .act, .chip .act.has { opacity: 1; }
.chip .act.has { color: var(--primary-hover); }
.chip .act svg { width: 14px; height: 14px; }
.chip .lockmark { position: absolute; top: 2px; right: 4px; color: var(--sub); }
.chip .lockmark svg { width: 10px; height: 10px; }
.chip.warn { border-color: #f0c36d; background: var(--warn-bg); }
.chip.dup, .chip.blocked { border-color: var(--danger); background: var(--danger-bg); }
.chip.editing { border-color: var(--primary); box-shadow: 0 0 0 3px #4fb24e26; padding-right: 8px; }
.chip input { width: 100%; border: 0; outline: none; background: none; font-size: 13px; font-weight: 600; padding: 0; }
.chip.loading .txt { color: transparent; background: linear-gradient(90deg, #eef1f4 0%, #f8fafb 50%, #eef1f4 100%); background-size: 200% 100%; animation: shimmer-bg 1s infinite; border-radius: 4px; }
.chip.flash { animation: flash .6s ease-out; }
.ghost-row { width: 100%; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px; border: 1.5px dashed var(--border-strong); border-radius: 12px; background: none; color: var(--sub); font-size: 12px; font-weight: 600; }
.ghost-row:hover { border-color: var(--primary); color: var(--primary-hover); background: var(--tint); }
.chip-hint { font-size: 11px; color: var(--warn); margin: 6px 0 0; }
.form-error { color: var(--danger); font-size: 12px; margin: 6px 0 0; }

/* details */
.details summary { cursor: pointer; font-weight: 700; font-size: 13px; list-style: none; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.details summary > span:first-child { white-space: nowrap; }
.details summary::-webkit-details-marker { display: none; }
.details summary::before { content: "▸"; color: var(--sub); }
.details[open] summary::before { content: "▾"; }
.details summary .sub { font-weight: 400; font-size: 12px; color: var(--sub); }
.details-body { display: grid; gap: 14px; margin-top: 14px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; }
.field input, .field select { border: 1px solid var(--border); background: var(--muted); border-radius: var(--radius); padding: 9px 10px; font-weight: 400; outline: none; }
.field input:focus { border-color: var(--primary); background: var(--surface); }
.field small { font-weight: 400; color: var(--sub); font-size: 11px; }
.field .seg { align-self: flex-start; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch .track { width: 34px; height: 20px; border-radius: 999px; background: var(--border-strong); position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px #0003; }
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(14px); }
.switch.small { font-size: 12px; }
.switch.small .track { width: 28px; height: 16px; }
.switch.small .track::after { width: 12px; height: 12px; }
.switch.small input:checked + .track::after { transform: translateX(12px); }

/* results */
.results-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.results-head h2 { margin: 0; }
.results-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.free-hint { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 12px; padding: 5px 12px; border-radius: 999px; background: var(--gift-bg); color: var(--gift); font-size: 12px; font-weight: 700; }
.free-hint svg { width: 14px; height: 14px; }
.free-hint.used { background: var(--muted); color: var(--sub); }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-right: 1px solid var(--border); background: var(--surface); padding: 4px 10px; font-size: 12px; color: var(--sub); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--tint); color: var(--primary-hover); font-weight: 700; }
.rsheet { margin-bottom: 16px; }
.rsheet-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.rsheet-head .state { font-size: 12px; color: var(--sub); display: inline-flex; align-items: center; gap: 6px; }
.rsheet-head .state.ok { color: var(--primary-hover); }
.rsheet-head .state.bad { color: var(--danger); }
.rsheet-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.rgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.rgrid.bg-white .cell-img { background: #fff; }
.rgrid.bg-talk .cell-img { background: var(--talk); }
.rgrid.bg-dark .cell-img { background: var(--dark); }
.rgrid.bg-white .cell-img.checker { background: repeating-conic-gradient(#f1f3f5 0% 25%, #fff 0% 50%) 50% / 14px 14px; }
.cell { position: relative; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); }
.cell-img { position: relative; aspect-ratio: 37 / 32; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.cell-img img { width: 100%; height: 100%; object-fit: contain; animation: appear .4s ease-out; }
.cell-img.safe::after { content: ""; position: absolute; inset: 3.1% 2.7%; border: 1px dashed #4fb24ecc; pointer-events: none; }
.cell-line { display: flex; align-items: center; gap: 4px; padding: 4px 6px; font-size: 11px; border-top: 1px solid var(--border); color: var(--sub); white-space: nowrap; overflow: hidden; }
.cell-line b { color: var(--fg); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.badges { position: absolute; top: 4px; left: 4px; display: flex; gap: 3px; flex-wrap: wrap; pointer-events: none; }
.badge { font-size: 9px; font-weight: 700; padding: 1px 5px; border-radius: 4px; background: #1c2230cc; color: #fff; }
.badge.main { background: var(--primary); }
.badge.new { background: #e8820c; }
.badge.warn { background: var(--warn); }
.quick { position: absolute; top: 4px; right: 4px; display: flex; gap: 3px; opacity: 0; transition: opacity .15s; }
.cell:hover .quick { opacity: 1; }
.quick button { height: 26px; min-width: 26px; border-radius: 7px; border: 0; background: #ffffffe6; box-shadow: 0 1px 3px #0002; display: flex; align-items: center; justify-content: center; gap: 3px; padding: 0 6px; color: var(--fg); font-size: 10px; font-weight: 700; }
.quick button.free { background: var(--gift-bg); color: var(--gift); }
.quick button svg { width: 14px; height: 14px; }
.placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--sub); font-size: 11px; background: var(--muted); text-align: center; padding: 4px; }
.placeholder.over { background: #ffffffb3; }
.placeholder.bad { background: var(--danger-bg); color: var(--danger); cursor: pointer; }
.placeholder.shimmer { background: linear-gradient(90deg, #eef1f4 0%, #f9fafb 50%, #eef1f4 100%); background-size: 200% 100%; animation: shimmer-bg 1.2s infinite; }
.sheet-error { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 26px 12px; border: 1px dashed #f0b4b4; border-radius: 10px; background: var(--danger-bg); color: var(--danger); text-align: center; font-size: 13px; }

/* side */
.side-card h3 { font-size: 14px; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.side-card h3 .tag { font-size: 10px; }
.style-preview { display: flex; justify-content: center; padding: 8px; border-radius: 10px; background: var(--muted); }
.style-preview img { width: 100%; max-width: 220px; aspect-ratio: 1; object-fit: contain; }
.samples-note { font-size: 11px; color: var(--sub); margin: 6px 0 12px; text-align: center; }
.file-list, .auto-list, .check-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 12px; }
.file-list li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 8px; background: var(--muted); border-radius: 8px; }
.file-list li span:last-child { color: var(--sub); }
.auto-title { font-size: 12px; font-weight: 700; margin: 14px 0 6px; }
.auto-list li, .check-list li { display: flex; align-items: flex-start; gap: 6px; color: var(--sub); }
.auto-list svg, .check-list svg { width: 14px; height: 14px; color: var(--primary); margin-top: 2px; }
.check-list li.pending svg { color: var(--sub); animation: spin 1s linear infinite; }
.check-list li.bad, .check-list li.bad svg { color: var(--danger); }
.pack { display: flex; gap: 12px; align-items: flex-end; margin-bottom: 4px; }
.pack figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 10px; color: var(--sub); }
.pack .main-img { width: 96px; height: 96px; border-radius: 10px; background: repeating-conic-gradient(#f1f3f5 0% 25%, #fff 0% 50%) 50% / 12px 12px; border: 1px solid var(--border); }
.pack .tab-img { width: 48px; height: 37px; border-radius: 6px; background: repeating-conic-gradient(#f1f3f5 0% 25%, #fff 0% 50%) 50% / 8px 8px; border: 1px solid var(--border); }
.pack img { width: 100%; height: 100%; object-fit: contain; }
.side-actions { display: grid; gap: 8px; margin-top: 14px; }
.side-actions .btn { width: 100%; }
.side-links { display: grid; gap: 4px; margin-top: 10px; font-size: 12px; }
.side-links a { color: var(--primary-hover); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }

/* below the creator */
.below { max-width: 1180px; margin: 48px auto 0; padding: 0 24px; }
.below h2 { font-size: 20px; margin-bottom: 6px; }
.below-sub { margin: 0 0 16px; color: var(--sub); }
.below > h2 + .steps, .below > h2 + .why-grid, .below > h2 + .faq { margin-top: 14px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.steps li { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.steps b { width: 24px; height: 24px; border-radius: 50%; background: var(--tint); color: var(--primary-hover); display: flex; align-items: center; justify-content: center; font-size: 12px; }
.steps span { font-weight: 700; }
.steps small { color: var(--sub); font-size: 12px; }
.style-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.style-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); text-align: center; }
.style-card:hover { border-color: var(--primary); }
.style-card img { width: 100%; max-width: 180px; aspect-ratio: 1; object-fit: contain; }
.style-card small { color: var(--sub); font-size: 12px; }
.why-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.why-item { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; }
.why-item p { margin: 6px 0 0; color: var(--sub); font-size: 13px; }
.pricing-free { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 14px; padding: 6px 12px; border-radius: 999px; background: var(--gift-bg); color: var(--gift); font-size: 13px; font-weight: 700; }
.pack-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }   /* the buy dialog: four packs, two by two */
.pack-card { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 16px; border: 1.5px solid var(--border); border-radius: 14px; background: var(--surface); text-align: left; }
.pack-card:hover { border-color: var(--primary); }
.pack-card:disabled { cursor: default; }
.pack-card:disabled:not(.busy) { opacity: .5; }
.pack-card.busy::after { content: ''; position: absolute; right: 14px; bottom: 14px; width: 16px; height: 16px; border: 2px solid var(--primary); border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
.pack-card.popular { border-color: var(--primary); }
.pack-card.pick { background: var(--tint); border-color: var(--primary); box-shadow: 0 0 0 3px #4fb24e26; }
.pack-card .pop { position: absolute; top: -10px; right: 12px; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--primary); color: #fff; }
.pack-name { font-size: 12px; color: var(--sub); font-weight: 600; }
.pack-credits { font-size: 18px; }
.pack-price { font-size: 22px; font-weight: 800; color: var(--primary-hover); }
.pack-card small { color: var(--sub); font-size: 11px; }
.pack-card .pack-price small { margin-left: 4px; font-size: 11px; font-weight: 600; }
.pack-card .save { color: var(--gift); }
.pack-card .pack-yen { margin: -2px 0 2px; color: var(--fg); font-size: 12px; font-weight: 600; }
/* pricing section / page: one card per pack */
.pricing-value { margin: -8px 0 16px; font-size: 14px; font-weight: 600; }
.plan-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: stretch; }
.plan { position: relative; display: flex; flex-direction: column; padding: 22px 18px 18px; border: 1.5px solid var(--border); border-radius: 16px; background: var(--surface); }
.plan.popular { border-color: var(--primary); background: linear-gradient(180deg, var(--tint), var(--surface) 160px); box-shadow: 0 8px 24px #4fb24e1f; }
.plan-badge { position: absolute; top: -11px; left: 50%; transform: translateX(-50%); padding: 3px 12px; border-radius: 999px; background: var(--primary); color: #fff; font-size: 11px; font-weight: 700; white-space: nowrap; }
.plan-badge.alt { background: var(--gift); }
.plan h3 { margin: 0; font-size: 17px; }
.plan-for { margin: 2px 0 12px; color: var(--sub); font-size: 12px; line-height: 1.6; min-height: 3.2em; }   /* two lines on every card */
.plan-price { display: flex; align-items: baseline; gap: 6px; }
.plan-price b { font-size: 30px; font-weight: 800; letter-spacing: -.01em; }
.plan-price { flex-wrap: wrap; }
.plan-price span { color: var(--sub); font-size: 12px; }
.plan-price .plan-yen { flex-basis: 100%; margin-top: -2px; font-size: 13px; font-weight: 600; color: var(--fg); }
.plan-unit { margin: 4px 0 0; color: var(--sub); font-size: 12px; }
.plan-save-row { margin: 6px 0 0; min-height: 22px; font-size: 12px; }   /* kept on every card so the rows line up */
.plan-save { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--gift-bg); color: var(--gift); font-weight: 700; }
.plan-qty { display: flex; flex-direction: column; margin: 12px 0 8px; padding: 8px 10px; border-radius: 10px; background: var(--muted); text-align: center; }
.plan-qty b { font-size: 16px; }
.plan-qty small { color: var(--sub); font-size: 11px; }
.plan-list { flex: 1; margin: 0 0 16px; padding: 0; list-style: none; font-size: 13px; }
.plan-list li { display: flex; gap: 6px; padding: 4px 0; line-height: 1.5; }
.plan-list li svg { flex: none; width: 15px; height: 15px; margin-top: 3px; color: var(--primary); }
.plan-list li.key { font-weight: 700; }
.plan-buy { width: 100%; justify-content: center; }
.plan-buy.busy::after { content: ''; width: 14px; height: 14px; margin-left: 8px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@media (max-width: 1000px) { .plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 14px; } }
@media (max-width: 640px) { .plan-grid { grid-template-columns: 1fr; } .plan-for { min-height: 0; } }
.faq { display: grid; gap: 8px; }
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; }
.faq summary { cursor: pointer; font-weight: 700; }
.faq p { margin: 8px 0 0; color: var(--sub); }
.cta { max-width: 1180px; margin: 48px auto 0; padding: 36px 24px; text-align: center; border-radius: 18px; background: linear-gradient(135deg, #edf8ee, #fff7e6); }
.cta h2 { font-size: 22px; }
.cta p { color: var(--sub); margin: 6px 0 16px; }
.footer { color: var(--sub); font-size: 12px; padding: 40px 24px 20px; max-width: 1180px; margin: 0 auto; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }
.footer-brand p { margin: 8px 0 0; max-width: 520px; }
.footer-disclaimer { font-size: 11px; }
.footer-links { display: grid; gap: 6px; align-content: start; }
.footer-links a, .footer a { color: var(--sub); text-decoration: none; }
.footer-links a:hover { color: var(--fg); text-decoration: underline; }
.footer-bottom { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 16px; font-size: 11px; flex-wrap: wrap; }

/* action bar */
.action-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: #ffffffef; backdrop-filter: blur(10px); border-top: 1px solid var(--border); box-shadow: 0 -10px 30px -20px #1c223055; padding-bottom: env(safe-area-inset-bottom); }
.bar-inner { max-width: 1180px; margin: 0 auto; padding: 10px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: var(--bar-h); }
.bar-left { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.bar-left p { margin: 0; }
.hint { font-size: 12px; color: var(--warn); font-weight: 600; }
.summary { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.summary button { border: 0; background: none; padding: 0; font-weight: 700; color: var(--fg); border-bottom: 1px dotted var(--border-strong); }
.summary button.warn { color: var(--warn); border-bottom-color: var(--warn); }
.summary button:hover { color: var(--primary-hover); }
.summary .dot { color: var(--sub); margin: 0 6px; font-weight: 400; }
.status { font-size: 12px; color: var(--sub); }
.status .link-btn { padding: 0 0 0 6px; }
.status.warn { color: var(--warn); }
.bar-right { display: flex; align-items: center; gap: 8px; flex: none; }
.bar-progress { height: 3px; background: var(--muted); }
.bar-progress span { display: block; height: 100%; width: 0; background: var(--primary); transition: width .4s; }

/* toasts, popover, dialogs, bottom sheet */
.toasts { position: fixed; left: 50%; bottom: calc(var(--bar-h) + 20px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(560px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; background: #1c2230; color: #fff; font-size: 13px; box-shadow: 0 10px 30px -10px #0006; animation: toast-in .2s ease-out; }
.toast.bad { background: #8a2525; }
.toast button { border: 0; background: none; color: #8fe08e; font-weight: 700; padding: 0; white-space: nowrap; }
.toast.big { font-size: 14px; padding: 12px 16px; }
.popover { position: absolute; z-index: 70; min-width: 220px; max-width: 280px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 16px 40px -14px #1c223066; padding: 6px; }
.popover .item { width: 100%; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 0; background: none; border-radius: 8px; text-align: left; font-size: 13px; }
.popover .item:hover { background: var(--muted); }
a.item { color: inherit; text-decoration: none; }
.popover .item.cur { color: var(--primary-hover); font-weight: 700; }
.popover .item small { margin-left: auto; color: var(--sub); font-size: 11px; }
.popover hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }
.popover .pop-field { padding: 8px; display: grid; gap: 6px; font-size: 12px; font-weight: 600; }
.popover .pop-field input { border: 1px solid var(--border); border-radius: 8px; padding: 8px; font-weight: 400; outline: none; }
.popover .pop-help { font-weight: 400; color: var(--sub); }
dialog { border: 0; border-radius: 16px; padding: 0; width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); box-shadow: 0 30px 80px -20px #0007; }
dialog.wide { width: min(860px, calc(100vw - 32px)); }
dialog::backdrop { background: #10182066; }
.dlg-head { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; background: var(--surface); border-bottom: 1px solid var(--border); z-index: 1; }
.dlg-head h3 { font-size: 16px; }
#dlgBody { padding: 16px 18px 18px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.dlg-copy { color: var(--sub); font-size: 13px; margin: 0 0 12px; }
.dlg-copy.center { text-align: center; margin-top: 10px; }
.redraw-preview { display: flex; justify-content: center; background: repeating-conic-gradient(#f1f3f5 0% 25%, #fff 0% 50%) 50% / 14px 14px; border-radius: 12px; margin-bottom: 12px; }
.redraw-preview img { width: 185px; height: 160px; object-fit: contain; }
.free-note { display: flex; align-items: center; gap: 6px; margin: 0 0 12px; padding: 8px 12px; border-radius: 10px; background: var(--gift-bg); color: var(--gift); font-size: 13px; font-weight: 700; }
.free-note.used { background: var(--muted); color: var(--sub); font-weight: 600; }
.form-grid { display: grid; gap: 12px; }
.quick-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.quick-chips button { border: 1px solid var(--border-strong); background: var(--surface); border-radius: 999px; padding: 3px 10px; font-size: 12px; }
.quick-chips button:hover { border-color: var(--primary); color: var(--primary-hover); }
.big-view { display: flex; justify-content: center; border-radius: 12px; overflow: hidden; }
.big-view img { width: min(370px, 100%); aspect-ratio: 37 / 32; object-fit: contain; }
.board-view img { width: 100%; border-radius: 10px; border: 1px solid var(--border); }
.pack-grid.in-dialog { margin-top: 6px; }
.creations { display: grid; gap: 8px; }
.creation { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px; border: 1px solid var(--border); border-radius: 12px; }
.creation img, .creation .ph { width: 64px; height: 55px; object-fit: contain; background: var(--muted); border-radius: 8px; }
.creation b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.creation small { color: var(--sub); }
.creation-actions { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

/* chat simulator */
.phone { width: min(340px, 100%); margin: 0 auto; border-radius: 28px; border: 8px solid #20232a; overflow: hidden; background: var(--talk); display: flex; flex-direction: column; height: 520px; }
.phone.dark { background: #1d1f24; }
.phone-head { background: #2a2f3a; color: #fff; font-size: 13px; font-weight: 700; padding: 10px 14px; }
.phone-body { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.msg { display: flex; flex-direction: column; max-width: 78%; }
.msg.them { align-self: flex-start; }
.msg.me { align-self: flex-end; align-items: flex-end; }
.msg .bubble { background: #fff; color: #1c2230; padding: 7px 11px; border-radius: 16px; font-size: 13px; }
.msg.me .bubble { background: #8de055; }
.msg img { width: 150px; height: 130px; object-fit: contain; }
.msg small { font-size: 10px; color: #ffffffcc; }
.phone-strip { display: flex; gap: 6px; overflow-x: auto; padding: 8px; background: #f4f5f7; }
.phone-strip button { flex: none; width: 64px; height: 56px; border: 1px solid var(--border); border-radius: 8px; background: #fff; padding: 2px; }
.phone-strip img { width: 100%; height: 100%; object-fit: contain; }
.chat-tools { display: flex; justify-content: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

.sheet-panel { position: fixed; inset: auto 0 0 0; z-index: 80; max-height: 78dvh; display: flex; flex-direction: column; background: var(--surface); border-radius: 18px 18px 0 0; box-shadow: 0 -20px 50px -10px #0005; padding-bottom: env(safe-area-inset-bottom); animation: sheet-up .2s ease-out; }
.sheet-panel .sp-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); font-weight: 700; }
.sheet-panel .sp-body { overflow-y: auto; padding: 10px 16px; display: grid; gap: 8px; }
.sheet-panel .sp-row { display: grid; grid-template-columns: 22px 1fr; gap: 8px; align-items: center; }
.sheet-panel .sp-row span { font-size: 11px; color: var(--sub); text-align: right; }
.sheet-panel input { border: 1px solid var(--border); border-radius: 10px; padding: 10px; font-size: 16px; outline: none; }
.sheet-panel input:focus { border-color: var(--primary); }
.sheet-panel .sp-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px 16px 14px; border-top: 1px solid var(--border); }
.sheet-panel .sp-foot .btn.primary { grid-column: 1 / -1; }
.scrim { position: fixed; inset: 0; z-index: 75; background: #10182055; }

/* credits history page */
.page { max-width: 880px; margin: 28px auto 40px; padding: 0 24px; }
.page h1 { font-size: 26px; }
.page-lead { color: var(--sub); margin: 6px 0 18px; }
.balance-card { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; }
.balance-card .big { font-size: 34px; font-weight: 800; color: var(--primary-hover); line-height: 1.1; }
.balance-card .label { color: var(--sub); font-size: 12px; }
.account-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0 0; font-size: 12px; color: var(--sub); }
.totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0; }
.totals div { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; }
.totals b { display: block; font-size: 18px; }
.totals span { font-size: 12px; color: var(--sub); }
.ledger { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; font-size: 13px; }
.ledger th, .ledger td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.ledger th { background: var(--muted); font-size: 12px; color: var(--sub); font-weight: 600; }
.ledger td.num, .ledger th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ledger td.plus { color: var(--primary-hover); font-weight: 700; }
.ledger td.minus { font-weight: 700; }
.ledger td.time { color: var(--sub); white-space: nowrap; }
.ledger tr:last-child td { border-bottom: 0; }
.ledger .detail small { display: block; color: var(--sub); font-size: 11px; }
.ledger-more { display: flex; justify-content: center; margin-top: 12px; }
.empty-note { text-align: center; color: var(--sub); padding: 30px; }

/* legal pages */
.nav-inner { width: 100%; max-width: 1180px; margin: 0 auto; display: flex; align-items: center; gap: 20px; }
.nav-tools { display: flex; align-items: center; gap: 12px; }
.segmented { display: flex; background: var(--muted); border-radius: 8px; padding: 3px; gap: 2px; width: fit-content; max-width: 100%; }
.segmented button { border: none; padding: 5px 10px; background: transparent; border-radius: 6px; color: var(--sub); font-size: 12px; font-weight: 600; white-space: nowrap; }
.segmented button.active { background: var(--surface); color: var(--fg); box-shadow: 0 2px 3px #0000000b; }
.secondary { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border); background: var(--muted); border-radius: 8px; padding: 8px 14px; font-weight: 700; text-decoration: none; color: var(--fg); }
.secondary.small { padding: 6px 12px; font-size: 12px; }
.legal { max-width: 820px; margin: auto; padding: 48px 32px 80px; }
.legal h1 { font-size: 32px; margin: 0 0 8px; line-height: 1.3; }
.legal h2 { font-size: 20px; margin: 40px 0 12px; }
.legal h3 { font-size: 16px; margin: 24px 0 8px; }
.legal p, .legal li { font-size: 14px; line-height: 1.9; }
.legal ul, .legal ol { padding-left: 22px; }
.legal-meta { color: var(--sub); font-size: 12px; margin-bottom: 24px; }
.legal-toc { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 16px 24px; margin: 24px 0 8px; }
.legal-toc ol { margin: 0; }
.legal-toc a { text-decoration: none; }
.legal-toc a:hover { text-decoration: underline; }
.legal table { border-collapse: collapse; width: 100%; margin: 16px 0; font-size: 14px; }
.legal th, .legal td { border: 1px solid var(--border); padding: 10px 12px; text-align: left; vertical-align: top; line-height: 1.7; }
.legal th { background: var(--muted); width: 32%; font-weight: 600; }
mark.todo { background: #fff3b0; color: #5a4b00; padding: 0 4px; border-radius: 3px; }
.legal-back { margin-top: 48px; }
.legal-nav { display: flex; gap: 16px; flex-wrap: wrap; }
.legal-nav a { color: var(--sub); text-decoration: none; }
.legal-nav a:hover { text-decoration: underline; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@keyframes shimmer-bg { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes appear { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
@keyframes flash { 0% { box-shadow: 0 0 0 3px #4fb24e66; } 100% { box-shadow: 0 0 0 0 #4fb24e00; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 #4fb24e88; } 100% { box-shadow: 0 0 0 14px #4fb24e00; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* tablet / mobile */
@media (max-width: 1023px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .ws-side { position: static; }
  .steps, .style-cards { grid-template-columns: repeat(2, 1fr); }
  .why-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  :root { --bar-h: 124px; }
  .nav { padding: 0 12px; gap: 8px; }
  .nav-links { display: none; }
  .account-name { display: none; }
  .account-btn { padding: 3px; }
  .save-nudge.in-dialog { grid-template-columns: 1fr; }
  .brand span { display: none; }
  .lang-switch svg { display: none; }
  .lang-switch { padding: 2px 4px; }
  .hero { margin: 18px auto 12px; padding: 0 16px; }
  .hero h1 { font-size: 22px; }
  .hero p { font-size: 13px; }
  .workspace, .below { padding: 0 12px; }
  .cta { margin: 40px 12px 0; padding: 28px 16px; }
  .card { padding: 14px; border-radius: 12px; }
  .count-seg { display: none; }
  .count-select { display: block; border: 1px solid var(--border-strong); border-radius: 8px; padding: 5px 8px; font-weight: 700; background: var(--surface); }
  .chips { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chip { cursor: pointer; }
  .chip .act { opacity: 1; }
  .rgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
  .cell-line { display: none; }
  .quick { display: none; }
  .bar-inner { padding: 8px 12px; gap: 10px; flex-wrap: wrap; }
  .bar-left { flex: 1 1 100%; }
  .bar-right { flex: 1 1 100%; }
  .bar-right .btn { min-width: 0; }
  .bar-right .btn.big { flex: 2; font-size: 15px; padding: 12px 10px; }
  .bar-right .btn.ghost { flex: 1; padding: 12px 8px; }
  .pc { display: none; }
  .sp { display: inline; }
  .hint { display: none; }
  .steps, .why-grid { grid-template-columns: 1fr; }
  .pack-grid, .pack-grid.in-dialog { grid-template-columns: 1fr 1fr; gap: 10px; }
  .pack-card { padding: 14px 12px 12px; }
  .pack-credits { font-size: 16px; }
  .pack-price { font-size: 20px; }
  .results-tools .switch { display: none; }
  .footer-grid { grid-template-columns: 1fr; }
  .creation { grid-template-columns: 56px minmax(0, 1fr); }
  .creation-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .page { padding: 0 12px; }
  .totals { grid-template-columns: 1fr; }
  .ledger th:nth-child(4), .ledger td:nth-child(4) { display: none; }
  .segmented button { padding: 5px 8px; }
  .legal { padding: 32px 16px 64px; }
  .legal h1 { font-size: 26px; }
  .legal th { width: 40%; }
}

/* admin.html（管理后台） */
/* Not signed in: the introduction sections (.intro) follow the creator on one page.
   Signed in: the creator page has only the creator, and the nav opens them as pages of their own (index.html#how / #pricing / #faq). */
.signed-in .intro { display: none !important; }
.signed-in[data-view="how"] #how, .signed-in[data-view="how"] #styles, .signed-in[data-view="how"] #why,
.signed-in[data-view="pricing"] #pricing, .signed-in[data-view="faq"] #faq, .signed-in[data-view="creations"] #creations,
.signed-in:is([data-view="how"], [data-view="pricing"], [data-view="faq"]) .cta { display: block !important; }   /* the way back to the creator, also on phones */
#creations { display: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.page-head h2 { margin-bottom: 4px; }
.creation-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.creation-card { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.creation-card[hidden] { display: none; }
.creation-thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; padding: 10px; border: 0; background: var(--muted); cursor: pointer; }
.creation-thumbs img { width: 100%; aspect-ratio: 370 / 320; object-fit: contain; }
.creation-thumbs .ph { grid-column: 1 / -1; aspect-ratio: 4 / 1; }
.creation-body { padding: 12px 14px 6px; min-width: 0; }
.creation-body b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.creation-body small { color: var(--sub); font-size: 12px; }
.creation-card .creation-actions { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px; padding: 8px 14px 14px; margin-top: auto; }
.creation-card .creation-actions .btn { justify-content: center; }
.creation-card .creation-actions .link-btn { justify-self: end; }
.upload-area.drag { border-color: var(--primary); background: var(--tint); }
.pricing-balance { display: none; margin: 4px 0 10px; font-size: 14px; }
.signed-in .pricing-balance { display: block; }
.creations-more { margin-top: 16px; text-align: center; }
.next-short { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--warn-bg); color: var(--warn); font-size: 12px; }
.next-short span { flex: 1 1 160px; }
.notify-btn, .notify-on { display: inline-flex; align-items: center; gap: 4px; margin-left: 10px; font-size: 12px; }
.notify-btn svg, .notify-on svg { width: 14px; height: 14px; }
.notify-on { color: var(--sub); }
.line-info { margin-top: 18px; padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.line-info h3 { display: flex; align-items: center; gap: 6px; margin: 0 0 4px; font-size: 15px; }
.li-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.li-field[data-k="copyright"] { grid-column: 1 / -1; }
.li-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 12px; color: var(--sub); }
.li-head label { font-weight: 600; color: var(--fg); }
.li-count { margin-left: auto; font-variant-numeric: tabular-nums; }
.li-field input, .li-field textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 8px; font: inherit; font-size: 13px; resize: vertical; }
.li-field.bad input, .li-field.bad textarea { border-color: var(--danger); }
.li-field.bad .li-count { color: var(--danger); font-weight: 700; }
.li-warn { margin: 4px 0 0; color: var(--danger); font-size: 12px; }
.li-steps { margin: 14px 0 6px; padding-left: 20px; color: var(--sub); font-size: 13px; line-height: 1.8; }
.li-link { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }
@media (max-width: 640px) { .li-grid { grid-template-columns: 1fr; } }
.creations-empty { grid-column: 1 / -1; padding: 40px 16px; text-align: center; color: var(--sub); border: 1px dashed var(--border-strong); border-radius: 14px; }
.signed-in[data-view]:not([data-view="create"]) .hero,
.signed-in[data-view]:not([data-view="create"]) .workspace,
.signed-in[data-view]:not([data-view="create"]) .action-bar { display: none !important; }
.signed-in[data-view]:not([data-view="create"]) main { min-height: calc(100vh - 220px); padding-top: 8px; }
.signed-in .nav-links a.on { background: var(--tint); color: var(--fg); font-weight: 600; }

.page.admin { max-width: 1180px; }
.admin h2 { margin: 28px 0 10px; font-size: 15px; }
.admin-tabs button { flex: none; white-space: nowrap; padding: 6px 10px; border: 0; border-radius: 8px; background: none; color: var(--sub); font: inherit; font-size: 13px; cursor: pointer; }
.admin-tabs button:hover { background: var(--muted); color: var(--fg); }
.admin-tabs button.on { background: var(--tint); color: var(--fg); font-weight: 600; }
.admin-who, .admin-hint, .admin-settings { color: var(--sub); font-size: 12px; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.card.stat { padding: 14px 16px; }
.card.stat .label { color: var(--sub); font-size: 12px; }
.card.stat .big { margin: 2px 0; font-size: 22px; font-weight: 700; overflow-wrap: anywhere; }
.card.stat small { display: block; color: var(--sub); font-size: 12px; }
.admin-table { overflow-x: auto; }
.admin .ledger td small { display: block; color: var(--sub); font-size: 11px; }
.admin .ledger td.pre { white-space: pre-wrap; font-size: 12px; }
.admin .ledger th, .admin .ledger td.time, .admin .ledger td.nw { white-space: nowrap; }
.admin .ledger td.desc { min-width: 220px; }
.admin .ledger tr.today td { background: var(--tint); }
.admin .ledger tr.today small { display: inline; color: var(--primary-hover); font-weight: 700; }
.admin .mono { font-family: ui-monospace, Menlo, monospace; font-size: 11px; }
.admin-thumb { width: 44px; height: 38px; object-fit: contain; }
.admin-search, .admin-adjust { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.admin-search input, .admin-adjust input { min-width: 0; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 8px; font: inherit; font-size: 13px; }
.admin-search input { flex: 1 1 260px; }
.admin-adjust #delta { width: 130px; }
.admin-adjust #note { flex: 1 1 240px; }
.admin-user { margin-top: 20px; padding: 18px; }
.admin-user-head { display: flex; align-items: center; gap: 12px; }
.admin-user-head img { width: 40px; height: 40px; border-radius: 50%; }
.admin-user-head > div:nth-child(2) { flex: 1; min-width: 0; }
.admin-user-head small { display: block; color: var(--sub); font-size: 12px; overflow-wrap: anywhere; }
.admin-user-head .big { font-size: 22px; font-weight: 700; white-space: nowrap; }
.admin-frozen { color: var(--danger); }
.admin-stickers { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.admin-stickers figure { margin: 0; padding: 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.admin-stickers figure.bad { border-color: var(--danger); background: var(--danger-bg); }
.admin-stickers img { width: 100%; aspect-ratio: 370 / 320; object-fit: contain; background: var(--muted); border-radius: 6px; }
.admin-stickers .ph { display: block; aspect-ratio: 370 / 320; background: var(--muted); border-radius: 6px; }
.admin-stickers figcaption { margin-top: 6px; font-size: 12px; }
.admin-tag { display: inline-block; padding: 0 6px; border-radius: 6px; background: var(--primary); color: #fff; font-size: 10px; font-weight: 700; }
.admin-stickers figcaption small { display: block; color: var(--sub); overflow-wrap: anywhere; }
.admin-error { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.admin-error summary { cursor: pointer; overflow-wrap: anywhere; }
.admin-error pre { overflow-x: auto; padding: 10px; border-radius: 8px; background: var(--muted); font-size: 11px; white-space: pre-wrap; }
@media (max-width: 640px) {
  .nav-links.admin-tabs:not([hidden]) { display: flex; overflow-x: auto; }
  .admin-who { display: none; }
}
