/* งาน 121: หน้าแนะนำเกม — กรอบไม้ ปุ่ม และกระดาษชุดเดียวกับในเกม (src/ui/htmlTheme.ts) · มือถือก่อน */

/* ฟอนต์ Kanit (SIL OFL 1.1) ไฟล์เดียวกับในเกม — ไม่ส่งคำขอไป Google Fonts */
@font-face { font-family: Kanit; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/kanit-400-thai.woff2") format("woff2"); unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: Kanit; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/kanit-400-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: Kanit; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/kanit-400-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Kanit; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/kanit-600-thai.woff2") format("woff2"); unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: Kanit; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/kanit-600-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: Kanit; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/kanit-600-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* สีเดียวกับ HTML_COLORS ในเกม */
:root {
  --ground: #16221b;
  --ground-2: #1d2c22;
  --wood: #2a1e18;
  --card: #3e2a1e;
  --rim: #93562a;
  --text: #f6ead0;
  --muted: #d4bd99;
  --gold: #ffd66b;
  --ink: #3b2618;
  --cream: #fff4dc;
  --green: #5d7d2f;
  --paper: #e8d5ae;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--text);
  font: 16px/1.7 Kanit, "Leelawadee UI", Tahoma, sans-serif;
  padding: 0 env(safe-area-inset-right, 0) 0 env(safe-area-inset-left, 0);
}
img { max-width: 100%; height: auto; }
a { color: var(--gold); text-underline-offset: 3px; }
a:hover { color: var(--cream); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
h1, h2, h3 { line-height: 1.3; }

.skip { position: absolute; left: 8px; top: -60px; z-index: 10; padding: 8px 14px; background: var(--wood); border: 2px solid var(--gold); border-radius: 6px; }
.skip:focus { top: 8px; }

/* ---- ปุ่มไม้ (button.png / button-wood.png ขยายแบบพิกเซล) ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 14px 2px;
  border-style: solid; border-width: 10px 12px; border-color: #3d5a1e; background: var(--green); background-clip: padding-box;
  border-image: url("img/button.png") 10 12 fill / 10px 12px / 0 stretch; image-rendering: pixelated;
  color: var(--cream); font-weight: 600; text-decoration: none; text-align: center; line-height: 1.25;
  text-shadow: 0 2px 0 #2a1b12, 1px 0 0 #2a1b12, -1px 0 0 #2a1b12, 0 -1px 0 #2a1b12;
}
.btn:hover { color: var(--cream); filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn-small { min-height: 40px; padding: 0 8px 2px; font-size: 15px; }
.btn-big { min-height: 64px; padding: 0 22px 3px; font-size: 21px; border-width: 15px 18px; border-image-width: 15px 18px; }

/* ---- แถบบน ---- */
.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(6px + env(safe-area-inset-top, 0px)) 16px 6px; background: rgba(22, 34, 27, 0.92);
  border-bottom: 2px solid #0f1813; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.top-brand img { display: block; width: 96px; image-rendering: pixelated; }
.top-nav { display: flex; align-items: center; gap: 14px; font-size: 15px; }
.top-nav a:not(.btn) { color: var(--text); text-decoration: none; }
.top-nav a:not(.btn):hover { color: var(--gold); text-decoration: underline; }

/* ---- ภาพปก ---- */
.hero { position: relative; overflow: hidden; min-height: min(calc(100svh - 120px), 720px); display: flex; align-items: flex-end; justify-content: center; text-align: center; }
.hero-art {
  position: absolute; inset: 0; background: #2b3d2a url("img/title-tall.png") center 65% / cover no-repeat; image-rendering: pixelated;
}
/* ไล่เงาด้านล่างให้ตัวหนังสืออ่านง่าย */
.hero-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(22, 34, 27, 0) 30%, rgba(22, 34, 27, 0.78) 62%, var(--ground) 100%); }
.hero-inner { position: relative; width: 100%; max-width: 640px; padding: 40px 16px 28px; }
.hero-title { margin: 0; }
.hero-title img { width: min(76vw, 384px); image-rendering: pixelated; filter: drop-shadow(0 4px 0 rgba(15, 24, 19, 0.6)); }
.tagline { margin: 6px auto 18px; max-width: 30em; font-size: 19px; font-weight: 600; color: var(--cream); text-shadow: 0 2px 0 #0f1813, 0 0 12px rgba(15, 24, 19, 0.9); }
.hero-cta { margin: 0 0 10px; }
.hero-note { margin: 4px 0; font-size: 15px; color: var(--text); text-shadow: 0 1px 0 #0f1813; }
.hero-more { margin: 14px 0 0; font-size: 15px; }


/* ---- เนื้อหา ---- */
.section { max-width: 1080px; margin: 0 auto; padding: 36px 16px 8px; scroll-margin-top: 56px; }
#faq-move { scroll-margin-top: 64px; }
.sign {
  display: block; width: fit-content; max-width: 100%; margin: 0 auto 16px; padding: 0 10px;
  border-style: solid; border-width: 0 28px; border-color: #c09767; background: #c09767; background-clip: padding-box;
  border-image: url("img/title.png") 0 14 fill / 0 28px / 0 stretch; image-rendering: pixelated;
  color: var(--ink); font-size: 21px; line-height: 44px; text-align: center;
}
.lead { max-width: 40em; margin: 0 auto 20px; text-align: center; color: var(--text); }

/* กรอบไม้ + เถาวัลย์ (panel.png มุม 32 แสดงครึ่งขนาด) */
.frame {
  border: 12px solid var(--rim); border-image: url("img/panel.png") 32 fill / 16px / 0 stretch; image-rendering: pixelated;
  background: var(--wood); background-clip: padding-box; padding: 10px 12px;
}
/* การ์ดกระดาษ ตัวอักษรเข้ม */
.paper {
  border: 8px solid #c27940; border-image: url("img/paper.png") 16 fill / 16px / 0 stretch; image-rendering: pixelated;
  background: var(--paper); background-clip: padding-box; color: var(--ink); padding: 6px 12px;
}
.paper a { color: #7a3d12; }
.paper a:hover { color: #3b2618; }

.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; grid-template-columns: 1fr; }
.card {
  border: 12px solid var(--rim); border-image: url("img/panel.png") 32 fill / 16px / 0 stretch;
  background: var(--wood); background-clip: padding-box; padding: 8px 8px 12px;
}
.card img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border: 2px solid #0f1813; border-radius: 2px; background: var(--ground-2); }
.card h3 { margin: 12px 4px 4px; font-size: 19px; color: var(--gold); }
.card p { margin: 0 4px; color: var(--text); font-size: 15.5px; }

.who, .devices { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; grid-template-columns: 1fr; }
.who strong, .devices strong { display: block; color: var(--gold); font-size: 18px; }
.who span, .devices span { display: block; font-size: 15.5px; }

.faq { display: grid; gap: 10px; max-width: 760px; margin: 0 auto; }
.faq summary { cursor: pointer; font-weight: 600; padding: 6px 0; min-height: 44px; display: flex; align-items: center; gap: 8px; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "▸"; flex: none; transition: transform 0.2s; }
.faq details[open] summary::before { transform: rotate(90deg); }
.faq p, .faq ol { margin: 0 0 8px; }
.faq ol { padding-left: 1.4em; }
.faq li { margin: 6px 0; }

.final { text-align: center; padding: 40px 16px; }

.foot { margin-top: 24px; padding: 24px 16px calc(28px + env(safe-area-inset-bottom, 0px)); background: #0f1813; text-align: center; font-size: 14px; color: var(--muted); }
.foot nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 20px; margin-bottom: 10px; font-size: 15px; }
.foot nav a { display: inline-block; padding: 8px 4px; }
.credits { max-width: 46em; margin: 0 auto 6px; }
.version { margin: 0; }

/* ---- จอกว้าง ---- */
@media (min-width: 700px) {
  .hero-art { background-image: url("img/title-wide.png"); background-position: center 40%; }
  .hero { min-height: min(calc(100svh - 52px), 720px); }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .who { grid-template-columns: repeat(3, 1fr); }
  .devices { grid-template-columns: repeat(2, 1fr); }
  .tagline { font-size: 22px; }
}
@media (min-width: 1000px) {
  .cards { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 420px) {
  .top-nav a:not(.btn):not(.nav-keep) { display: none; }
}

/* งาน 122: การ์ดลิงก์ไปวิกิ */
.wiki-card { display: block; max-width: 760px; margin: 0 auto; text-decoration: none; color: var(--text); padding: 14px 16px; }
.wiki-card strong { display: block; color: var(--gold); font-size: 20px; }
.wiki-card span { display: block; font-size: 15.5px; }
.wiki-card:hover strong, .wiki-card:focus strong { color: var(--cream); text-decoration: underline; }

/* ผู้ใช้ที่ขอลดการเคลื่อนไหว: ไม่เลื่อนแบบนุ่ม ไม่หมุนลูกศร */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .faq summary::before { transition: none; }
  .btn:active { transform: none; }
}

/* หน้าไม่พบ (404.html) */
.notfound { text-align: center; padding-top: 56px; }
.notfound h1 { font-size: 21px; }
.notfound img { image-rendering: pixelated; width: min(70vw, 288px); height: auto; }
