/* 網站的介紹頁（landing.js）：沒登入的訪客打開首頁時才有。整頁固定深色（遊戲畫面當背景），上方列在首屏上時透明 */

/* 介紹頁開著的時候：整個網站用深色（淺色主題也是）。直接用 :has 看目前的頁面，不等 JS 加 class（第一次載入時 class 偶爾慢一步） */
:root:has(#pages > .page:not(.hidden) .landing) { --bg: #16181d; --panel: #1f2229; --line: #2e323b; --text: #e8eaee; --muted: #9aa1ad; --accent: #3ba55c; --accent-hover: #46bd6a; color-scheme: dark; }
:root:has(#pages > .page:not(.hidden) .landing) main { max-width: none; padding: 0; }
:root:has(#pages > .page:not(.hidden) .landing) #topbar { background: rgba(22, 24, 29, .82); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); transition: background-color .3s, border-color .3s, top .2s var(--ease-out); }
:root.landing-top:has(#pages > .page:not(.hidden) .landing) #topbar { background: transparent; border-bottom-color: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
:root:has(#pages > .page:not(.hidden) .landing) #foot { margin-top: 0; padding-top: 24px; }
/* 手機上介紹頁不顯示底部分頁列（訪客先看介紹，分頁在「先逛逛」之後才用到） */
@media (max-width: 700px) {
  :root:has(#pages > .page:not(.hidden) .landing) #tabs { display: none; }
  :root:has(#pages > .page:not(.hidden) .landing) #foot { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
}

.landing { --lp-green: #5fd17f; --lp-soft: #c2c8d1; overflow-x: clip; font-size: 16px; line-height: 1.6; color: var(--text); }
.landing h1, .landing h2 { letter-spacing: .01em; }
/* 韓文照詞換行（預設會在字中間斷開） */
html[lang="ko"] .landing { word-break: keep-all; }
.lp-wrap { max-width: 1160px; margin: 0 auto; padding: 0 24px; }

/* 按鈕 */
.landing .lp-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 54px; padding: 0 28px; border-radius: 12px; font-size: 17px; font-weight: 700; white-space: nowrap; text-decoration: none; transition: transform .18s var(--ease-out), box-shadow .25s, background-color .2s; }
.lp-btn.primary { box-shadow: 0 8px 24px rgba(59, 165, 92, .35); }
.lp-btn.primary:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(59, 165, 92, .45); }
.lp-btn .ic { transition: transform .25s var(--ease-out); }
.lp-btn.primary:hover .ic { transform: translateY(2px); }
.landing .lp-ghost { background: rgba(255, 255, 255, .08); color: #fff; border: 1px solid rgba(255, 255, 255, .22); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.landing .lp-ghost:hover { background: rgba(255, 255, 255, .15); transform: translateY(-2px); }
.lp-ghost:hover .ic { transform: translateX(4px); }
.lp-cta { display: flex; flex-wrap: wrap; gap: 14px; }

/* 首屏 */
.lp-hero { position: relative; min-height: 860px; display: flex; align-items: center; overflow: hidden; }
.lp-hero-bg { position: absolute; inset: -6% 0 0; background: url(/landing/hero.webp) center 60% / cover; transform: scale(1.08); will-change: transform; }
.lp-hero-shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(14, 16, 20, .92) 0%, rgba(14, 16, 20, .7) 45%, rgba(14, 16, 20, .15) 100%), linear-gradient(0deg, var(--bg) 0%, rgba(22, 24, 29, .6) 18%, transparent 40%); }
.lp-hero-in { position: relative; display: flex; align-items: center; gap: 40px; width: 100%; padding-top: calc(var(--lp-top, 52px) + 48px); padding-bottom: 72px; }
.lp-hero-txt { flex: 1; max-width: 600px; }
.lp-eyebrow { display: inline-block; padding: 4px 14px; border-radius: 999px; background: rgba(59, 165, 92, .18); color: #7ee09c; font-size: 14px; font-weight: 700; margin-bottom: 18px; }
.lp-hero h1 { font-size: 58px; line-height: 1.18; margin: 0 0 18px; }
.lp-hero h1 em { font-style: normal; color: var(--lp-green); background: linear-gradient(90deg, #5fd17f, #9be7b0, #5fd17f); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; animation: lp-shine 6s linear infinite; }
.lp-lead { font-size: 20px; color: #cfd4dc; margin: 0 0 32px; }
.lp-platforms { margin-top: 22px; color: var(--muted); font-size: 14px; display: flex; gap: 8px 18px; flex-wrap: wrap; }
.lp-platforms span { display: inline-flex; align-items: center; gap: 5px; }
.lp-platforms .ic { color: var(--accent); }
.lp-hero-art { perspective: 1200px; }
.lp-hero-phone { --w: 300px; transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .5s var(--ease-out); animation: lp-float 6s ease-in-out infinite; }

/* 首屏的字依序浮上來（--d 是順序） */
.lp-rise { animation: lp-rise .8s var(--ease-out) both; animation-delay: calc(var(--d, 0) * 110ms + 80ms); }
.lp-hero-art.lp-rise { animation-duration: 1.1s; }

/* 手機外框：每一支都一樣（寬度用 --w，圓角和邊框跟著等比例） */
.lp-phone { --w: 300px; width: var(--w); flex: none; padding: calc(var(--w) * .03); border-radius: calc(var(--w) * .15); background: #0b0c0f; box-shadow: 0 0 0 1px rgba(255, 255, 255, .14), 0 30px 70px rgba(0, 0, 0, .55); }
.lp-screen { position: relative; aspect-ratio: 1080 / 2340; border-radius: calc(var(--w) * .12); overflow: hidden; background: var(--bg); }
.lp-screen > img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }
/* 橫拿的手機（浮動球）：遊戲畫面＋左邊的小視窗＋右邊的浮動球 */
.lp-phone.land { --w: 560px; padding: calc(var(--w) * .014); border-radius: calc(var(--w) * .07); }
.lp-phone.land .lp-screen { aspect-ratio: 2340 / 1080; border-radius: calc(var(--w) * .055); }
.lp-screen > img.lp-game { object-position: 46% 70%; }
.lp-screen > img.lp-ball { position: absolute; right: 3.5%; top: 12%; width: auto; height: 15%; border-radius: 50%; box-shadow: 0 6px 16px rgba(0, 0, 0, .45); }
.lp-panel { position: absolute; left: 3%; top: 2.5%; bottom: 2.5%; border-radius: calc(var(--w) * .022); overflow: hidden; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
.lp-panel img { display: block; height: 100%; width: auto; }

/* 數字 */
.lp-stats { position: relative; z-index: 2; margin-top: -36px; display: grid; grid-template-columns: repeat(var(--n, 3), 1fr); gap: 16px; }
.lp-stat { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px 22px; display: flex; align-items: center; gap: 16px; transition: border-color .3s, transform .3s var(--ease-out); }
.lp-stat:hover { border-color: rgba(95, 209, 127, .45); transform: translateY(-3px); }
.lp-stat > div { display: flex; flex-direction: column; }
.lp-stat b { font-size: 32px; line-height: 1.15; color: #fff; font-variant-numeric: tabular-nums; }
.lp-stat span { color: var(--muted); font-size: 15px; }
.lp-stat-ic { width: 52px; height: 52px; flex: none; border-radius: 14px; display: grid; place-items: center; color: var(--lp-green); background: rgba(59, 165, 92, .14); }
.lp-stat.done .lp-stat-ic { animation: lp-pop .5s var(--ease-out); }

/* 功能介紹：圖文左右交錯 */
.lp-feature { padding-top: 110px; }
.lp-feature .lp-wrap { display: flex; align-items: center; gap: 72px; }
.lp-feature.flip .lp-wrap { flex-direction: row-reverse; }
.lp-txt { flex: 1; min-width: 0; }
.lp-tag { color: var(--lp-green); font-weight: 700; font-size: 15px; letter-spacing: .06em; }
.lp-feature h2 { font-size: 38px; line-height: 1.3; margin: 8px 0 16px; }
.lp-feature p { color: var(--lp-soft); font-size: 18px; margin: 0; }
.lp-points { margin: 22px 0 0; padding: 0; list-style: none; color: var(--lp-soft); }
.lp-points li { display: flex; align-items: center; gap: 12px; padding: 6px 0; }
.lp-points .ic { flex: none; color: var(--accent); }
.lp-art { flex: none; display: flex; justify-content: center; }
.lp-pair { display: flex; gap: 24px; align-items: flex-start; }
.lp-pair .lp-phone { --w: 230px; }
.lp-pair .lp-phone:last-child { margin-top: 60px; }
/* 浮動球一閃一閃的光圈、小視窗滑進來 */
.lp-art.in .lp-ball { animation: lp-ping 2.4s var(--ease-out) 1s infinite; }
.lp-art .lp-panel { transform: translateX(-30px); opacity: 0; transition: transform .9s var(--ease-out) .35s, opacity .9s .35s; }
.lp-art.in .lp-panel { transform: none; opacity: 1; }

/* 現在有人在玩（真的房間） */
.lp-section { padding-top: 110px; }
.lp-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 24px; }
.lp-head h2 { font-size: 34px; margin: 0; display: flex; align-items: center; gap: 14px; }
.lp-more { margin-left: auto; color: var(--lp-green); font-weight: 700; display: inline-flex; align-items: center; gap: 4px; text-decoration: none; white-space: nowrap; }
.lp-more:hover .ic { transform: translateX(3px); }
.lp-more .ic { transition: transform .2s; }
.lp-live-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 rgba(59, 165, 92, .6); animation: lp-live 1.8s infinite; }
.lp-rooms { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.lp-rooms .hcard { flex: none; min-height: 140px; padding: 14px; border-radius: 14px; font-size: 14px; transition: transform .3s var(--ease-out), border-color .3s; }
.lp-rooms .hcard:hover { transform: translateY(-4px); }

/* 常見問題 */
.lp-faq-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.lp-q { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px 22px; }
.lp-q summary { font-weight: 700; font-size: 17px; cursor: pointer; list-style: none; }
.lp-q summary::-webkit-details-marker { display: none; }
.lp-q p { color: var(--lp-soft); margin: 10px 0 0; }

/* 最後再放一次下載 */
.lp-final { position: relative; margin-top: 120px; padding: 110px 0; text-align: center; overflow: hidden; }
.lp-final-bg { position: absolute; inset: 0; background: url(/landing/final.webp) center / cover; }
.lp-final-shade { position: absolute; inset: 0; background: linear-gradient(0deg, rgba(14, 16, 20, .88), rgba(14, 16, 20, .6)), linear-gradient(180deg, var(--bg) 0%, transparent 30%); }
.lp-final .lp-wrap { position: relative; }
.lp-logo { width: 84px; height: 84px; border-radius: 20px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); animation: lp-float 5s ease-in-out infinite; }
.lp-final h2 { font-size: 44px; margin: 18px 0 10px; }
.lp-final p { color: #cfd4dc; font-size: 19px; margin: 0 0 30px; }
.lp-final .lp-cta { justify-content: center; }
.lp-nw { display: inline-block; }

/* 往下捲時滑進來（landing.js 看得到時加上 .in；--d 錯開順序） */
[data-reveal] { opacity: 0; transition: opacity .8s var(--ease-out), transform .9s var(--ease-out); transition-delay: calc(var(--d, 0) * 90ms); }
[data-reveal="up"] { transform: translateY(40px); }
[data-reveal="left"] { transform: translateX(-56px); }
[data-reveal="right"] { transform: translateX(56px); }
.lp-art[data-reveal="left"] { transform: translateX(-56px) rotate(-3deg); }
.lp-art[data-reveal="right"] { transform: translateX(56px) rotate(3deg); }
[data-reveal].in { opacity: 1; transform: none; }
.lp-txt.in .lp-points li { animation: lp-rise .6s var(--ease-out) both; }
.lp-txt.in .lp-points li:nth-child(1) { animation-delay: .35s; }
.lp-txt.in .lp-points li:nth-child(2) { animation-delay: .47s; }
.lp-txt.in .lp-points li:nth-child(3) { animation-delay: .59s; }

@keyframes lp-rise { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }
@keyframes lp-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -12px; } }
@keyframes lp-shine { to { background-position: -200% 0; } }
@keyframes lp-pop { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes lp-live { 0% { box-shadow: 0 0 0 0 rgba(59, 165, 92, .6); } 70% { box-shadow: 0 0 0 10px rgba(59, 165, 92, 0); } 100% { box-shadow: 0 0 0 0 rgba(59, 165, 92, 0); } }
@keyframes lp-ping { 0% { box-shadow: 0 6px 16px rgba(0, 0, 0, .45), 0 0 0 0 rgba(95, 209, 127, .7); } 70%, 100% { box-shadow: 0 6px 16px rgba(0, 0, 0, .45), 0 0 0 16px rgba(95, 209, 127, 0); } }

/* 減少動態效果：全部直接顯示 */
@media (prefers-reduced-motion: reduce) {
  .landing *, .landing *::before { animation: none !important; transition: none !important; }
  [data-reveal], .lp-art .lp-panel { opacity: 1 !important; transform: none !important; }
}

/* 手機 */
@media (max-width: 820px) {
  .lp-wrap { padding: 0 16px; }
  .lp-hero { min-height: 0; }
  .lp-hero-bg { background-position: 62% center; }
  .lp-hero-shade { background: linear-gradient(180deg, rgba(14, 16, 20, .55) 0%, rgba(14, 16, 20, .85) 55%, var(--bg) 100%); }
  .lp-hero-in { flex-direction: column; padding-top: calc(var(--lp-top, 48px) + 28px); padding-bottom: 40px; gap: 36px; }
  .lp-hero h1 { font-size: 38px; }
  .lp-lead { font-size: 17px; margin-bottom: 24px; }
  .landing .lp-cta .lp-btn { flex: 1; height: 52px; padding: 0 14px; font-size: 16px; }
  .lp-hero-phone { --w: min(72vw, 280px); }
  .lp-stats { margin-top: 0; gap: 8px; }
  .lp-stat { padding: 12px 6px; flex-direction: column; gap: 8px; text-align: center; }
  .lp-stat > div { align-items: center; }
  .lp-stat-ic { width: 40px; height: 40px; border-radius: 11px; }
  .lp-stat-ic .ic { width: 22px; height: 22px; }
  .lp-stat b { font-size: 22px; }
  .lp-stat span { font-size: 12px; line-height: 1.4; }
  .lp-feature { padding-top: 72px; }
  .lp-feature .lp-wrap, .lp-feature.flip .lp-wrap { flex-direction: column; gap: 28px; }
  .lp-feature h2 { font-size: 28px; }
  .lp-feature p { font-size: 16px; }
  .lp-feature .lp-art { width: 100%; }
  .lp-art > .lp-phone { --w: min(72vw, 280px); }
  .lp-art > .lp-phone.land { --w: calc(100vw - 32px); }
  .lp-pair { gap: 14px; }
  .lp-pair .lp-phone { --w: calc(50vw - 24px); }
  .lp-pair .lp-phone:last-child { margin-top: 40px; }
  [data-reveal="left"], [data-reveal="right"], .lp-art[data-reveal="left"], .lp-art[data-reveal="right"] { transform: translateY(40px); }
  .lp-section { padding-top: 80px; }
  .lp-head h2 { font-size: 26px; }
  .lp-more { font-size: 14px; }
  .lp-rooms { grid-template-columns: 1fr; gap: 10px; }
  .lp-rooms .hcard { min-height: 0; }
  .lp-faq-grid { grid-template-columns: 1fr; }
  .lp-final { margin-top: 80px; padding: 80px 0; }
  .lp-final h2 { font-size: 30px; }
  .lp-final p { font-size: 16px; }
}
