/* ─────────────────────────────────────────────────────────────
   Lotto — Modern Thai Refresh
   ─────────────────────────────────────────────────────────────
   Inter (UI) + Bai Jamjuree (display/numbers)
   ขาว 95% · accent ครามไทย + ส้มเทอราคอตต้า + ทอง
*/

:root {
  /* Brand accents (keep) */
  --indigo:       #2C3E70;
  --indigo-deep:  #1F2D54;
  --indigo-soft:  rgba(44, 62, 112, 0.08);
  --terra:        #C9622E;
  --terra-soft:   rgba(201, 98, 46, 0.10);
  --gold:         #B89556;
  --green:        #4A6741;
  --green-soft:   rgba(74, 103, 65, 0.10);
  --crimson:      #A8312E;
  --crimson-soft: rgba(168, 49, 46, 0.10);

  /* Neutrals — refreshed */
  --bg:           #FAFAFA;
  --surface:      #FFFFFF;
  --surface-2:    #F5F5F4;
  --cream:        #FBF6E9;     /* keep — highlight only */
  --cream-deep:   #F2EBD7;
  --text:         #18181B;
  --muted:        #71717A;
  --line:         #E4E4E7;
  --line-soft:    #F4F4F5;

  /* Typography */
  --font-body:    'Inter', 'Sarabun', system-ui, -apple-system, sans-serif;
  --font-display: 'Bai Jamjuree', 'Sarabun', sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, monospace;

  /* Radius / Shadow */
  --radius-sm:    6px;
  --radius:       8px;
  --radius-lg:    12px;
  --radius-pill:  999px;

  --shadow-xs:    0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow:       0 1px 3px rgba(0,0,0,0.05), 0 4px 12px rgba(0,0,0,0.04);
  --shadow-lg:    0 4px 6px rgba(0,0,0,0.05), 0 10px 25px rgba(0,0,0,0.05);

  --max-w:        1100px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Typography ─────────────────────────────────────────── */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text);
  margin: 0 0 .75rem;
  line-height: 1.2;
  letter-spacing: -0.015em;
}

h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.3rem; font-weight: 600; }
h3 { font-size: 1.1rem; font-weight: 600; }

p { margin: 0 0 1rem; }

a {
  color: var(--indigo);
  text-decoration: none;
  transition: color .12s;
}
a:hover { color: var(--terra); }

code, pre {
  font-family: var(--font-mono);
  font-size: .9em;
  background: var(--surface-2);
  padding: 0.1em 0.35em;
  border-radius: var(--radius-sm);
}

/* ─── Layout ─────────────────────────────────────────────── */

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  background: var(--indigo);
  color: white;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: .95rem;
}
.brand-logo,
.brand img {
  height: 32px !important;
  width: auto !important;
  max-width: 160px !important;
  max-height: 32px !important;
  object-fit: contain;
  display: block;
}

.nav { display: flex; gap: 1.25rem; align-items: center; }
.nav a {
  text-decoration: none;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 500;
  transition: color .12s;
}
.nav a:hover { color: var(--text); }

.site-footer {
  margin-top: 4rem;
  padding: 2rem 0;
  background: var(--surface);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .85rem;
  text-align: center;
}

main { min-height: calc(100vh - 60px - 100px); padding: 2rem 0; }

/* ─── Card ───────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-xs);
  transition: box-shadow .15s;
}
.card.tight { padding: 1.25rem; }
.card-narrow {
  max-width: 460px;
  margin: 2rem auto;
}

.card-title {
  display: flex;
  align-items: center;
  gap: .65rem;
  margin-bottom: 1.25rem;
}
.card-title::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 1.2em;
  background: var(--terra);
  border-radius: 2px;
  flex-shrink: 0;
}
.card-title h1, .card-title h2 { margin: 0; }

/* ─── Form ───────────────────────────────────────────────── */

