/* styles.css — หน้าเว็บหลัก Dummy Online
   ค่าสี/ขนาดทั้งหมดอยู่ใน :root ตาม DESIGN.md — ส่วนอื่นใช้ชื่อตัวแปรเท่านั้น
   ลำดับ: tokens → พื้นฐาน → กรอบ (frame/plate/divider) → ปุ่มเริ่มเกม → แถบเมนู → hero + SSR → ตัวละคร
          → ข่าว → วิธีเล่น → เกม → อัปเดต → ปิดท้าย → ท้ายเว็บ → จอเล็ก → ลดการเคลื่อนไหว */

:root {
  --ink-950: #0f0d18;
  --ink-900: #17142a;
  --ink-800: #221e38;
  --ink-700: #352f52;
  --text: #f4eee3;
  --text-muted: #b8afc8;
  --gold-200: #ffe9a8;
  --gold-400: #f0c35a;
  --gold-600: #c8922c;
  --gold-800: #8a5a12;
  --gold-ink: #2b1a03;
  --sakura-300: #f5b3c6;
  --sakura-500: #e07a98;
  --sky-300: #8fd8ff;
  --violet-400: #a77bff;
  --ok: #7fd1a0;
  --err: #ff8a8a;
  --paper: #fbf6ec;
  --paper-ink: #2a2433;
  --paper-muted: #5b5168;
  --card-red: #c0344f;

  --font-display: 'Mali', 'Sarabun', sans-serif;
  --font-body: 'Sarabun', system-ui, sans-serif;

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

  --r-tag: 8px;
  --r-card: 14px;
  --r-pill: 999px;
  --shadow-card: 0 10px 30px -12px rgb(0 0 0 / 0.6);

  --content: 1160px;
  --topbar-h: 68px;

  /* กรอบหน้าต่างครีม (window-frame.webp 1493×755 · ค่าตัดเดียวกับในเกม Code/Theme/sakura-kit.css) */
  --wf-u: 0.19px;
}

/* ===== พื้นฐาน ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* clip (ไม่ใช่ hidden) — กันของตกแต่งที่ยื่นออกนอกจอทำให้เลื่อนซ้ายขวาได้ โดยไม่ทำให้แถบเมนู sticky พัง */
html {
  overflow-x: clip;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-h) + var(--s-4));
}

