/* Clatterbox / ピタゴラBOX landing — the game's own paper, ink and palette (game/Assets/Scripts/Core/Config.cs: Ink) */
:root {
  color-scheme: light;
  --paper: #F7F3EA; --dot: #DDD5C5; --ink: #2B2A33; --ink-soft: #5d5a66;
  --tomato: #EC5E42; --mustard: #F4B93A; --teal: #3AA6A0; --teal-l: #96D6CF; --wood: #ECD6B0; --stone: #DED8CC; --white: #FFFDF8;
  --r: 22px; --line: 3px;
  --font: "Fredoka", "Zen Maru Gothic", "Jua", system-ui, sans-serif;
  --wobble: 255px 15px 225px 15px / 15px 225px 15px 255px;
}
.lang-ja { --font: "Zen Maru Gothic", "Fredoka", system-ui, sans-serif; }
.lang-ko { --font: "Jua", "Fredoka", system-ui, sans-serif; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); font-family: var(--font); font-weight: 500; line-height: 1.7;
  background-color: var(--paper);
  background-image: radial-gradient(circle, var(--dot) 1.6px, transparent 1.9px);
  background-size: 26px 26px;
  overflow-x: hidden;
}
.lang-ja, .lang-ko { word-break: keep-all; overflow-wrap: anywhere; line-break: strict; }
img, video, canvas, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; z-index: 99; background: var(--white); padding: 6px 12px; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; border-radius: 6px; }

/* ---------- bar */
.bar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px;
  padding: 10px max(16px, calc((100vw - 1180px) / 2)); background: rgba(247, 243, 234, .92);
  backdrop-filter: blur(6px); border-bottom: 2px dashed rgba(43, 42, 51, .18);
}
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; font-size: 1.15rem; }
.logo img { border-radius: 9px; border: 2px solid var(--ink); }
.menu { display: flex; gap: 4px; margin-left: auto; }
.menu a { text-decoration: none; padding: 4px 10px; border-radius: 999px; font-size: .95rem; }
.menu a:hover { background: var(--wood); }
.langs { display: flex; gap: 2px; border: 2px solid var(--ink); border-radius: 999px; padding: 2px; background: var(--white); }
.langs a { text-decoration: none; font-size: .82rem; padding: 2px 9px; border-radius: 999px; }
.langs a[aria-current] { background: var(--ink); color: var(--paper); }
@media (max-width: 860px) { .menu { display: none; } .langs { margin-left: auto; } }