.field {
  margin-bottom: 1rem;
}
.field label {
  display: block;
  font-weight: 500;
  font-size: .85rem;
  margin-bottom: .4rem;
  color: var(--text);
}
.field input[type="text"],
.field input[type="tel"],
.field input[type="password"],
.field input[type="email"],
.field input[type="number"],
.field input[type="date"],
.field textarea,
.field select {
  width: 100%;
  padding: .6rem .85rem;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: .95rem;
  border-radius: var(--radius);
  transition: border-color .15s, box-shadow .15s;
}
.field input:hover,
.field textarea:hover,
.field select:hover {
  border-color: #D4D4D8;
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px var(--indigo-soft);
}
.field .hint {
  font-size: .82rem;
  color: var(--muted);
  margin-top: .25rem;
}

.field-row {
  display: flex;
  gap: 1rem;
}
.field-row > .field { flex: 1; }

.checkbox-field {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  font-size: .92rem;
  margin-bottom: 1rem;
}
.checkbox-field input { margin-top: 4px; }

/* ─── Button ─────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .55rem 1.1rem;
  background: var(--indigo);
  color: white;
  border: 1px solid var(--indigo);
  font-family: inherit;
  font-size: .92rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .15s, transform .08s, box-shadow .15s;
  box-shadow: var(--shadow-xs);
}
.btn:hover {
  background: var(--indigo-deep);
  color: white;
  box-shadow: var(--shadow-sm);
}
.btn:active { transform: translateY(1px); }

.btn-block { display: flex; width: 100%; }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
}
.btn-secondary:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: #D4D4D8;
}

.btn-terra {
  background: var(--terra);
  border-color: var(--terra);
}
.btn-terra:hover { background: #A24D1F; border-color: #A24D1F; color: white; }

.btn-link {
  background: transparent;
  border: none;
  color: var(--indigo);
  text-decoration: none;
  padding: 0;
  font-size: inherit;
  cursor: pointer;
  font-weight: 500;
}
.btn-link:hover { color: var(--terra); text-decoration: underline; text-underline-offset: 3px; }

/* ─── Alert ──────────────────────────────────────────────── */

.alert {
  padding: .75rem 1rem;
  border: 1px solid var(--crimson-soft);
  background: var(--crimson-soft);
  color: #6B1F1D;
  margin-bottom: 1rem;
  border-radius: var(--radius);
  font-size: .9rem;
}
.alert-info {
  border-color: var(--indigo-soft);
  background: var(--indigo-soft);
  color: var(--indigo-deep);
}
.alert-success {
  border-color: var(--green-soft);
  background: var(--green-soft);
  color: #2E4827;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: .2em .65em;
  background: var(--gold);
  color: white;
  font-size: .72rem;
  letter-spacing: .02em;
  border-radius: var(--radius-pill);
  font-weight: 500;
  line-height: 1.5;
}
.badge-indigo { background: var(--indigo); }
.badge-terra { background: var(--terra); }

/* ─── Misc ───────────────────────────────────────────────── */

.muted { color: var(--muted); }
.text-sm { font-size: .9rem; }
.text-xs { font-size: .8rem; }
.center { text-align: center; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; } .mt-4 { margin-top: 2rem; }

.divider {
  height: 1px;
  background: var(--line);
  margin: 1.5rem 0;
}

.tos-content {
  max-height: 400px;
  overflow-y: auto;
  padding: 1rem 1.25rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: .9rem;
  line-height: 1.7;
  white-space: pre-wrap;
}

/* ─── App tabs (horizontal nav ใน /app/*) ─────────────────── */

.app-nav-wrap {
  margin-bottom: 1.75rem;
}
.app-nav-toggle { display: none; }   /* hidden on desktop */

