/* ===========================
   Game pages — "Neon Refined"
   Shares its palette with the iOS games (Calculation 10 / Calculation Card Game).
   Used only by the two game pages; the portfolio keeps style.css.
   =========================== */

:root {
  --bg-top: #0c0722;
  --bg-mid: #150b33;
  --bg-bottom: #070a1c;
  --ink: #0c0722;
  --cyan: #22e3ff;
  --magenta: #ff3d9a;
  --amber: #ffc53d;
  --green: #3dffa2;
  --violet: #8b6cff;
  --text: #f4f2ff;
  --text-2: rgba(244, 242, 255, 0.68);
  --text-3: rgba(244, 242, 255, 0.42);
  --panel: rgba(255, 255, 255, 0.055);
  --panel-line: rgba(255, 255, 255, 0.1);
  --accent: var(--cyan);
  --font: ui-rounded, "SF Pro Rounded", "Hiragino Maru Gothic ProN", "Nunito",
    system-ui, -apple-system, "Segoe UI", sans-serif;
  --wrap: 1040px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  background:
    radial-gradient(900px 520px at 85% -8%, rgba(255, 61, 154, 0.16), transparent 62%),
    radial-gradient(760px 480px at 6% 4%, rgba(34, 227, 255, 0.13), transparent 60%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-mid) 46%, var(--bg-bottom) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }

/* Language switch: the page carries both languages, one is shown. */
html[data-lang="en"] [lang="ja"],
html[data-lang="ja"] [lang="en"] { display: none !important; }

/* ---------- Top bar ---------- */
.bar {
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(12, 7, 34, 0.72);
  border-bottom: 1px solid var(--panel-line);
}
.bar .wrap { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.bar__back { color: var(--text-2); font-weight: 700; font-size: 15px; }
.bar__back:hover { color: var(--text); text-decoration: none; }
.lang { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--panel); border: 1px solid var(--panel-line); }
.lang button {
  font: inherit; font-size: 13px; font-weight: 800; letter-spacing: 0.04em;
  color: var(--text-2); background: none; border: 0; border-radius: 999px;
  padding: 5px 13px; cursor: pointer;
}
.lang button[aria-pressed="true"] { background: var(--text); color: var(--ink); }
.lang button:focus-visible, .cta:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--amber); outline-offset: 3px;
}

