/* Randombox official site — KiwiTomatoStudio */
:root {
  --bg: #ffffff;
  --bg-soft: #f5f8fc;
  --surface: #ffffff;
  --text: #0f1729;
  --text-2: #4a5568;
  --text-3: #718096;
  --line: #e6ebf2;
  --brand: #5b9be0;
  --brand-strong: #2f74d0;
  --brand-ink: #ffffff;
  --brand-tint: #eaf2fc;
  --shadow: 0 1px 2px rgba(15, 23, 41, .04), 0 8px 24px rgba(15, 23, 41, .06);
  --shadow-lg: 0 30px 60px -20px rgba(31, 64, 120, .35);
  --radius: 20px;
  --max: 1120px;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f17;
    --bg-soft: #111723;
    --surface: #151c2a;
    --text: #eef2f8;
    --text-2: #b4bfd0;
    --text-3: #8592a6;
    --line: #232c3c;
    --brand: #6aa8ec;
    --brand-strong: #8bbcf2;
    --brand-ink: #0b0f17;
    --brand-tint: #16253b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --shadow-lg: 0 30px 60px -20px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}
:lang(zh-Hant) { --font-cjk: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei"; }
:lang(zh-Hans) { --font-cjk: "PingFang SC", "Noto Sans SC", "Microsoft YaHei"; }
:lang(ja) { --font-cjk: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", Meiryo; }
:lang(ko) { --font-cjk: "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic"; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, var(--font-cjk, "Noto Sans"), "Noto Sans", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -.02em; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; border-radius: 8px; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }
@media (max-width: 600px) { .wrap { padding: 0 16px; } }
.skip { position: absolute; left: -999px; top: 8px; background: var(--brand-strong); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.site-header.scrolled { border-bottom-color: var(--line); }
.nav { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: -.01em; min-width: 0; }
.brand img { width: 32px; height: 32px; border-radius: 8px; flex: none; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-links { display: flex; align-items: center; gap: 28px; font-size: 15px; color: var(--text-2); }
.nav-links a:not(.btn):hover { color: var(--text); }
@media (max-width: 760px) { .nav-links a:not(.btn) { display: none; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px; border-radius: 999px;
  font-weight: 600; font-size: 15px; white-space: nowrap;
  background: var(--brand-strong); color: #fff; border: 0; cursor: pointer;
  transition: transform .15s, background .15s, box-shadow .15s;
}
@media (prefers-color-scheme: dark) { .btn { background: var(--brand); color: var(--brand-ink); } }
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px -6px var(--brand); }
.btn-lg { height: 52px; padding: 0 28px; font-size: 16px; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; isolation: isolate; padding: 104px 0 120px; text-align: center; }
.hero-bg { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.blob { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .5; animation: drift 24s ease-in-out infinite alternate; }
.b1 { width: 560px; height: 560px; left: 50%; top: -220px; margin-left: -280px; background: color-mix(in srgb, var(--brand) 60%, transparent); }
.b2 { width: 420px; height: 420px; left: 2%; top: 38%; background: color-mix(in srgb, #ec4899 30%, transparent); animation-duration: 28s; animation-delay: -7s; }
.b3 { width: 460px; height: 460px; right: 0; top: 50%; background: color-mix(in srgb, #f59e0b 28%, transparent); animation-duration: 32s; animation-delay: -14s; }
@keyframes drift {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(60px, -40px) scale(1.1); }
  100% { transform: translate(-40px, 30px) scale(.94); }
}
.hero-inner { display: flex; flex-direction: column; align-items: center; }
.hero-icon { width: 96px; height: 96px; border-radius: 24px; box-shadow: var(--shadow-lg); margin-bottom: 32px; }
.hero h1 { font-size: clamp(52px, 9.5vw, 120px); font-weight: 800; letter-spacing: -.05em; line-height: 1.02; }
:lang(zh-Hant) .hero h1, :lang(zh-Hans) .hero h1, :lang(ja) .hero h1, :lang(ko) .hero h1 { letter-spacing: -.02em; }
.hero .tagline {
  margin-top: 20px; font-size: clamp(22px, 3.2vw, 34px); font-weight: 650; letter-spacing: -.02em;
  background: linear-gradient(90deg, #3b6ff6, #8b5cf6 25%, #ec4899 50%, #f59e0b 75%, #3b6ff6);
  background-size: 200% auto; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shine 10s linear infinite;
}
@keyframes shine { to { background-position: -200% center; } }
.hero .stores { margin-top: 40px; }
/* store buttons: always equal width */
.stores { display: inline-grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 32px; vertical-align: top; }
.stores-1 { grid-template-columns: 1fr; }
@media (max-width: 400px) { .stores { grid-template-columns: 1fr; width: min(100%, 240px); } }
.store {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  height: 56px; padding: 0 20px 0 16px; border-radius: 14px;
  background: #000; color: #fff; border: 1px solid #000;
  transition: transform .15s, box-shadow .15s;
}
@media (prefers-color-scheme: dark) { .store { background: #fff; color: #000; border-color: #fff; } }
.store:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -10px rgba(0,0,0,.5); }
.store svg { width: 26px; height: 26px; flex: none; }
.store > span { text-align: left; }

/* desktop download cards with QR codes */
.stores-qr .dl { display: flex; flex-direction: column; gap: 14px; }
.stores-qr .qr {
  display: none; padding: 14px; border-radius: 20px; background: #fff;
  border: 1px solid var(--line); box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
}
.stores-qr .qr:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stores-qr .qr img { width: 100%; height: auto; aspect-ratio: 1; margin: 0; border-radius: 0; box-shadow: none; }
.scan-hint { display: none; }
@media (min-width: 901px) and (hover: hover) {
  .stores-qr { gap: 20px; margin-top: 40px; }
  .stores-qr .dl { width: 196px; }
  .stores-qr .qr { display: block; }
  .scan-hint { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 18px !important; font-size: 14px !important; color: var(--text-3) !important; }
}
.store small { display: block; font-size: 11px; line-height: 1.1; opacity: .85; }
.store strong { display: block; font-size: 19px; line-height: 1.15; font-weight: 600; letter-spacing: -.01em; }
.hero-note { margin-top: 18px; font-size: 14px; color: var(--text-3); }

/* phone mockup */
.phone-stage { position: relative; display: flex; justify-content: center; margin: 88px auto 0; max-width: 980px; perspective: 1400px; --p: 1; }
.phone {
  position: relative; z-index: 2;
  width: 300px; aspect-ratio: 300 / 620; border-radius: 48px; padding: 12px;
  background: linear-gradient(145deg, #2a2f3a, #0c0f15);
  box-shadow: 0 50px 100px -30px rgba(31, 64, 120, .45), inset 0 0 0 2px #3b4252;
  transform-origin: 50% 100%;
  transform: translateY(calc((1 - var(--p)) * 60px)) rotateX(calc((1 - var(--p)) * 28deg)) scale(calc(.88 + var(--p) * .12));
  will-change: transform;
}
.screen::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 38%, rgba(255,255,255,.35) 50%, transparent 62%);
  transform: translateX(-120%); animation: sweep 7s 2.4s var(--ease) infinite;
}
@keyframes sweep { 0% { transform: translateX(-120%); } 28%, 100% { transform: translateX(120%); } }
.float { position: absolute; z-index: 1; transform: translate(-50%, calc((1 - var(--p)) * var(--s) * 120px)); will-change: transform; }
.float .ic {
  width: 68px; height: 68px; border-radius: 22px; background: var(--surface); color: var(--c);
  box-shadow: 0 24px 48px -18px rgba(15, 23, 41, .35), 0 0 0 1px var(--line);
  animation: bob 7s ease-in-out infinite; animation-delay: var(--fd);
}
.float .ic svg { width: 30px; height: 30px; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-5deg); } 50% { transform: translateY(-16px) rotate(5deg); } }
@media (max-width: 760px) { .float { display: none; } }
.screen { text-align: left;
  position: relative; height: 100%; border-radius: 38px; overflow: hidden;
  background: #f4f6fb; color: #0f1729; padding: 46px 14px 14px;
  display: flex; flex-direction: column; gap: 10px;
}
@media (prefers-color-scheme: dark) { .screen { background: #10141d; color: #eef2f8; } }
.screen::before { content: ""; position: absolute; top: 12px; left: 50%; translate: -50% 0; width: 92px; height: 26px; border-radius: 20px; background: #0c0f15; }
.scr-title { font-weight: 800; font-size: 20px; letter-spacing: -.02em; padding: 0 4px; }
.scr-sub { font-size: 11px; color: #718096; padding: 0 4px; margin-top: -8px; }
.scr-hero {
  border-radius: 18px; padding: 14px; color: #fff;
  background: linear-gradient(135deg, #ff6b6b, #ff4d4d 55%, #e0346a);
  display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 14px;
}
.scr-hero .ic { background: rgba(255,255,255,.22); color: #fff; }
.scr-grid { flex: 1; display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; gap: 8px; }
.scr-tile {
  background: #fff; border-radius: 16px; padding: 10px; min-height: 68px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 6px;
  font-size: 11.5px; font-weight: 650; line-height: 1.25;
  box-shadow: 0 1px 2px rgba(15,23,41,.05);
}
@media (prefers-color-scheme: dark) { .scr-tile { background: #1a2130; } }
.ic {
  width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--c) 15%, transparent); color: var(--c); flex: none;
}
.ic svg { width: 17px; height: 17px; }

@media (max-width: 900px) {
  .hero { padding: 64px 0 88px; }
  .phone { width: 270px; }
  .phone-stage { margin-top: 64px; }
}

/* ---------- Stats ---------- */
.stats ul { list-style: none; margin: 0; padding: 0 0 120px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; text-align: center; }
.stats strong {
  display: block; font-size: clamp(40px, 5.4vw, 64px); font-weight: 800; letter-spacing: -.04em; line-height: 1.1;
  background: linear-gradient(135deg, var(--brand-strong), #8b5cf6); -webkit-background-clip: text; background-clip: text; color: transparent;
  font-variant-numeric: tabular-nums;
}
.stats span { display: block; margin-top: 6px; font-size: 15px; color: var(--text-2); }
@media (max-width: 600px) { .stats ul { grid-template-columns: repeat(2, 1fr); row-gap: 36px; padding-bottom: 88px; } }

/* ---------- Manifesto (scroll-highlighted text) ---------- */
.manifesto { padding: 140px 0 120px; }
.scrub { max-width: 940px; margin: 0 auto; text-align: center; font-size: clamp(28px, 4.6vw, 56px); font-weight: 750; line-height: 1.3; letter-spacing: -.035em; text-wrap: balance; }
:lang(zh-Hant) .scrub, :lang(zh-Hans) .scrub, :lang(ja) .scrub, :lang(ko) .scrub { letter-spacing: -.01em; line-height: 1.45; }
.js .scrub span { color: color-mix(in srgb, var(--text) 16%, var(--bg)); transition: color .5s var(--ease); }
.js .scrub span.on { color: var(--text); }
@media (max-width: 600px) { .manifesto { padding: 96px 0 80px; } }

/* ---------- Sections ---------- */
section.block { padding: 140px 0; }
section.alt { background: var(--bg-soft); }
.head { text-align: center; max-width: 760px; margin: 0 auto 72px; }
.eyebrow { display: inline-block; font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--brand-strong); margin-bottom: 12px; }
.head h2 { font-size: clamp(36px, 5.6vw, 64px); font-weight: 800; letter-spacing: -.04em; line-height: 1.08; }
:lang(zh-Hant) h2, :lang(zh-Hans) h2, :lang(ja) h2, :lang(ko) h2 { letter-spacing: -.015em; }
.head p { margin-top: 20px; font-size: clamp(17px, 1.8vw, 21px); color: var(--text-2); }
@media (max-width: 600px) { section.block { padding: 88px 0; } .head { margin-bottom: 44px; } }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 900px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .cards { grid-template-columns: 1fr; gap: 14px; } }
.card {
  position: relative; overflow: hidden; isolation: isolate;
  background: var(--bg-soft); border: 1px solid transparent; border-radius: 28px; padding: 32px;
  transition: transform .6s var(--ease), box-shadow .6s var(--ease), border-color .6s var(--ease);
}
section.alt .card { background: var(--surface); }
.card::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0; transition: opacity .5s var(--ease);
  background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 0%), color-mix(in srgb, var(--c) 16%, transparent), transparent 70%);
}
.card:hover::before { opacity: 1; }
.card:hover { transform: translateY(-6px); border-color: color-mix(in srgb, var(--c) 25%, transparent); box-shadow: 0 34px 60px -34px color-mix(in srgb, var(--c) 60%, transparent); }
.card .ic { width: 52px; height: 52px; border-radius: 16px; margin-bottom: 22px; transition: transform .6s var(--ease); }
.card:hover .ic { transform: scale(1.1) rotate(-8deg); }
.card .ic svg { width: 25px; height: 25px; }
.card h3 { font-size: 21px; font-weight: 700; letter-spacing: -.02em; }
.card p { margin-top: 8px; color: var(--text-2); font-size: 15.5px; }

/* party games */
.games {
  display: grid; grid-template-columns: .9fr 1.1fr; gap: 48px; align-items: center;
  background: linear-gradient(120deg, #ff5a5f, #ef4444 25%, #db2777 55%, #8b5cf6 80%, #ff5a5f);
  background-size: 300% 300%; animation: grad 18s ease infinite;
  color: #fff; border-radius: 36px; padding: 64px;
  box-shadow: 0 30px 60px -30px rgba(219, 39, 119, .6);
}
.games .eyebrow { color: rgba(255,255,255,.85); }
@keyframes grad { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.games h2 { font-size: clamp(32px, 4.4vw, 52px); font-weight: 800; letter-spacing: -.035em; line-height: 1.1; }
.games .lead { margin-top: 14px; font-size: 18px; opacity: .92; }
.games ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.games li {
  display: flex; align-items: center; gap: 20px;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22); border-radius: 22px; padding: 22px 24px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: transform .5s var(--ease), background .5s var(--ease);
}
.games li:hover { transform: translateX(6px); background: rgba(255,255,255,.22); }
.games li b { flex: none; font-size: 28px; font-weight: 800; letter-spacing: -.04em; opacity: .55; font-variant-numeric: tabular-nums; }
.games li strong { display: block; font-size: 18px; }
.games li span { display: block; margin-top: 4px; font-size: 14px; opacity: .88; line-height: 1.5; }
@media (max-width: 900px) { .games { grid-template-columns: 1fr; padding: 40px 28px; gap: 32px; } }
@media (max-width: 560px) { .games { padding: 32px 20px; border-radius: 24px; } .games ul { grid-template-columns: 1fr; } }

/* FAQ */
.faq { max-width: 780px; margin: 0 auto; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  list-style: none; cursor: pointer; padding: 22px 40px 22px 0; position: relative;
  font-size: 18px; font-weight: 650;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary:hover { color: var(--brand-strong); }
.faq summary::after {
  content: ""; position: absolute; right: 6px; top: 50%; width: 10px; height: 10px; margin-top: -7px;
  border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3); transform: rotate(45deg); transition: transform .3s cubic-bezier(.2,.7,.2,1), margin-top .3s cubic-bezier(.2,.7,.2,1);
}
.faq details[open]:not(.closing) summary::after { transform: rotate(-135deg); margin-top: -2px; }
.faq-a { overflow: hidden; }
.faq-a p { padding: 0 0 22px; color: var(--text-2); }

/* CTA */
.cta { text-align: center; padding: 96px 0; }
.cta img { width: 80px; height: 80px; border-radius: 20px; margin: 0 auto 24px; box-shadow: var(--shadow-lg); }
.cta h2 { font-size: clamp(30px, 4.4vw, 46px); font-weight: 800; }
.cta p { margin-top: 14px; font-size: 18px; color: var(--text-2); }
.cta .stores { justify-content: center; }

/* Contact */
.contact { display: grid; grid-template-columns: .85fr 1.15fr; gap: 56px; align-items: start; }
.contact .head { text-align: left; margin: 0; }
.contact .mail { margin-top: 28px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 15px; color: var(--text-2); }
.contact .mail a { color: var(--brand-strong); font-weight: 600; word-break: break-all; }
form.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 32px; box-shadow: var(--shadow); }
.field { margin-bottom: 22px; }
.field > label, .field > .label { display: block; font-size: 14px; font-weight: 650; margin-bottom: 8px; }
.field .opt { font-weight: 400; color: var(--text-3); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; border: 0; padding: 0; margin: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label {
  display: flex; align-items: center; justify-content: center; text-align: center; gap: 6px;
  min-height: 46px; padding: 8px 10px; border-radius: 12px; cursor: pointer;
  border: 1.5px solid var(--line); font-size: 14.5px; font-weight: 600; color: var(--text-2);
  transition: border-color .15s, background .15s, color .15s;
}
.seg input:checked + label { border-color: var(--brand-strong); background: var(--brand-tint); color: var(--brand-strong); }
.seg input:focus-visible + label { outline: 3px solid var(--brand); outline-offset: 2px; }
@media (max-width: 420px) { .seg { grid-template-columns: 1fr; } }
input[type=text], textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--text);
  background: var(--bg); border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px;
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 150px; resize: vertical; }
input[type=text]:focus, textarea:focus { outline: none; border-color: var(--brand-strong); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 22%, transparent); }
.field.err textarea { border-color: #e5484d; }
.err-msg { display: none; margin-top: 6px; font-size: 13px; color: #e5484d; }
.field.err .err-msg { display: block; }
.form-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 18px; }
.form-foot small { color: var(--text-3); font-size: 13px; flex: 1 1 220px; }
@media (max-width: 900px) { .contact { grid-template-columns: 1fr; gap: 32px; } .contact .head { text-align: center; } .contact .mail { justify-content: center; } }
@media (max-width: 560px) { form.panel { padding: 22px 18px; border-radius: 20px; } .form-foot .btn { width: 100%; } }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--bg-soft); padding: 64px 0 32px; font-size: 14.5px; color: var(--text-2); }
.foot-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 40px; }
.foot-brand p { margin-top: 12px; max-width: 320px; color: var(--text-3); }
.site-footer h3 { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text); margin-bottom: 14px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.site-footer a:hover { color: var(--text); }
.copy { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; color: var(--text-3); font-size: 13.5px; }

/* language dropdown */
.lang-menu { position: relative; }
.lang-menu summary {
  list-style: none; cursor: pointer; user-select: none;
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px 0 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  color: var(--text-2); font-size: 14px; font-weight: 500;
  transition: border-color .15s, color .15s;
}
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-menu summary:hover, .lang-menu[open] summary { color: var(--text); border-color: color-mix(in srgb, var(--text-3) 45%, var(--line)); }
.lang-menu summary svg { width: 16px; height: 16px; flex: none; }
.lang-menu summary svg:last-child { width: 14px; height: 14px; opacity: .7; transition: transform .2s; }
.lang-menu[open] summary svg:last-child { transform: rotate(180deg); }
.site-footer .lang-list {
  position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 20;
  min-width: 200px; max-height: min(70vh, 470px); overflow-y: auto;
  display: block; padding: 6px; margin: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 12px 40px -8px rgba(15, 23, 41, .22), 0 2px 6px rgba(15, 23, 41, .06);
  transform-origin: bottom right; animation: menu-in .16s cubic-bezier(.2,.7,.2,1);
}
@keyframes menu-in { from { opacity: 0; transform: translateY(4px) scale(.98); } }
.lang-list a {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 12px; border-radius: 8px; font-size: 14px; color: var(--text-2);
}
.lang-list a:hover { background: var(--bg-soft); color: var(--text); }
.lang-list svg { width: 15px; height: 15px; visibility: hidden; color: var(--brand-strong); }
.lang-list a[aria-current] { color: var(--brand-strong); font-weight: 600; }
.lang-list a[aria-current] svg { visibility: visible; }
@media (max-width: 560px) {
  .copy { flex-direction: column-reverse; align-items: flex-start; gap: 16px; }
  .site-footer .lang-list { left: 0; right: auto; transform-origin: bottom left; }
}
@media (max-width: 760px) { .foot-grid { grid-template-columns: 1fr 1fr; } .foot-brand { grid-column: 1 / -1; } }

/* ---------- Legal page ---------- */
.legal { padding: 64px 0 96px; }
.legal .wrap { max-width: 780px; }
.legal h1 { font-size: clamp(32px, 5vw, 46px); font-weight: 800; }
.legal .meta { margin-top: 12px; color: var(--text-3); font-size: 15px; }
.legal .lead { margin-top: 28px; font-size: 18px; color: var(--text-2); }
.legal h2 { font-size: 22px; font-weight: 750; margin: 44px 0 12px; }
.legal p, .legal li { color: var(--text-2); }
.legal p + p { margin-top: 12px; }
.legal ul { padding-left: 1.3em; margin: 12px 0 0; display: grid; gap: 6px; }
.legal a { color: var(--brand-strong); text-decoration: underline; text-underline-offset: 3px; }
.legal a.back {
  display: inline-flex; align-items: center; gap: 10px; margin-bottom: 32px;
  height: 40px; padding: 0 16px 0 5px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow);
  font-size: 14.5px; font-weight: 600; color: var(--text-2); text-decoration: none;
  transition: color .15s, border-color .15s, transform .15s;
}
.back-ic {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand-tint); color: var(--brand-strong); transition: transform .2s;
}
.back-ic svg { width: 16px; height: 16px; }
.legal a.back:hover { color: var(--text); border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.legal a.back:hover .back-ic { transform: translateX(-2px); }

/* ---------- Motion ---------- */
@keyframes heroIn { from { opacity: 0; transform: translateY(32px); filter: blur(12px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes rise { from { opacity: 0; translate: 0 48px; } to { opacity: 1; translate: none; } }
@keyframes tileIn { from { opacity: 0; transform: translateY(14px) scale(.94); } to { opacity: 1; transform: none; } }
.js [data-hero] { animation: heroIn 1.3s var(--ease) both; animation-delay: calc(var(--d, 0) * 110ms + 80ms); }
.js [data-reveal] { opacity: 0; }
.js [data-reveal].in { animation: rise 1.1s var(--ease) both; animation-delay: calc(var(--i, 0) * 90ms); }
.js .scr-hero, .js .scr-tile { animation: tileIn .9s var(--ease) both; animation-delay: calc(1s + var(--t, 0) * 70ms); }
.scr-hero { --t: 0; }
.scr-tile:nth-child(1) { --t: 1; } .scr-tile:nth-child(2) { --t: 2; } .scr-tile:nth-child(3) { --t: 3; } .scr-tile:nth-child(4) { --t: 4; }
.scr-tile:nth-child(5) { --t: 5; } .scr-tile:nth-child(6) { --t: 6; } .scr-tile:nth-child(7) { --t: 7; } .scr-tile:nth-child(8) { --t: 8; }
.js .legal .wrap > :nth-child(-n+4) { animation: heroIn 1.1s var(--ease) both; }
.js .legal .wrap > :nth-child(2) { animation-delay: .08s; }
.js .legal .wrap > :nth-child(3) { animation-delay: .16s; }
.js .legal .wrap > :nth-child(4) { animation-delay: .24s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .js [data-reveal] { opacity: 1; }
  .phone, .float { transform: none !important; }
  .js .scrub span { color: var(--text); }
}

/* typography refinements */
h1, h2, .tagline, .head p { text-wrap: balance; }
:lang(ja) h1, :lang(ja) h2, :lang(ja) h3, :lang(ja) .tagline { word-break: auto-phrase; }
:lang(ko) { word-break: keep-all; overflow-wrap: anywhere; }

/* compact cards on phones */
@media (max-width: 560px) {
  .card { display: grid; grid-template-columns: 52px 1fr; column-gap: 16px; padding: 20px; border-radius: 22px; }
  .card .ic { grid-row: span 2; margin: 0; }
  .card p { margin-top: 4px; font-size: 15px; }
}

/* ---------- 404 ---------- */
.nf-body { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.nf { position: relative; isolation: isolate; overflow: hidden; flex: 1; display: grid; place-items: center; padding: 48px 0 96px; text-align: center; }
.nf-inner { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; }
.nf-code {
  display: flex; align-items: center; justify-content: center; gap: clamp(8px, 2vw, 20px);
  font-size: clamp(120px, 24vw, 260px); font-weight: 800; line-height: 1; letter-spacing: -.06em;
  background: linear-gradient(180deg, var(--text) 30%, color-mix(in srgb, var(--text) 35%, var(--bg)));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  font-variant-numeric: tabular-nums;
}
.nf-die { display: grid; place-items: center; width: .74em; height: .74em; perspective: 600px; }
.nf-die img {
  width: 100%; height: 100%; border-radius: 22%;
  box-shadow: 0 40px 80px -30px rgba(31, 64, 120, .55);
  animation: nf-roll 4.2s var(--ease) 1.2s infinite;
}
@keyframes nf-roll {
  0% { transform: translateY(0) rotate(0); }
  10% { transform: translateY(-28%) rotate(-12deg) scale(1.04); }
  22% { transform: translateY(0) rotate(180deg) scale(.96); }
  30% { transform: translateY(-8%) rotate(350deg); }
  38%, 100% { transform: translateY(0) rotate(360deg); }
}
.nf h1 { margin-top: 28px; font-size: clamp(28px, 4.4vw, 48px); font-weight: 800; letter-spacing: -.035em; line-height: 1.15; }
:lang(zh-Hant) .nf h1, :lang(zh-Hans) .nf h1, :lang(ja) .nf h1, :lang(ko) .nf h1 { letter-spacing: -.01em; }
.nf-sub { margin-top: 16px; max-width: 520px; font-size: clamp(16px, 1.8vw, 19px); color: var(--text-2); text-wrap: balance; }
.nf-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 40px; }
.btn-ghost { background: var(--surface) !important; color: var(--text) !important; border: 1px solid var(--line); box-shadow: var(--shadow); }
.btn-ghost:hover { box-shadow: var(--shadow-lg); }
.nf-floats { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.nf-float { position: absolute; translate: -50% -50%; }
.nf-float .ic {
  width: 64px; height: 64px; border-radius: 20px; background: var(--surface); color: var(--c);
  box-shadow: 0 24px 48px -18px rgba(15, 23, 41, .35), 0 0 0 1px var(--line);
  animation: bob 7s ease-in-out infinite; animation-delay: var(--fd);
}
.nf-float .ic svg { width: 28px; height: 28px; }
.js .nf-float { animation: heroIn 1.4s var(--ease) both; animation-delay: .5s; }
@media (max-width: 700px) {
  .nf-float .ic { width: 46px; height: 46px; border-radius: 15px; }
  .nf-float .ic svg { width: 21px; height: 21px; }
  .nf-float:nth-child(n+3) { display: none; }
  .nf-float:nth-child(1) { top: 14% !important; }
  .nf-float:nth-child(2) { top: 18% !important; }
}
@media (prefers-reduced-motion: reduce) { .nf-float, .nf-die img { animation: none !important; } }

/* ---------- Language router ("/") ---------- */
.router .nf-inner { width: 100%; }
.router .hero-icon { margin: 0 auto 24px; }
.router h1 { font-size: clamp(44px, 7vw, 80px); font-weight: 800; letter-spacing: -.045em; }
.lang-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; width: min(100%, 820px); margin-top: 40px; }
.lang-card {
  display: flex; flex-direction: column; gap: 2px; text-align: left;
  padding: 16px 18px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow); transition: transform .4s var(--ease), border-color .4s var(--ease);
}
.lang-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.lang-card strong { font-size: 16px; }
.lang-card span { font-size: 13.5px; color: var(--text-3); }
@media (max-width: 480px) { .lang-grid { grid-template-columns: 1fr 1fr; } }