.app-tabs {
  display: flex;
  gap: .25rem;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.app-tabs::-webkit-scrollbar { display: none; }
.app-tabs a {
  padding: .65rem 1rem;
  text-decoration: none;
  color: var(--muted);
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-size: .9rem;
  white-space: nowrap;
  border-radius: var(--radius) var(--radius) 0 0;
  transition: color .12s, border-color .12s, background .12s;
}
.app-tabs a:hover {
  color: var(--text);
  background: var(--surface-2);
}
.app-tabs a.active {
  color: var(--indigo);
  border-bottom-color: var(--terra);
  background: transparent;
}

/* Mobile: hamburger toggle */
@media (max-width: 600px) {
  .app-nav-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: .65rem .9rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    cursor: pointer;
    font-family: inherit;
    font-size: .95rem;
    font-weight: 500;
    color: var(--text);
    transition: background .12s;
  }
  .app-nav-toggle:hover { background: var(--surface-2); }
  .app-nav-toggle .app-nav-current { color: var(--indigo); }
  .app-nav-toggle .app-nav-icon { display: flex; color: var(--muted); }

  .app-tabs {
    display: none;
    flex-direction: column;
    gap: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-top: .4rem;
    background: var(--surface);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
  }
  .app-tabs.open { display: flex; }
  .app-tabs a {
    padding: .85rem 1rem;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    margin-bottom: 0;
    font-size: .95rem;
  }
  .app-tabs a:last-child { border-bottom: none; }
  .app-tabs a.active {
    background: var(--indigo-soft);
    border-bottom-color: var(--line);
    border-left: 3px solid var(--terra);
    padding-left: calc(1rem - 3px);
  }
}

/* ─── Plan card ──────────────────────────────────────────── */

.plan-card {
  border: 1px solid var(--line);
  padding: 1.25rem;
  background: var(--surface);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  transition: box-shadow .15s;
}
.plan-card:hover { box-shadow: var(--shadow-sm); }
.plan-card.featured {
  border-color: var(--terra);
  border-width: 1.5px;
  box-shadow: var(--shadow-sm);
}
.plan-card .plan-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  margin: 0 0 .25rem;
}
.plan-card .plan-price {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--terra);
  margin: .5rem 0;
  letter-spacing: -0.02em;
}
.plan-card .plan-price small {
  font-size: .85rem;
  color: var(--muted);
  font-weight: 400;
}
.plan-card .plan-desc {
  color: var(--muted);
  font-size: .9rem;
  margin: 0 0 1rem;
  flex: 1;
}

/* ─── Status badges ─────────────────────────────────────── */

.status-pending { background: var(--gold); }
.status-approved { background: var(--green); }
.status-rejected { background: var(--crimson); }

/* ─── Theme picker (radio cards) ────────────────────────── */

.theme-option {
  cursor: pointer;
  display: block;
  border: 1px solid var(--line);
  padding: .85rem;
  border-radius: var(--radius);
  text-align: center;
  transition: border-color .12s, background .12s, box-shadow .12s;
  user-select: none;
  background: var(--surface);
}
.theme-option:hover {
  border-color: #D4D4D8;
  background: var(--surface-2);
}
.theme-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.theme-option-name {
  font-weight: 600;
  color: var(--text);
  font-size: .9rem;
}
.theme-option-sub {
  color: var(--muted);
  font-size: .78rem;
  margin-top: .25rem;
}

/* selected state */
.theme-option.selected,
.theme-option:has(input:checked) {
  border-color: var(--terra);
  background: var(--terra-soft);
  box-shadow: 0 0 0 3px var(--terra-soft);
}
.theme-option.selected .theme-option-name,
.theme-option:has(input:checked) .theme-option-name {
  color: var(--terra);
}

/* ─── Slot grid (ตาราง 00-99) ─────────────────────────────
   theme = heritage (default)
   ทำเป็น CSS variables เพื่อให้ override ได้ตาม theme
*/

