/* Sudoku Flow — dark-first, matching the videos. Light follows the system. */
:root {
  --bg: #050708;
  --bg-lift: #0d1216;
  --surface: #0f1417;
  --surface-2: #161b1f;
  --line: #232a30;
  --text: #e6ecf1;
  --muted: #98a2ab;
  --accent: #90caf9;
  --accent-ink: #06121c;
  --entry: #87c6f8;
  --amber: #ffa726;
  --radius: 20px;
  --max: 1120px;
  --font: system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}
:root:lang(ja) {
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", system-ui, sans-serif;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f8fa;
    --bg-lift: #ffffff;
    --surface: #ffffff;
    --surface-2: #eef2f5;
    --line: #dde3e8;
    --text: #14171a;
    --muted: #5b636a;
    --accent: #1565c0;
    --accent-ink: #ffffff;
    --entry: #2881e7;
    --amber: #e65100;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: radial-gradient(1200px 700px at 70% -10%, var(--bg-lift), var(--bg) 70%) no-repeat, var(--bg);
  color: var(--text);
  font: 17px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img, video { display: block; max-width: 100%; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 20px; }
.skip { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
.skip:focus { clip-path: none; width: auto; height: auto; padding: 8px 12px; background: var(--surface); z-index: 10; }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 22px 0; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; font-weight: 700; font-size: 19px; letter-spacing: .2px; }
.brand img { width: 34px; height: 34px; }
.nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.nav a { text-decoration: none; color: var(--muted); font-size: 15px; padding: 8px 12px; border-radius: 999px; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
.nav .lang { border: 1px solid var(--line); }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 10px; padding: 13px 20px; border-radius: 14px; font-weight: 650; font-size: 16px; text-decoration: none; border: 1px solid var(--line); background: var(--surface); }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.06); }
.btn small { display: block; font-weight: 500; font-size: 12px; opacity: .75; line-height: 1.2; }
.btn span { line-height: 1.25; }
.row { display: flex; flex-wrap: wrap; gap: 12px; }

/* hero */
.hero { display: grid; grid-template-columns: 1.15fr .85fr; gap: 56px; align-items: center; padding: 40px 0 72px; }
.eyebrow { display: inline-block; color: var(--accent); font-weight: 650; font-size: 14px; letter-spacing: .6px; text-transform: uppercase; margin-bottom: 14px; }
:lang(ja) .eyebrow { text-transform: none; letter-spacing: .2px; }
h1 { text-wrap: balance; font-size: clamp(38px, 6vw, 64px); line-height: 1.05; letter-spacing: -1.2px; margin: 0 0 20px; font-weight: 800; }
:lang(ja) h1 { letter-spacing: 0; line-height: 1.2; }
.lead { font-size: 19px; color: var(--muted); max-width: 34em; margin: 0 0 28px; }
.phone { position: relative; width: 100%; max-width: 360px; justify-self: center; aspect-ratio: 9 / 16; border-radius: 28px; overflow: hidden; background: #050708; box-shadow: 0 30px 80px rgba(0,0,0,.45), 0 0 0 1px var(--line); }
.phone video { width: 100%; height: 100%; object-fit: cover; }

/* sections */
section { padding: 8px 0 64px; }
.head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
h2 { font-size: 28px; letter-spacing: -.4px; margin: 0; }
:lang(ja) h2 { letter-spacing: 0; }
.head a { color: var(--muted); font-size: 15px; text-decoration: none; }
.head a:hover { color: var(--text); }

/* cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 20px; }
.card { text-decoration: none; display: block; }
.card .thumb { position: relative; aspect-ratio: 4 / 5; border-radius: 18px; overflow: hidden; background: #050708; box-shadow: 0 0 0 1px var(--line); }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; transition: transform .4s cubic-bezier(.2,.8,.2,1); }
.card:hover .thumb img { transform: scale(1.03); }
.card .play { position: absolute; right: 12px; bottom: 12px; width: 40px; height: 40px; border-radius: 50%; background: rgba(5,7,8,.72); display: grid; place-items: center; backdrop-filter: blur(6px); }
.card .play::before { content: ""; border-left: 12px solid #e6ecf1; border-top: 7px solid transparent; border-bottom: 7px solid transparent; margin-left: 3px; }
.card .t { margin-top: 12px; font-weight: 650; font-size: 16px; }
.card .m { color: var(--muted); font-size: 14px; }

/* learn + app panels */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 32px; }
.panel p { color: var(--muted); max-width: 46em; }
.app { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center; }
.app img.icon { width: 96px; height: 96px; border-radius: 22px; box-shadow: 0 0 0 1px var(--line); }
.app h2 { margin-bottom: 8px; }
.app p { margin: 0 0 20px; }
.note { color: var(--muted); font-size: 14px; margin-top: 18px; }

