@font-face {
  font-family: "MyEnglish";
  src: url("/fonts/LexendDeca-VariableFont_wght.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-007F, U+00A0-024F;
}

@font-face {
  font-family: "MyThai";
  src: url("/fonts/SukhumvitSet-Text.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-display: "MyEnglish", "MyThai", sans-serif;
  --font-body: "MyEnglish", "MyThai", sans-serif;
  --brick: #9a4d1b;
  --brick-dark: #5b2c14;
  --gold: #d6a845;
  --gold-soft: #e7c56d;
  --cream: #f3e6d0;
  --paper: #fff8ee;
  --ink: #2c1810;
  --muted: rgba(44, 24, 16, .72);
  --line: rgba(91, 44, 20, .16);
  --shadow: 0 24px 70px rgba(91, 44, 20, .14);
  --shadow-floor: 0 22px 28px rgba(53, 20, 8, .28);
  --shadow-paper: 0 22px 46px rgba(91, 44, 20, .16), 0 1px 0 rgba(255, 255, 255, .7) inset;
  --shadow-stamp: 0 10px 16px rgba(61, 18, 8, .32);

  --color-primary: var(--brick);
  --color-on-primary: #fffaf2;
  --color-accent: var(--gold);
  --color-background: var(--cream);
  --color-foreground: var(--ink);
  --color-card: var(--paper);
  --color-ring: var(--brick);
  --color-success: #176d3b;
  --color-success-bg: #eaf8ef;
  --color-error: #b2291f;
  --color-error-bg: #fff0ef;
  --color-line: #06c755;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --radius-xl: 36px;
  --radius-pill: 999px;

  --header-h: 76px;
  --shadow-sm: 0 8px 18px rgba(91, 44, 20, .1);
  --shadow-md: 0 16px 36px rgba(91, 44, 20, .14);
  --ease-out: cubic-bezier(.22, .72, .28, 1);
  --ease-spring: cubic-bezier(.18, .89, .32, 1.28);
  --duration-fast: 160ms;
  --duration: 240ms;
  --z-header: 40;
  --z-modal: 80;
  --z-particle: 1000;
}

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

html {
  scroll-padding-top: calc(var(--header-h) + 12px);
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100dvh;
  max-width: 100%;
  overflow-x: hidden;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background:
    radial-gradient(ellipse 72% 46% at 50% -10%, rgba(214, 168, 69, .42), transparent 62%),
    radial-gradient(ellipse 80% 28% at 50% 108%, rgba(91, 44, 20, .12), transparent 70%),
    var(--cream);
  touch-action: manipulation;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .16;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 180 180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
}

.site-header,
main,
.site-footer {
  position: relative;
  z-index: 1;
}

a { color: inherit; }

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

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  background: var(--brick-dark);
  color: var(--paper);
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

.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;
}

.icon {
  width: 1.15em;
  height: 1.15em;
  display: block;
  flex-shrink: 0;
}

.site-header {
  min-height: var(--header-h);
  width: 100%;
  max-width: 100%;
  padding: 12px clamp(18px, 4vw, 56px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  flex-wrap: nowrap;
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  backdrop-filter: blur(8px);
  background: rgba(243, 230, 208, .92);
  border-bottom: 1px solid var(--line);
}

.site-header .brand {
  flex: 0 0 auto;
}

.site-header nav {
  flex: 0 1 auto;
  min-width: 0;
  flex-wrap: nowrap;
}

.site-header.is-admin {
  flex-wrap: wrap;
}

.site-header.is-admin nav {
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  min-height: 44px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 25%, rgba(214, 168, 69, .95), transparent 42%),
    linear-gradient(160deg, var(--brick), var(--brick-dark));
  color: var(--gold);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  border: 1.5px solid rgba(214, 168, 69, .9);
  box-shadow:
    inset 0 1px 0 rgba(255, 236, 190, .45),
    inset 0 -8px 12px rgba(61, 22, 8, .28),
    0 8px 14px rgba(91, 44, 20, .22);
}

.brand-copy {
  display: grid;
  line-height: 1.15;
}

.brand-text {
  font-family: var(--font-display);
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 700;
  color: var(--brick-dark);
  letter-spacing: .01em;
  white-space: nowrap;
}

.brand-tagline {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.nav-link {
  font: inherit;
  border: 0;
  background: transparent;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
  color: var(--brick-dark);
  min-height: 44px;
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
}

.nav-link:hover,
.nav-link.is-active {
  background: rgba(154, 77, 27, .08);
}

.nav-link.is-active {
  box-shadow: inset 0 0 0 1px rgba(154, 77, 27, .16);
}

.line-button {
  padding: 8px 14px;
  min-height: 44px;
  border-radius: var(--radius-pill);
  background: rgba(255, 248, 238, .72);
  color: var(--brick-dark);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 800;
  white-space: nowrap;
  border: 1px solid rgba(91, 44, 20, .16);
  box-shadow: var(--shadow-sm);
}

.line-button .icon {
  color: var(--color-line);
  width: 1.25em;
  height: 1.25em;
}

.inline { display: inline; }

.hero-shell {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  width: 100%;
  padding: 28px 18px 12px;
  position: relative;
  overflow: visible;
}

.hero-ornament {
  position: absolute;
  width: 168px;
  height: 64px;
  pointer-events: none;
  border: 1.5px solid rgba(154, 77, 27, .16);
  border-radius: 80px;
  box-shadow:
    0 18px 0 -8px rgba(154, 77, 27, .08),
    28px 10px 0 -10px rgba(214, 168, 69, .2);
  opacity: .8;
}

.hero-ornament-left { left: -36px; top: 72px; transform: rotate(-8deg); }
.hero-ornament-right { right: -28px; bottom: 120px; transform: rotate(12deg); }

.hero-stage {
  width: 100%;
  max-width: 760px;
  min-width: 0;
  text-align: center;
  position: relative;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--brick);
  font-weight: 700;
  letter-spacing: .08em;
  font-size: 13px;
}

h1, h2, .admin-title h1 {
  font-family: var(--font-display);
  font-weight: 700;
  text-wrap: balance;
}

h1 {
  font-size: clamp(34px, 6vw, 60px);
  line-height: 1.22;
  margin: 0 0 12px;
  color: var(--brick-dark);
}

.subtitle {
  width: 100%;
  max-width: 640px;
  margin: 0 auto 28px;
  font-size: 18px;
  color: var(--muted);
  line-height: 1.75;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.ritual-steps {
  list-style: none;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
  margin: 0 auto 4px;
  padding: 0;
  width: 100%;
  max-width: 640px;
}

.ritual-steps li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0;
  color: rgba(44, 24, 16, .42);
  font-size: 13px;
  font-weight: 700;
  justify-content: center;
}

.ritual-steps li:not(:last-child)::after {
  content: "";
  width: 28px;
  height: 1px;
  margin: 0 10px;
  background: rgba(214, 168, 69, .85);
}

.ritual-steps li.is-current,
.ritual-steps li.is-done {
  color: var(--brick-dark);
}

.ritual-steps span {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--paper);
  color: var(--brick);
  font-size: 12px;
  border: 1.5px solid rgba(214, 168, 69, .9);
  box-shadow: 0 4px 8px rgba(91, 44, 20, .12);
}

