/* ============================================================
   QR Studio — 依 Claude Design「QR Studio.dc.html」1:1 還原
   暖米色系 (#F1ECE2 / #F8F3E9) + 琥珀金漸層 (#E3B23C → #C28A1E)
   字體：Space Grotesk（標題/標籤）＋ Plus Jakarta Sans（內文）
   ============================================================ */
:root {
  --bg:        #F1ECE2;
  --panel:     #F8F3E9;
  --stage:     #F6F1E8;
  --line:      #E6DFD1;
  --line-soft: #EDE7DB;
  --line-2:    #D6CDBB;
  --ink:       #221F18;
  --ink-mut:   #6E6657;
  --ink-faint: #A49B88;
  --accent:    #E3B23C;
  --accent-deep:#C28A1E;
  --danger:    #E03131;
  --maxw:      1240px;
  --display: 'Space Grotesk', sans-serif;
  --body: 'Plus Jakarta Sans', 'Noto Sans JP', 'Noto Sans KR', system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  font-family: var(--body);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
.page { min-height: 100vh; background: var(--bg); }

::selection { background: rgba(227,178,60,.18); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; border: 3px solid var(--bg); }
@keyframes qspin { to { transform: rotate(360deg); } }

/* ---------- header ---------- */
.header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 32px; max-width: var(--maxw); margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; background: var(--accent);
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 3px; padding: 8px;
}
.brand-mark i { border-radius: 2px; background: rgba(255,255,255,.45); }
.brand-mark i:nth-child(1), .brand-mark i:nth-child(4) { background: var(--panel); }
.brand-name { font-family: var(--display); font-weight: 700; font-size: 20px; letter-spacing: -.02em; color: var(--ink); }
.nav { display: flex; align-items: center; gap: 18px; }
.nav-links { display: flex; align-items: center; gap: 22px; }
.nav-link { font-size: 14px; font-weight: 500; color: var(--ink-mut); cursor: pointer; background: none; border: 0; font-family: inherit; }
.nav-link:hover { color: var(--ink); }
.lang-wrap { position: relative; display: flex; align-items: center; }
.lang-wrap .ico-globe { position: absolute; left: 11px; pointer-events: none; }
.lang-wrap .ico-caret { position: absolute; right: 9px; pointer-events: none; }
.lang-select {
  appearance: none; -webkit-appearance: none; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel); color: var(--ink); font-family: inherit; font-weight: 600; font-size: 13px;
  padding: 9px 28px 9px 32px; cursor: pointer; outline: none;
}
.cta {
  background: var(--accent); color: var(--panel); border: none; padding: 10px 18px; border-radius: 10px;
  font-family: inherit; font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap;
}
.cta:hover { background: var(--accent-deep); }

/* ---------- hero ---------- */
.hero { max-width: var(--maxw); margin: 0 auto; padding: 14px 32px 8px; }
.hero-title { font-family: var(--display); font-size: clamp(28px, 5vw, 40px); line-height: 1.1; letter-spacing: -.03em; margin: 8px 0; color: var(--ink); }
.hero-tagline { font-size: 16px; color: var(--ink-mut); margin: 0; max-width: 560px; }

/* ---------- main grid ---------- */
.main {
  display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 24px;
  max-width: var(--maxw); margin: 0 auto; padding: 20px 32px 64px; align-items: start;
}
.main > div { min-width: 0; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 1px 2px rgba(45,36,18,.05); }
.controls { padding: 8px; }
.divider { height: 1px; background: var(--line-soft); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 8px; overflow-x: auto; padding: 14px 14px 16px; }
.tab {
  display: flex; align-items: center; gap: 7px; padding: 9px 13px; border-radius: 10px;
  border: 1px solid var(--line); cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 600;
  white-space: nowrap; transition: all .15s; background: var(--panel); color: var(--ink-mut);
}
.tab:hover { border-color: var(--line-2); }
.tab.is-active { background: var(--accent); border-color: var(--accent); color: var(--panel); }
.tab.is-active:hover { border-color: var(--accent); }

/* ---------- sections ---------- */
.section { padding: 20px 18px 4px; }
.section--custom { padding: 20px 18px 16px; }
.section-label {
  font-family: var(--display); font-size: 11px; font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-faint); margin-bottom: 16px;
}
.section-label--tight { margin-bottom: 14px; }

