:root {
  --bg: #f1f5f9;
  --card: #fff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #0d9488;
  --brand-dark: #0f766e;
  --brand-soft: #ccfbf1;
  --danger: #b91c1c;
  --radius: 16px;
  --shadow: 0 12px 40px rgba(15, 23, 42, 0.07);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Noto Sans Khmer", Inter, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.wrap { max-width: 640px; margin: 0 auto; padding: 1rem 1rem 3rem; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .75rem 0 1rem; flex-wrap: wrap;
}
.facility-pill {
  font-size: .82rem; font-weight: 700; color: var(--brand-dark);
  background: var(--brand-soft); padding: .4rem .8rem; border-radius: 999px;
}
.top-links { display: flex; align-items: center; gap: .5rem; }
.top-links a.hub {
  font-size: .8rem; color: var(--muted); text-decoration: none; font-weight: 600;
}
.lang-switch {
  display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: #fff;
}
.lang-switch a {
  text-decoration: none; color: var(--muted); font-size: .85rem; font-weight: 600; padding: .45rem .85rem;
}
.lang-switch a.active { background: var(--brand); color: #fff; }

.hero {
  background: linear-gradient(145deg, var(--brand-dark), var(--brand));
  color: #fff; border-radius: 20px; padding: 1.5rem 1.35rem; margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}
.hero h1 { margin: 0 0 .65rem; font-size: clamp(1.2rem, 4vw, 1.55rem); line-height: 1.35; }
.hero p { margin: 0 0 .5rem; opacity: .95; font-size: .95rem; }
.hero p:last-child { margin: 0; opacity: .85; font-size: .88rem; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.15rem; margin-bottom: .9rem; box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 .85rem; font-size: 1rem; font-weight: 700; line-height: 1.4; }
.card h2 .req { color: #dc2626; }
.hint { font-size: .8rem; color: var(--muted); font-weight: 500; }
.note { font-size: .8rem; color: var(--muted); margin: 0 0 1rem; }
.alert {
  background: #fef2f2; border: 1px solid #fecaca; color: var(--danger);
  border-radius: 12px; padding: .85rem 1rem; margin-bottom: 1rem;
}

.scale-labels {
  display: flex; justify-content: space-between; font-size: .75rem; color: var(--muted); margin-bottom: .5rem;
}
.options { display: grid; gap: .5rem; }
.option { display: block; cursor: pointer; }
.option input, .scale-row input, .nps-row input {
  position: absolute; opacity: 0; pointer-events: none;
}
.option span {
  display: block; border: 1px solid var(--line); border-radius: 12px; padding: .8rem .95rem;
  background: #fff; transition: .15s; font-size: .95rem;
}
.option input:checked + span {
  border-color: var(--brand); background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px var(--brand); font-weight: 600;
}
.option input:focus-visible + span,
.scale-row input:focus-visible + span,
.nps-row input:focus-visible + span {
  outline: 2px solid var(--brand); outline-offset: 2px;
}

.scale-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: .4rem; }
.scale-row.with-na { grid-template-columns: repeat(6, 1fr); }
@media (max-width: 420px) {
  .scale-row.with-na { grid-template-columns: repeat(3, 1fr); }
}
.scale-row label, .nps-row label { cursor: pointer; }
.scale-row span {
  display: flex; align-items: center; justify-content: center; min-height: 48px;
  border: 1px solid var(--line); border-radius: 12px; font-weight: 700; background: #fff;
}
.scale-row input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }

.nps-row { display: grid; grid-template-columns: repeat(11, 1fr); gap: .25rem; }
@media (max-width: 520px) { .nps-row { grid-template-columns: repeat(6, 1fr); } }
.nps-row span {
  display: flex; align-items: center; justify-content: center; min-height: 42px;
  border: 1px solid var(--line); border-radius: 10px; font-weight: 700; font-size: .85rem; background: #fff;
}
.nps-row input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }

textarea, input[type=text], input[type=tel], select {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: .85rem .95rem;
  font: inherit; background: #fff; color: var(--text);
}
textarea:focus, input:focus, select:focus {
  outline: 2px solid var(--brand); border-color: var(--brand);
}
.field { margin-bottom: .75rem; }
.field label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .35rem; color: var(--muted); }
.callback-fields { display: none; margin-top: .85rem; padding-top: .85rem; border-top: 1px dashed var(--line); }
.callback-fields.open { display: block; }

.actions {
  position: sticky; bottom: 0; padding: .75rem 0 .25rem;
  background: linear-gradient(transparent, var(--bg) 30%);
}
button[type=submit] {
  width: 100%; border: 0; border-radius: 14px; padding: 1rem 1.25rem;
  background: var(--brand); color: #fff; font: inherit; font-weight: 700; font-size: 1.05rem;
  cursor: pointer; box-shadow: 0 8px 24px color-mix(in srgb, var(--brand) 40%, transparent);
}
button[type=submit]:hover { filter: brightness(.95); }
button[type=submit]:disabled { opacity: .7; cursor: wait; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.thanks { text-align: center; padding: 2.5rem 1.25rem; }
.thanks-icon {
  width: 72px; height: 72px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark);
  display: flex; align-items: center; justify-content: center; font-size: 2rem; margin: 0 auto 1.25rem;
}
.thanks h1 { margin: 0 0 .75rem; font-size: 1.75rem; }
.thanks p { color: var(--muted); margin: 0 0 1.5rem; }
.thanks a {
  display: inline-flex; background: var(--brand); color: #fff; text-decoration: none;
  font-weight: 700; padding: .85rem 1.25rem; border-radius: 12px; margin: .25rem;
}
.thanks a.ghost { background: transparent; color: var(--brand); border: 1px solid var(--brand); }

.foot-note { text-align: center; font-size: .75rem; color: var(--muted); margin-top: 1.5rem; }
.foot-note a { color: var(--brand-dark); }
