/* PHYSICS LAB - landing site
   Shares the game's palette so the page and the game read as one product. */
:root {
  --bg: #070b12;
  --bg-2: #0b1320;
  --panel: rgba(255, 255, 255, 0.035);
  --panel-solid: #101a28;
  --line: rgba(63, 224, 207, 0.16);
  --line-soft: rgba(255, 255, 255, 0.08);
  --text: #e4eff8;
  --muted: rgba(220, 234, 245, 0.62);
  --dim: rgba(220, 234, 245, 0.42);
  --accent: #3fe0cf;
  --accent-ink: #04211f;
  --amber: #ffb648;
  --ball: #ff7a4d;
  --radius: 16px;
  --maxw: 1080px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    "Noto Sans KR", "Noto Sans JP", "Noto Sans SC", "Noto Sans TC", sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; display: block; }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.mono {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 0.08em;
}

/* skip link for keyboard users */
.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 10px 16px;
  z-index: 100;
  border-radius: 0 0 10px 0;
}
.skip:focus { left: 0; }

/* ---------------- header ---------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(7, 11, 18, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.site-header__in {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 60px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 800 15px/1 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.14em;
  color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand b { color: var(--accent); font-weight: 800; }
.brand__mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(140deg, #16283c, #0b1320);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.site-nav { display: none; margin-left: auto; gap: 22px; align-items: center; }
.site-nav a { color: var(--muted); font-size: 13.5px; font-weight: 500; }
.site-nav a:hover { color: var(--accent); text-decoration: none; }
@media (min-width: 900px) { .site-nav { display: flex; } }

.header-cta { margin-left: auto; }
@media (min-width: 900px) { .header-cta { margin-left: 0; } }

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 13px 22px;
  border-radius: 13px;
  border: 1px solid transparent;
  font: 700 14px/1 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: transform 0.09s ease, filter 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; filter: brightness(1.07); }
.btn:active { transform: translateY(1px); }
.btn--primary {
  color: var(--accent-ink);
  background: linear-gradient(180deg, #63f1e2, var(--accent));
  box-shadow: 0 8px 30px rgba(63, 224, 207, 0.22);
}
.btn--ghost {
  color: var(--text);
  background: var(--panel);
  border-color: var(--line-soft);
}
.btn--sm { padding: 9px 15px; font-size: 12px; }
.btn--block { width: 100%; }

/* ---------------- hero ---------------- */
.hero { position: relative; padding: 56px 0 44px; overflow: hidden; }
.hero::before {
  content: "";
  position: absolute;
  inset: -40% 0 auto 0;
  height: 620px;
  background: radial-gradient(60% 60% at 50% 40%, rgba(63, 224, 207, 0.16), transparent 70%);
  pointer-events: none;
}
.hero__grid { position: relative; display: grid; gap: 36px; }
@media (min-width: 900px) {
  .hero { padding: 80px 0 64px; }
  .hero__grid { grid-template-columns: 1.05fr 0.95fr; align-items: center; gap: 48px; }
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px;
  border-radius: 999px;
  background: rgba(63, 224, 207, 0.1);
  border: 1px solid var(--line);
  color: var(--accent);
  font: 600 11px/1 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.1em;
}
.badge__dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