/* ---------- fields ---------- */
.field { margin-bottom: 14px; }
.field-label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-mut); margin-bottom: 6px; }
.input, .textarea, .select {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 11px;
  font-family: inherit; font-size: 14px; color: var(--ink); background: var(--panel); outline: none;
}
.select { font-size: 13px; padding: 11px 12px; cursor: pointer; }
.textarea { resize: vertical; }
.input:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(227,178,60,.12); }
.vgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.row-end { display: flex; gap: 12px; align-items: flex-end; margin-bottom: 14px; }
.row-end > .field { flex: 1; margin-bottom: 0; }
.check-inline { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; color: var(--ink); padding: 12px 0; cursor: pointer; }
.check-inline input { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }
.field-label .badge { display: inline-flex; width: 16px; height: 16px; align-items: center; justify-content: center; color: var(--panel); border-radius: 4px; font-size: 9px; font-weight: 700; }
.field-label.with-badge { display: flex; align-items: center; gap: 6px; }
.badge--line { background: #06C755; }
.badge--wa { background: #25D366; font-size: 10px; }

/* hidden content panels */
.cpanel { display: none; }
.cpanel.is-on { display: block; }

/* ---------- presets ---------- */
.presets { display: flex; gap: 10px; flex-wrap: wrap; }
.preset-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel); cursor: pointer; width: 74px;
}
.preset-btn:hover { border-color: var(--line-2); }
.preset-btn--mono { background: var(--bg); }
.preset-name { font-size: 11px; font-weight: 600; color: var(--ink-mut); }

/* ---------- colors ---------- */
.colors-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.colorpill {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 13px; background: var(--panel); cursor: pointer; transition: border-color .15s;
}
.colorpill:hover { border-color: var(--line-2); }
.colorpill input[type=color] { -webkit-appearance: none; appearance: none; width: 30px; height: 30px; border: none; border-radius: 9px; padding: 0; background: transparent; cursor: pointer; flex: none; }
.colorpill input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.colorpill input[type=color]::-webkit-color-swatch { border: 1px solid rgba(0,0,0,.12); border-radius: 9px; }
.colorpill input[type=color]::-moz-color-swatch { border: 1px solid rgba(0,0,0,.12); border-radius: 9px; }
.colorpill-hex { font-family: var(--display); font-size: 13px; font-weight: 600; letter-spacing: .02em; color: var(--ink); text-transform: uppercase; }
.colorpill-lbl { font-size: 13px; font-weight: 600; color: var(--ink-mut); }

.swatches { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.swatch-label { font-size: 11px; font-weight: 600; color: var(--ink-faint); margin-right: 2px; }
.swatch { width: 24px; height: 24px; border-radius: 7px; border: 1px solid rgba(0,0,0,.08); cursor: pointer; padding: 0; }

/* gradient box */
.gradient-box { border: 1px solid var(--line-soft); border-radius: 14px; padding: 13px 14px; margin-bottom: 18px; background: var(--panel); }
.gradient-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer; }
.gradient-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 13px; }
.gradient-grid .colorpill { background: #FCFAF5; }

/* toggle */
.qtoggle { position: relative; width: 44px; height: 25px; border-radius: 99px; background: var(--line); transition: background .2s; cursor: pointer; flex: none; }
.qtoggle input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.qtoggle .knob { position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%; background: #FCFAF5; box-shadow: 0 1px 3px rgba(90,64,12,.35); transition: transform .2s; pointer-events: none; }
.qtoggle:has(input:checked) { background: linear-gradient(90deg, var(--accent), var(--accent-deep)); }
.qtoggle:has(input:checked) .knob { transform: translateX(19px); }

/* styles selects grid */
.styles-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.styles-grid .field-label { margin-bottom: 8px; }
.eye-row { margin-bottom: 6px; }
.eye-row .check-eye { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--ink-mut); margin-bottom: 6px; cursor: pointer; }
.eye-row .check-eye input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.eye-color { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 10px; padding: 3px; background: var(--panel); cursor: pointer; margin-top: 4px; }

/* sliders */
.sliders-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; margin-top: 14px; }
.slider-label { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; color: var(--ink-mut); margin-bottom: 8px; }
.slider-label span { color: var(--ink-faint); }
.qslider { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; cursor: pointer; margin: 0; }
.qslider::-webkit-slider-runnable-track { height: 6px; border-radius: 99px; background: var(--qtrack, var(--line)); }
.qslider::-moz-range-track { height: 6px; border-radius: 99px; background: var(--line); }
.qslider::-moz-range-progress { height: 6px; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent-deep)); }
.qslider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 18px; height: 18px; margin-top: -6px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #F2CC6B, #D6A02C 60%, #B57F1C); border: 2px solid #FCFAF5; box-shadow: 0 1px 3px rgba(90,64,12,.45), 0 0 0 1px rgba(181,127,28,.4); transition: box-shadow .15s, transform .15s; }
.qslider::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #F2CC6B, #D6A02C 60%, #B57F1C); border: 2px solid #FCFAF5; box-shadow: 0 1px 3px rgba(90,64,12,.45), 0 0 0 1px rgba(181,127,28,.4); }
.qslider:hover::-webkit-slider-thumb { transform: scale(1.08); box-shadow: 0 2px 6px rgba(90,64,12,.5), 0 0 0 4px rgba(227,178,60,.22); }
.qslider:focus { outline: none; }