/* ---------- shared */
section { position: relative; padding: clamp(56px, 9vw, 120px) max(16px, calc((100vw - 1180px) / 2)); }
.band::before { content: ""; position: absolute; inset: 0; background: rgba(236, 214, 176, .28); border-block: 2px dashed rgba(43, 42, 51, .12); z-index: -1; }
.sec-head { max-width: 760px; margin-bottom: clamp(24px, 4vw, 48px); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .4em; font-weight: 700; letter-spacing: .01em; }
h2 { font-size: clamp(1.8rem, 4.4vw, 3rem); }
h3 { font-size: clamp(1.4rem, 3vw, 2rem); }
.sec-head p { font-size: clamp(1rem, 1.6vw, 1.15rem); color: var(--ink-soft); margin: 0; }
.sheet {
  margin: 0; background: var(--white); border: var(--line) solid var(--ink); border-radius: var(--r);
  box-shadow: 7px 8px 0 -1px var(--paper), 7px 8px 0 1px var(--ink); overflow: hidden; position: relative;
}
.btn {
  display: inline-flex; align-items: center; gap: .5em; padding: .75em 1.4em; border-radius: 999px; cursor: pointer;
  border: var(--line) solid var(--ink); background: var(--white); font-weight: 700; font-size: 1.05rem;
  box-shadow: 0 5px 0 var(--ink); transition: transform .12s, box-shadow .12s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 7px 0 var(--ink); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.btn.primary { background: var(--tomato); color: var(--white); }
.snd {
  position: absolute; right: 10px; bottom: 10px; z-index: 3; border: 2px solid var(--ink); border-radius: 999px;
  background: var(--white); padding: 4px 12px 4px 30px; font-size: .85rem; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 9h4l5-4v14l-5-4H4z' fill='%232B2A33'/%3E%3Cpath d='M16 9l5 6M21 9l-5 6' stroke='%23EC5E42' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-size: 18px; background-position: 8px center;
}
.snd[aria-pressed="true"] {
  background-color: var(--mustard);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 9h4l5-4v14l-5-4H4z' fill='%232B2A33'/%3E%3Cpath d='M16 8c2 2 2 6 0 8M19 5c4 4 4 10 0 14' stroke='%232B2A33' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
}
.phone { aspect-ratio: 886 / 1920; height: min(70vh, 640px); width: auto; border-radius: 26px; justify-self: center; }
@media (max-width: 700px) { .phone { height: auto; width: min(72vw, 300px); } }
.phone video { width: 100%; height: 100%; object-fit: cover; }
.hint { font-size: .95rem; color: var(--ink-soft); margin: 0 0 10px; }
.hint::before { content: "☞ "; color: var(--teal); }
.note { font-size: .82rem; color: var(--ink-soft); }

/* ---------- hero */
.hero { display: grid; grid-template-columns: 1.05fr 1fr; gap: clamp(24px, 4vw, 64px); align-items: center; padding-top: clamp(32px, 6vw, 80px); }
.eyebrow { display: inline-block; margin: 0 0 14px; padding: 4px 14px; border: 2px solid var(--ink); border-radius: 999px; background: var(--white); font-size: .92rem; }
.hero h1 { font-size: clamp(2.4rem, 6vw, 5.6rem); margin: 0 0 .1em; white-space: nowrap; }
@media (max-width: 860px) { .hero h1 { font-size: clamp(2.4rem, 11vw, 4.4rem); } }
.title-word { background: linear-gradient(transparent 62%, var(--mustard) 62%, var(--mustard) 92%, transparent 92%); padding: 0 .08em; }
.tagline { font-size: clamp(1.5rem, 3.4vw, 2.3rem); font-weight: 700; line-height: 1.35; margin: .2em 0 .5em; }
.lead { font-size: clamp(1rem, 1.8vw, 1.2rem); max-width: 34em; margin: 0 0 1.4em; }
.lead b { color: var(--tomato); }
.cta { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 22px; }
.cta.center { justify-content: center; }
.stores { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.badge img { height: 54px; width: auto; }
.soon { margin: 0; padding: 6px 14px; border: 2px dashed var(--ink); border-radius: 12px; font-weight: 700; background: var(--white); }
.fine { margin-top: 16px; font-size: .86rem; color: var(--ink-soft); }
.hero-media { aspect-ratio: 16 / 9; transform: rotate(1.2deg); }
.hero-media video { width: 100%; height: 100%; object-fit: cover; }
.hero-media figcaption, .grand-stage figcaption {
  position: absolute; left: 10px; bottom: 10px; font-size: .78rem; background: rgba(255, 253, 248, .9); padding: 2px 10px; border-radius: 999px; border: 2px solid var(--ink);
}
.doodle-ball { position: absolute; width: 58px; right: 6%; top: 18px; fill: var(--tomato); stroke: var(--ink); stroke-width: 3; animation: roll 7s linear infinite; }
.doodle-ball path { fill: none; stroke: var(--white); stroke-width: 3; }
@keyframes roll { 0% { transform: translateX(0) rotate(0) } 50% { transform: translateX(-60px) rotate(-200deg) } 100% { transform: translateX(0) rotate(0) } }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; } .doodle-ball { display: none; } }