body {
  margin: 0;
  background: var(--ink-950);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

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

h1,
h2,
h3 {
  font-family: var(--font-display);
  line-height: 1.25;
  margin: 0;
}

h2 {
  font-size: 2rem;
}

h3 {
  font-size: 1.125rem;
}

p {
  margin: 0;
}

a {
  color: var(--sakura-300);
  text-decoration: none;
}

a:hover {
  color: var(--sakura-500);
  text-decoration: underline;
}

:focus-visible {
  outline: 3px solid var(--sakura-300);
  outline-offset: 3px;
  border-radius: 6px;
}

.wrap {
  width: min(var(--content), 100% - 2 * var(--s-5));
  margin-inline: auto;
}

.nowrap {
  white-space: nowrap;
}

.muted {
  color: var(--text-muted);
}

.skip {
  position: absolute;
  left: var(--s-4);
  top: -100px;
  z-index: 100;
  padding: var(--s-2) var(--s-4);
  background: var(--gold-400);
  color: var(--gold-ink);
  border-radius: var(--r-tag);
  font-weight: 800;
}

.skip:focus {
  top: var(--s-4);
}

svg {
  width: 1.25em;
  height: 1.25em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ===== กรอบ ===== */

/* กรอบหน้าต่างครีม 9 ส่วน — มุมและดอกไม้ไม่ยืด · outset ดันกรอบออกนอกกล่องให้เส้นทองตรงขอบกล่อง (แบบเดียวกับในเกม) */
.frame {
  position: relative;
  color: var(--paper-ink);
  border: 0 solid transparent;
  border-image-source: url(/assets/window-frame.webp);
  border-image-slice: 235 401 375 546 fill;
  border-image-width: calc(235 * var(--wf-u)) calc(401 * var(--wf-u)) calc(375 * var(--wf-u)) calc(546 * var(--wf-u));
  border-image-outset: calc(26 * var(--wf-u)) calc(22 * var(--wf-u)) calc(67 * var(--wf-u)) calc(78 * var(--wf-u));
  border-image-repeat: stretch;
  filter: drop-shadow(0 12px 22px rgb(0 0 0 / 0.45));
  /* ดอกซากุระมุมซ้ายล่างกินพื้นที่เข้ามาด้านใน — เว้นล่างกับซ้ายมากกว่าด้านอื่น */
  padding: var(--s-6) var(--s-6) var(--s-8) calc(var(--s-6) + 8px);
}

.frame .muted,
.frame p {
  color: var(--paper-muted);
}

/* ป้ายหัวข้อส่วน: แผ่นสีน้ำเงินมีช่อซากุระด้านขวา ยืดตามความยาวคำ */
.plate {
  display: inline-block;
  color: #fff;
  font-size: 1.75rem;
  text-shadow: 0 2px 6px rgb(0 0 0 / 0.5);
  border: 0 solid transparent;
  /* รูป 889×262: ตัวแผ่นอยู่ช่วง y 54–237 (ด้านบนเป็นช่อดอกไม้ยื่นออกมา) จึงเว้นบนมากกว่าล่าง */
  border-image: url(/assets/title-plate.webp) 90 250 60 60 fill / 35px 98px 24px 24px stretch;
  padding: 24px 112px 14px 36px;
  line-height: 1.25;
  white-space: nowrap; /* ห้ามตัดบรรทัด — ป้ายจะถูกยืดแนวตั้งจนเพี้ยน */
}

/* เส้นคั่นทองมีดาวสองข้าง */
.divider {
  position: relative;
  height: 24px;
  width: min(760px, 86%);
  margin: var(--s-7) auto;
  background: linear-gradient(90deg, transparent, var(--gold-600) 12%, var(--gold-400) 50%, var(--gold-600) 88%, transparent) center / 100% 2px no-repeat;
}

.divider::before,
.divider::after {
  content: '';
  position: absolute;
  top: 0;
  width: 24px;
  height: 24px;
  background: var(--gold-400);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
}

.divider::before {
  left: 10%;
}

.divider::after {
  right: 10%;
}

/* ===== ปุ่มเริ่มเกม =====
   ชั้น: วงแสงหมุนรอบขอบ (เลียนแบบ animated border highlight) → หน้าปุ่มทอง → แสงวิ่งผ่าน → ดอกซากุระหมุน → ประกายดาว */
@property --spin {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}

.start {
  --spin: 0deg;
  position: relative;
  display: inline-flex;
  padding: 3px;
  border-radius: var(--r-pill);
  text-decoration: none;
  isolation: isolate;
  background: conic-gradient(from var(--spin), var(--gold-200), var(--sakura-300), var(--violet-400), var(--sky-300), var(--gold-400), var(--gold-200));
  box-shadow:
    0 0 0 1px rgb(255 233 168 / 0.25),
    0 0 26px 2px rgb(240 195 90 / 0.45),
    0 0 60px 6px rgb(224 122 152 / 0.25);
  animation:
    start-spin 3.6s linear infinite,
    start-glow 2.4s ease-in-out infinite;
  transition: transform 0.18s ease;
}

.start:hover {
  text-decoration: none;
  transform: translateY(-2px) scale(1.03);
}

.start:active {
  transform: translateY(1px) scale(0.99);
}

.start__face {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  overflow: hidden;
  border-radius: var(--r-pill);
  color: var(--gold-ink);
  background:
    radial-gradient(120% 90% at 50% 0%, rgb(255 255 255 / 0.55), transparent 55%),
    linear-gradient(180deg, var(--gold-200) 0%, var(--gold-400) 46%, var(--gold-600) 100%);
  box-shadow:
    inset 0 2px 0 rgb(255 255 255 / 0.7),
    inset 0 -5px 0 var(--gold-800);
}

/* แสงวิ่งเฉียงผ่านหน้าปุ่ม */
.start__face::after {
  content: '';
  position: absolute;
  top: -20%;
  bottom: -20%;
  left: -40%;
  width: 34%;
  transform: skewX(-22deg);
  background: linear-gradient(90deg, transparent, rgb(255 255 255 / 0.75), transparent);
  animation: start-shine 3.2s ease-in-out infinite;
}

.start__flower {
  flex: none;
  filter: drop-shadow(0 2px 4px rgb(138 90 18 / 0.5));
  animation: start-flower 14s linear infinite;
}

.start__text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  white-space: nowrap;
}

.start__text b {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.start__text small {
  margin-top: 4px;
  font-weight: 600;
  color: rgb(43 26 3 / 0.75);
}

.start__spark {
  position: absolute;
  z-index: 2;
  width: 18px;
  pointer-events: none;
  animation: start-twinkle 2.2s ease-in-out infinite;
}

.start__spark--a {
  top: -14px;
  right: 18%;
}

.start__spark--b {
  bottom: -12px;
  right: 6%;
  width: 13px;
  animation-delay: 0.7s;
}

.start__spark--c {
  top: 18%;
  left: -12px;
  width: 14px;
  animation-delay: 1.4s;
}

.start--lg .start__face {
  padding: 14px 40px 16px 16px;
}

.start--lg .start__flower {
  width: 52px;
}

.start--lg .start__text b {
  font-size: 1.75rem;
}

.start--lg .start__text small {
  font-size: 0.8125rem;
}

.start--sm {
  padding: 2px;
}

.start--sm .start__face {
  padding: 6px 20px 8px 8px;
  gap: var(--s-2);
}

.start--sm .start__flower {
  width: 28px;
}

.start--sm .start__text b {
  font-size: 1.0625rem;
}

@keyframes start-spin {
  to {
    --spin: 360deg;
  }
}

@keyframes start-glow {
  50% {
    box-shadow:
      0 0 0 1px rgb(255 233 168 / 0.4),
      0 0 38px 6px rgb(240 195 90 / 0.6),
      0 0 80px 12px rgb(224 122 152 / 0.32);
  }
}

@keyframes start-shine {
  0%,
  55% {
    left: -40%;
  }
  100% {
    left: 130%;
  }
}

@keyframes start-flower {
  to {
    transform: rotate(360deg);
  }
}

@keyframes start-twinkle {
  0%,
  100% {
    opacity: 0;
    transform: scale(0.4) rotate(0deg);
  }
  50% {
    opacity: 1;
    transform: scale(1) rotate(25deg);
  }
}

/* ปุ่มรอง */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-pill);
  font-family: var(--font-display);
  font-weight: 700;
  white-space: nowrap;
}

