@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Thai:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
  --ink: #101828;
  --muted: #667085;
  --soft: #98a2b3;
  --line: #e6e9ee;
  --paper: #f7f8fa;
  --card: #ffffff;
  --accent: #ff694a;
  --accent-dark: #e85335;
  --navy: #0b1220;
  --shadow: 0 18px 60px rgba(16, 24, 40, .07);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: 'IBM Plex Sans Thai', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button { cursor: pointer; }

.page-shell {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 82px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: var(--ink);
  font: 700 23px/1 'Space Grotesk', sans-serif;
  letter-spacing: -.07em;
  text-decoration: none;
}

.brand > span:last-child span { color: var(--accent); }
.brand-mark {
  display: grid;
  width: 29px;
  height: 29px;
  color: #fff;
  background: var(--accent);
  border-radius: 9px;
  place-items: center;
  font: 700 25px/1 'Space Grotesk', sans-serif;
  transform: rotate(-14deg);
}

.topbar-note { color: var(--muted); font-size: 12px; }

main { padding: 75px 0 46px; }
.hero { max-width: 690px; }
.eyebrow, .step-label {
  color: var(--accent);
  font: 700 11px/1.2 'Space Grotesk', sans-serif;
  letter-spacing: .13em;
}
.eyebrow { display: flex; gap: 9px; align-items: center; }
.eyebrow-dot { width: 7px; height: 7px; background: var(--accent); border-radius: 50%; }