.hero h1 {
  margin: 18px 0 14px;
  font-size: clamp(30px, 6.4vw, 50px);
  line-height: 1.12;
  letter-spacing: -0.02em;
  font-weight: 800;
}
.hero__p { margin: 0 0 26px; color: var(--muted); font-size: clamp(15px, 2.3vw, 17px); max-width: 52ch; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.hero__note { margin: 12px 0 0; color: var(--dim); font-size: 12.5px; }

.stats { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.stat {
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  font: 600 12px/1 ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--muted);
  letter-spacing: 0.06em;
}

/* playable preview */
.preview {
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #0d1622, #070d16);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  aspect-ratio: 9 / 16;
  max-height: 620px;
  margin: 0 auto;
  width: 100%;
  max-width: 340px;
}
.preview iframe { width: 100%; height: 100%; border: 0; display: block; }
.preview__poster {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  gap: 14px;
  align-content: center;
  cursor: pointer;
  background-size: cover;
  background-position: center;
  border: 0;
  width: 100%;
  color: inherit;
  font: inherit;
}
.preview__poster::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(7, 13, 22, 0.35), rgba(7, 13, 22, 0.75));
}
.preview__play {
  position: relative;
  z-index: 1;
  width: 68px; height: 68px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 0 0 10px rgba(63, 224, 207, 0.14), 0 14px 40px rgba(63, 224, 207, 0.3);
  transition: transform 0.15s;
}
.preview__poster:hover .preview__play { transform: scale(1.06); }
.preview__label {
  position: relative; z-index: 1;
  font: 700 12px/1 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.16em;
  color: var(--text);
}

/* ---------------- sections ---------------- */
.section { padding: 58px 0; border-top: 1px solid var(--line-soft); }
.section__head { max-width: 62ch; margin-bottom: 30px; }
.section h2 {
  margin: 0 0 10px;
  font-size: clamp(22px, 4vw, 30px);
  letter-spacing: -0.015em;
  font-weight: 750;
}
.section__sub { margin: 0; color: var(--muted); font-size: 15px; }
.eyebrow {
  display: block;
  margin-bottom: 10px;
  font: 700 11px/1 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.18em;
  color: var(--accent);
}

/* how to play */
.steps { display: grid; gap: 14px; counter-reset: step; }
@media (min-width: 760px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.step {
  padding: 22px 20px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line-soft);
}
.step::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  display: block;
  margin-bottom: 12px;
  font: 800 12px/1 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.16em;
  color: var(--accent);
}
.step h3 { margin: 0 0 7px; font-size: 16px; font-weight: 700; }
.step p { margin: 0; color: var(--muted); font-size: 14px; }

/* levels */
.levels { display: grid; gap: 10px; }
@media (min-width: 680px) { .levels { grid-template-columns: repeat(2, 1fr); } }
.level {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 14px;
  align-items: baseline;
  padding: 15px 17px;
  border-radius: 13px;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  transition: border-color 0.15s, background 0.15s;
}
.level:hover { border-color: var(--line); background: rgba(63, 224, 207, 0.05); }
.level__no {
  grid-row: span 2;
  font: 800 13px/1 ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--accent);
  letter-spacing: 0.08em;
}
.level__name { font-weight: 650; font-size: 15px; }
.level__teaches { color: var(--muted); font-size: 13.5px; }

/* records */
.records { border-radius: var(--radius); border: 1px solid var(--line-soft); overflow: hidden; background: var(--panel); }
.records__row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px 18px;
  border-top: 1px solid var(--line-soft);
  font-size: 14px;
}
.records__row:first-child { border-top: 0; }
.records__row--head {
  color: var(--dim);
  font: 600 11px/1 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.02);
}
.records__no { font: 700 12px/1 ui-monospace, Menlo, monospace; color: var(--accent); }
.records__time { font: 600 13px/1 ui-monospace, Menlo, monospace; color: var(--text); }
.records__time--none { color: var(--dim); font-weight: 400; }
.records__row--total { background: rgba(63, 224, 207, 0.06); font-weight: 700; }
.records__empty { padding: 26px 18px; color: var(--muted); font-size: 14px; text-align: center; }
.records__foot {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
  margin-top: 14px;
}
.records__note { margin: 0; color: var(--dim); font-size: 12.5px; max-width: 60ch; }

/* features */
.feats { display: grid; gap: 14px; }
@media (min-width: 680px) { .feats { grid-template-columns: repeat(2, 1fr); } }
.feat { padding: 20px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line-soft); }
.feat h3 { margin: 0 0 6px; font-size: 15.5px; font-weight: 700; }
.feat p { margin: 0; color: var(--muted); font-size: 14px; }
.feat__icon {
  width: 34px; height: 34px; border-radius: 10px; margin-bottom: 13px;
  display: grid; place-items: center;
  background: rgba(63, 224, 207, 0.1);
  border: 1px solid var(--line);
  color: var(--accent);
}