/* ---------- Hero ---------- */
.hero { padding: 56px 0 28px; }
.hero__grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 36px; align-items: center; }
.hero__icon { width: 92px; height: 92px; border-radius: 22px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5); }
.eyebrow {
  margin-top: 22px; font-size: 13px; font-weight: 800; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--accent);
}
.hero h1 {
  margin-top: 8px; font-size: clamp(40px, 9vw, 68px); line-height: 1.04;
  font-weight: 900; letter-spacing: -0.02em;
}
.hero h1 em { font-style: normal; color: var(--accent); text-shadow: 0 0 34px color-mix(in srgb, var(--accent) 55%, transparent); }
.hero__lead { margin-top: 18px; max-width: 34em; font-size: 19px; color: var(--text-2); }
.hero__actions { margin-top: 28px; display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.hero__meta { font-size: 14px; color: var(--text-3); font-weight: 700; }

/* Keycap button — the same pressed-key look as the in-game buttons */
.cta {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 58px; padding: 0 28px; border-radius: 18px;
  font-size: 18px; font-weight: 900; letter-spacing: 0.02em;
  color: var(--ink); background: var(--accent);
  box-shadow: 0 6px 0 color-mix(in srgb, var(--accent) 58%, #000), 0 16px 40px color-mix(in srgb, var(--accent) 38%, transparent);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.cta:hover { text-decoration: none; transform: translateY(1px); }
.cta:active { transform: translateY(6px); box-shadow: 0 0 0 color-mix(in srgb, var(--accent) 58%, #000), 0 8px 20px color-mix(in srgb, var(--accent) 30%, transparent); }

/* ---------- Phone screenshots ---------- */
.phones { display: flex; gap: 14px; justify-content: center; }
.phone {
  flex: 1 1 0; max-width: 232px; aspect-ratio: 598 / 1300;
  border-radius: 26px; overflow: hidden; background: #000;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}
.phone img { width: 100%; height: 100%; object-fit: cover; }
.phone:nth-child(2) { transform: translateY(-18px); }

/* ---------- Sections ---------- */
section { padding: 44px 0; }
.label {
  font-size: 13px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--text-3); margin-bottom: 10px;
}
h2 { font-size: clamp(26px, 5vw, 36px); line-height: 1.2; font-weight: 900; letter-spacing: -0.01em; margin-bottom: 22px; }

.steps { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); counter-reset: step; list-style: none; }
.steps li {
  counter-increment: step; position: relative;
  padding: 22px 22px 22px 70px; border-radius: 20px;
  background: var(--panel); border: 1px solid var(--panel-line);
}
.steps li::before {
  content: counter(step); position: absolute; left: 20px; top: 22px;
  width: 36px; height: 36px; border-radius: 11px;
  display: grid; place-items: center;
  font-weight: 900; color: var(--ink); background: var(--accent);
  box-shadow: 0 4px 0 color-mix(in srgb, var(--accent) 58%, #000);
}
.steps strong { display: block; font-size: 18px; line-height: 1.35; }
.steps span { display: block; margin-top: 4px; color: var(--text-2); font-size: 15.5px; line-height: 1.6; }

/* Sample puzzle shown as in-game tiles */
.sample { margin-top: 18px; padding: 22px; border-radius: 20px; background: rgba(0, 0, 0, 0.28); border: 1px solid var(--panel-line); }
.sample__row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sample__row + .sample__row { margin-top: 14px; }
.sample__note { margin-top: 14px; color: var(--text-2); font-size: 15.5px; }
.tile {
  min-width: 46px; height: 50px; padding: 0 12px; border-radius: 13px;
  display: inline-grid; place-items: center;
  font-size: 22px; font-weight: 900; color: var(--ink); background: var(--cyan);
  box-shadow: 0 4px 0 #1596aa;
}
.tile--op { background: var(--magenta); color: #fff; box-shadow: 0 4px 0 #a9245f; }
.tile--par { background: var(--amber); box-shadow: 0 4px 0 #a97f1e; }
.tile--card { background: var(--violet); color: #fff; box-shadow: 0 4px 0 #4d37a6; }
.tile--eq { background: none; box-shadow: none; color: var(--green); min-width: 0; padding: 0 4px; }

.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card { padding: 22px; border-radius: 20px; background: var(--panel); border: 1px solid var(--panel-line); }
.card h3 { font-size: 18px; font-weight: 900; line-height: 1.35; }
.card h3::before { content: ""; display: block; width: 26px; height: 5px; border-radius: 3px; background: var(--dot, var(--accent)); margin-bottom: 14px; }
.card p { margin-top: 6px; color: var(--text-2); font-size: 15.5px; line-height: 1.65; }

.rules { width: 100%; border-collapse: collapse; border-radius: 20px; overflow: hidden; background: var(--panel); border: 1px solid var(--panel-line); }
.rules th, .rules td { text-align: left; padding: 14px 18px; vertical-align: top; border-top: 1px solid var(--panel-line); font-size: 15.5px; line-height: 1.6; }
.rules tr:first-child th, .rules tr:first-child td { border-top: 0; }
.rules th { width: 34%; font-weight: 800; color: var(--text); }
.rules td { color: var(--text-2); }
.rules b { color: var(--amber); font-weight: 900; }

details { border-radius: 16px; background: var(--panel); border: 1px solid var(--panel-line); }
details + details { margin-top: 10px; }
summary { cursor: pointer; list-style: none; padding: 16px 48px 16px 20px; font-weight: 800; position: relative; border-radius: 16px; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; position: absolute; right: 20px; top: 50%; transform: translateY(-50%); font-size: 22px; font-weight: 900; color: var(--accent); }
details[open] summary::after { content: "−"; }
details p { padding: 0 20px 18px; color: var(--text-2); font-size: 15.5px; }

.split { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.split .card p + p { margin-top: 10px; }

/* ---------- Footer ---------- */
.foot { margin-top: 28px; padding: 28px 0 44px; border-top: 1px solid var(--panel-line); color: var(--text-3); font-size: 14px; }
.foot .wrap { display: flex; flex-wrap: wrap; gap: 10px 22px; justify-content: space-between; }
.foot a { color: var(--text-2); font-weight: 700; }

/* ---------- Wider screens ---------- */
@media (min-width: 900px) {
  .hero { padding: 84px 0 44px; }
  .hero__grid { grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr); gap: 48px; }
  section { padding: 60px 0; }
}

@media (max-width: 520px) {
  body { font-size: 16px; }
  .phones { gap: 9px; }
  .phone { border-radius: 16px; }
  .phone:nth-child(2) { transform: translateY(-10px); }
  .rules th, .rules td { display: block; width: 100%; padding: 12px 16px; }
  .rules td { border-top: 0; padding-top: 0; }
}

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