:root {
  --surface: #E7E8DF;
  --paper: #F7F1E5;
  --ink: #172021;
  --muted: #5F6263;
  --panel: #1B2728;
  --accent: #D8AA3E;
  --signal: #D94C35;
  --primary: #8A6A18;
  --line-light: rgba(255, 255, 255, .9);
  --line-dark: rgba(38, 45, 46, .28);
  --radius-lg: 28px;
  --radius-md: 18px;
  --content: 1120px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 12%, rgba(255,255,255,.45), transparent 28rem),
    var(--surface);
  font-family: "Noto Sans Thai", system-ui, sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
button, a { font: inherit; }
img { display: block; max-width: 100%; }
a { color: var(--primary); }
.hidden { display: none !important; }

.loading-screen {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  color: var(--muted);
}
.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(23,32,33,.13);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.site-header {
  width: min(var(--content), calc(100% - 40px));
  min-height: 74px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}
.brand-symbol {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: var(--paper);
  background: var(--panel);
  border-radius: 12px;
  font-size: 1.4rem;
}
.back-symbol { font-size: 1.5rem; line-height: 1; }
.app-nav { position: relative; z-index: 5; }
.version-badge, .catalog-label {
  display: inline-flex;
  width: fit-content;
  padding: 5px 12px;
  color: var(--muted);
  background: rgba(255,255,255,.42);
  border: 1px solid rgba(23,32,33,.1);
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
}

.catalog-hero {
  width: min(900px, calc(100% - 40px));
  margin: 0 auto;
  padding: 96px 0 82px;
  text-align: center;
}
.eyebrow, .section-kicker {
  margin: 0 0 10px;
  color: var(--primary);
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .12em;
}
.catalog-hero h1 {
  margin: 0;
  font-size: clamp(2.35rem, 7vw, 4.8rem);
  line-height: 1.2;
  letter-spacing: -.04em;
}
.catalog-intro {
  max-width: 680px;
  margin: 28px auto 0;
  color: var(--muted);
  font-size: 1.08rem;
}
.catalog-section, .content-section {
  width: min(var(--content), calc(100% - 40px));
  margin: 0 auto;
  padding: 70px 0;
}
.section-heading { margin-bottom: 32px; }
.section-heading h2 {
  margin: 0;
  font-size: clamp(1.65rem, 4vw, 2.35rem);
  line-height: 1.25;
}
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 470px), 1fr));
  gap: 20px;
}
.catalog-card {
  display: grid;
  grid-template-columns: 126px 1fr;
  gap: 26px;
  align-items: center;
  min-height: 220px;
  padding: 28px;
  color: var(--ink);
  text-decoration: none;
  background: rgba(247,241,229,.86);
  border: 1px solid var(--line-dark);
  border-top-color: var(--line-light);
  border-left-color: var(--line-light);
  border-radius: var(--radius-lg);
  transition: transform .2s ease, background .2s ease;
}
.catalog-card:hover { transform: translateY(-3px); background: var(--paper); }
.catalog-icon { width: 126px; aspect-ratio: 1; border-radius: 28%; }
.catalog-card h3 { margin: 10px 0 6px; font-size: 1.65rem; }
.catalog-card p { margin: 0 0 14px; color: var(--muted); }
.catalog-action { color: var(--primary); font-weight: 700; }

