:root {
  --cream: #fff8f5;
  --rose: #8d3148;
  --rose-deep: #6e2438;
  --ink: #2c2224;
  --muted: #5e4b4e;
  --white: #ffffff;
  --line: rgba(44, 34, 36, 0.1);
  --shadow: 0 10px 30px rgba(44, 34, 36, 0.08);
  --radius: 20px;
  --focus: 0 0 0 3px rgba(141, 49, 72, 0.35);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Sarabun", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, rgba(141, 49, 72, 0.08), transparent 40%),
    linear-gradient(180deg, #fffaf8 0%, var(--cream) 45%, #fff4ef 100%);
  min-height: 100vh;
  line-height: 1.55;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--rose);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

a:hover {
  color: var(--rose-deep);
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.skip {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 100;
  background: var(--white);
  color: var(--ink);
  padding: 0.65rem 1rem;
  border-radius: 999px;
  box-shadow: var(--shadow);
}

.skip:focus {
  top: 1rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 248, 245, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--rose-deep);
  text-decoration: none;
  letter-spacing: 0.01em;
}

.topnav,
.subnav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
}

.topnav a,
.subnav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}

.topnav a:hover,
.subnav a:hover,
.subnav a.is-current {
  color: var(--rose-deep);
}

.topnav a.btn-primary,
.topnav a.btn-primary:hover {
  color: #fff;
}

.subnav {
  margin: 0 0 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}

.wrap {
  width: min(960px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 4rem;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.title-edit {
  margin: 0 0 1.1rem;
}

.title-edit label {
  display: block;
  margin: 0 0 0.4rem;
  font-weight: 600;
}

.title-edit input {
  width: 100%;
  min-height: 52px;
  padding: 0.7rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 1.2rem;
  font-weight: 700;
}

.page-head h1,
.hero h1,
.auth-card h1,
.empty h2,
.panel h2,
.node-card legend {
  margin: 0 0 0.4rem;
  line-height: 1.25;
  color: var(--ink);
}

.lede {
  margin: 0;
  color: var(--muted);
  max-width: 42rem;
}

.eyebrow {
  margin: 0 0 0.65rem;
  color: var(--rose);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.85rem;
}

.hero {
  padding: 2rem 0 2.5rem;
}

.hero h1 {
  font-size: clamp(1.95rem, 5vw, 2.9rem);
  max-width: 16ch;
  letter-spacing: -0.01em;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.hero-split {
  display: grid;
  gap: 2.25rem;
  align-items: center;
  padding: 1.5rem 0 3rem;
}

.hero-points {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.95rem;
}

.hero-points li {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.hero-points li::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rose);
  flex: 0 0 auto;
}

.hero-demo {
  width: min(360px, 100%);
  margin: 0 auto;
}

.demo-phone {
  padding: 0.7rem;
  border-radius: 32px;
  background: linear-gradient(160deg, #3a2a2e, #2c2224);
  box-shadow: 0 30px 60px rgba(44, 34, 36, 0.22);
}

.demo-bar {
  display: flex;
  justify-content: center;
  padding: 0.35rem 0 0.6rem;
}

.demo-bar span {
  width: 84px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.25);
}

.demo-screen {
  min-height: 300px;
  padding: 1.35rem 1.15rem 1.15rem;
  border-radius: 24px;
  background: var(--white);
}

.demo-step[hidden] {
  display: none;
}

.demo-step .story-body {
  min-height: 2.6em;
}

.demo-screen .demo-reset {
  display: block;
  margin: 1rem auto 0;
  padding: 0.35rem 0.75rem;
}

.demo-screen .demo-reset[hidden] {
  display: none;
}

.demo-caption {
  margin: 0.9rem 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
}

.section {
  padding: 2.5rem 0 0;
}

.section-head {
  margin-bottom: 1.25rem;
}

.section-head h2 {
  margin: 0;
  font-size: clamp(1.4rem, 3.4vw, 1.85rem);
  line-height: 1.3;
  max-width: 24ch;
}

.steps {
  display: grid;
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: none;
}

.steps li {
  position: relative;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.35rem 1.35rem 1.35rem 4.4rem;
}

.step-no {
  position: absolute;
  left: 1.25rem;
  top: 1.3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff1f3;
  color: var(--rose-deep);
  font-weight: 700;
}

.steps h3 {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
}

.steps p {
  margin: 0;
  color: var(--muted);
}

.use-grid {
  display: grid;
  gap: 0.85rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.use-grid li {
  display: grid;
  gap: 0.25rem;
  padding: 1.1rem 1.2rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
}

.use-grid strong {
  color: var(--rose-deep);
}

.use-grid span {
  color: var(--muted);
  font-size: 0.97rem;
}

.trust-list {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding: 1.35rem;
  list-style: none;
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
}

.trust-list li {
  position: relative;
  padding-left: 1.9rem;
}

.trust-list li::before {
  content: "";
  position: absolute;
  left: 0.2rem;
  top: 0.45em;
  width: 0.75rem;
  height: 0.4rem;
  border-left: 2px solid var(--rose);
  border-bottom: 2px solid var(--rose);
  transform: rotate(-45deg);
}

.cta-band {
  margin-top: 3rem;
  padding: 2.25rem 1.5rem;
  border-radius: 28px;
  text-align: center;
  color: #fff;
  background: linear-gradient(135deg, var(--rose) 0%, var(--rose-deep) 100%);
}

.cta-band h2 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.45rem, 3.5vw, 1.9rem);
}

.cta-band p {
  margin: 0 auto;
  max-width: 34rem;
  color: rgba(255, 255, 255, 0.85);
}

.cta-band .hero-actions {
  justify-content: center;
}

.cta-band .btn-primary {
  background: #fff;
  color: var(--rose-deep);
}

.cta-band .btn-primary:hover {
  background: #fff1f3;
  color: var(--rose-deep);
}

.cta-band .btn-secondary {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.55);
}