.ritual-steps li.is-current span {
  background: linear-gradient(160deg, var(--gold-soft), #b8862f);
  color: #3d2416;
  border-color: #f3dd9a;
}

.ritual-steps li.is-done span {
  background: var(--brick);
  color: var(--paper);
  border-color: var(--brick-dark);
}

.primary-cta, .secondary-cta, .download-btn {
  border: 0;
  border-radius: var(--radius-pill);
  padding: 14px 26px;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 17px;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  transition: transform var(--duration) var(--ease-out), box-shadow var(--duration), opacity var(--duration-fast), background var(--duration);
}

.primary-cta {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(135deg, var(--brick), var(--brick-dark));
  color: var(--color-on-primary);
  box-shadow: 0 16px 30px rgba(91, 44, 20, .24);
}

#randomBtn::before {
  content: "";
  position: absolute;
  inset: -60%;
  background: conic-gradient(from 0deg, transparent, rgba(255, 226, 150, .28), transparent 40%);
  animation: buttonAura 8s linear infinite;
  z-index: -1;
}

.secondary-cta, .download-btn {
  background: transparent;
  color: var(--brick-dark);
  box-shadow: inset 0 0 0 1.5px rgba(91, 44, 20, .28);
}

.journal .primary-cta {
  width: 100%;
}