/* faq */
.faq { display: grid; gap: 8px; }
.faq details {
  border-radius: 13px;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  overflow: hidden;
}
.faq summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 48px 16px 18px;
  font-weight: 650;
  font-size: 15px;
  position: relative;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  position: absolute;
  right: 18px; top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  font: 400 20px/1 ui-monospace, monospace;
}
.faq details[open] summary::after { content: "\2212"; }
.faq p { margin: 0; padding: 0 18px 17px; color: var(--muted); font-size: 14px; }

/* share */
.share { display: flex; flex-wrap: wrap; gap: 9px; }
.share a, .share button {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 15px;
  border-radius: 11px;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.share a:hover, .share button:hover { border-color: var(--line); background: rgba(63, 224, 207, 0.07); text-decoration: none; }
.share__dot { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 auto; }

/* final cta */
.finalcta {
  margin: 0 0 58px;
  padding: 40px 28px;
  border-radius: 24px;
  text-align: center;
  background: linear-gradient(160deg, rgba(63, 224, 207, 0.13), rgba(63, 224, 207, 0.03));
  border: 1px solid var(--line);
}
.finalcta h2 { margin: 0 0 8px; font-size: clamp(21px, 4vw, 28px); }
.finalcta p { margin: 0 0 22px; color: var(--muted); }

/* footer */
.site-footer { border-top: 1px solid var(--line-soft); background: var(--bg-2); padding: 40px 0 32px; }
.footer__grid { display: grid; gap: 28px; }
@media (min-width: 760px) { .footer__grid { grid-template-columns: 1.2fr 1fr; } }
.footer h4 {
  margin: 0 0 12px;
  font: 700 11px/1 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.16em;
  color: var(--dim);
  text-transform: uppercase;
}
.footer__biz { color: var(--muted); font-size: 12.5px; line-height: 1.85; margin: 0; }
.footer__biz b { color: var(--text); font-weight: 650; }
.langs { display: flex; flex-wrap: wrap; gap: 7px; }
.langs a {
  padding: 6px 11px;
  border-radius: 9px;
  border: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 12.5px;
}
.langs a:hover { border-color: var(--line); color: var(--accent); text-decoration: none; }
.langs a[aria-current="true"] { border-color: var(--accent); color: var(--accent); background: rgba(63, 224, 207, 0.08); }
.footer__legal {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line-soft);
  display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center;
  color: var(--dim);
  font-size: 12.5px;
}
.footer__legal a { color: var(--muted); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 14px);
  padding: 11px 20px;
  border-radius: 999px;
  background: rgba(10, 18, 29, 0.95);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 90;
}
.toast.is-open { opacity: 1; transform: translate(-50%, 0); }

/* The author `display` rules above beat the UA rule for [hidden], so it has to
   be turned off explicitly - otherwise a hidden control still shows. */
[hidden] { display: none !important; }

/* ---------------- create your own (UGC) ---------------- */
.section--ugc .step--ugc::before { color: #ffc15a; }
.ugc__cta { margin-top: 22px; display: grid; justify-items: start; gap: 8px; }
@media (min-width: 760px) { .ugc__cta { justify-items: center; text-align: center; } }

/* ---------------- legal pages ---------------- */
.legal { max-width: 760px; padding-top: 36px; padding-bottom: 56px; line-height: 1.7; }
.legal h1 { font-size: clamp(24px, 4vw, 32px); line-height: 1.25; margin: 0 0 12px; }
.legal h2 { font-size: 18px; margin: 34px 0 10px; padding-top: 18px; border-top: 1px solid var(--line-soft); scroll-margin-top: 80px; }
.legal p, .legal li { color: var(--text); font-size: 15px; }
.legal p { margin: 0 0 12px; }
.legal ul { margin: 0 0 14px; padding-left: 22px; }
.legal li { margin-bottom: 6px; }
.legal code { font: 13px ui-monospace, "SF Mono", Menlo, monospace; padding: 1px 6px; border-radius: 6px; background: rgba(63, 224, 207, 0.08); color: var(--accent); word-break: break-all; }
.legal__table { overflow-x: auto; margin: 6px 0 16px; border: 1px solid var(--line-soft); border-radius: 12px; }
.legal table { width: 100%; border-collapse: collapse; font-size: 14px; }
.legal th, .legal td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); }
.legal tr:last-child th, .legal tr:last-child td { border-bottom: 0; }
.legal thead th { color: var(--muted); font-weight: 600; background: rgba(255, 255, 255, 0.02); }
.legal tbody th { font-weight: 600; white-space: nowrap; color: var(--muted); }
.legal__switch { margin-top: 36px; }
.legal .site-footer .langs { margin-bottom: 18px; }
.site-footer .langs + .footer__legal { margin-top: 20px; }