.cta-band .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.site-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

.site-foot span:first-child {
  font-weight: 700;
  color: var(--rose-deep);
}

.panel,
.project-card,
.auth-card,
.node-card,
.story-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.35rem;
}

.panel + .panel,
.auth-card + .panel,
.node-card + .node-card {
  margin-top: 1rem;
}

.panel-quiet {
  background: rgba(255, 255, 255, 0.55);
  box-shadow: none;
  border: 1px dashed var(--line);
}

.auth-card {
  width: min(440px, 100%);
  margin: 1rem auto;
}

.auth-body {
  min-height: 100vh;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
}

.auth-side {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  gap: 2rem;
  padding: 2.25rem 2.5rem;
  color: #fff;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.14), transparent 45%),
    radial-gradient(circle at 80% 90%, rgba(255, 255, 255, 0.1), transparent 40%),
    linear-gradient(160deg, var(--rose) 0%, var(--rose-deep) 100%);
}

.brand-light,
.brand-light:hover {
  color: #fff;
}

.auth-side-body {
  max-width: 26rem;
}

.auth-side-kicker {
  margin: 0 0 0.6rem;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.78);
}

.auth-side h2 {
  margin: 0 0 1.25rem;
  font-size: clamp(1.6rem, 2.4vw, 2.1rem);
  line-height: 1.3;
  color: #fff;
}

.auth-side-list {
  display: grid;
  gap: 0.8rem;
  margin: 0;
  padding: 0;
  list-style: none;
  color: rgba(255, 255, 255, 0.9);
}

.auth-side-list li {
  position: relative;
  padding-left: 1.75rem;
}

.auth-side-list li::before {
  content: "";
  position: absolute;
  left: 0.15rem;
  top: 0.5em;
  width: 0.7rem;
  height: 0.38rem;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg);
}

.auth-side-foot {
  margin: 0;
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.72);
}

.auth-main {
  display: flex;
  flex-direction: column;
  padding: 1rem 1.25rem 2.5rem;
}