.slot-grid {
  --slot-size: 64px;
  --slot-gap: 6px;
  --slot-fg-available: var(--indigo);
  --slot-bg-available: var(--cream);
  --slot-border-available: var(--indigo);
  --slot-fg-reserved: var(--cream);
  --slot-bg-reserved: var(--indigo);
  --slot-fg-sold: var(--cream);
  --slot-bg-sold: var(--terra);

  display: grid;
  grid-template-columns: repeat(10, var(--slot-size));
  gap: var(--slot-gap);
  justify-content: center;
  font-family: 'Bai Jamjuree', sans-serif;
  font-weight: 600;
}

.slot-grid.theme-editorial {
  --slot-fg-available: #0F0F0F;
  --slot-bg-available: #FFFFFF;
  --slot-border-available: #0F0F0F;
  --slot-fg-reserved: #FFFFFF;
  --slot-bg-reserved: #2A2A2A;
  --slot-fg-sold: #FFFFFF;
  --slot-bg-sold: #8B0E0E;
}
.slot-grid.theme-ticket {
  --slot-fg-available: #8B1538;
  --slot-bg-available: #FFFFFF;
  --slot-border-available: #D4A017;
  --slot-fg-reserved: #D4A017;
  --slot-bg-reserved: #1B3A5C;
  --slot-fg-sold: #D4A017;
  --slot-bg-sold: #8B1538;
}

.slot {
  width: var(--slot-size);
  height: var(--slot-size);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  border-radius: 4px;
  background: var(--slot-bg-available);
  color: var(--slot-fg-available);
  border: 1.5px solid var(--slot-border-available);
  position: relative;
  transition: transform .1s, box-shadow .1s;
  user-select: none;
}
.slot.status-reserved {
  background: var(--slot-bg-reserved);
  color: var(--slot-fg-reserved);
  border-color: var(--slot-bg-reserved);
}
.slot.status-sold {
  background: var(--slot-bg-sold);
  color: var(--slot-fg-sold);
  border-color: var(--slot-bg-sold);
}
.slot.status-sold::after {
  content: '';
  position: absolute;
  inset: 8px;
  background:
    linear-gradient(45deg, transparent 47%, currentColor 48%, currentColor 52%, transparent 53%),
    linear-gradient(-45deg, transparent 47%, currentColor 48%, currentColor 52%, transparent 53%);
  opacity: .25;
  pointer-events: none;
}

.slot-grid.clickable .slot {
  cursor: pointer;
}
.slot-grid.clickable .slot:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(44,62,112,0.15);
}

/* Winner highlight (เลขที่ผลออก) */
.slot.winner {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
  animation: winner-pulse 2s ease-in-out infinite;
  z-index: 1;
}
@keyframes winner-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(184, 149, 86, 0.5); }
  50%      { box-shadow: 0 0 0 8px rgba(184, 149, 86, 0); }
}

@media (max-width: 720px) {
  .slot-grid { --slot-size: 9vw; --slot-gap: 1vw; }
  .slot { font-size: 4vw; }
}

/* ─── Heatmap (buyer stats) ──────────────────────────────── */