/* ---------- how */
.how-grid { display: grid; grid-template-columns: auto 1fr; gap: clamp(24px, 5vw, 72px); align-items: center; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; counter-reset: s; }
.steps li {
  counter-increment: s; position: relative; padding: 18px 20px 18px 78px; background: var(--white); border: var(--line) solid var(--ink);
  border-radius: var(--wobble); transition: transform .25s, background .25s; opacity: .55;
}
.steps li::before {
  content: counter(s); position: absolute; left: 18px; top: 50%; translate: 0 -50%; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: 1.3rem; background: var(--paper); border: var(--line) solid var(--ink);
}
.steps li.on { opacity: 1; background: #fff7e2; transform: translateX(-6px) rotate(-.6deg); }
.steps li.on::before { background: var(--mustard); }
.steps li:nth-child(3).on::before { background: var(--tomato); color: var(--white); }
.steps h3 { margin: 0; font-size: 1.5rem; }
.steps p { margin: .2em 0 0; color: var(--ink-soft); }
@media (max-width: 700px) { .how-grid { grid-template-columns: 1fr; justify-items: center; } .steps li { opacity: 1; } }

/* ---------- fix */
.fix-grid { display: grid; grid-template-columns: auto 1fr; gap: clamp(24px, 5vw, 72px); align-items: center; }
.fix-screen video { position: absolute; inset: 0; }
.fix-control { max-width: 460px; }
.dial { width: min(240px, 70vw); aspect-ratio: 1; cursor: grab; touch-action: none; user-select: none; }
.dial:active { cursor: grabbing; }
.dial-ring { fill: var(--white); stroke: var(--ink); stroke-width: 3; stroke-dasharray: 8 8; }
.dial-plank rect { fill: var(--teal-l); stroke: var(--ink); stroke-width: 3; }
.dial-plank circle { fill: var(--white); stroke: var(--ink); stroke-width: 3; }
.dial-plank { transform-origin: 120px 120px; transition: transform .35s cubic-bezier(.3, 1.6, .5, 1); }
.dial-handle { transform-origin: 120px 120px; transition: transform .35s cubic-bezier(.3, 1.6, .5, 1); }
.dial-handle circle { fill: var(--white); stroke: var(--teal); stroke-width: 4; }
.dial-handle path { fill: none; stroke: var(--teal); stroke-width: 3; stroke-linecap: round; }
.dial-buttons { display: flex; gap: 10px; margin: 14px 0; }
.dial-buttons button { border: 2px solid var(--ink); background: var(--white); border-radius: 999px; padding: 6px 14px; cursor: pointer; }
.dial-buttons button[aria-pressed="true"] { background: var(--teal); color: var(--white); }
.result { font-size: 1.4rem; font-weight: 700; min-height: 2em; }
.result [data-r="fail"] { color: var(--tomato); }
.result [data-r="ok"] { display: inline-block; color: var(--tomato); border: 4px solid var(--tomato); border-radius: 50%; padding: 6px 16px; rotate: -8deg; }
@media (max-width: 700px) { .fix-grid { grid-template-columns: 1fr; justify-items: center; } }

/* ---------- sound */
.xylo { padding: 20px clamp(16px, 3vw, 32px) 26px; margin-bottom: clamp(32px, 6vw, 72px); }
.bars { display: flex; align-items: flex-end; gap: clamp(6px, 1.4vw, 14px); height: 190px; }
.bars button {
  flex: 1; border: var(--line) solid var(--ink); border-radius: 12px; cursor: pointer; position: relative;
  transition: transform .08s; touch-action: manipulation;
}
.bars button::after { content: ""; position: absolute; left: 50%; top: 10px; width: 9px; height: 9px; margin-left: -4px; border-radius: 50%; background: var(--white); border: 2px solid var(--ink); }
.bars button.hit { transform: translateY(6px) scaleY(.97); }
.xylo .chain { margin-top: 18px; font-size: .95rem; padding: .5em 1.1em; }
.ring { position: absolute; border: 3px solid var(--ink); border-radius: 50%; pointer-events: none; animation: ring .6s ease-out forwards; }
@keyframes ring { from { opacity: .7; transform: scale(.3); } to { opacity: 0; transform: scale(1.6); } }
.music-grid { display: grid; grid-template-columns: auto 1fr; gap: clamp(24px, 5vw, 72px); align-items: center; }
.music-copy p { color: var(--ink-soft); }
.beatline { position: relative; height: 54px; margin-top: 22px; border-bottom: 3px solid var(--ink); }
.beatline .tick { position: absolute; bottom: 0; width: 3px; height: 14px; background: var(--ink); border-radius: 2px; }
.beatline .tick.major { height: 26px; }
.beatline .tick.on { background: var(--tomato); }
.beatline .bell-mark { position: absolute; bottom: 30px; translate: -50% 0; font-size: .85rem; white-space: nowrap; font-weight: 700; }
.beatline .head { position: absolute; bottom: -8px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: var(--tomato); border: 2px solid var(--ink); }
.beatline.landed .bell-mark { animation: pop .5s; }
@keyframes pop { 50% { transform: scale(1.4); } }
@media (max-width: 700px) { .music-grid { grid-template-columns: 1fr; justify-items: center; } .bars { height: 150px; } }

/* ---------- machines */
.reel { display: grid; grid-auto-flow: column; grid-auto-columns: min(78vw, 420px); gap: 22px; overflow-x: auto; padding: 6px 8px 22px; scroll-snap-type: x mandatory; }
.reel figure { scroll-snap-align: start; aspect-ratio: 16 / 10; }
.reel video { width: 100%; height: 100%; object-fit: cover; }
.reel figcaption { position: absolute; left: 10px; top: 10px; background: var(--white); border: 2px solid var(--ink); border-radius: 999px; padding: 0 12px; font-size: .9rem; }
.facts { list-style: none; padding: 0; margin: clamp(32px, 6vw, 64px) 0 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.facts li { text-align: center; padding: 18px 8px; border: var(--line) solid var(--ink); border-radius: var(--wobble); background: var(--white); }
.facts b { display: block; font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 1.1; color: var(--tomato); }
@media (max-width: 700px) { .facts { grid-template-columns: repeat(2, 1fr); } }

/* ---------- grand machine (scroll-scrubbed) */
.grand { height: 320vh; padding-top: 0; padding-bottom: 0; }
.grand-sticky { position: sticky; top: 64px; padding-top: clamp(24px, 5vw, 56px); }
.grand-stage { aspect-ratio: 16 / 9; max-height: 62vh; margin: 0 auto; }
.grand-stage canvas { width: 100%; height: 100%; object-fit: cover; background: var(--paper); }
.grand-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 8px; background: rgba(43, 42, 51, .12); }
.grand-progress span { display: block; height: 100%; width: 0; background: var(--tomato); }
.trail { position: absolute; right: max(8px, calc((100vw - 1180px) / 2 - 70px)); top: 0; width: 60px; height: 100%; pointer-events: none; }
.trail path { fill: none; stroke: var(--tomato); stroke-dasharray: 0.01 2.2; stroke-linecap: round; vector-effect: non-scaling-stroke; stroke-width: 6; }
@media (max-width: 860px) { .trail { display: none; } .grand { height: 260vh; } }

/* ---------- details / final / foot */
.checks { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 28px; }
.checks li { padding-left: 38px; position: relative; font-size: 1.05rem; }
.checks li::before { content: ""; position: absolute; left: 0; top: .35em; width: 22px; height: 22px; border: var(--line) solid var(--ink); border-radius: 50%; background: var(--teal); box-shadow: inset 0 0 0 4px var(--white); }
@media (max-width: 700px) { .checks { grid-template-columns: 1fr; } }
.final { text-align: center; }
.final-icon { margin: 0 auto 16px; border-radius: 28px; border: var(--line) solid var(--ink); box-shadow: 6px 7px 0 var(--ink); }
.foot { padding: 32px 16px 48px; text-align: center; font-size: .9rem; color: var(--ink-soft); border-top: 2px dashed rgba(43, 42, 51, .18); }

/* ---------- trailer dialog */
dialog.trailer { border: 0; padding: 0; background: transparent; max-width: min(96vw, 1200px); width: 100%; }
dialog.trailer::backdrop { background: rgba(43, 42, 51, .72); }
.trailer-box { position: relative; aspect-ratio: 16 / 9; background: #000; border: var(--line) solid var(--ink); border-radius: 18px; overflow: hidden; }
.trailer-frame, .trailer-frame video, .trailer-frame iframe { width: 100%; height: 100%; border: 0; }
.close { position: absolute; right: 8px; top: 8px; z-index: 2; width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--ink); background: var(--white); cursor: pointer; }

/* ---------- reveal */
.rv { opacity: 0; transform: translateY(18px); transition: opacity .6s, transform .6s; }
.rv.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .rv { opacity: 1; transform: none; transition: none; }
  .doodle-ball { animation: none; }
  .grand { height: auto; }
  .grand-sticky { position: static; }
  .hero-media { transform: none; }
}