.cta-hint {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.primary-cta:hover, .secondary-cta:hover, .download-btn:hover,
.line-button:hover, .like-btn:hover, .approve:hover, .reject:hover {
  transform: translateY(-1px);
}

.primary-cta:active, .secondary-cta:active, .download-btn:active {
  transform: translateY(0) scale(.98);
}

.primary-cta:disabled { opacity: .72; cursor: wait; }

.btn-ripple {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  pointer-events: none;
  background: rgba(255, 241, 188, .65);
  transform: translate(-50%, -50%) scale(0);
  animation: rippleExpand .75s ease-out forwards;
}

.modal-open {
  overflow: hidden;
}

.fortune-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: grid;
  place-items: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .36s cubic-bezier(.22, 1, .36, 1), visibility .36s;
}

.fortune-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.fortune-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(53, 32, 20, .42);
  backdrop-filter: blur(12px);
  opacity: 0;
  transition: opacity .36s cubic-bezier(.22, 1, .36, 1);
}

.fortune-modal.is-open .fortune-modal-backdrop {
  opacity: 1;
}

.fortune-modal-panel {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: min(90dvh, 760px);
  overflow: visible;
  padding: 28px 20px 24px;
  border-radius: var(--radius-xl);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, .92), rgba(255, 235, 198, .88)),
    var(--paper);
  border: 1px solid rgba(214, 168, 69, .42);
  box-shadow: 0 28px 80px rgba(53, 32, 20, .28);
  text-align: center;
  outline: none;
  opacity: 0;
  transform: translate3d(0, 18px, 0) scale(.96);
  transition: opacity .42s cubic-bezier(.22, 1, .36, 1), transform .42s cubic-bezier(.22, 1, .36, 1);
}

.fortune-modal.is-open .fortune-modal-panel {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
}

.fortune-modal-stage {
  position: relative;
  min-height: 248px;
}

.fortune-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 246, 232, .9);
  color: var(--brick-dark);
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 1px var(--line);
}

.fortune-modal-close:hover {
  background: var(--cream);
}

.altar {
  position: relative;
  width: min(560px, 100%);
  height: 300px;
  margin: 4px auto 8px;
}

.altar-tray {
  position: absolute;
  left: 50%;
  bottom: 28px;
  width: min(300px, 78%);
  height: 42px;
  border-radius: 50%;
  transform: translateX(-50%);
  background:
    radial-gradient(ellipse at 50% 38%, #a56b3c 0%, #6d3a1c 58%, #4a2412 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 220, 160, .28),
    inset 0 -8px 12px rgba(40, 14, 6, .35),
    var(--shadow-floor);
  z-index: 0;
}

.jiaobei-stage {
  width: 100%;
  max-width: none;
  height: 100%;
  margin: 0;
  position: absolute;
  inset: 0;
  opacity: 1;
  overflow: visible;
  pointer-events: none;
  transform: none;
  transition: opacity .48s cubic-bezier(.22, 1, .36, 1), transform .48s cubic-bezier(.22, 1, .36, 1);
  perspective: 900px;
  z-index: 1;
}

.altar.has-result .jiaobei-stage {
  transform: translateY(28px) scale(.86);
  opacity: .9;
}

.jiaobei-stage.casting,
.jiaobei-stage.settled,
.fortune-modal.is-casting .jiaobei-stage {
  opacity: 1;
  transform: none;
}

.altar.has-result .jiaobei-stage.settled {
  transform: translateY(28px) scale(.86);
  opacity: .9;
}

.fortune-modal.has-result .jiaobei-stage {
  opacity: 0;
  transform: scale(.96);
}

.jiaobei-floor-shadow {
  position: absolute;
  left: 50%;
  bottom: 22px;
  width: 220px;
  height: 22px;
  border-radius: 50%;
  background: rgba(40, 14, 6, .35);
  filter: blur(8px);
  transform: translateX(-50%) scale(1);
  opacity: .7;
  z-index: 1;
}

.jiaobei {
  position: absolute;
  left: 50%;
  top: 15px;
  width: 148px;
  height: 148px;
  z-index: 2;
  transform-style: preserve-3d;
  will-change: transform;
  filter: drop-shadow(0 14px 8px rgba(74, 31, 11, .28));
}

.jiaobei img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.jiaobei-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 2px;
  margin: 0;
  color: var(--brick-dark);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .08em;
  opacity: 0;
}

