:root {
  --gold: #c9941f;
  --gold-dark: #80600f;
  --ink: #21160f;
  --muted: #675f55;
  --line: #eadbb8;
  --green: #16a34a;
  --yellow: #d99400;
  --red: #dc2626;
  --paper: #fffaf0;
  --shadow: 0 18px 50px rgba(44, 24, 16, .16);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Sarabun", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 10%, rgba(244,196,48,.22), transparent 28rem),
    linear-gradient(135deg, #fff8e7 0%, #f8efd3 48%, #fffdf8 100%);
}
button, input, textarea { font: inherit; }
a { color: inherit; }
.hidden { display: none !important; }

.shell {
  width: min(100%, 580px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 14px 36px;
}
.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.eyebrow {
  margin: 0 0 4px;
  color: var(--gold-dark);
  font-size: .78rem;
  font-weight: 900;
  text-transform: uppercase;
  cursor: default;
}
h1, h2, h3, h4, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.48rem, 7vw, 2.08rem); line-height: 1.15; }
h2 { margin-bottom: 10px; font-size: 1.35rem; line-height: 1.25; }
.agent-chip {
  max-width: 42%;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.84);
  color: var(--gold-dark);
  font-size: .78rem;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.95);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.hero {
  min-height: 72vh;
  display: grid;
  align-content: end;
  gap: 18px;
  padding: 24px;
  background:
    linear-gradient(rgba(255,255,255,.06), rgba(255,255,255,.95)),
    url("https://images.unsplash.com/photo-1490645935967-10de6ba17061?auto=format&fit=crop&w=900&q=80") center/cover;
}
.band { width: 48px; height: 6px; border-radius: 99px; background: linear-gradient(90deg, var(--green), var(--yellow), var(--red)); }
.hero p { color: #382316; font-size: 1.03rem; font-weight: 750; line-height: 1.65; }
.social-proof {
  padding: 12px;
  border: 1px solid rgba(201,148,31,.32);
  border-radius: 10px;
  background: rgba(255, 248, 231, .92);
  color: var(--gold-dark);
  font-size: .93rem;
  font-weight: 900;
  line-height: 1.45;
}
.btn, .line-cta {
  width: 100%;
  min-height: 54px;
  border: 0;
  border-radius: 10px;
  color: #fff;
  font-weight: 900;
  cursor: pointer;
  text-decoration: none;
}
.btn { background: linear-gradient(135deg, var(--gold), var(--gold-dark)); box-shadow: 0 12px 24px rgba(139,105,20,.24); }
.btn.secondary { color: var(--gold-dark); background: #fff; border: 1.5px solid var(--line); box-shadow: none; }
.line-cta { display: flex; align-items: center; justify-content: center; background: #06c755; box-shadow: 0 12px 24px rgba(6,199,85,.25); }
.progress-wrap {
  position: sticky;
  top: 0;
  z-index: 4;
  padding: 10px 0 13px;
  background: rgba(255,248,231,.92);
  backdrop-filter: blur(12px);
}
.progress-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: .86rem; font-weight: 800; }
.progress-track { height: 9px; margin-top: 7px; border-radius: 99px; overflow: hidden; background: #eadfca; }
.progress-fill { width: 0%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--gold), var(--green)); transition: width .25s ease; }
.question-stack { display: grid; gap: 12px; }
.question-card { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 10px 24px rgba(44,24,16,.08); }
.question-card h3 { margin-bottom: 12px; font-size: 1rem; line-height: 1.45; }
.choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice {
  min-height: 112px;
  padding: 12px 10px;
  border: 1.5px solid #eadfca;
  border-radius: 10px;
  background: #fffdf8;
  color: var(--ink);
  font-weight: 750;
  line-height: 1.38;
  cursor: pointer;
}
.choice b { display: block; margin-bottom: 7px; color: var(--gold-dark); font-size: 1.3rem; }
.choice.selected { border-color: var(--gold); background: #fff2bf; box-shadow: inset 0 0 0 1px var(--gold); }
.form-panel, .result-panel { padding: 20px; }
label { display: grid; gap: 7px; margin-bottom: 12px; color: #3a2417; font-weight: 900; }
input, textarea {
  width: 100%;
  min-height: 50px;
  padding: 11px 12px;
  border: 1.5px solid #eadfca;
  border-radius: 10px;
  background: #fffdf8;
  color: var(--ink);
  font-size: 16px;
}
textarea { min-height: 82px; resize: vertical; }
.checkline { display: flex; align-items: flex-start; gap: 9px; margin: 10px 0 14px; color: var(--muted); font-size: .9rem; line-height: 1.5; }
.checkline input { width: auto; min-height: auto; margin-top: 4px; }
.error { min-height: 24px; color: var(--red); font-size: .9rem; font-weight: 900; }
.summary-box { margin: 12px 0 16px; padding: 12px; border-radius: 12px; background: #fff8e7; color: var(--muted); font-size: .92rem; line-height: 1.55; }
.risk-grid { display: grid; gap: 11px; }
.risk-card { display: grid; grid-template-columns: 82px 1fr; gap: 13px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fffdf8; }
.gauge {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--risk-color) var(--risk-deg), #eadfca 0);
}
.gauge span {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #fff;
  color: var(--risk-color);
  font-size: .76rem;
  font-weight: 950;
  line-height: 1;
  text-align: center;
  overflow-wrap: anywhere;
  padding: 0 3px;
}
.risk-card h3 { margin-bottom: 3px; font-size: .98rem; }
.risk-card p { margin-bottom: 0; color: var(--muted); font-size: .86rem; }
.formula-panel { margin-top: 16px; border: 1px solid var(--line); border-radius: 12px; background: #fffdf8; overflow: hidden; }
.formula-head { padding: 15px 16px; background: linear-gradient(135deg, #fff3c4, #fffaf0); border-bottom: 1px solid var(--line); }
.formula-head h3 { margin-bottom: 4px; font-size: 1.05rem; }
.formula-head p { margin-bottom: 0; color: var(--muted); font-size: .88rem; }
.formula-body { display: grid; gap: 10px; padding: 14px; }
.formula-card { padding: 12px; border: 1px solid #efe3c7; border-radius: 10px; background: #fff; }
.formula-card strong { display: block; margin-bottom: 6px; color: var(--gold-dark); font-size: .92rem; }
.formula-card ul { margin: 0; padding-left: 19px; color: var(--muted); font-size: .88rem; line-height: 1.55; }
.locked-days-wrap { position: relative; overflow: hidden; border-radius: 10px; }
.locked-days { filter: blur(6px); opacity: .58; pointer-events: none; user-select: none; }
.formula-panel.is-unlocked .locked-days { filter: none; opacity: 1; pointer-events: auto; user-select: auto; }
.solution-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  gap: 10px;
  padding: 16px;
  text-align: center;
  background: linear-gradient(180deg, rgba(255,253,248,.54), rgba(255,253,248,.97) 52%, #fffdf8 100%);
}
.formula-panel.is-unlocked .solution-overlay { display: none; }
.solution-overlay strong { font-size: 1.02rem; }
.solution-overlay span { color: var(--muted); font-size: .86rem; font-weight: 800; line-height: 1.45; }
.nutrition-note { padding: 11px 12px; border-radius: 10px; background: #f0fff4; color: #166534; font-size: .84rem; line-height: 1.5; }
.mini { margin-top: 12px; color: #9a7d43; font-size: .78rem; text-align: center; }
.admin-fab {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 30;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #fff;
  font-size: 1.35rem;
  box-shadow: 0 14px 32px rgba(44,24,16,.28);
  cursor: pointer;
}
.admin-modal { position: fixed; inset: 0; z-index: 40; display: none; padding: 16px; background: rgba(38,22,13,.56); }
.admin-modal.show { display: grid; align-items: center; }
.admin-card { width: min(100%, 920px); max-height: 88vh; margin: 0 auto; overflow: hidden; border-radius: 14px; background: #fffdf8; box-shadow: 0 22px 70px rgba(0,0,0,.34); }
.admin-head { display: flex; justify-content: space-between; gap: 12px; padding: 16px; border-bottom: 1px solid var(--line); background: linear-gradient(135deg, #fff3c4, #fffaf0); }
.admin-head h2 { margin-bottom: 2px; }
.admin-close { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--gold-dark); font-weight: 950; cursor: pointer; }
.admin-body { display: grid; gap: 12px; max-height: calc(88vh - 84px); overflow: auto; padding: 14px; }
.admin-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.admin-stat { padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; text-align: center; }
.admin-stat b { display: block; color: var(--gold-dark); font-size: 1.16rem; }
.admin-stat span { color: var(--muted); font-size: .78rem; font-weight: 800; }
.notice { padding: 10px 12px; border: 1px solid #f0c36b; border-radius: 10px; background: #fff8df; color: #6b4e0f; font-weight: 850; line-height: 1.45; }
.admin-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; min-width: 880px; border-collapse: collapse; font-size: .84rem; }
.admin-table th, .admin-table td { padding: 9px; border-bottom: 1px solid #f0e5cc; text-align: left; vertical-align: top; }
.admin-table th { color: var(--gold-dark); background: #fff8e7; font-weight: 950; }
.admin-empty { padding: 18px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); text-align: center; font-weight: 800; }
@media (max-width: 520px) {
  .admin-stats { grid-template-columns: 1fr 1fr; }
  .admin-actions { grid-template-columns: 1fr; }
}