.btn:hover {
  text-decoration: none;
}

.btn--ghost {
  padding: 14px 28px;
  font-size: 1.125rem;
  color: var(--text);
  border: 1.5px solid rgb(245 179 198 / 0.4);
  background: rgb(15 13 24 / 0.45);
}

.btn--ghost:hover {
  color: var(--text);
  border-color: var(--sakura-300);
}

/* ===== แถบเมนู ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-h);
  background: rgb(23 20 42 / 0.94);
  border-bottom: 1px solid var(--ink-700);
}

.topbar__in {
  height: 100%;
  display: flex;
  align-items: center;
  gap: var(--s-6);
}

.topbar__brand img {
  height: 52px;
  width: auto;
}

.topbar__nav {
  display: flex;
  gap: var(--s-5);
  margin-right: auto;
}

.topbar__nav a {
  color: var(--text-muted);
  font-weight: 600;
}

.topbar__nav a:hover {
  color: var(--text);
  text-decoration: none;
}

/* ===== ส่วนหัว (hero) ===== */
.hero {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.hero__bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  background: url(/assets/hero.webp) center 40% / cover no-repeat;
}

/* ไล่มืดจากซ้ายและล่าง ให้ตัวหนังสืออ่านออก · ด้านขวาสว่างไว้ให้ซากุยะเด่น */
.hero__bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgb(15 13 24 / 0.94) 0%, rgb(15 13 24 / 0.72) 38%, rgb(15 13 24 / 0.15) 70%),
    linear-gradient(0deg, var(--ink-950) 0%, transparent 28%);
}