.app-hero {
  position: relative;
  width: min(var(--content), calc(100% - 40px));
  min-height: 550px;
  margin: 18px auto 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: 70px 24px;
  color: var(--paper);
  background:
    linear-gradient(140deg, rgba(255,255,255,.04), transparent 35%),
    var(--panel);
  border: 1px solid rgba(255,255,255,.28);
  border-right-color: rgba(0,0,0,.4);
  border-bottom-color: rgba(0,0,0,.4);
  border-radius: 36px;
}
.app-hero-content {
  position: relative;
  z-index: 2;
  max-width: 700px;
  display: grid;
  justify-items: center;
  text-align: center;
}
.app-icon {
  width: 124px;
  height: 124px;
  margin-bottom: 28px;
  border-radius: 29%;
  box-shadow: 0 16px 40px rgba(0,0,0,.25);
}
.app-hero .eyebrow { color: var(--accent); }
.app-hero h1 {
  margin: 0;
  font-size: clamp(2.5rem, 8vw, 5rem);
  line-height: 1.12;
  letter-spacing: -.04em;
}
.app-tagline {
  max-width: 620px;
  margin: 20px 0 32px;
  color: rgba(247,241,229,.78);
  font-size: clamp(1rem, 2.3vw, 1.22rem);
}
.hero-orbit {
  position: absolute;
  border: 1px solid rgba(216,170,62,.25);
  border-radius: 50%;
}
.orbit-one { width: 480px; height: 480px; right: -185px; top: -230px; }
.orbit-two { width: 360px; height: 360px; left: -130px; bottom: -210px; }
.hero-orbit::before, .hero-orbit::after {
  content: "";
  position: absolute;
  inset: 18%;
  border: inherit;
  border-radius: inherit;
}
.hero-orbit::after { inset: 38%; }

.store-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.store-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 11px 18px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid rgba(255,255,255,.8);
  border-right-color: rgba(0,0,0,.25);
  border-bottom-color: rgba(0,0,0,.25);
  border-radius: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: transform .2s ease, filter .2s ease;
}
.store-btn:hover { transform: translateY(-2px); filter: brightness(1.04); }
.store-note {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 16px;
  color: rgba(247,241,229,.76);
  border: 1px solid rgba(247,241,229,.25);
  border-radius: 14px;
  font-size: .9rem;
  font-weight: 600;
}
.store-btn svg, .store-note svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.store-btn svg path[d^="m5 3"], .store-btn svg path[d^="M16.5"] { fill: currentColor; stroke: none; }
.store-note svg path[d^="m5 3"] { fill: currentColor; stroke: none; }

.features-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.feature-card {
  position: relative;
  min-height: 230px;
  padding: 24px;
  background: rgba(247,241,229,.72);
  border: 1px solid var(--line-dark);
  border-top-color: var(--line-light);
  border-left-color: var(--line-light);
  border-radius: var(--radius-md);
}
.feature-number {
  position: absolute;
  top: 18px;
  right: 20px;
  color: rgba(23,32,33,.3);
  font-size: .75rem;
  font-weight: 700;
}
.feature-icon {
  width: 44px;
  height: 44px;
  margin-bottom: 28px;
  display: grid;
  place-items: center;
  color: var(--primary);
  background: rgba(216,170,62,.14);
  border-radius: 13px;
}
.feature-icon svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.feature-card h3 { margin: 0 0 8px; font-size: 1.05rem; }
.feature-card p { margin: 0; color: var(--muted); font-size: .9rem; }

.screenshots-section {
  width: 100%;
  padding-inline: max(20px, calc((100% - var(--content)) / 2));
  background: rgba(255,255,255,.2);
  border-block: 1px solid rgba(255,255,255,.42);
}
.screenshots-section .section-heading { width: min(var(--content), 100%); }
.screenshots-gallery {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  padding: 4px 2px 22px;
  scroll-snap-type: x mandatory;
  scrollbar-color: var(--accent) transparent;
}
.screenshot-card {
  flex: 0 0 310px;
  margin: 0;
  scroll-snap-align: start;
}
.screenshot-button {
  width: 100%;
  padding: 0;
  overflow: hidden;
  display: block;
  cursor: zoom-in;
  background: #fff;
  border: 1px solid var(--line-dark);
  border-top-color: var(--line-light);
  border-left-color: var(--line-light);
  border-radius: 28px;
}
.screenshot-button img { width: 100%; aspect-ratio: 9 / 20; object-fit: cover; }
.screenshot-card figcaption {
  min-height: 58px;
  padding: 14px 6px 0;
  color: var(--muted);
  font-size: .88rem;
}