.heatmap {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 5px;
}
.heatmap-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bai Jamjuree', sans-serif;
  font-size: .95rem;
  font-weight: 600;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
}
.heatmap-cell.t1 { background: rgba(201, 98, 46, 0.20); color: var(--text); border-color: rgba(201, 98, 46, 0.30); }
.heatmap-cell.t2 { background: rgba(201, 98, 46, 0.42); color: var(--text); border-color: rgba(201, 98, 46, 0.55); }
.heatmap-cell.t3 { background: rgba(201, 98, 46, 0.65); color: #fff; border-color: var(--terra); }
.heatmap-cell.t4 { background: var(--terra); color: #fff; border-color: var(--terra); }
.heatmap-cell.t5 { background: var(--terra); color: #fff; border-color: var(--indigo); box-shadow: 0 0 0 2px rgba(44,62,112,.4); }

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .8rem;
  color: var(--muted);
  margin-top: .5rem;
}
.heatmap-legend .swatches { display: flex; gap: 2px; }
.heatmap-legend .swatch {
  width: 18px;
  height: 14px;
  border-radius: 2px;
  border: 1px solid var(--line);
}

/* ─── Responsive list (table → card บน mobile) ───────── */

@media (max-width: 600px) {
  .responsive-list {
    border-collapse: separate;
    border-spacing: 0;
  }
  .responsive-list thead { display: none; }
  .responsive-list tbody, .responsive-list tr, .responsive-list td {
    display: block;
    width: 100%;
  }
  .responsive-list tr {
    border: 1px solid var(--line) !important;
    border-radius: var(--radius);
    margin-bottom: .6rem;
    padding: .7rem .85rem;
    background: var(--surface);
  }
  .responsive-list td {
    padding: .15rem 0 !important;
    border: 0 !important;
    text-align: left !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
    line-height: 1.4;
  }
  .responsive-list td:empty { display: none; }
  .responsive-list td[data-label=""] { justify-content: flex-end; }
  .responsive-list td::before {
    content: attr(data-label);
    font-size: .75rem;
    font-weight: 500;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .03em;
    flex-shrink: 0;
    min-width: 60px;
  }
  .responsive-list td[data-label=""]::before { display: none; }
  .responsive-list td > span,
  .responsive-list td > strong,
  .responsive-list td > code,
  .responsive-list td > a {
    text-align: right;
  }
}

/* ─── Sheet detail header (split layout) ─────────────── */

.sheet-header-split {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.sheet-header-info {
  flex: 1;
  min-width: 260px;
}
.sheet-header-actions {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  min-width: 200px;
}

@media (max-width: 600px) {
  .sheet-header-info { min-width: 0; }
  .sheet-header-actions {
    flex-direction: row;
    flex-wrap: wrap;
    width: 100%;
    min-width: 0;
    gap: .5rem;
  }
  .sheet-header-actions > * {
    flex: 1 1 calc(50% - .25rem);
    min-width: 0;
  }
  .sheet-header-actions .btn { padding: .5rem .75rem; font-size: .85rem; }
  .sheet-header-actions form { display: flex; }
  .sheet-header-actions form .btn { width: 100%; }
}

/* ─── Heatmap row (heatmap + chips side by side) ─────── */

.heatmap-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(220px, 1fr);
  gap: 1.5rem;
  align-items: stretch;
}
@media (max-width: 720px) {
  .heatmap-row {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

/* ─── Top numbers chip list ──────────────────────────── */

.top-numbers-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  align-content: flex-start;
  overflow-y: auto;
}
.top-numbers-chips .chip {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .55rem .2rem .35rem;
  background: var(--cream-deep);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: .85rem;
  line-height: 1.4;
}
.top-numbers-chips .chip .num {
  display: inline-block;
  background: var(--terra);
  color: #fff;
  font-family: 'Bai Jamjuree', sans-serif;
  font-weight: 700;
  font-size: .82rem;
  padding: 1px 7px;
  border-radius: 999px;
  min-width: 28px;
  text-align: center;
}
.top-numbers-chips .chip .count {
  color: var(--muted);
  font-size: .8rem;
}

/* ─── Definition list (info display) ─────────────────────── */

dl.info-list {
  margin: 0;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: .5rem 1rem;
  font-size: .95rem;
}
dl.info-list dt { color: var(--muted); }
dl.info-list dd { margin: 0; color: var(--text); }

/* ─── Responsive: Tablet (≤ 900px) ─────────────────────── */
@media (max-width: 900px) {
  .container { padding: 0 1rem; }
  .card { padding: 1.25rem; }
  .card.tight { padding: 1rem; }

  /* Site header — wrap nav items */
  .site-header .container { flex-wrap: wrap; height: auto; padding-top: .75rem; padding-bottom: .75rem; gap: .5rem; }
  .nav { flex-wrap: wrap; gap: .75rem; }

  /* App tabs scrollable */
  .app-tabs { margin-bottom: 1.25rem; }
  .app-tabs a { padding: .55rem .75rem; font-size: .85rem; }

  /* Heatmap → stack 1 column */
  .heatmap-cell { font-size: .8rem; }

  /* Tables — smaller font + tighter spacing */
  table { font-size: .85rem; }
  th, td { padding-left: .6rem !important; padding-right: .6rem !important; }
}

/* ─── Responsive: Mobile (≤ 600px) ─────────────────────── */
@media (max-width: 600px) {
  body { font-size: 14px; }
  h1 { font-size: 1.4rem; }
  h2 { font-size: 1.15rem; }

  .container { padding: 0 .85rem; }
  .card { padding: 1rem; border-radius: var(--radius); }
  .card.tight { padding: .85rem; }

  /* Forms — stack fields */
  .field-row { flex-direction: column; gap: 0; }
  .field input, .field textarea, .field select { font-size: .92rem; }

  /* Buttons — full width */
  .btn { padding: .55rem 1rem; font-size: .88rem; }

  /* Tables — extra compact */
  table { font-size: .8rem; }
  th, td { padding: .5rem !important; }

  /* Slot grid — fit container ของ card อัตโนมัติ */
  .slot-grid {
    grid-template-columns: repeat(10, 1fr);
    gap: 3px;
  }
  .slot {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    font-size: clamp(.6rem, 2.4vw, .82rem);
    border-width: 1px;
  }

  /* Heatmap — full width grid 10 cols */
  .heatmap { gap: 3px; }
  .heatmap-cell { font-size: .68rem; border-radius: 3px; }

  /* Top numbers chips smaller */
  .top-numbers-chips .chip { font-size: .78rem; padding: .15rem .5rem .15rem .3rem; }
  .top-numbers-chips .chip .num { font-size: .76rem; padding: 1px 6px; min-width: 24px; }

  /* Definition list — keep 2 columns but tighter */
  dl.info-list {
    grid-template-columns: max-content 1fr;
    gap: .35rem .75rem;
    font-size: .88rem;
  }
  dl.info-list dt { font-size: .85rem; margin-top: 0; }
  dl.info-list dd { font-weight: 500; }

  /* Plan cards — single column */
  .plan-card { padding: 1rem; }

  /* TOS content scroll */
  .tos-content { max-height: 300px; padding: .85rem 1rem; }
}

/* ═══════════════════════════════════════════════════════════
   LANDING PAGE
   ═══════════════════════════════════════════════════════════ */

.lp { color: var(--text); }
.lp-section { padding: 4.5rem 0; }
.lp-section-title {
  font-size: 1.85rem;
  font-weight: 700;
  text-align: center;
  margin: 0 0 .4rem;
  letter-spacing: -.01em;
  color: var(--text);
}
.lp-section-sub {
  text-align: center;
  color: var(--muted);
  margin: 0 auto 2.5rem;
  max-width: 560px;
  font-size: 1rem;
  line-height: 1.55;
}

/* ─── HERO ─────────────────────────────────────────── */

.lp-hero {
  padding: 3.5rem 0 4.5rem;
  background:
    radial-gradient(ellipse 800px 400px at 80% 0%, var(--terra-soft), transparent 70%),
    radial-gradient(ellipse 600px 500px at 10% 100%, var(--indigo-soft), transparent 70%),
    var(--bg);
  border-bottom: 1px solid var(--line);
}
.lp-hero-grid {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 3.5rem;
  align-items: center;
}
.lp-eyebrow {
  display: inline-block;
  padding: .35rem .75rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  font-size: .8rem;
  font-weight: 500;
  color: var(--terra);
  margin-bottom: 1.25rem;
}
.lp-h1 {
  font-size: clamp(2rem, 4.5vw, 3rem);
  line-height: 1.15;
  font-weight: 700;
  margin: 0 0 1rem;
  letter-spacing: -.02em;
  color: var(--text);
}
.lp-sub {
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--muted);
  margin: 0 0 1.75rem;
  max-width: 540px;
}
.lp-cta-row {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.lp-cta-primary {
  font-size: 1rem !important;
  padding: .85rem 1.6rem !important;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.lp-cta-secondary {
  font-size: 1rem !important;
  padding: .85rem 1.4rem !important;
}
.lp-hero-note {
  font-size: .85rem;
  color: var(--muted);
  margin: 0;
}

/* HERO MOCKUP */
.lp-hero-mockup {
  position: relative;
  perspective: 1200px;
}
.lp-mockup-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-lg);
  transform: rotate(-1deg);
}
.lp-mockup-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: .85rem;
  border-bottom: 1px solid var(--line);
}
.lp-mockup-title {
  font-weight: 600;
  font-size: .98rem;
  color: var(--text);
}
.lp-mockup-sub {
  font-size: .78rem;
  color: var(--muted);
  margin-top: .15rem;
}
.lp-mockup-badge {
  background: var(--green-soft);
  color: var(--green);
  font-size: .72rem;
  font-weight: 600;
  padding: .25rem .6rem;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
.lp-mockup-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 3px;
  margin-bottom: 1rem;
}
.lp-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: .65rem;
  font-weight: 500;
  color: var(--muted);
}
.lp-cell.taken {
  background: var(--indigo);
  color: #fff;
  border-color: var(--indigo);
}
.lp-cell.hot {
  background: var(--terra);
  color: #fff;
  border-color: var(--terra);
}
.lp-mockup-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .5rem;
  padding-top: .85rem;
  border-top: 1px solid var(--line);
  text-align: center;
}
.lp-mockup-stats-2 { grid-template-columns: repeat(2, 1fr); }
.lp-mockup-stats div {
  display: flex;
  flex-direction: column;
}
.lp-mockup-stats strong {
  font-size: 1.1rem;
  color: var(--text);
}
.lp-mockup-stats span {
  font-size: .72rem;
  color: var(--muted);
  margin-top: .1rem;
}
.lp-floating-badge {
  position: absolute;
  bottom: -.85rem;
  right: -.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: .55rem 1rem;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text);
  box-shadow: var(--shadow);
  transform: rotate(2deg);
}