.hero__in {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  align-items: end;
  gap: var(--s-5);
  min-height: min(90vh, 860px);
}

.hero__copy {
  align-self: center;
  padding-block: var(--s-8);
}

.hero__logo {
  width: clamp(200px, 26vw, 340px);
  margin-left: calc(-1 * var(--s-3));
  filter: drop-shadow(0 8px 24px rgb(0 0 0 / 0.5));
}

.hero__title {
  margin-top: var(--s-4);
  font-size: clamp(2rem, 4vw, 3.1rem);
  text-shadow: 0 3px 14px rgb(0 0 0 / 0.6);
}

.hero__lead {
  margin-top: var(--s-4);
  max-width: 50ch;
  font-size: 1.125rem;
  color: var(--text-muted);
}

.hero__cta {
  margin-top: var(--s-7);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-5);
}

.hero__meta {
  margin-top: var(--s-5);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3);
  font-size: 0.875rem;
}

.pill {
  display: inline-block;
  padding: var(--s-1) var(--s-3);
  border-radius: var(--r-pill);
  border: 1px solid rgb(245 179 198 / 0.45);
  color: var(--sakura-300);
  background: rgb(15 13 24 / 0.55);
  font-weight: 600;
}

.hero__ver {
  color: var(--text-muted);
}

/* ซากุยะ SSR: วงแสงด้านหลัง + ตัวละครเต็มตัว + ป้ายชื่อมงกุฎ */
.ssr {
  position: relative;
  margin: 0;
  height: min(86vh, 820px);
  display: flex;
  justify-content: center;
  align-items: flex-end;
}

/* ภาพรวม (ฉาก + วงแหวน + ซากุยะ + กลีบ) ไม่มีพื้นโปร่งใส — จางขอบซ้าย/ขวา/บนด้วย mask ให้กลืนกับพื้นหลัง hero */
.ssr__scene {
  height: 100%;
  width: auto;
  max-width: none;
  -webkit-mask-image:
    linear-gradient(90deg, transparent 0%, #000 22%, #000 80%, transparent 100%),
    linear-gradient(180deg, transparent 0%, #000 14%);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(90deg, transparent 0%, #000 22%, #000 80%, transparent 100%),
    linear-gradient(180deg, transparent 0%, #000 14%);
  mask-composite: intersect;
}

.ssr__plate {
  position: absolute;
  bottom: 7%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  white-space: nowrap;
  border: 0 solid transparent;
  /* รูป 682×128: ตัวแถบอยู่ช่วง y 45–126 ตรามงกุฎยื่นขึ้นด้านบน */
  border-image: url(/assets/crown-bar.webp) 60 80 40 130 fill / 41px 55px 28px 90px stretch;
  padding: 34px 60px 10px 100px;
  color: #fff;
  text-shadow: 0 2px 4px rgb(0 0 0 / 0.6);
}

.ssr__rank {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--gold-200);
  letter-spacing: 0.06em;
}

.ssr__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.375rem;
}

.ssr__name small {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--sakura-300);
  margin-left: var(--s-1);
}

/* กลีบซากุระปลิว (รูปจริง) — main.js สร้างใส่ .petals */
.petals {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.petal {
  position: absolute;
  top: -40px;
  width: 22px;
  opacity: 0.85;
  animation: petal-fall linear infinite;
}

@keyframes petal-fall {
  to {
    transform: translate(var(--drift, -120px), 110vh) rotate(540deg);
  }
}

/* ===== ส่วนทั่วไป ===== */
.section {
  position: relative;
  padding-block: var(--s-9);
}

.section--alt {
  background: var(--ink-900);
}

.section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3) var(--s-5);
  margin-bottom: var(--s-7);
}

.branch {
  position: absolute;
  pointer-events: none;
  opacity: 0.9;
}