.about-shell, .policy-section {
  max-width: 820px;
  margin: 0 auto;
  padding: 40px clamp(22px, 5vw, 64px);
  background: rgba(247,241,229,.74);
  border: 1px solid var(--line-dark);
  border-top-color: var(--line-light);
  border-left-color: var(--line-light);
  border-radius: var(--radius-lg);
}
.rich-content h1, .rich-content h2, .rich-content h3 {
  margin: 1.5em 0 .5em;
  line-height: 1.3;
}
.rich-content h1:first-child, .rich-content h2:first-child, .rich-content h3:first-child { margin-top: 0; }
.rich-content h2 { font-size: 1.55rem; }
.rich-content h3 { font-size: 1.16rem; }
.rich-content p { margin: 0 0 1em; color: var(--muted); }
.rich-content ul { margin: 0 0 1.25em; padding-left: 1.35em; }
.rich-content li { margin-bottom: .55em; color: var(--muted); }
.rich-content strong { color: var(--ink); }

.policy-hero {
  width: min(820px, calc(100% - 40px));
  margin: 50px auto 34px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.policy-app-icon { width: 86px; height: 86px; border-radius: 25%; }
.policy-hero h1 { margin: 0; font-size: clamp(2rem, 5vw, 3rem); line-height: 1.25; }
.policy-hero .eyebrow { margin-bottom: 4px; }
.last-updated { margin: 7px 0 0; color: var(--muted); font-size: .88rem; }
.policy-section { width: min(820px, calc(100% - 40px)); }

.footer {
  padding: 42px 20px;
  color: var(--muted);
  text-align: center;
  font-size: .86rem;
}
.footer a { color: inherit; text-underline-offset: 3px; }
.footer span[aria-hidden] { padding-inline: 5px; }

.screenshot-dialog {
  width: min(920px, calc(100% - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  color: var(--paper);
  background: var(--panel);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 24px;
}
.screenshot-dialog::backdrop { background: rgba(18,22,22,.82); backdrop-filter: blur(5px); }
.screenshot-dialog figure { margin: 0; padding: 34px 24px 24px; display: grid; justify-items: center; }
.screenshot-dialog img { max-height: calc(100vh - 130px); border-radius: 16px; }
.screenshot-dialog figcaption { margin-top: 14px; color: rgba(247,241,229,.75); }
.dialog-close {
  position: absolute;
  z-index: 2;
  top: 9px;
  right: 12px;
  width: 38px;
  height: 38px;
  color: var(--paper);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 1.8rem;
}

.error-screen { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.error-card {
  width: min(480px, 100%);
  padding: 40px;
  text-align: center;
  background: var(--paper);
  border: 1px solid var(--line-dark);
  border-top-color: var(--line-light);
  border-left-color: var(--line-light);
  border-radius: var(--radius-lg);
}
.error-symbol {
  width: 44px;
  height: 44px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--signal);
  border-radius: 50%;
  font-weight: 700;
}
.error-card h2 { margin: 0; }
.error-card p { margin: 10px 0 24px; color: var(--muted); }
.empty-state { color: var(--muted); }

@media (max-width: 900px) {
  .features-grid { grid-template-columns: repeat(2, 1fr); }
  .app-hero { min-height: 500px; }
}

@media (max-width: 600px) {
  .site-header { width: calc(100% - 28px); min-height: 64px; }
  .catalog-hero { padding: 64px 0 54px; }
  .catalog-section, .content-section { width: calc(100% - 28px); padding: 48px 0; }
  .catalog-card { grid-template-columns: 82px 1fr; gap: 18px; min-height: 170px; padding: 20px; }
  .catalog-icon { width: 82px; border-radius: 24%; }
  .catalog-card h3 { font-size: 1.3rem; }
  .catalog-card p { font-size: .88rem; }
  .app-hero {
    width: calc(100% - 28px);
    min-height: 480px;
    margin-top: 8px;
    padding: 54px 18px;
    border-radius: 28px;
  }
  .app-icon { width: 104px; height: 104px; }
  .features-grid { grid-template-columns: 1fr; }
  .feature-card { min-height: 190px; }
  .screenshots-section { width: 100%; padding-inline: 14px; }
  .screenshot-card { flex-basis: min(76vw, 300px); }
  .about-shell { padding: 30px 22px; }
  .policy-hero { width: calc(100% - 32px); margin-top: 32px; align-items: flex-start; }
  .policy-app-icon { width: 68px; height: 68px; }
  .policy-section { width: calc(100% - 28px); padding: 30px 22px; }
  .version-badge { font-size: .7rem; padding-inline: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