.auth-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.auth-switch {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.auth-switch a {
  font-weight: 600;
}

.auth-card-wide {
  width: min(460px, 100%);
  margin: auto;
  padding: 1.75rem 1.5rem;
}

.auth-head {
  margin-bottom: 1.25rem;
}

.auth-head h1 {
  font-size: clamp(1.55rem, 4vw, 1.9rem);
}

.auth-head .lede {
  margin-top: 0.25rem;
}

.auth-alt {
  margin: 1.35rem 0 0;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
  text-align: center;
  color: var(--muted);
}

.auth-alt a {
  font-weight: 600;
}

.auth-foot {
  margin: 1.5rem 0 0;
  text-align: center;
  font-size: 0.92rem;
}

.auth-foot a {
  color: var(--muted);
  text-decoration: none;
}

.auth-foot a:hover {
  color: var(--rose-deep);
}

.form-stack {
  display: grid;
  gap: 1.05rem;
}

.form-stack .field label,
.field label {
  display: block;
  margin: 0 0 0.4rem;
  font-weight: 600;
  color: var(--ink);
}

.form-stack .field input {
  width: 100%;
  min-height: 50px;
  padding: 0.75rem 0.95rem;
  border: 1px solid rgba(44, 34, 36, 0.16);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-stack .field input::placeholder {
  color: rgba(94, 75, 78, 0.55);
}

.form-stack .field input:hover {
  border-color: rgba(141, 49, 72, 0.35);
}

.form-stack .field input:focus-visible {
  border-color: var(--rose);
  box-shadow: 0 0 0 4px rgba(141, 49, 72, 0.14);
}

.label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
}

.label-row label {
  margin: 0;
}

.label-link {
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.label-link:hover {
  text-decoration: underline;
}

.alert code {
  font-size: 0.9em;
  background: rgba(0, 0, 0, 0.05);
  padding: 0.05rem 0.35rem;
  border-radius: 6px;
}

.alert a {
  color: inherit;
  font-weight: 600;
}

.field-help {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.form-note {
  margin: 0;
  text-align: center;
}

.input-wrap {
  position: relative;
}

.input-wrap input {
  padding-right: 4.6rem;
}

.input-toggle {
  position: absolute;
  top: 50%;
  right: 0.5rem;
  transform: translateY(-50%);
  min-height: 36px;
  padding: 0.3rem 0.75rem;
  border: 0;
  border-radius: 999px;
  background: #fff1f3;
  color: var(--rose-deep);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.input-toggle:hover {
  background: #ffe4e9;
}

.input-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
}

.input-toggle-icon:hover {
  background: #fff1f3;
  color: var(--rose-deep);
}

.input-toggle-icon svg {
  display: block;
}

.input-toggle-icon .icon-eye-off,
.input-toggle-icon[aria-pressed="true"] .icon-eye {
  display: none;
}

.input-toggle-icon[aria-pressed="true"] .icon-eye-off {
  display: block;
}

.input-toggle-icon[aria-pressed="true"] {
  color: var(--rose-deep);
}

.input-wrap input:has(+ .input-toggle-icon) {
  padding-right: 3.4rem;
}

.form-stack .btn-block {
  margin-top: 0.35rem;
}

.btn-lg {
  min-height: 52px;
  font-size: 1.05rem;
}

.auth-card .alert:last-of-type {
  margin-bottom: 1.25rem;
}

.empty {
  text-align: center;
  padding: 2.5rem 1.25rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.65);
  border-radius: var(--radius);
  border: 1px dashed var(--line);
}

.btn,
button.btn,
a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 48px;
  padding: 0.7rem 1.25rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--rose);
  color: #fff;
}

.btn-primary:hover {
  background: var(--rose-deep);
  color: #fff;
}

.btn.btn-secondary {
  background: #fff;
  color: var(--rose-deep);
  border-color: rgba(141, 49, 72, 0.25);
}

.btn.btn-secondary:hover {
  background: #fff1f3;
  color: var(--rose-deep);
}

.btn.btn-danger {
  background: #fff;
  color: #9b1c2c;
  border-color: rgba(155, 28, 44, 0.28);
}

.btn.btn-danger:hover {
  background: #fff0f0;
}

