:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #332d49;
  background: #f7f4ff;
  --purple: #7354b7;
  --deep-purple: #493374;
  --lavender: #eee7ff;
  --line: #e8e0f5;
  --muted: #777187;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: radial-gradient(ellipse at 80% 12%, #eee7ff 0, transparent 35%), #f7f4ff; }
button, input { font: inherit; }
button { min-height: 48px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid #b493fa; outline-offset: 3px; }
.shell { width: min(100% - 32px, 900px); margin: 0 auto; padding: max(20px, env(safe-area-inset-top)) 0 max(28px, env(safe-area-inset-bottom)); }
.topbar { display: flex; align-items: center; gap: 12px; min-height: 52px; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 15px; color: white; font-weight: 800; font-size: 20px; background: linear-gradient(145deg, #a38be1, #6548a2); box-shadow: 0 7px 18px #7254b733; }
.topbar strong, .topbar small { display: block; }
.topbar small { margin-top: 2px; color: var(--muted); font-size: 12px; }
.private-pill { margin-left: auto; border: 1px solid #d8cbed; border-radius: 99px; padding: 7px 10px; color: var(--deep-purple); font-size: 10px; font-weight: 700; letter-spacing: .07em; }
.environment-note { margin: 18px 0 0; padding: 11px 14px; border: 1px solid #e4daf4; border-radius: 14px; color: #584477; background: #ffffffbd; font-size: 12px; line-height: 1.5; }
.liff-state { display: grid; gap: 3px; margin: 10px 0 0; padding: 11px 14px; border: 1px solid #d9cfea; border-radius: 14px; color: #493374; background: #eee7ff; font-size: 12px; line-height: 1.45; }
.liff-state span { color: #655b78; }
.liff-state[data-state="initializing"] { border-color: #d8c4f2; background: #f4edff; }
.liff-state[data-state="outside-line"] { border-color: #ead9b8; color: #68490f; background: #fff8e9; }
.liff-state[data-state="error"] { border-color: #e9bdbd; color: #7e3030; background: #fff0f0; }
.hero { display: grid; grid-template-columns: 1.1fr .9fr; align-items: center; gap: 28px; margin: 36px 0 24px; }
.eyebrow { color: var(--purple); font-size: 11px; font-weight: 750; letter-spacing: .15em; }
h1 { margin: 10px 0 14px; color: #302544; font-size: clamp(34px, 6vw, 54px); line-height: 1.12; letter-spacing: -.04em; }
h1 span { color: var(--purple); }
.intro { max-width: 390px; color: #6c657c; font-size: 16px; line-height: 1.65; }
.primary-button, .secondary-button { border: 0; border-radius: 15px; font-weight: 700; transition: transform .16s ease, box-shadow .16s ease; }
.primary-button { display: inline-flex; align-items: center; gap: 18px; margin-top: 12px; padding: 0 20px; color: white; background: linear-gradient(135deg, #8466c4, #63439f); box-shadow: 0 9px 20px #63439f2e; }
.primary-button:active, .secondary-button:active { transform: scale(.98); }
.luna-card { margin: 0; text-align: center; }
.luna-card img { display: block; width: min(100%, 252px); max-height: 290px; margin: auto; object-fit: contain; object-position: center bottom; filter: drop-shadow(0 15px 22px #55417a24); }
.luna-card figcaption { width: fit-content; margin: -2px auto 0; padding: 10px 16px; border: 1px solid #e4daf4; border-radius: 99px; color: #584477; background: #fff; box-shadow: 0 5px 15px #4933740c; font-size: 13px; }
.sparkle { margin-right: 6px; color: #ae84d5; }
.test-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 18px 0; }
.test-card, .lesson-card, .liff-setup, .diagnostics { border: 1px solid var(--line); border-radius: 22px; background: #ffffffd9; box-shadow: 0 8px 26px #4b367b0b; }
.test-card { padding: 20px; }
.card-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 13px; color: var(--purple); background: var(--lavender); font-size: 22px; }
h2 { margin: 12px 0 7px; font-size: 18px; }
.test-card p, .liff-setup p { color: var(--muted); font-size: 13px; line-height: 1.55; }
.secondary-button { padding: 0 15px; color: var(--deep-purple); background: #eee7fa; }
.inline-status { min-height: 20px; margin: 9px 0 0; color: #5b5270 !important; font-size: 12px !important; }
.lesson-card { margin: 16px 0; padding: 20px; animation: appear .22s ease-out; }
.lesson-meta { display: flex; justify-content: space-between; gap: 8px; color: var(--purple); font-size: 10px; font-weight: 750; letter-spacing: .08em; }
.lesson-card h2 { margin-top: 16px; font-size: 23px; }
.lesson-thai { color: var(--muted); }
.phrase { display: grid; gap: 6px; margin: 16px 0; padding: 16px; border-radius: 16px; background: #f5f0ff; font-size: 18px; font-weight: 700; }
.phrase span:last-child { color: var(--muted); font-size: 13px; font-weight: 400; }
.preview-note, .privacy-note { color: var(--muted); font-size: 11px; line-height: 1.55; }
.liff-setup, .diagnostics { display: block; margin: 14px 0; padding: 16px 18px; }
summary { color: var(--deep-purple); font-weight: 700; cursor: pointer; min-height: 28px; }
.liff-setup label { display: block; margin-top: 12px; font-size: 12px; font-weight: 700; }
.liff-row { display: flex; gap: 8px; margin-top: 7px; }
.liff-row input { flex: 1; min-width: 0; border: 1px solid #d9cfe9; border-radius: 13px; padding: 0 12px; color: #332d49; background: white; }
.diagnostic-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; margin: 12px 0; }
.diagnostic-list div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid #f0ebf6; font-size: 12px; }
.diagnostic-list dt { color: var(--muted); }
.diagnostic-list dd { margin: 0; max-width: 58%; overflow-wrap: anywhere; text-align: right; font-weight: 650; }
footer { padding: 14px 4px 0; color: #827b91; font-size: 11px; line-height: 1.55; text-align: center; }
@keyframes appear { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 600px) {
  .shell { width: min(100% - 24px, 460px); }
  .hero { grid-template-columns: 1fr .82fr; gap: 6px; margin: 26px 0 16px; }
  .eyebrow { font-size: 9px; }
  h1 { font-size: clamp(30px, 9vw, 40px); }
  .intro { font-size: 13px; }
  .primary-button { gap: 8px; padding: 0 13px; font-size: 12px; }
  .luna-card img { width: min(100%, 180px); max-height: 235px; }
  .luna-card figcaption { padding: 8px 11px; font-size: 10px; }
  .test-grid { gap: 9px; }
  .test-card { padding: 14px 12px; border-radius: 18px; }
  .test-card h2 { font-size: 15px; }
  .test-card p { font-size: 11px; }
  .secondary-button { width: 100%; padding: 0 8px; font-size: 12px; }
  .liff-row { flex-direction: column; }
  .liff-row input { min-height: 48px; }
  .diagnostic-list { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