.jiaobei-stage.casting .jiaobei-convex,
.jiaobei-stage.casting .jiaobei-flat,
.jiaobei-stage.casting .jiaobei-floor-shadow {
  animation: none;
}

.jiaobei-stage.casting .jiaobei-caption {
  animation: captionIn .45s .16s ease forwards;
}

.jiaobei-stage.settled .jiaobei-convex {
  transform: translate3d(-145px, 88px, 0) rotateZ(655deg) rotateY(732deg) rotateX(364deg) scale(.88);
}

.jiaobei-stage.settled .jiaobei-flat {
  transform: translate3d(-3px, 88px, 0) rotateZ(-669deg) rotateY(720deg) rotateX(-363deg) scale(.88);
}

.jiaobei-stage.settled .jiaobei-floor-shadow,
.jiaobei-stage.is-resting .jiaobei-floor-shadow {
  opacity: .78;
  transform: translateX(-50%) scale(1);
}

.jiaobei-stage.is-resting .jiaobei-convex {
  animation: restConvex 3.8s ease-in-out infinite;
}

.jiaobei-stage.is-resting .jiaobei-flat {
  animation: restFlat 3.8s ease-in-out infinite;
}

.fortune-modal .fortune-card {
  margin: 0;
  max-width: none;
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 12px 8px 8px;
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translate3d(0, 14px, 0) scale(.97);
  transition: opacity .5s cubic-bezier(.22, 1, .36, 1), transform .5s cubic-bezier(.22, 1, .36, 1), visibility .5s;
}

.fortune-modal .fortune-card.revealed {
  opacity: 1;
  visibility: visible;
  transform: translate3d(0, 0, 0) scale(1);
}

.fortune-card {
  width: min(400px, 92%);
  max-width: 400px;
  margin: 0;
  padding: 18px 22px 14px;
  border-radius: 18px 22px 16px 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .55), transparent 26%),
    repeating-linear-gradient(0deg, transparent, transparent 27px, rgba(154, 77, 27, .035) 28px),
    var(--paper);
  border: 1px solid rgba(184, 134, 47, .55);
  box-shadow:
    var(--shadow-paper),
    inset 0 0 0 7px rgba(255, 248, 238, .95),
    inset 0 0 0 8px rgba(214, 168, 69, .38);
  transform-origin: center top;
  position: absolute;
  left: 50%;
  top: 6px;
  z-index: 3;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(-50%) translateY(18px) rotate(-1.4deg) scale(.97);
  transition: opacity .5s cubic-bezier(.22, 1, .36, 1), transform .5s cubic-bezier(.22, 1, .36, 1), visibility .5s;
}

.fortune-card::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: linear-gradient(120deg, transparent, rgba(214, 168, 69, .55), transparent, rgba(154, 77, 27, .28), transparent);
  transform: translateX(-120%);
  opacity: 0;
  pointer-events: none;
}

.fortune-card.summoning { animation: cardSummon .95s ease-in-out infinite alternate; }
.fortune-card.summoning .seal { animation: sealSpin .95s ease-in-out infinite; }
.fortune-card.summoning h2 { animation: slotBlur .15s linear infinite alternate; }
.fortune-card.gold-flash::before { opacity: 1; animation: goldSweep 1.15s ease-out forwards; }