h1, h2, p { margin: 0; }
h1 {
  margin-top: 20px;
  font: 700 clamp(42px, 6vw, 70px)/.98 'Space Grotesk', 'IBM Plex Sans Thai', sans-serif;
  letter-spacing: -.065em;
}
h1 em { color: var(--accent); font-style: normal; }
.hero-copy { max-width: 470px; margin-top: 25px; color: var(--muted); font-size: 16px; line-height: 1.75; }

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: 20px;
  margin-top: 50px;
}
.card {
  padding: 31px;
  background: var(--card);
  border: 1px solid rgba(230, 233, 238, .9);
  border-radius: 20px;
  box-shadow: var(--shadow);
}
.card-heading, .section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.card h2, .section-heading h2 { margin-top: 9px; font-size: 23px; letter-spacing: -.035em; }
.secure-badge, .live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  color: #147d4d;
  background: #ecfdf3;
  border-radius: 999px;
  font-size: 11px;
  white-space: nowrap;
}
.live-pill { color: var(--muted); background: #f2f4f7; }
.live-pill.is-ready { color: #147d4d; background: #ecfdf3; }

#qrForm { margin-top: 34px; }
.field-label { display: block; margin-bottom: 9px; color: var(--muted); font-size: 12px; font-weight: 600; }
.input-wrap { position: relative; }
.input-icon { position: absolute; top: 15px; left: 17px; color: var(--accent); font: 700 19px/1 'Space Grotesk'; pointer-events: none; }
input[type='text'], select, .color-control {
  width: 100%;
  height: 50px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fbfcfd;
  color: var(--ink);
  outline: 0;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
input[type='text'] { padding: 0 42px 0 46px; }
input[type='text']:focus, select:focus, .color-control:focus-within { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 4px rgba(255, 105, 74, .11); }
input[aria-invalid='true'] { border-color: #e5484d; }
.clear-button { position: absolute; top: 9px; right: 10px; width: 32px; height: 32px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-size: 24px; line-height: 1; }
.clear-button:hover { background: #f2f4f7; }
.field-hint { margin: 8px 2px 0; color: var(--soft); font-size: 11px; }
.error-message { margin: 8px 2px 0; color: #d92d20; font-size: 12px; }

.options-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 24px; }
select { padding: 0 13px; appearance: none; background: #fbfcfd url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%23667085' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 14px center; }
.color-control { display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 7px; color: var(--muted); font: 500 12px/1 'Space Grotesk'; }
input[type='color'] { width: 36px; height: 36px; padding: 0; border: 0; border-radius: 7px; background: transparent; cursor: pointer; }

.primary-button, .secondary-button, .icon-button { border: 0; font-weight: 700; transition: transform .2s, background .2s, box-shadow .2s; }
.primary-button { display: flex; align-items: center; justify-content: space-between; width: 100%; height: 54px; margin-top: 25px; padding: 0 18px 0 20px; color: #fff; background: var(--accent); border-radius: 11px; box-shadow: 0 9px 20px rgba(255, 105, 74, .2); }
.primary-button:hover { background: var(--accent-dark); box-shadow: 0 12px 24px rgba(255, 105, 74, .28); transform: translateY(-1px); }
.button-arrow { font-size: 22px; font-weight: 400; }
.privacy-note { display: flex; gap: 8px; align-items: center; margin-top: 24px; color: var(--soft); font-size: 11px; }
.privacy-icon { color: var(--accent); font-size: 18px; }

.preview-panel { display: flex; flex-direction: column; min-height: 475px; background: var(--navy); border-color: var(--navy); color: #fff; }
.preview-panel .step-label { color: #ff8c74; }
.preview-panel h2 { color: #fff; }
.qr-stage { display: grid; min-height: 280px; margin: 28px 0 18px; padding: 20px; overflow: hidden; border: 1px solid rgba(255,255,255,.08); border-radius: 15px; background: rgba(255,255,255,.035); place-items: center; }
.qr-placeholder { display: grid; gap: 14px; color: rgba(255,255,255,.38); text-align: center; font-size: 13px; line-height: 1.55; place-items: center; }
.placeholder-grid { width: 92px; height: 92px; opacity: .5; border: 7px solid rgba(255,255,255,.2); border-radius: 7px; background: repeating-linear-gradient(90deg, transparent 0 10px, rgba(255,255,255,.2) 10px 17px), repeating-linear-gradient(0deg, transparent 0 10px, rgba(255,255,255,.2) 10px 17px); }
.qr-preview { display: grid; padding: 10px; background: #fff; border-radius: 10px; place-items: center; }
.qr-preview img, .qr-preview canvas { display: block; max-width: 100%; height: auto; }
.generated-url { overflow: hidden; color: rgba(255,255,255,.63); font: 11px/1.5 'Space Grotesk', sans-serif; text-overflow: ellipsis; white-space: nowrap; }
.actions { display: flex; gap: 9px; margin-top: 22px; }
.secondary-button { flex: 1; height: 43px; color: var(--navy); background: #fff; border-radius: 9px; font-size: 12px; }
.secondary-button:hover { background: #f2f4f7; transform: translateY(-1px); }
.icon-button { width: 43px; height: 43px; color: #fff; background: rgba(255,255,255,.1); border-radius: 9px; font-size: 18px; }
.icon-button:hover { background: rgba(255,255,255,.18); }

.history-section { margin-top: 70px; }
.text-button { padding: 3px 0; border: 0; color: var(--accent); background: none; font-size: 12px; }
.text-button:hover { text-decoration: underline; }
.history-list { display: grid; gap: 8px; margin-top: 20px; }
.history-item { display: flex; gap: 12px; align-items: center; width: 100%; padding: 15px 16px; color: var(--ink); text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 11px; }
.history-item:hover { border-color: #ffc0b2; background: #fffaf8; }
.history-icon { display: grid; width: 28px; height: 28px; color: var(--accent); background: #fff0ec; border-radius: 7px; place-items: center; }
.history-url { flex: 1; overflow: hidden; font: 12px 'Space Grotesk', sans-serif; text-overflow: ellipsis; white-space: nowrap; }
.history-arrow { color: var(--soft); }

.tips-section { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-top: 65px; }
.tip-card { display: flex; gap: 15px; padding: 22px 20px; border-top: 1px solid var(--line); }
.tip-number { color: var(--accent); font: 700 11px/1.5 'Space Grotesk'; }
.tip-card strong { font-size: 13px; }
.tip-card p { margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.footer { padding: 34px 0 42px; color: var(--soft); font: 11px 'Space Grotesk', sans-serif; text-align: center; }
.footer span { padding: 0 6px; color: var(--accent); }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 10; padding: 12px 16px; color: #fff; background: var(--navy); border-radius: 9px; box-shadow: 0 10px 28px rgba(16,24,40,.2); font-size: 12px; opacity: 0; pointer-events: none; transform: translateY(10px); transition: opacity .2s, transform .2s; }
.toast.is-visible { opacity: 1; transform: translateY(0); }

[hidden] { display: none !important; }

@media (max-width: 760px) {
  .page-shell { width: min(100% - 28px, 570px); }
  .topbar { height: 68px; }
  .topbar-note { display: none; }
  main { padding-top: 52px; }
  h1 { font-size: clamp(42px, 13vw, 64px); }
  .workspace { grid-template-columns: 1fr; margin-top: 40px; }
  .card { padding: 24px; }
  .preview-panel { min-height: 430px; }
  .qr-stage { min-height: 250px; }
  .tips-section { grid-template-columns: 1fr; gap: 0; margin-top: 45px; }
  .tip-card { padding: 17px 0; }
}

@media (max-width: 420px) {
  .card-heading { display: block; }
  .secure-badge, .live-pill { margin-top: 14px; }
  .options-row { grid-template-columns: 1fr; }
  .actions { flex-wrap: wrap; }
  .secondary-button { flex-basis: 100%; }
}