.branch--right {
  top: -40px;
  right: -60px;
  width: min(440px, 46vw);
}

/* ===== ตัวละคร ===== */
.spotlight {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr);
  align-items: center;
  gap: var(--s-7);
  padding: var(--s-7);
  border-radius: 24px;
  overflow: hidden;
  isolation: isolate;
}

.spotlight__stage {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgb(15 13 24 / 0.15), rgb(15 13 24 / 0.55)),
    url(/assets/sakuya-stage.webp) center / cover;
  box-shadow: inset 0 0 0 2px rgb(240 195 90 / 0.5), inset 0 0 80px rgb(0 0 0 / 0.6);
  border-radius: inherit;
}

.spotlight__card {
  width: 100%;
  max-width: 380px;
  justify-self: center;
  border-radius: 18px;
  filter: drop-shadow(0 0 22px rgb(240 195 90 / 0.55)) drop-shadow(0 20px 30px rgb(0 0 0 / 0.6));
  transform: rotate(-2deg);
}

.spotlight__info {
  max-width: 520px;
}

.frame .spotlight__rank {
  font-weight: 800;
  color: var(--gold-800);
  letter-spacing: 0.02em;
}

.spotlight__info h3 {
  font-size: 2.6rem;
  color: var(--paper-ink);
}

.frame .spotlight__title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--sakura-500);
}

.skill {
  margin-top: var(--s-5);
  padding: var(--s-4);
  border-radius: var(--r-card);
  background: rgb(240 195 90 / 0.14);
  border: 1px solid rgb(200 146 44 / 0.35);
}

.skill__label {
  display: inline-block;
  margin-right: var(--s-2);
  padding: 0 var(--s-2);
  border-radius: var(--r-tag);
  background: var(--gold-600);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 800;
}

.skill b {
  font-family: var(--font-display);
  font-size: 1.125rem;
}

.skill p {
  margin-top: var(--s-2);
}

.frame .spotlight__how {
  margin-top: var(--s-4);
  font-weight: 700;
  color: var(--paper-ink);
}

.cast {
  list-style: none;
  margin: var(--s-8) 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-6);
}

.cast__item {
  text-align: center;
}

/* รูปหน้าในวงแหวนรวมเป็นไฟล์เดียวแล้ว (tools/compose-art.py) พื้นสีเดียวกับหน้าเว็บ */
.cast__img {
  width: min(240px, 100%);
  margin: 0 auto;
  transition: transform 0.4s ease;
}

.cast__item:hover .cast__img {
  transform: scale(1.04);
}

.cast__rank {
  display: inline-block;
  margin-top: var(--s-2);
  padding: 0 var(--s-3);
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--violet-400), var(--sakura-500));
  color: #fff;
  font-weight: 800;
  font-size: 0.8125rem;
}

.cast__item h3 {
  margin-top: var(--s-2);
  font-size: 1.5rem;
}

.cast__item p {
  margin-top: var(--s-1);
  color: var(--text-muted);
  font-size: 0.9375rem;
  max-width: 30ch;
  margin-inline: auto;
}

.cast__item b {
  color: var(--text);
}

.cast__more {
  margin-top: var(--s-6);
  text-align: center;
}

/* ===== ข่าวสาร ===== */
.news {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: var(--s-7);
  align-items: start;
}

.news__feature {
  padding: 6px 6px var(--s-8);
}

.news__feature img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 10px 10px 0 0;
}

.news__body {
  padding: var(--s-4) var(--s-5) 0 var(--s-6);
}

.news__body h3 {
  margin-top: var(--s-2);
  font-size: 1.375rem;
}

.news__body p {
  margin-top: var(--s-2);
}

.news__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--s-5);
}

/* รายการข่าวบนพื้นมืด ประดับมุมซากุระซ้ายบน + มุมทองขวาล่าง */
.news__item {
  position: relative;
  padding: var(--s-5) var(--s-5) var(--s-5) var(--s-6);
  border-radius: var(--r-card);
  background: var(--ink-800);
  border: 1px solid var(--ink-700);
}