/* ─── PAIN POINTS ──────────────────────────────────── */

.lp-pain { background: var(--surface); border-bottom: 1px solid var(--line); }
.lp-pain-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}
.lp-pain-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-align: center;
}
.lp-pain-icon {
  font-size: 2rem;
  margin-bottom: .75rem;
  line-height: 1;
}
.lp-pain-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 .5rem;
  color: var(--text);
}
.lp-pain-card p {
  margin: 0;
  font-size: .92rem;
  color: var(--muted);
  line-height: 1.55;
}

/* ─── FEATURES ─────────────────────────────────────── */

.lp-features { background: var(--bg); }
.lp-feat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}
.lp-feat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.5rem;
  transition: transform .15s ease, box-shadow .15s ease;
}
.lp-feat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.lp-feat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 1rem;
}
.lp-feat-card h3 {
  font-size: 1.08rem;
  font-weight: 600;
  margin: 0 0 .5rem;
  color: var(--text);
}
.lp-feat-card p {
  margin: 0;
  font-size: .92rem;
  color: var(--muted);
  line-height: 1.6;
}

/* ─── HOW IT WORKS ─────────────────────────────────── */

.lp-how { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.lp-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  counter-reset: step;
}
.lp-step {
  text-align: center;
  position: relative;
  padding: 0 .5rem;
}
.lp-step-num {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--terra);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1rem;
  box-shadow: 0 4px 12px rgba(201, 98, 46, 0.25);
}
.lp-step h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 .4rem;
  color: var(--text);
}
.lp-step p {
  margin: 0;
  font-size: .9rem;
  color: var(--muted);
  line-height: 1.55;
}