.btn-choice {
  background: #fff7f4;
  color: var(--ink);
  border-color: rgba(141, 49, 72, 0.18);
  justify-content: flex-start;
  text-align: left;
}

.btn-choice:hover {
  background: #ffe9e4;
  border-color: var(--rose);
}

.btn-small {
  min-height: 40px;
  padding: 0.45rem 0.95rem;
  font-size: 0.95rem;
}

.btn-block {
  width: 100%;
}

.btn-text {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
}

.btn-text:hover {
  color: var(--rose-deep);
}

.alert {
  border-radius: 16px;
  padding: 0.95rem 1.1rem;
  margin: 0 0 1rem;
}

.alert ul {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
}

.alert-success {
  background: #eef8f0;
  color: #1f5b34;
}

.alert-warn {
  background: #fff6e8;
  color: #7a4b12;
}

.alert-danger {
  background: #fff0f0;
  color: #8a1f2b;
}

.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.stat {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  text-decoration: none;
  border: 1px solid transparent;
  font-weight: 500;
}

.stat.is-current,
.stat:hover {
  color: var(--rose-deep);
  border-color: rgba(141, 49, 72, 0.2);
  background: #fff;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}

.filters input[type="search"],
.filters input[type="text"],
label + input,
label + textarea,
label + select,
.editor-form input,
.editor-form textarea,
.editor-form select,
.auth-card input,
.panel input,
.panel textarea,
.copy-row input {
  width: 100%;
  min-height: 48px;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.editor-form .title-edit input {
  min-height: 52px;
  font-size: 1.2rem;
  font-weight: 700;
}

.editor-form textarea,
.panel textarea {
  min-height: 110px;
  resize: vertical;
}

.editor-form label,
.auth-card label,
.panel label,
.option-row label {
  display: block;
  margin: 0.85rem 0 0.35rem;
  font-weight: 600;
  color: var(--ink);
}

.card-grid {
  display: grid;
  gap: 1rem;
}

.project-card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.card-actions,
.row-actions,
.hero-actions,
.node-tools,
.add-row,
.copy-row,
.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0.15rem 0.7rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  background: #f3ecea;
  color: var(--muted);
}

.badge-published {
  background: #e8f6ec;
  color: #1f5b34;
}

.badge-unpublished {
  background: #f3ecea;
  color: #6a5558;
}

.badge-draft {
  background: #fff1e8;
  color: #8a4d1c;
}

.hint,
.hint-inline {
  color: var(--muted);
  font-size: 0.95rem;
}

.hint {
  margin: 0.75rem 0 0;
}

.hint-inline {
  font-weight: 400;
}

.stats-panel {
  margin-bottom: 1rem;
}

.stats-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.stats-head h2 {
  margin: 0;
  font-size: 1.15rem;
}

.stat-grid {
  display: grid;
  gap: 0.75rem;
  margin: 0;
}

.stat-item {
  padding: 0.95rem 1rem;
  border-radius: 16px;
  background: #fff8f5;
  border: 1px solid var(--line);
}

.stat-item-primary {
  background: linear-gradient(135deg, #fff1f3, #ffe4e9);
  border-color: rgba(141, 49, 72, 0.18);
}

.stat-item dt {
  margin: 0 0 0.15rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
}

.stat-item dd {
  margin: 0;
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--rose-deep);
}

.stat-item dd small {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
}

.stat-item p {
  margin: 0.3rem 0 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.card-scan {
  margin: 0;
  font-size: 0.92rem;
  color: var(--muted);
}

.card-scan.is-scanned {
  color: #1f5b34;
  font-weight: 600;
}

.share-panel .qr {
  display: block;
  margin: 1.25rem auto;
  background: #fff;
  border-radius: 16px;
  padding: 0.75rem;
  box-shadow: inset 0 0 0 1px var(--line);
}

.copy-row input {
  flex: 1 1 180px;
}

.node-card {
  border: 0;
  margin: 0 0 1rem;
}

.node-card legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  float: left;
  padding: 0;
  font-weight: 700;
}

.start-pick {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 500;
  color: var(--muted);
  margin: 0 !important;
}

.option-list {
  display: grid;
  gap: 0.85rem;
  margin-top: 0.75rem;
}

.option-row {
  padding: 0.85rem;
  border-radius: 16px;
  background: #fff8f5;
  border: 1px solid var(--line);
}

.add-row {
  margin-bottom: 1rem;
  color: var(--muted);
  font-weight: 600;
}

.node-tools {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.savebar {
  position: sticky;
  bottom: 0;
  z-index: 15;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  padding: 0.85rem 0;
  margin-top: 1rem;
  background: linear-gradient(180deg, rgba(255, 248, 245, 0), rgba(255, 248, 245, 0.95) 28%, var(--cream));
}

.phone {
  width: min(390px, 100%);
  margin: 0 auto;
  padding: 0.75rem;
  border-radius: 28px;
  background: rgba(44, 34, 36, 0.06);
}

.viewer-body {
  background:
    radial-gradient(circle at top, rgba(141, 49, 72, 0.1), transparent 45%),
    var(--cream);
}

.viewer-shell {
  width: min(440px, calc(100% - 1.5rem));
  margin: 0 auto;
  padding: 1.25rem 0 3rem;
}

.story-card {
  padding: 1.5rem 1.35rem;
}

.story-kicker {
  margin: 0 0 0.75rem;
  color: var(--rose);
  font-weight: 600;
  font-size: 0.95rem;
}

.story-body {
  margin: 0 0 1.25rem;
  font-size: 1.12rem;
  white-space: pre-wrap;
}

.story-end {
  margin: 1rem 0 0;
  color: var(--muted);
  text-align: center;
}

.story-quiet {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.25rem;
  margin-top: 1.35rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.choice-list {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.5rem;
}

.viewer-mark {
  text-align: center;
  margin: 1.5rem 0 0;
  font-size: 0.9rem;
}

.viewer-mark a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}

@media (min-width: 720px) {
  .steps {
    grid-template-columns: repeat(3, 1fr);
  }

  .steps li {
    padding: 4.4rem 1.35rem 1.35rem;
  }

  .step-no {
    left: 1.35rem;
    top: 1.35rem;
  }

  .use-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .trust-list {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.9rem 1.5rem;
  }

  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .wrap {
    padding-top: 2rem;
  }
}

@media (min-width: 900px) {
  .auth-shell {
    grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.1fr);
  }

  .auth-side {
    display: flex;
  }

  .auth-top-brand {
    visibility: hidden;
  }

  .auth-main {
    padding: 1.5rem 3rem 3rem;
  }

  .auth-card-wide {
    padding: 2.25rem 2.25rem 2rem;
  }

  .hero-split {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: 3rem;
    padding: 2.5rem 0 3.5rem;
  }

  .hero-demo {
    margin: 0 0 0 auto;
  }

  .use-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ---------- PDPA: checkbox, footer links, cookie banner, legal pages ---------- */

label.check,
.panel label.check,
.auth-card label.check,
.editor-form label.check {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  margin: 0;
  cursor: pointer;
  line-height: 1.5;
  font-weight: 400;
  color: var(--ink);
}

.check input[type="checkbox"],
.panel .check input[type="checkbox"],
.auth-card .check input[type="checkbox"] {
  flex: 0 0 auto;
  width: 1.2rem;
  height: 1.2rem;
  min-height: 0;
  padding: 0;
  margin: 0.15rem 0 0;
  border: 0;
  border-radius: 4px;
  accent-color: var(--rose);
  cursor: pointer;
}

.check-disabled {
  cursor: default;
  color: var(--muted);
}

.check .req {
  color: var(--rose);
  font-weight: 600;
}

.check .opt {
  color: var(--muted);
}

.consent-box {
  display: grid;
  gap: 0.8rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--cream);
  font-size: 0.95rem;
}

.consent-box a {
  font-weight: 600;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.text-warn {
  color: #7a4b12;
  font-weight: 600;
}

.subnav a[aria-current="page"] {
  color: var(--rose-deep);
  font-weight: 700;
}

.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
}

.foot-links a {
  color: var(--muted);
  text-decoration: none;
}

.foot-links a:hover {
  color: var(--rose-deep);
  text-decoration: underline;
}

.viewer-legal a {
  color: var(--muted);
  font-weight: 400;
}

/* Cookie banner */
.cookie-banner {
  position: fixed;
  inset: auto 0.75rem 0.75rem;
  z-index: 60;
  max-width: 760px;
  margin: 0 auto;
  background: var(--white);
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(44, 34, 36, 0.22);
  border: 1px solid var(--line);
  padding: 1.1rem 1.2rem;
  font-size: 0.95rem;
}

.cookie-form {
  display: grid;
  gap: 0.9rem;
}

.cookie-title {
  margin: 0 0 0.25rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--rose-deep);
}