/* puzzle page */
.crumbs { color: var(--muted); font-size: 14px; margin: 6px 0 22px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--text); }
.puzzle { display: grid; grid-template-columns: minmax(0, 380px) 1fr; gap: 56px; align-items: start; padding-bottom: 64px; }
.puzzle .phone { max-width: 380px; }
.puzzle h1 { font-size: clamp(34px, 5vw, 52px); }
.legend { display: flex; gap: 22px; flex-wrap: wrap; margin: 22px 0; padding: 0; list-style: none; color: var(--muted); font-size: 15px; }
.legend li { display: flex; align-items: center; gap: 10px; }
.legend b { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--surface-2); font-weight: 500; font-size: 20px; }
.legend .g { color: var(--text); }
.legend .e { color: var(--entry); }
details { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); margin: 8px 0 22px; }
summary { cursor: pointer; padding: 16px 20px; font-weight: 650; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; float: right; color: var(--muted); }
details[open] summary::after { content: "−"; }
details p { margin: 0; padding: 0 20px 18px; color: var(--text); }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; }
.pager a { color: var(--muted); text-decoration: none; font-size: 15px; }
.pager a:hover { color: var(--text); }
.prose { max-width: 42em; padding-bottom: 56px; }
.prose p { color: var(--muted); }

/* footer */
footer { border-top: 1px solid var(--line); padding: 32px 0 48px; color: var(--muted); font-size: 14px; }
footer .links { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 12px; }
footer a { color: var(--muted); }
footer a:hover { color: var(--text); }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 36px; padding: 16px 0 56px; }
  .phone { max-width: 320px; }
  .puzzle { grid-template-columns: 1fr; gap: 28px; }
  .puzzle .phone { justify-self: center; }
}
@media (max-width: 560px) {
  .top { flex-direction: column; align-items: flex-start; gap: 10px; padding: 16px 0; }
  .nav { justify-content: flex-start; margin-left: -12px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .app { grid-template-columns: 1fr; gap: 18px; }
  .panel { padding: 24px; }
  .btn { flex: 1 1 auto; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .card .thumb img { transition: none; }
}

/* playable board (same digits as the video) */
.play-board { margin: 26px 0 18px; }
.play-board h2 { font-size: 20px; margin: 0 0 4px; }
.play-board .hint { color: var(--muted); margin: 0 0 14px; font-size: 15px; }
.board { display: grid; grid-template-columns: repeat(9, 1fr); width: min(100%, 432px); aspect-ratio: 1; background: var(--surface-2); border: 2px solid var(--text); border-radius: 10px; overflow: hidden; }
.board > * { display: grid; place-items: center; border: 0; margin: 0; padding: 0; background: transparent; color: var(--text); font: 400 clamp(17px, 4.6vw, 26px)/1 "Helvetica Neue", Arial, system-ui, sans-serif; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0; }
.board > *:nth-child(9n) { border-right: 0; }
.board > *:nth-last-child(-n+9) { border-bottom: 0; }
.board .br { border-right: 2px solid var(--text); }
.board .bb { border-bottom: 2px solid var(--text); }
.board .e { color: var(--entry); }
.board button { cursor: pointer; }
.board button:hover { background: rgba(144, 202, 249, .10); }
.board button:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.board .miss { animation: miss .35s ease; }
.board .pair { color: var(--amber); box-shadow: inset 0 0 0 3px var(--amber); }
.board .hit { color: var(--entry); box-shadow: inset 0 0 0 3px var(--accent); background: rgba(144, 202, 249, .14); }
@keyframes miss { 0%, 100% { transform: none; } 30% { transform: translateX(-3px); } 70% { transform: translateX(3px); } }
.fb { min-height: 1.6em; margin: 12px 0 0; font-weight: 600; }
h2.small { font-size: 18px; margin-top: 8px; }
.app p.note { margin: 18px 0 0; }
.eyebrow a { color: inherit; text-decoration: none; }
.prose h2 { margin-top: 36px; }
.prose ol, .prose ul { color: var(--muted); padding-left: 1.2em; }
.prose li { margin: 8px 0; }
@media (prefers-reduced-motion: reduce) { .board .miss { animation: none; } }

/* poster → YouTube player (loads nothing from YouTube until pressed) */
.phone > img, .phone button img { width: 100%; height: 100%; object-fit: cover; }
.phone button { all: unset; display: block; width: 100%; height: 100%; cursor: pointer; position: relative; }
.phone button:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.phone iframe { width: 100%; height: 100%; border: 0; display: block; }
.play.big, .phone .play.big { position: absolute; left: 50%; top: 84%; width: 76px; height: 76px; margin: -38px 0 0 -38px; border-radius: 50%; background: rgba(5,7,8,.72); display: grid; place-items: center; backdrop-filter: blur(6px); box-shadow: 0 0 0 1px rgba(230,236,241,.18); }
.play.big::before { content: ""; border-left: 22px solid #e6ecf1; border-top: 13px solid transparent; border-bottom: 13px solid transparent; margin-left: 6px; }
