:root {
  --accent: #6657ff;
  --ink: #16161d;
  --muted: #73737e;
  --faint: #a7a7b0;
  --paper: #ffffff;
  --surface: #f4f4f7;
  --surface-strong: #ececf1;
  --ok: #00a66a;
  --warn: #d97706;
  --bad: #dc284f;
  --corner: 10px;
  --corner-sm: 7px;
  --page: min(100%, 720px);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang TC", "PingFang SC", "Microsoft JhengHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); -webkit-text-size-adjust: 100%; }
body { min-height: 100svh; margin: 0; background: var(--paper); color: var(--ink); -webkit-tap-highlight-color: transparent; }
button, input, select { font: inherit; }
button { border: 0; }
button, select, input[type="range"] { touch-action: manipulation; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 28%, transparent); outline-offset: 3px; }
button:disabled { opacity: .38; cursor: not-allowed; }
.spectrum { position: fixed; z-index: 20; top: 0; left: 0; width: 100%; height: 4px; background: linear-gradient(90deg,#645cff 0%,#00a8ff 24%,#00c978 48%,#ffd43b 70%,#ff5b85 100%); }
.app { width: var(--page); margin: 0 auto; padding: calc(28px + env(safe-area-inset-top)) 20px calc(132px + env(safe-area-inset-bottom)); }
.hero { padding: 10px 0 28px; }
.hero-bar { display: flex; min-height: 32px; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; letter-spacing: .14em; }
.brand-mark { width: 9px; height: 9px; border-radius: 3px; background: var(--accent); box-shadow: 10px 0 0 #00b9ff, 20px 0 0 #ff4c8b; }
.hero h1 { max-width: 600px; margin: 34px 0 14px; font-size: clamp(40px, 10vw, 68px); line-height: .98; letter-spacing: -.055em; font-weight: 790; }
.hero p { max-width: 520px; margin: 0; color: var(--muted); font-size: 15px; line-height: 1.65; }
.text-button { min-height: 40px; padding: 0 4px; background: transparent; color: var(--accent); font-size: 14px; font-weight: 700; cursor: pointer; }
.install { display: none; }
.install.show { display: inline-flex; align-items: center; }
.source-section, .mode-section, .editor-section, .quality-section, .result-section { padding: 24px 0; }
.source-section { padding-top: 6px; }
.source-button { position: relative; display: flex; min-height: 78px; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 16px 14px 18px; overflow: hidden; border-radius: var(--corner); background: linear-gradient(125deg, color-mix(in srgb,var(--accent) 14%,#f5f5f8), #f6f6f8 70%); cursor: pointer; }
.source-button input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.source-copy { display: grid; min-width: 0; gap: 5px; }
.source-copy strong { font-size: 17px; line-height: 1.2; }
.source-copy span { overflow: hidden; color: var(--muted); font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.source-plus { display: grid; width: 42px; height: 42px; flex: 0 0 auto; place-items: center; border-radius: 9px; background: var(--ink); color: #fff; font-size: 25px; font-weight: 350; line-height: 1; }
.source-button.has-file .source-plus { background: var(--accent); }
.status { min-height: 18px; margin: 10px 2px 0; color: var(--muted); font-size: 12.5px; }
.status[data-state="ok"] { color: var(--ok); }
.status[data-state="warn"] { color: var(--warn); }
.status[data-state="bad"] { color: var(--bad); }
.section-head { display: grid; grid-template-columns: 28px 1fr auto; align-items: baseline; gap: 8px; margin-bottom: 14px; }
.section-head h2, .result-head h2 { margin: 0; font-size: 18px; line-height: 1.2; letter-spacing: -.02em; }
.section-index { color: var(--accent); font-size: 11px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .06em; }
.section-action { min-height: 32px; align-self: center; color: var(--muted); }
.mode-rail { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(110px, 1fr); gap: 7px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; scroll-snap-type: x proximity; }
.mode-rail::-webkit-scrollbar { display: none; }
.mode-chip { display: grid; min-height: 78px; align-content: space-between; gap: 8px; padding: 11px 12px; border-radius: var(--corner); background: var(--surface); color: var(--ink); text-align: left; cursor: pointer; scroll-snap-align: start; transition: transform .16s ease, background .16s ease, color .16s ease; }
.mode-chip:active { transform: scale(.975); }
.mode-chip[aria-pressed="true"] { background: var(--ink); color: #fff; }
.mode-glyph { display: grid; width: 25px; height: 25px; place-items: center; border-radius: 6px; background: var(--paper); color: var(--ink); font-size: 11px; font-weight: 850; }
.mode-chip[aria-pressed="true"] .mode-glyph { background: var(--accent); color: #fff; }
.mode-chip > span:last-child { font-size: 13px; font-weight: 750; }
.layout-copy { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; align-items: baseline; margin-top: 12px; padding: 0 2px; }
.layout-copy strong { font-size: 13px; }
.layout-copy p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.layout-copy > span { grid-column: 2; color: var(--accent); font-size: 11px; font-weight: 700; }
.preview { position: relative; display: grid; min-height: 220px; place-items: center; overflow: hidden; border-radius: var(--corner); background: #efeff3; }
.preview canvas { display: block; width: 100%; height: auto; }
.empty { display: grid; max-width: 240px; justify-items: center; gap: 12px; padding: 40px 18px; text-align: center; }
.empty span { width: 32px; height: 24px; border-radius: 6px; background: linear-gradient(135deg,var(--accent),#00b7ff); opacity: .8; transform: rotate(-7deg); }
.empty p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.control-stack { margin-top: 14px; }
.control-row { padding: 13px 2px 15px; }
.control-row + .control-row { box-shadow: inset 0 1px 0 rgba(22,22,29,.065); }
.control-row label { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 11px; font-size: 13px; font-weight: 680; }
.control-row output { color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 600; }
.select-row { display: grid; grid-template-columns: 100px 1fr; align-items: center; gap: 16px; }
.select-row label { margin: 0; }
.select-row select { width: 100%; min-height: 42px; appearance: auto; border: 0; border-radius: var(--corner-sm); padding: 0 10px; background: var(--surface); color: var(--ink); font-size: 13px; }
input[type="range"] { width: 100%; height: 28px; appearance: none; background: transparent; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(90deg,color-mix(in srgb,var(--accent) 85%,#fff),#dedee5); }
input[type="range"]::-webkit-slider-thumb { width: 22px; height: 22px; margin-top: -9px; appearance: none; border: 5px solid #fff; border-radius: 50%; background: var(--accent); box-shadow: 0 1px 7px rgba(22,22,29,.24); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: #dedee5; }
input[type="range"]::-moz-range-progress { height: 4px; background: var(--accent); }
input[type="range"]::-moz-range-thumb { width: 13px; height: 13px; border: 5px solid #fff; border-radius: 50%; background: var(--accent); box-shadow: 0 1px 7px rgba(22,22,29,.24); }
.quality-switch { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; }
.quality-switch button { display: grid; min-height: 76px; align-content: center; gap: 5px; padding: 10px 8px; border-radius: var(--corner); background: var(--surface); color: var(--ink); cursor: pointer; }
.quality-switch button[aria-pressed="true"] { background: color-mix(in srgb,var(--accent) 15%,#f4f4f7); color: color-mix(in srgb,var(--accent) 72%,#101016); box-shadow: inset 0 -3px 0 var(--accent); }
.quality-switch strong { font-size: 13px; }
.quality-switch span { color: var(--muted); font-size: 10px; line-height: 1.25; }
.microcopy { margin: 10px 2px 0; color: var(--faint); font-size: 11px; line-height: 1.5; }
.result-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.result-head > div { display: grid; grid-template-columns: 28px 1fr; align-items: baseline; gap: 8px; }
.result-head p { margin: 0; color: var(--muted); font-size: 11px; text-align: right; }
.results { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px 8px; }
.result-item { min-width: 0; }
.result-media { overflow: hidden; border-radius: var(--corner-sm); background: var(--surface); }
.result-media canvas { display: block; width: 100%; height: auto; }
.result-row { display: flex; min-height: 38px; align-items: center; justify-content: space-between; gap: 6px; padding: 4px 1px 0; }
.result-copy { display: grid; min-width: 0; gap: 1px; }
.result-copy strong { font-size: 11px; font-variant-numeric: tabular-nums; }
.result-copy span { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.result-row .text-button { min-height: 34px; font-size: 11px; }
.share-all { width: 100%; min-height: 50px; margin-top: 18px; border-radius: var(--corner); background: var(--surface-strong); color: var(--ink); font-size: 14px; font-weight: 760; cursor: pointer; }
.action-dock { position: fixed; z-index: 15; right: 0; bottom: 0; left: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.9); box-shadow: 0 -12px 32px rgba(22,22,29,.07); backdrop-filter: blur(18px) saturate(1.35); -webkit-backdrop-filter: blur(18px) saturate(1.35); }
.action-inner { display: grid; width: var(--page); grid-template-columns: 1fr minmax(150px,220px); align-items: center; gap: 14px; margin: 0 auto; padding: 0 4px; }
.action-meta { display: grid; gap: 2px; }
.action-meta span { color: var(--muted); font-size: 10px; }
.action-meta strong { font-size: 13px; font-variant-numeric: tabular-nums; }
.generate-button { min-height: 54px; border-radius: var(--corner); background: var(--accent); color: #fff; font-size: 15px; font-weight: 800; cursor: pointer; box-shadow: 0 8px 22px color-mix(in srgb,var(--accent) 24%,transparent); transition: transform .16s ease; }
.generate-button:active:not(:disabled) { transform: scale(.98); }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 520px) {
  .app { padding-right: 16px; padding-left: 16px; }
  .hero h1 { margin-top: 28px; }
  .mode-rail { margin-right: -16px; padding-right: 16px; }
  .results { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px 6px; }
  .result-row { align-items: flex-start; }
  .result-copy span { max-width: 78px; }
}
@media (max-width: 360px) {
  .app { padding-right: 14px; padding-left: 14px; }
  .quality-switch { gap: 5px; }
  .quality-switch button { min-height: 72px; padding-inline: 5px; }
  .select-row { grid-template-columns: 88px 1fr; }
  .action-inner { grid-template-columns: 1fr 148px; gap: 10px; }
}
@media (min-width: 760px) {
  .app { padding-inline: 24px; }
  .hero { padding-top: 18px; }
  .preview { min-height: 300px; }
  .results { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 18px 10px; }
}
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { scroll-behavior: auto !important; transition-duration: .001ms !important; animation-duration: .001ms !important; } }