.cookie-text p {
  margin: 0;
  color: var(--muted);
}

.cookie-text a {
  color: var(--rose-deep);
  font-weight: 600;
}

.cookie-settings summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--rose-deep);
  list-style: none;
}

.cookie-settings summary::-webkit-details-marker {
  display: none;
}

.cookie-settings summary::before {
  content: "▸ ";
}

.cookie-settings[open] summary::before {
  content: "▾ ";
}

.cookie-options {
  list-style: none;
  margin: 0.75rem 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}

.cookie-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.6rem;
}

.cookie-panel {
  margin-bottom: 1.5rem;
}

.cookie-panel h2 {
  margin-top: 0;
}

.cookie-reset {
  margin-top: 1rem;
}

/* Legal pages */
.legal {
  max-width: 760px;
  margin: 0 auto;
}

.legal-head {
  margin: 1rem 0 1.5rem;
}

.legal-head h1 {
  margin: 0 0 0.6rem;
}

.legal-meta {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.legal-toc {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.35rem 1rem;
  padding: 1rem 1.1rem;
  margin: 0 0 1.5rem;
  border-radius: 16px;
  background: var(--white);
  box-shadow: var(--shadow);
  font-size: 0.92rem;
}

.legal-toc a {
  text-decoration: none;
  color: var(--muted);
}

.legal-toc a:hover {
  color: var(--rose-deep);
}

.legal section {
  margin: 0 0 1.75rem;
}

.legal h2 {
  font-size: 1.25rem;
  margin: 0 0 0.6rem;
  scroll-margin-top: 5rem;
}

.legal h3 {
  font-size: 1.02rem;
  margin: 1rem 0 0.4rem;
}

.legal p,
.legal li {
  line-height: 1.7;
}

.legal ul {
  padding-left: 1.3rem;
  margin: 0.4rem 0;
}

.legal a {
  color: var(--rose-deep);
  font-weight: 600;
}

.legal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  margin: 0.6rem 0;
  background: var(--white);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.legal-table th,
.legal-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid var(--line);
}