.news__item::before,
.news__item::after {
  content: '';
  position: absolute;
  width: 64px;
  height: 56px;
  background: url(/assets/corner.webp) top left / contain no-repeat;
  pointer-events: none;
}

.news__item::before {
  top: -10px;
  left: -10px;
}

.news__item::after {
  right: -10px;
  bottom: -10px;
  transform: rotate(180deg);
  opacity: 0.6;
}

.news__item h3 {
  margin-top: var(--s-1);
}

.news__item p {
  margin-top: var(--s-1);
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.news__meta {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  font-size: 0.875rem;
  color: var(--text-muted);
}

.frame .news__meta {
  color: var(--paper-muted);
}

.tag {
  padding: 2px var(--s-2);
  border-radius: var(--r-tag);
  background: rgb(224 122 152 / 0.18);
  color: var(--sakura-500);
  font-weight: 700;
}

/* ===== วิธีเข้าเล่น ===== */
.how {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: var(--s-8);
  align-items: start;
}

.steps {
  list-style: none;
  margin: var(--s-7) 0 0;
  padding: 0;
}

/* เส้นต่อระหว่างเลขขั้นตอน ทำให้อ่านเป็นลำดับ ไม่ใช่การ์ดแยกกัน */
.step {
  position: relative;
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: var(--s-4);
  padding-bottom: var(--s-6);
}

.step:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 27px;
  top: 56px;
  bottom: 4px;
  width: 2px;
  background: linear-gradient(var(--gold-600), var(--ink-700));
}

.step__no {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid var(--gold-400);
  background: radial-gradient(circle at 50% 35%, #3a2f63, var(--ink-900));
  box-shadow: 0 0 18px rgb(240 195 90 / 0.3);
  color: var(--gold-400);
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
}

.step h3 {
  font-size: 1.375rem;
  margin-top: var(--s-2);
}

.step p {
  margin-top: var(--s-1);
  color: var(--text-muted);
  max-width: 52ch;
}

.step strong {
  color: var(--text);
}

.tips {
  margin-top: var(--s-7);
}

.tips h3 {
  font-size: 1.375rem;
}

.tips ul {
  list-style: none;
  margin: var(--s-4) 0 0;
  padding: 0;
  display: grid;
  gap: var(--s-4);
}

.tips li {
  display: flex;
  gap: var(--s-3);
  color: var(--paper-muted);
  font-size: 0.9375rem;
}

.tips li svg {
  margin-top: 3px;
  color: var(--sakura-500);
}

.tips strong {
  color: var(--paper-ink);
}

/* ===== เกมในนี้: ไพ่ 5 ใบ ===== */
.hand {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--s-4);
}

.pcard {
  position: relative;
  min-height: 250px;
  padding: var(--s-7) var(--s-4) var(--s-5);
  background:
    url(/assets/corner.webp) right -14px bottom -14px / 70px auto no-repeat,
    var(--paper);
  color: var(--paper-ink);
  border-radius: var(--r-card);
  border: 2px solid #e8d3a6;
  box-shadow: var(--shadow-card);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

/* เอียงสลับเล็กน้อยให้ดูเป็นไพ่ในมือ */
.pcard:nth-child(odd) {
  transform: rotate(-1.2deg);
}

.pcard:nth-child(even) {
  transform: rotate(1.2deg) translateY(6px);
}

.pcard:hover {
  transform: translateY(-8px) rotate(0);
  box-shadow: 0 0 0 2px var(--gold-400), 0 18px 34px -12px rgb(0 0 0 / 0.7);
}

.pcard__idx {
  position: absolute;
  top: var(--s-3);
  left: var(--s-3);
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1;
}

.pcard__idx i {
  font-style: normal;
  font-size: 1.125rem;
}

.pcard--red .pcard__idx {
  color: var(--card-red);
}

.pcard h3 {
  font-size: 1.375rem;
  padding-left: var(--s-5);
}

.pcard p {
  margin-top: var(--s-3);
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--paper-muted);
}

