:root {
  --ink: #171717;
  --paper: #fffaf0;
  --blue: #1768c9;
  --red: #df3b2f;
  --yellow: #f8c52b;
  --mint: #1a8b70;
  --line: 3px solid var(--ink);
  --shadow: 7px 7px 0 var(--ink);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  font-family: Arial, "Noto Sans TC", "PingFang TC", sans-serif;
  background: var(--paper);
}
button, input, textarea, select { font: inherit; }
button { color: inherit; }

.market-banner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 28px;
  min-height: 82px;
  padding: 14px clamp(18px, 4vw, 58px);
  color: #111;
  border-bottom: var(--line);
  background: #06c755;
  text-decoration: none;
}
.market-label { padding: 7px 9px; color: white; border: 2px solid #111; background: #111; font-size: .72rem; font-weight: 900; }
.market-banner strong { font-size: clamp(1.35rem, 3vw, 2.25rem); line-height: 1.05; }
.market-action { padding-bottom: 4px; border-bottom: 2px solid #111; font-weight: 900; }
.market-banner:hover .market-action, .market-banner:focus-visible .market-action { border-bottom-width: 5px; }

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  min-height: 74px;
  border-bottom: var(--line);
  background: var(--paper);
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px clamp(18px, 4vw, 58px);
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 900;
  text-decoration: none;
}
.brand-shape {
  width: 30px;
  aspect-ratio: 1;
  border: var(--line);
  background: var(--red);
  transform: rotate(45deg);
}
.class-clock {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 150px;
  padding: 8px 22px;
  border-left: var(--line);
  color: white;
  background: var(--ink);
}
.next-course-link { align-self: center; margin-left: auto; padding: 10px 16px; color: var(--ink); font-weight: 900; }
.class-clock span { font-size: 2rem; font-weight: 900; }
.class-clock small { line-height: 1.1; }

.line-spec-intro { padding: 26px clamp(18px, 3vw, 44px) 22px; border-bottom: var(--line); background: var(--paper); }
.line-spec-title { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 14px; padding-bottom: 10px; border-bottom: var(--line); }
.line-spec-title span { font-size: .72rem; font-weight: 900; }
.line-spec-title h2 { margin: 0; font-size: clamp(1.5rem, 2.5vw, 2.4rem); }
.line-spec-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: var(--line); border-left: var(--line); }
.line-spec-grid article { display: grid; grid-template-rows: auto 200px auto 1fr; min-width: 0; border-right: var(--line); border-bottom: var(--line); background: white; }
.line-spec-grid h3 { margin: 0; padding: 10px 12px; border-bottom: var(--line); background: var(--yellow); font-size: 1rem; }
.line-spec-grid img { display: block; width: 100%; height: 200px; border-bottom: var(--line); object-fit: contain; background: #eef3fb; }
.line-spec-grid strong { padding: 10px 12px 0; font-size: 1rem; }
.line-spec-grid p { margin: 0; padding: 6px 12px 12px; font-size: .78rem; line-height: 1.45; }
.product-spec { display: grid; grid-template-columns: minmax(320px, .9fr) minmax(280px, 1.1fr); margin-top: 14px; border: var(--line); background: white; }
.product-spec img { display: block; width: 100%; height: 310px; border-right: var(--line); object-fit: contain; }
.product-spec div { padding: 18px; }
.product-spec h3 { margin: 0 0 10px; }
.product-spec p { max-width: 620px; line-height: 1.55; }
.product-spec strong { display: inline-block; margin-top: 18px; padding: 9px 11px; color: white; background: var(--blue); }
.line-spec-link { display: inline-block; margin-top: 12px; color: var(--ink); font-size: .78rem; font-weight: 900; }

.intro-band {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(360px, .7fr);
  gap: 48px;
  align-items: end;
  min-height: 490px;
  padding: 70px clamp(18px, 6vw, 90px) 56px;
  border-bottom: var(--line);
  background:
    linear-gradient(90deg, rgba(23,23,23,.06) 1px, transparent 1px),
    linear-gradient(rgba(23,23,23,.06) 1px, transparent 1px),
    var(--paper);
  background-size: 32px 32px;
}
.kicker { margin: 0 0 12px; font-size: .78rem; font-weight: 900; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 24px; font-size: clamp(3rem, 7vw, 6.5rem); line-height: .92; }
h2 { margin-bottom: 14px; font-size: clamp(2rem, 4vw, 4rem); line-height: .98; }
.lead { max-width: 670px; margin-bottom: 0; font-size: 1.2rem; line-height: 1.7; }
.analytics-disclosure { max-width: 670px; margin: 18px 0 0; padding: 10px 12px; border-left: 5px solid var(--blue); background: rgba(255,255,255,.76); font-size: .82rem; line-height: 1.55; }

.route-map { display: grid; border-top: var(--line); }
.route {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 14px;
  align-items: center;
  min-height: 65px;
  padding: 10px 0;
  border: 0;
  border-bottom: var(--line);
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.route b { font-size: 1.2rem; }
.route span { font-weight: 900; }
.route small { padding: 5px 8px; color: white; background: var(--ink); }
.route.active { padding-left: 12px; background: var(--yellow); }

.lesson-section { display: grid; grid-template-columns: 115px 1fr; border-bottom: var(--line); }
.section-label { padding: 32px 14px; border-right: var(--line); text-align: center; }
.section-label span { display: block; font-size: 2rem; font-weight: 900; }
.section-label p { margin: 10px 0 0; font-size: .68rem; font-weight: 900; writing-mode: vertical-rl; display: inline-block; }
.section-content { width: 100%; max-width: 1440px; margin: 0 auto; padding: 56px clamp(20px, 5vw, 72px) 68px; }
.yellow { background: var(--yellow); }
.paper { background: var(--paper); }
.blue { color: white; background: var(--blue); }
.two-columns { display: grid; grid-template-columns: minmax(280px, .8fr) minmax(320px, 1.2fr); gap: 48px; align-items: center; }
.section-note { max-width: 600px; font-size: 1.1rem; line-height: 1.7; }
.section-heading { display: flex; justify-content: space-between; gap: 30px; align-items: end; margin-bottom: 34px; border-bottom: var(--line); }
.section-heading > p { max-width: 460px; margin-bottom: 14px; line-height: 1.55; }
.section-heading.light { border-color: white; }

.check-row { display: flex; flex-wrap: wrap; gap: 10px; }
.check-row label, .toggle-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 2px solid var(--ink);
  background: var(--paper);
  font-weight: 800;
}
input[type="checkbox"] { width: 19px; height: 19px; accent-color: var(--red); }

.upload-stage, .grid-upload {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 330px;
  overflow: hidden;
  border: var(--line);
  background:
    linear-gradient(45deg, #eee 25%, transparent 25%),
    linear-gradient(-45deg, #eee 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eee 75%),
    linear-gradient(-45deg, transparent 75%, #eee 75%), white;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.upload-stage { width: min(100%, 480px); min-height: 0; aspect-ratio: 1; justify-self: end; }
.upload-stage input, .grid-upload input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-stage img { display: none; width: 100%; height: 100%; object-fit: contain; }
.upload-stage img.sample-visible { display: block; }
.upload-stage > span, .grid-upload > span { display: grid; gap: 10px; place-items: center; padding: 30px; text-align: center; font-size: 1.05rem; font-weight: 900; }
.upload-stage > .example-replace { position: absolute; right: 12px; bottom: 12px; gap: 2px; padding: 10px 13px; border: 2px solid var(--ink); background: white; box-shadow: 4px 4px 0 var(--ink); }
.upload-stage > .example-replace b { font-size: 1rem; }
.upload-stage b, .grid-upload b { font-size: 3rem; }
.upload-stage small, .grid-upload small { font-weight: 400; }

.example-board { display: grid; grid-template-columns: minmax(0, 1fr) 210px; width: min(100%, 620px); margin: 0 auto 26px; overflow: hidden; border: var(--line); background: white; box-shadow: var(--shadow); }
.example-board img { display: block; width: 100%; max-height: 205px; object-fit: contain; }
.example-board figcaption { display: grid; align-content: end; gap: 8px; padding: 22px; border-left: var(--line); line-height: 1.5; }
.example-board figcaption strong { font-size: 1.1rem; }
.grid-example { grid-template-columns: minmax(220px, 270px) 1fr; width: min(100%, 520px); color: var(--ink); }
.grid-example img { max-height: 270px; }
.replace-grid { cursor: pointer; }

.prompt-workspace { display: grid; grid-template-columns: minmax(260px, .68fr) minmax(360px, 1.32fr); gap: 26px; }
.field-stack { display: grid; align-content: start; gap: 18px; }
label { font-weight: 900; }
textarea, select {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 14px;
  border: var(--line);
  border-radius: 0;
  color: var(--ink);
  background: white;
  line-height: 1.55;
}
textarea { resize: vertical; }
.upload-reminder { padding: 16px; border: 2px dashed var(--ink); line-height: 1.5; }
.upload-reminder.ready { color: white; border-style: solid; background: var(--mint); }
.prompt-output { display: block; }
.prompt-output textarea { min-height: 300px; }
.dark-output { margin-top: 26px; }
.dark-output textarea { color: white; border-color: white; background: #111; }

.action-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.button {
  min-height: 50px;
  padding: 11px 18px;
  border: var(--line);
  border-radius: 0;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--ink);
}
.button:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.button:disabled { cursor: not-allowed; opacity: .45; box-shadow: none; }
.button.red { color: white; background: var(--red); }
.button.blue { color: white; background: var(--blue); }
.button.white { background: white; }
.button.black { color: white; background: var(--ink); }
.button.yellow-button { background: var(--yellow); }
.button.full { width: 100%; }
.status-line { margin: 18px 0 0; color: var(--mint); font-weight: 800; }
.light-text { color: white; }

.action-editor { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 2px solid white; border-left: 2px solid white; }
.action-field { display: grid; grid-template-columns: 36px 1fr; align-items: center; min-width: 0; border-right: 2px solid white; border-bottom: 2px solid white; }
.action-field span { font-weight: 900; text-align: center; }
.action-field input { width: 100%; min-width: 0; height: 56px; padding: 10px; border: 0; border-left: 2px solid white; border-radius: 0; color: white; background: transparent; }
.action-field input::placeholder { color: rgba(255,255,255,.65); }

.cutter-layout { display: grid; grid-template-columns: minmax(350px, 1.2fr) minmax(260px, .8fr); gap: 32px; align-items: start; }
.grid-upload { min-height: 470px; box-shadow: none; }
.grid-upload canvas { display: none; width: 100%; height: auto; touch-action: none; background: white; }
.grid-upload canvas.is-adjusting { cursor: grabbing; }
.grid-guide { margin: 14px 0 0; padding-left: 13px; border-left: 5px solid var(--yellow); line-height: 1.55; }
.cut-controls { display: grid; gap: 20px; }
.cut-controls label:not(.toggle-row) { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.cut-controls input[type="range"] { grid-column: 1 / -1; width: 100%; accent-color: var(--red); }
.cut-controls output { padding: 3px 8px; color: white; background: var(--ink); }
.spec-block { display: grid; border: var(--line); }
.spec-block strong, .spec-block span { padding: 11px 13px; border-bottom: 2px solid var(--ink); }
.spec-block span:last-child { border-bottom: 0; }
.spec-block strong { color: white; background: var(--ink); }

.sticker-results { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 38px; }
.results-empty { grid-column: 1 / -1; padding: 46px 20px; border: 2px dashed var(--ink); text-align: center; }
.sticker-card { border: var(--line); background: white; box-shadow: 5px 5px 0 var(--ink); }
.sticker-card canvas { display: block; width: 100%; aspect-ratio: 370 / 320; object-fit: contain; background:
  linear-gradient(45deg, #eee 25%, transparent 25%), linear-gradient(-45deg, #eee 25%, transparent 25%),
  linear-gradient(45deg, transparent 75%, #eee 75%), linear-gradient(-45deg, transparent 75%, #eee 75%), white;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0; background-size: 20px 20px;
}
.sticker-meta { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; padding: 10px; border-top: 2px solid var(--ink); }
.sticker-meta label { display: flex; align-items: center; gap: 7px; }
.download-one { border: 0; background: transparent; font-weight: 900; text-decoration: underline; cursor: pointer; }
.asset-choice-buttons { display: flex; grid-column: 1 / -1; border-top: 2px solid var(--ink); }
.asset-choice-buttons button { flex: 1; min-height: 38px; border: 0; border-right: 2px solid var(--ink); background: var(--paper); font-size: .82rem; font-weight: 900; cursor: pointer; }
.asset-choice-buttons button:last-child { border-right: 0; }
.asset-choice-buttons button.active { color: white; background: var(--blue); }
.asset-choice-buttons button[data-asset="tab"].active { color: var(--ink); background: var(--yellow); }
.asset-picks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 28px; }
.asset-picks[hidden] { display: none; }
.asset-picks article { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; padding: 18px; border: var(--line); background: white; }
.asset-picks h3, .asset-picks p { margin-bottom: 5px; }
.asset-picks canvas { grid-row: 1 / span 2; grid-column: 2; max-width: 150px; max-height: 150px; border: 2px solid var(--ink); object-fit: contain; background:
  linear-gradient(45deg, #eee 25%, transparent 25%), linear-gradient(-45deg, #eee 25%, transparent 25%),
  linear-gradient(45deg, transparent 75%, #eee 75%), linear-gradient(-45deg, transparent 75%, #eee 75%), white;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0; background-size: 16px 16px;
}
.asset-picks #mainPreview { width: 150px; aspect-ratio: 1; }
.asset-picks #tabPreview { width: 150px; aspect-ratio: 96 / 74; }
.asset-picks .download-one { justify-self: start; }
.download-bar { position: sticky; bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 28px; padding: 14px 18px; border: var(--line); background: var(--yellow); box-shadow: var(--shadow); }
.download-bar[hidden] { display: none; }
.download-bar p { margin: 0; }

.product-copy-section { margin-top: 58px; padding-top: 42px; border-top: 8px solid var(--ink); }
.product-copy-section .section-heading h2 { max-width: 760px; }
.product-copy-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, .9fr); gap: 30px; align-items: start; }
.product-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.product-fields label, .product-ai-helper label { display: grid; gap: 8px; font-weight: 900; }
.product-fields input, .product-fields textarea, .product-ai-helper textarea {
  width: 100%;
  min-width: 0;
  padding: 13px 14px;
  border: var(--line);
  border-radius: 0;
  color: var(--ink);
  background: white;
  resize: vertical;
}
.product-fields input:focus, .product-fields textarea:focus, .product-ai-helper textarea:focus { outline: 4px solid var(--yellow); outline-offset: 1px; }
.product-ai-helper { display: grid; gap: 16px; padding: 20px; border: var(--line); background: white; box-shadow: var(--shadow); }
.product-ai-helper .action-row { margin: 0; }
.product-ai-helper .button { min-height: 44px; }
.status-line { margin: 0; padding-left: 12px; border-left: 5px solid var(--mint); line-height: 1.5; }

.toast { position: fixed; z-index: 50; right: 22px; bottom: 22px; max-width: 340px; padding: 13px 18px; color: white; border: var(--line); background: var(--ink); opacity: 0; pointer-events: none; transform: translateY(10px); transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 900px) {
  .line-spec-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product-spec { grid-template-columns: 1fr; }
  .product-spec img { height: 260px; border-right: 0; border-bottom: var(--line); }
  .intro-band { grid-template-columns: 1fr; min-height: auto; }
  .lesson-section { grid-template-columns: 72px 1fr; }
  .two-columns, .prompt-workspace, .cutter-layout, .product-copy-grid { grid-template-columns: 1fr; }
  .upload-stage { justify-self: center; }
  .example-board, .grid-example { grid-template-columns: 1fr; }
  .example-board figcaption { border-top: var(--line); border-left: 0; }
  .section-heading { align-items: start; flex-direction: column; gap: 6px; }
  .action-editor, .sticker-results { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .asset-picks { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .market-banner { grid-template-columns: 1fr auto; gap: 9px 14px; min-height: 96px; padding: 13px 14px; }
  .market-label { grid-column: 1 / -1; justify-self: start; }
  .market-banner strong { font-size: 1.2rem; }
  .market-action { font-size: .78rem; }
  .topbar { min-height: 62px; }
  .line-spec-intro { padding: 20px 14px; }
  .line-spec-title { align-items: start; flex-direction: column; gap: 6px; }
  .line-spec-grid { grid-template-columns: 1fr; }
  .line-spec-grid article { grid-template-rows: auto 180px auto 1fr; }
  .line-spec-grid img { height: 180px; }
  .product-spec img { height: 210px; }
  .brand { padding: 10px 14px; font-size: 1rem; }
  .brand-shape { width: 23px; }
  .class-clock { min-width: 112px; padding: 8px 12px; }
  .next-course-link { display: none; }
  .class-clock span { font-size: 1.6rem; }
  .intro-band { gap: 30px; padding: 48px 18px 36px; }
  h1 { font-size: 3.2rem; }
  .lesson-section { display: block; }
  .section-label { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-right: 0; border-bottom: var(--line); text-align: left; }
  .section-label span { font-size: 1.3rem; }
  .section-label p { margin: 0; writing-mode: horizontal-tb; }
  .section-content { padding: 38px 18px 52px; }
  .action-editor, .sticker-results { grid-template-columns: 1fr; }
  .asset-picks article { grid-template-columns: 1fr; }
  .asset-picks canvas { grid-row: auto; grid-column: auto; width: 100%; max-width: 190px; }
  .grid-upload { min-height: 320px; }
  .example-board img { max-height: 190px; }
  .grid-example img { max-height: 240px; }
  .download-bar { align-items: stretch; flex-direction: column; }
  .product-copy-section { margin-top: 42px; padding-top: 30px; }
  .product-fields { grid-template-columns: 1fr; }
  .product-ai-helper { padding: 14px; box-shadow: 5px 5px 0 var(--ink); }
  .button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