.legal-table th {
  background: var(--cream);
  font-weight: 700;
}

.legal-table tr:last-child td {
  border-bottom: 0;
}

.legal-table code {
  font-size: 0.88em;
  background: rgba(0, 0, 0, 0.05);
  padding: 0.05rem 0.35rem;
  border-radius: 6px;
}

/* Settings: privacy */
.settings-grid {
  display: grid;
  gap: 1.25rem;
}

.settings-grid .panel h2 {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
}

.settings-grid .panel .lede {
  margin-bottom: 1rem;
}

.settings-grid .form-stack > .btn {
  justify-self: start;
}

.panel-danger {
  border: 1px solid rgba(155, 28, 44, 0.22);
}

.panel-danger h2 {
  color: #9b1c2c;
}

.settings-grid .legal-table {
  box-shadow: none;
  border: 1px solid var(--line);
}

@media (min-width: 720px) {
  .settings-grid {
    grid-template-columns: 1fr 1fr;
  }

  .settings-span {
    grid-column: 1 / -1;
  }

  .cookie-banner {
    inset: auto 1.25rem 1.25rem;
    padding: 1.25rem 1.5rem;
  }

  .cookie-form {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .cookie-settings {
    grid-column: 1 / -1;
  }

  .cookie-actions {
    flex-wrap: nowrap;
  }
}

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

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