.fortune-card.gold-flash {
  box-shadow:
    0 0 28px rgba(214, 168, 69, .35),
    var(--shadow-paper),
    inset 0 0 0 7px rgba(255, 248, 238, .95),
    inset 0 0 0 8px rgba(214, 168, 69, .38);
}

.fortune-card.revealed {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0) rotate(-1.4deg) scale(1);
}

.fortune-card.revealed h2 { animation: textPop .6s cubic-bezier(.22, 1, .36, 1); }

.fortune-card-inline.is-hidden {
  display: none;
}

.fortune-card-inline.is-visible {
  animation: savedCardIn .45s cubic-bezier(.22, 1, .36, 1) both;
}

.seal {
  width: 54px;
  height: 54px;
  margin: 0 auto 8px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #f6e2a8;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 226, 160, .7), transparent 34%),
    radial-gradient(circle at 50% 58%, #b4231c, #7a140f 72%);
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  border: 2px solid rgba(232, 196, 110, .9);
  box-shadow:
    inset 0 2px 0 rgba(255, 236, 190, .45),
    inset 0 -8px 12px rgba(60, 10, 6, .4),
    var(--shadow-stamp);
  text-shadow: 0 1px 0 rgba(90, 16, 8, .45);
}
.seal.seal-image {
  width: 70px;
  height: 70px;
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.seal-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}


.fortune-kicker,
.fortune-card p { margin: 0 0 8px; color: var(--muted); font-weight: 600; }
.fortune-card h2 { margin: 0 0 8px; font-size: clamp(24px, 4vw, 36px); color: var(--brick-dark); line-height: 1.4; }
.fortune-from { display: block; color: var(--brick); font-weight: 700; }

.like-btn {
  margin-top: 8px;
  border: 0;
  background: transparent;
  border-radius: var(--radius-pill);
  padding: 8px 12px;
  min-height: 44px;
  font: inherit;
  font-weight: 700;
  color: var(--brick);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.like-btn[aria-pressed="true"] {
  color: #9a2a22;
}

.like-btn[aria-pressed="true"] .icon path {
  fill: currentColor;
}

.like-btn:disabled {
  opacity: .5;
  cursor: default;
}

.like-btn.liked-pop { animation: likePop .45s var(--ease-spring); }

.particle-layer {
  position: fixed;
  inset: 0;
  z-index: var(--z-particle);
  pointer-events: none;
  overflow: hidden;
}

.particle {
  position: absolute;
  color: var(--gold);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(18px, 3vw, 32px);
  text-shadow: 0 2px 8px rgba(91, 44, 20, .18), 0 0 18px rgba(214, 168, 69, .5);
  transform: translate(-50%, -50%);
  animation: particleBurst 1.45s cubic-bezier(.16, .84, .29, 1) forwards;
}

.toast {
  width: 100%;
  max-width: 680px;
  margin: 24px auto 0;
  padding: 14px 18px;
  border-radius: 18px;
  font-weight: 700;
  text-align: left;
}

.toast.success {
  background: var(--color-success-bg);
  color: var(--color-success);
  border: 1px solid rgba(23, 109, 59, .16);
}

.toast.error {
  background: var(--color-error-bg);
  color: var(--color-error);
  border: 1px solid rgba(178, 41, 31, .16);
}

.stats-row {
  width: 100%;
  max-width: 980px;
  margin: -20px auto 60px;
  padding: 0 18px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  position: relative;
  z-index: 2;
}

.stats-row div, .admin-stats .stat-card, .admin-stats > div {
  background: rgba(255, 255, 255, .82);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.stats-row strong, .admin-stats strong {
  display: block;
  font-family: var(--font-display);
  font-size: 34px;
  color: var(--brick);
  line-height: 1.1;
}

.stats-row span, .admin-stats span {
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}

.submit-section {
  width: 100%;
  max-width: 640px;
  margin: 60px auto 72px;
  padding: 0 18px;
  display: block;
}

.section-copy, .admin-card {
  background: rgba(255, 248, 238, .92);
  border: 1px solid var(--line);
  border-radius: 30px;
  padding: 30px;
  box-shadow: var(--shadow-paper);
}

.section-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.section-copy h2, .admin-card h2 {
  margin: 0 0 12px;
  color: var(--brick-dark);
  font-size: clamp(26px, 3vw, 34px);
}

.section-copy p {
  color: var(--muted);
  line-height: 1.8;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.copy-notes {
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.copy-notes li {
  padding-left: 28px;
  position: relative;
  color: var(--brick-dark);
  font-weight: 600;
}

.copy-notes li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .45em;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 4px rgba(214, 168, 69, .18);
}

.glass-form {
  display: grid;
  gap: 18px;
  background: rgba(255, 248, 238, .94);
  border: 1px solid rgba(184, 134, 47, .35);
  border-radius: 28px;
  padding: 32px 28px 28px;
  box-shadow: var(--shadow-paper);
}

.journal-head h2 {
  margin: 0 0 8px;
  color: var(--brick-dark);
  font-size: clamp(26px, 3vw, 34px);
}

.journal-head p:last-child {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.form-help {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.6;
}

.glass-form.small,
.admin-card .glass-form {
  padding: 0;
  box-shadow: none;
  border: 0;
  background: transparent;
}

label {
  display: grid;
  gap: 8px;
  text-align: left;
  font-weight: 700;
}

.label-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

label span, .label-row span { color: var(--brick-dark); }

.char-count {
  color: var(--muted) !important;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

input, textarea, select {
  width: 100%;
  border: 1px solid rgba(91, 44, 20, .16);
  border-radius: 14px;
  background: #fffdf8;
  padding: 14px 16px;
  min-height: 48px;
  font: inherit;
  color: var(--ink);
  transition: border-color var(--duration), box-shadow var(--duration);
}

input:focus-visible, textarea:focus-visible, select:focus-visible {
  border-color: rgba(184, 134, 47, .8);
  box-shadow: 0 0 0 4px rgba(214, 168, 69, .22);
}

textarea { resize: vertical; min-height: 120px; }
.csv-box { min-height: 360px; font-family: ui-monospace, Consolas, monospace; }

input:hover, textarea:hover, select:hover {
  border-color: rgba(154, 77, 27, .28);
}

.admin-auth {
  min-height: calc(100dvh - var(--header-h));
  display: grid;
  place-items: center;
  padding: 36px 18px;
}

.auth-card {
  width: 100%;
  max-width: 520px;
}

.auth-card .primary-cta {
  width: 100%;
}

.auth-lead { margin-top: 0; }

.admin-wrap {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 46px 18px 80px;
}

.admin-title h1 {
  margin-top: 0;
  font-size: clamp(34px, 5vw, 52px);
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}

.stat-card em {
  display: block;
  margin-top: 8px;
  font-style: normal;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 24px;
  align-items: start;
}

.admin-grid.two {
  grid-template-columns: 1fr 1fr;
  margin-bottom: 24px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
}

.card-header h2 { margin: 0; }
.card-header a { color: var(--brick); font-weight: 800; }
.muted { color: var(--muted); }

.empty-state {
  margin: 8px 0 18px;
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 246, 232, .8);
  border: 1px dashed var(--line);
  color: var(--muted);
  text-align: center;
}

.list {
  display: grid;
  gap: 12px;
}

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 20px;
  padding: 16px;
}

.list-item strong {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
}

.list-item p { margin: 6px 0 0; color: var(--muted); }

.lang-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: var(--radius-pill);
  background: rgba(154, 77, 27, .1);
  color: var(--brick-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.approve, .reject, .search-form button, .weight-form button {
  border: 0;
  border-radius: var(--radius-pill);
  padding: 10px 14px;
  min-height: 44px;
  color: white;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.approve { background: #13884b; }
.reject { background: #b2291f; }

.search-form { display: flex; gap: 8px; flex-wrap: wrap; }
.search-form input { min-width: 220px; }
.search-form button, .weight-form button { background: var(--brick); }

.export-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th, td {
  padding: 13px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--brick-dark);
  font-family: var(--font-display);
}

.weight-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.weight-form input {
  width: 76px;
  min-height: 44px;
  padding: 8px 10px;
}

pre {
  white-space: pre-wrap;
  overflow-x: auto;
  overflow-wrap: anywhere;
  background: #2b1a11;
  color: #ffe6bd;
  padding: 16px;
  border-radius: 18px;
}

.site-footer {
  border-top: 0;
  background: #3d2416;
  color: #f6ead6;
  padding: 28px clamp(18px, 4vw, 56px);
}

.footer-inner {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-brand strong {
  font-family: var(--font-display);
  color: #f6ead6;
}

.footer-brand p {
  margin: 2px 0 0;
  color: rgba(246, 234, 214, .72);
  font-size: 14px;
}

.footer-line {
  color: var(--gold-soft);
  font-weight: 800;
  text-decoration: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.language-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: rgba(255, 248, 238, .78);
  margin: 0;
}

.language-switch a {
  text-decoration: none;
  font-weight: 800;
  padding: 9px 16px;
  min-height: 40px;
  min-width: 72px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  color: var(--brick-dark);
}

.language-switch a.active {
  background: var(--brick);
  color: white;
}

.search-form select {
  width: auto;
  min-width: 110px;
}

.download-btn {
  margin: 4px 6px 4px 0;
}

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

@keyframes buttonAura { to { transform: rotate(360deg); } }
@keyframes rippleExpand { to { transform: translate(-50%, -50%) scale(18); opacity: 0; } }
@keyframes cardSummon {
  from { transform: translateY(0) rotate(-.6deg) scale(.995); box-shadow: 0 18px 50px rgba(91,44,20,.12); }
  to { transform: translateY(-6px) rotate(.6deg) scale(1.01); box-shadow: 0 26px 70px rgba(214,168,69,.28); }
}
@keyframes sealSpin {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(12deg) scale(1.08); }
  100% { transform: rotate(-12deg) scale(1); }
}
@keyframes slotBlur {
  from { filter: blur(0); transform: translateY(0); }
  to { filter: blur(1.5px); transform: translateY(-1px); }
}
@keyframes goldSweep {
  0% { transform: translateX(-120%); opacity: 0; }
  25% { opacity: .7; }
  100% { transform: translateX(120%); opacity: 0; }
}
@keyframes textPop {
  0% { transform: translate3d(0, 10px, 0); opacity: 0; }
  100% { transform: translate3d(0, 0, 0); opacity: 1; }
}
@keyframes particleBurst {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.4) rotate(0deg); }
  12% { opacity: 1; }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(var(--scale)) rotate(var(--rot));
  }
}
@keyframes likePop {
  0% { transform: scale(1); }
  55% { transform: scale(1.12); }
  100% { transform: scale(1); }
}
@keyframes frameGlow {
  0%, 100% { opacity: .25; }
  50% { opacity: .8; }
}

@keyframes restConvex {
  0%, 100% { transform: translate3d(-102px, 86px, 0) rotateZ(-22deg) scale(.92); }
  50% { transform: translate3d(-102px, 76px, 0) rotateZ(-16deg) scale(.92); }
}

@keyframes restFlat {
  0%, 100% { transform: translate3d(16px, 98px, 0) rotateZ(18deg) scale(.92); }
  50% { transform: translate3d(16px, 88px, 0) rotateZ(12deg) scale(.92); }
}

@keyframes captionIn { to { opacity: .72; } }
@keyframes savedCardIn {
  from { opacity: 0; transform: translate3d(0, 12px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}
@keyframes modalFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

  .jiaobei-stage.casting .jiaobei,
  .jiaobei-stage.casting .jiaobei-floor-shadow,
  .jiaobei-stage.casting .jiaobei-caption {
    animation-duration: .01ms;
    animation-delay: 0s;
  }

  #randomBtn::before,
  .fortune-modal-backdrop,
  .fortune-modal-panel,
  .jiaobei-stage.is-resting .jiaobei-convex,
  .jiaobei-stage.is-resting .jiaobei-flat {
    animation: none;
  }

  .jiaobei-stage.is-resting .jiaobei-convex {
    transform: translate3d(-102px, 86px, 0) rotateZ(-22deg) scale(.92);
  }

  .jiaobei-stage.is-resting .jiaobei-flat {
    transform: translate3d(16px, 98px, 0) rotateZ(18deg) scale(.92);
  }
}

@media (max-width: 860px) {
  .site-header {
    align-items: center;
    gap: 10px;
    padding-inline: 16px;
  }

  .brand-tagline { display: none; }
  .brand { gap: 8px; min-width: 0; }
  .brand-text {
    font-size: 22px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  nav { justify-content: flex-end; font-size: 14px; }

  .line-button span { display: none; }
  .line-button { padding: 10px; width: 44px; justify-content: center; }

  .stats-row, .submit-section, .admin-stats, .admin-grid, .admin-grid.two {
    grid-template-columns: 1fr;
  }

  .hero-shell {
    min-height: auto;
    padding-top: 28px;
  }

  .altar {
    height: 280px;
  }

  .subtitle {
    font-size: 16px;
    max-width: 20rem;
  }

  .section-copy p,
  .copy-notes {
    max-width: 20rem;
  }

  .card-header { align-items: stretch; flex-direction: column; }
  .search-form { flex-direction: column; }
  .search-form input, .search-form select { min-width: 0; width: 100%; }
  .list-item { align-items: flex-start; flex-direction: column; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
  .ritual-steps { gap: 8px; }
}

@media (max-width: 520px) {
  .ritual-steps {
    flex-direction: column;
    align-items: flex-start;
    width: max-content;
    gap: 8px;
  }
  .ritual-steps li {
    position: relative;
    justify-content: flex-start;
  }
  .ritual-steps li:not(:last-child)::after {
    width: 1px;
    height: 12px;
    margin: 0;
    position: absolute;
    left: 12px;
    top: 30px;
  }
  .language-switch { gap: 2px; padding: 3px; }
  .language-switch a { min-width: 44px; padding: 8px 10px; }
  .brand-mark { width: 40px; height: 40px; font-size: 18px; }
  .brand-text { font-size: 20px; }
}

@media (max-width: 480px) {
  h1 { font-size: clamp(30px, 11vw, 42px); }
  .subtitle { font-size: 16px; }
}
/* ป้องกัน overflow เดิมทำให้ sticky ไม่เกาะหน้าจอ */
html,
body {
  overflow-x: clip;
}

.site-header {
  position: sticky;
  top: 0;
  transition: transform 0.2s ease;
}

.site-header.header-hidden {
  transform: translateY(-100%);
}

/* ให้เมนูแสดงเมื่อใช้งานด้วยคีย์บอร์ด */
.site-header:focus-within {
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .site-header {
    transition: none;
  }
}

.brand-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex-shrink: 0;
  transform: scale(1.5);
  transform-origin: center;
}

button,
input,
textarea,
select {
  font-family: var(--font-body);
}

.csv-box {
  min-height: 360px;
  font-family: var(--font-body);
}

.footer-inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 32px;
}

.footer-about {
  max-width: 340px;
  margin: 0 auto;
  text-align: center;
  font-size: 14px;
  line-height: 1.8;
  color: rgba(246, 234, 214, .8);
}

.footer-about a {
  color: var(--gold-soft);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.footer-about a:hover {
  color: #fff;
}

.footer-socials {
  max-width: 220px;
  justify-content: flex-end;
}

@media (max-width: 860px) {
  .footer-inner {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 24px;
  }

  .footer-socials {
    max-width: none;
    justify-content: center;
  }
}

.submit-status {
  min-height: 3.6em;
  margin-top: 12px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.submit-status.is-success {
  color: var(--color-success);
}

.submit-status.is-error {
  color: var(--color-error);
}