/* ─── PRICING ──────────────────────────────────────── */

.lp-pricing { background: var(--bg); }
.lp-price-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.25rem;
  align-items: stretch;
}
.lp-price-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.5rem;
  display: flex;
  flex-direction: column;
  position: relative;
}
.lp-price-popular {
  border: 2px solid var(--terra);
  box-shadow: 0 8px 24px rgba(201, 98, 46, 0.12);
  transform: translateY(-4px);
}
.lp-price-popular-tag {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--terra);
  color: #fff;
  font-size: .75rem;
  font-weight: 600;
  padding: .25rem .85rem;
  border-radius: var(--radius-pill);
  letter-spacing: .03em;
}
.lp-price-tier {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: .5rem;
  color: var(--text);
}
.lp-price-num {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-bottom: .25rem;
}
.lp-price-meta {
  font-size: .85rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
}
.lp-price-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
  flex: 1;
}
.lp-price-list li {
  font-size: .9rem;
  color: var(--text);
  padding: .35rem 0;
  border-bottom: 1px dashed var(--line-soft);
  position: relative;
  padding-left: 1.4rem;
}
.lp-price-list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--green);
  font-weight: 700;
}
.lp-price-list li:last-child { border-bottom: 0; }
.lp-price-cta {
  width: 100%;
  text-align: center;
  justify-content: center;
}