/* world records column */
.records--world .records__row { grid-template-columns: 34px minmax(0, 1fr) auto minmax(78px, auto); gap: 10px; }
.records__wr { display: grid; justify-items: end; gap: 3px; font: 600 13px/1 ui-monospace, Menlo, monospace; }
.records__wr b { color: var(--accent); }
.records__wr small { font: 500 11px/1 system-ui, sans-serif; color: var(--muted); max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 420px) { .records--world .records__row { padding: 11px 12px; font-size: 13px; } }

/* header language menu (a <details>, no script) */
.header-cta { display: flex; align-items: center; gap: 8px; }
.langpick { position: relative; }
.langpick summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 11px; border-radius: 10px; border: 1px solid var(--line-soft); background: rgba(255, 255, 255, 0.03); color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; user-select: none; }
.langpick summary::-webkit-details-marker { display: none; }
.langpick summary:hover, .langpick[open] summary { color: var(--text); border-color: var(--line); }
.langpick summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.langpick__menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; min-width: 190px; display: grid; gap: 2px; padding: 6px; border-radius: 14px; background: #0f1826; border: 1px solid var(--line); box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.9); }
.langpick__menu a { padding: 9px 12px; border-radius: 9px; color: var(--text); font-size: 14px; }
.langpick__menu a:hover { background: rgba(255, 255, 255, 0.05); text-decoration: none; }
.langpick__menu a[aria-current] { color: var(--accent); background: rgba(63, 224, 207, 0.1); }
@media (max-width: 520px) { .langpick summary span { display: none; } .langpick summary { width: 34px; justify-content: center; padding: 0; } }

/* ---------------- typesetting ----------------
   Korean breaks between words, never inside one; Japanese/Chinese use strict
   line breaking. Headings balance their lines, paragraphs avoid a lone last
   word (build_site also binds short tails with no-break spaces for browsers
   without text-wrap: pretty). */
:lang(ko) { word-break: keep-all; }
:lang(ja), :lang(zh-Hans), :lang(zh-Hant) { line-break: strict; }
body { overflow-wrap: break-word; }
h1, h2, h3, .step h3, .feat h3, summary { text-wrap: balance; }
p, li, .section__sub, .hero__p, dd { text-wrap: pretty; }
/* section titles get the room to stay on one line on desktop */
.section__head { max-width: 780px; }
.section__head .section__sub { max-width: 62ch; }
.keep { display: inline-block; }

/* welcome back strip (landing.js renderResume) */
.resume { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 18px; }
.resume[hidden] { display: none; }
.resume__hi { font-size: 13px; font-weight: 700; color: var(--text); margin-right: 2px; }
.resume__chip { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border-radius: 99px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line-soft); color: var(--text); font-size: 13px; font-weight: 600; text-decoration: none; }
.resume__chip:hover { border-color: var(--line); text-decoration: none; }
.resume__chip--go { background: rgba(63, 224, 207, 0.12); border-color: rgba(63, 224, 207, 0.4); color: var(--accent); }
.resume__chip b { font-size: 11px; }
.resume__star { color: #ffcf4a; }
.resume__flame { color: #ff9a3d; }