/* ===== อัปเดตล่าสุด ===== */
.updates {
  display: grid;
  gap: var(--s-4);
}

/* ให้รายการหดตามจอได้ (ค่าเริ่มต้นของ grid ไม่ยอมหดให้เล็กกว่าข้อความบรรทัดเดียว) */
.update {
  min-width: 0;
}

/* แถบหัวแพตช์: แผ่นน้ำเงินเรืองแสง ดอกซากุระสองข้าง */
.update summary {
  list-style: none;
  cursor: pointer;
  /* แถบต้องสูงคงที่บรรทัดเดียว — ถ้าข้อความตัดหลายบรรทัด รูปกรอบจะถูกยืดแนวตั้งจนดอกไม้ปลายแถบเพี้ยน */
  display: flex;
  align-items: center;
  gap: var(--s-4);
  height: 66px;
  white-space: nowrap;
  border: 0 solid transparent;
  border-image: url(/assets/panel-bar.webp) 60 150 60 150 fill / 30px 64px 30px 64px stretch;
  padding: 0 76px 0 72px;
}

.update__title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* จอเล็กหัวแถบมีแค่เลขเวอร์ชัน + ชื่อย่อ — ชื่อเต็มกับวันที่ย้ายมาบรรทัดแรกของเนื้อหา */
.update__full {
  display: none;
  color: var(--text);
  font-weight: 600;
}

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

.update summary::after {
  content: '+';
  margin-left: auto;
  color: var(--gold-400);
  font-size: 1.5rem;
  line-height: 1;
}

.update[open] summary::after {
  content: '−';
}

.update__ver {
  flex: none;
  font-family: var(--font-display);
  color: var(--gold-400);
  font-weight: 700;
}

.update__title {
  font-weight: 600;
}

.update__date {
  flex: none;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.update__body {
  margin: var(--s-2) var(--s-6) 0;
  padding: var(--s-4) var(--s-5) var(--s-5);
  border-left: 2px solid var(--ink-700);
  color: var(--text-muted);
}

.update__body h4 {
  margin: var(--s-3) 0 var(--s-1);
  color: var(--text);
  font-size: 1rem;
}

.update__body ul {
  margin: 0;
  padding-left: 1.2em;
  max-width: 75ch;
}

.update__body li + li {
  margin-top: var(--s-1);
}

/* ===== ปิดท้าย ===== */
.closing {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  padding-block: var(--s-9);
  background:
    radial-gradient(ellipse at 70% 60%, rgb(167 123 255 / 0.25), transparent 60%),
    linear-gradient(90deg, var(--ink-950) 0%, rgb(15 13 24 / 0.82) 40%, rgb(15 13 24 / 0) 70%),
    url(/assets/closing-scene.webp) right top / cover;
}

.closing__in {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s-4);
}

.closing h2 {
  font-size: 2.5rem;
  text-shadow: 0 3px 14px rgb(0 0 0 / 0.6);
}

.closing .start {
  margin-top: var(--s-4);
}

/* ===== ท้ายเว็บ ===== */
.footer {
  position: relative;
  border-top: 1px solid var(--ink-700);
  padding-block: var(--s-7);
  font-size: 0.875rem;
}

.branch--footer {
  top: -50px;
  left: -40px;
  width: 300px;
  opacity: 0.8;
}

.footer__in {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-4) var(--s-6);
}

.footer__in > img {
  height: 44px;
  width: auto;
}

.footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-4);
  margin-right: auto;
}

.footer nav a {
  color: var(--text-muted);
}

.state-error {
  color: var(--err);
}

/* ===== จอกลาง ===== */
@media (max-width: 1080px) {
  .topbar__nav {
    gap: var(--s-4);
  }

  .spotlight {
    padding: var(--s-6);
    gap: var(--s-6);
  }
}

@media (max-width: 960px) {
  .news,
  .how {
    grid-template-columns: 1fr;
  }

  .how {
    gap: var(--s-4);
  }

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

  .hand .pcard:last-child {
    grid-column: span 2;
  }

  /* 2 คอลัมน์ ไพ่กว้างขึ้น ข้อความสั้นลง — ไม่ต้องสูงเท่าไพ่ 5 ใบบนจอใหญ่ */
  .pcard {
    min-height: 0;
  }

  .topbar__nav {
    display: none;
  }

  .topbar__in {
    justify-content: space-between;
  }
}