/* logo */
.logo-block { border-top: 1px solid var(--line-soft); padding-top: 16px; }
.logo-current { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.logo-current img { width: 48px; height: 48px; object-fit: contain; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); padding: 4px; }
.logo-remove { padding: 9px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); font-family: inherit; font-size: 13px; font-weight: 600; color: var(--danger); cursor: pointer; }
.logo-upload { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 16px; border: 1.5px dashed var(--line-2); border-radius: 12px; cursor: pointer; color: var(--ink-faint); font-size: 13px; font-weight: 500; }
.logo-upload:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- preview ---------- */
.preview-panel { position: sticky; top: 24px; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 28px; box-shadow: 0 12px 40px rgba(45,36,18,.10); display: flex; flex-direction: column; }
.preview-label { font-family: var(--display); font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 18px; text-align: center; }
.qr-stage { position: relative; width: 288px; height: 288px; margin: 0 auto 20px; border-radius: 16px; background: var(--stage); border: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: center; padding: 14px; max-width: 100%; overflow: hidden; }
.qr-spinner { position: absolute; width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: qspin .8s linear infinite; }
.qr-holder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.qr-holder canvas, .qr-holder svg { width: 100%; height: 100%; max-width: 100%; max-height: 100%; display: block; border-radius: 4px; }
.data-preview { font-size: 12px; color: var(--ink-faint); text-align: center; margin-bottom: 22px; word-break: break-all; line-height: 1.5; min-height: 18px; padding: 0 6px; }

.btn-primary {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 14px;
  border: 1px solid var(--accent); border-radius: 12px;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent) 45%, var(--accent-deep) 100%);
  color: #fff; font-family: inherit; font-size: 15px; font-weight: 700; cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.45), 0 6px 16px rgba(227,178,60,.33);
  text-shadow: 0 1px 1px rgba(0,0,0,.18);
}
.btn-primary:hover { filter: brightness(1.03); }
.btn-row { display: flex; gap: 10px; margin-top: 10px; }
.btn-secondary { flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); font-family: inherit; font-size: 14px; font-weight: 600; color: var(--ink); cursor: pointer; }
.btn-secondary:hover { border-color: var(--line-2); background: var(--line-soft); }
.scan-hint { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line-soft); display: flex; align-items: center; gap: 10px; justify-content: center; color: var(--ink-faint); font-size: 12px; }

/* ---------- native ad slot（即時預覽下方） ---------- */
.ad-native { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line-soft); }
.ad-native__label { font-family: var(--display); font-size: 10px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 10px; text-align: center; }
.ad-native__unit { display: block; min-height: 0; }
.ad-native__ph { display: flex; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line-soft); border-radius: 13px; background: var(--stage); }
.ad-native__thumb { flex: none; width: 50px; height: 50px; display: grid; place-items: center; border-radius: 11px; color: var(--ink-faint); background: var(--panel); border: 1px solid var(--line); }
.ad-native__title { font-size: 13px; font-weight: 600; color: var(--ink); margin: 0 0 3px; }
.ad-native__desc { font-size: 11.5px; color: var(--ink-faint); margin: 0; line-height: 1.45; }

/* ---------- footer ---------- */
.footer {
  max-width: var(--maxw); margin: 0 auto; padding: 28px 32px 44px;
  border-top: 1px solid var(--line-soft);
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.footer-left { display: flex; align-items: center; gap: 10px; }
.footer-mark { width: 24px; height: 24px; border-radius: 7px; background: var(--accent); display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 2px; padding: 5px; }
.footer-mark i { border-radius: 1px; background: rgba(255,255,255,.45); }
.footer-mark i:nth-child(1), .footer-mark i:nth-child(4) { background: var(--panel); }
.footer-copy { font-size: 13px; color: var(--ink-faint); }
.footer-links { display: flex; align-items: center; gap: 20px; }
.footer-link { font-size: 13px; font-weight: 500; color: var(--ink-mut); text-decoration: none; }
.footer-link:hover { color: var(--accent-deep); }
.footer-note { width: 100%; font-size: 12px; color: var(--ink-faint); margin-top: 4px; }

/* ---------- responsive (依設計斷點) ---------- */
@media (max-width: 980px) {
  .main { grid-template-columns: 1fr; }
  .preview-panel { position: static; }
  /* 手機單欄時：廣告版位移到預覽上方 */
  .preview-label { order: 1; }
  .qr-stage { order: 2; }
  .data-preview { order: 3; }
  .btn-primary { order: 4; }
  .btn-row { order: 5; }
  .scan-hint { order: 6; }
  .ad-native { order: 0; margin-top: 0; margin-bottom: 20px; padding-top: 0; padding-bottom: 20px; border-top: none; border-bottom: 1px solid var(--line-soft); }
}
@media (max-width: 640px) {
  .nav-links { display: none; }
  .header { padding: 14px 18px; }
  .hero { padding: 10px 18px 6px; }
  .main { padding: 16px 18px 48px; gap: 18px; }
  .vgrid { grid-template-columns: 1fr; }
  .cta { display: none; }
  .footer { flex-direction: column; align-items: flex-start; gap: 14px; padding: 24px 18px 40px; }
}