/* ─── FAQ ──────────────────────────────────────────── */

.lp-faq { background: var(--surface); border-top: 1px solid var(--line); }
.lp-faq-list { display: flex; flex-direction: column; gap: .65rem; }
.lp-faq-item {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  overflow: hidden;
}
.lp-faq-item summary {
  cursor: pointer;
  padding: 1rem 1.25rem;
  font-weight: 500;
  color: var(--text);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.lp-faq-item summary::-webkit-details-marker { display: none; }
.lp-faq-item summary::after {
  content: '+';
  font-size: 1.4rem;
  color: var(--muted);
  font-weight: 400;
  transition: transform .2s;
}
.lp-faq-item[open] summary::after {
  transform: rotate(45deg);
}
.lp-faq-item p {
  margin: 0;
  padding: 0 1.25rem 1.1rem;
  color: var(--muted);
  font-size: .92rem;
  line-height: 1.6;
}

/* ─── FINAL CTA ────────────────────────────────────── */

.lp-final-cta { padding: 3rem 0 5rem; background: var(--bg); }
.lp-final-card {
  background:
    linear-gradient(135deg, var(--indigo) 0%, var(--indigo-deep) 100%);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.lp-final-card h2 {
  font-size: 1.7rem;
  font-weight: 700;
  margin: 0 0 .75rem;
  color: #fff;
  letter-spacing: -.01em;
}
.lp-final-card p {
  margin: 0 0 1.75rem;
  color: rgba(255,255,255,0.85);
  font-size: 1rem;
}

/* ─── RESPONSIVE ───────────────────────────────────── */

@media (max-width: 900px) {
  .lp-hero-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }
  .lp-hero-text { text-align: center; }
  .lp-sub { margin-left: auto; margin-right: auto; }
  .lp-cta-row { justify-content: center; }
  .lp-mockup-card { transform: rotate(0); max-width: 460px; margin: 0 auto; }
  .lp-floating-badge { right: 1rem; }
}

@media (max-width: 600px) {
  .lp-section { padding: 3rem 0; }
  .lp-hero { padding: 2.5rem 0 3.5rem; }
  .lp-section-title { font-size: 1.5rem; }
  .lp-h1 { font-size: 1.85rem; }
  .lp-sub { font-size: 1rem; }
  .lp-cta-primary, .lp-cta-secondary {
    width: 100%;
    text-align: center;
    justify-content: center;
  }
  .lp-cta-row { flex-direction: column; }

  .lp-mockup-card { padding: 1rem; }
  .lp-cell { font-size: .55rem; }
  .lp-floating-badge { font-size: .72rem; padding: .4rem .75rem; }

  .lp-final-card { padding: 2rem 1.25rem; }
  .lp-final-card h2 { font-size: 1.35rem; }

  .lp-price-popular { transform: translateY(0); }
}