/* ===== จอเล็ก: ซากุยะขึ้นก่อน ตามด้วยหัวข้อและปุ่ม ===== */
@media (max-width: 860px) {
  .hero__in {
    grid-template-columns: 1fr;
    min-height: 0;
    gap: 0;
  }

  .ssr {
    order: -1;
    height: min(46vh, 520px);
    margin-top: var(--s-4);
  }

  .ssr__plate {
    bottom: 4%;
  }

  .hero__copy {
    padding-block: var(--s-5) var(--s-8);
  }

  .hero__logo {
    display: none;
  }

  .hero__bg {
    background-image: url(/assets/hero-sm.webp);
    background-position: 60% center;
  }

  .hero__bg::after {
    background: linear-gradient(0deg, var(--ink-950) 0%, rgb(15 13 24 / 0.82) 45%, rgb(15 13 24 / 0.2) 100%);
  }

  .spotlight {
    grid-template-columns: 1fr;
    padding: var(--s-5) var(--s-4) var(--s-7);
  }

  .spotlight__card {
    max-width: 260px;
  }

  .spotlight__info {
    max-width: none;
  }

}

@media (max-width: 720px) {
  :root {
    --topbar-h: 58px;
    --wf-u: 0.15px;
  }

  .topbar__brand img {
    height: 42px;
  }

  .hero__cta {
    margin-top: var(--s-6);
  }

  .hero__cta .start,
  .hero__cta .btn {
    flex: 1 1 100%;
  }

  .start--lg .start__face {
    flex: 1;
    justify-content: center;
    padding-right: 32px;
  }

  h2 {
    font-size: 1.75rem;
  }

  .plate {
    font-size: 1.5rem;
  }

  .section,
  .closing {
    padding-block: var(--s-8);
  }

  .cast {
    grid-template-columns: 1fr;
    gap: var(--s-5);
  }

  /* มือถือ: รูปวงกลมซ้าย ข้อความขวา ไม่ให้ยาวลงไปเป็นสามจอ */
  .cast__item {
    display: grid;
    grid-template-columns: 128px 1fr;
    grid-template-rows: auto auto 1fr;
    column-gap: var(--s-4);
    text-align: left;
    align-items: start;
  }

  .cast__img {
    grid-row: 1 / 4;
    width: 128px;
  }

  .cast__rank {
    justify-self: start;
  }

  .cast__item h3 {
    margin-top: 0;
  }

  .cast__item p {
    margin-inline: 0;
  }

  .hand {
    grid-template-columns: 1fr;
  }

  .hand .pcard:last-child {
    grid-column: auto;
  }

  .pcard {
    padding: var(--s-4) var(--s-4) var(--s-4) 64px;
  }

  .pcard:nth-child(n) {
    transform: none;
  }

  .pcard h3 {
    padding-left: 0;
  }

  .pcard p {
    margin-top: var(--s-1);
  }

  .update summary {
    height: 54px;
    gap: var(--s-3);
    border-image-width: 24px 48px 24px 48px;
    padding: 0 54px 0 50px;
  }

  .update__date {
    display: none;
  }

  .update__full {
    display: block;
  }

  .update__body {
    margin-inline: var(--s-3);
  }

  .closing h2 {
    font-size: 2rem;
  }

  .closing__in .start {
    width: 100%;
  }
}

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

  .petals,
  .start__spark,
  .start__face::after {
    display: none;
  }

  .start,
  .start__flower {
    animation: none;
  }

  .start,
  .pcard,
  .cast__img {
    transition: none;
  }
}

/* เบราว์เซอร์เก่าที่ไม่รู้จัก overflow: clip (Safari ก่อน 16) */
@supports not (overflow: clip) {
  html,
  body {
    overflow-x: hidden;
  }
}
