:root {
  --ink: #18223d;
  --muted: #66708a;
  --cream: #fff8e8;
  --paper: #fffdf8;
  --coral: #ff6b55;
  --yellow: #ffc83d;
  --blue: #2c6bed;
  --mint: #3ac7a1;
  --skin: #ffbe91;
  --skin-dark: #f49a69;
  --shadow: 0 16px 40px rgb(24 34 61 / 12%);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Hiragino Maru Gothic ProN", "Yu Gothic", system-ui, sans-serif;
  font-weight: 700;
}
button, a { font: inherit; }
button { color: inherit; }
a { color: inherit; }

.advertising-note {
  margin: 0;
  padding: 7px 24px;
  color: var(--muted);
  background: var(--cream);
  text-align: center;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .04em;
}

.hero {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(24px, 6vw, 84px);
  background: var(--cream);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-size: 15px; }
.brand-mark {
  width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px;
  color: white; background: var(--coral); font-size: 13px; letter-spacing: -2px; transform: rotate(-4deg);
}
.header-link { font-size: 13px; text-underline-offset: 5px; }

.intro {
  min-height: 620px;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  align-items: center;
  padding: 70px clamp(24px, 8vw, 120px) 100px;
  overflow: hidden;
  background: var(--cream);
  border-radius: 0 0 48px 48px;
}
.eyebrow { margin: 0 0 15px; color: var(--coral); font-size: 13px; letter-spacing: .15em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 22px; font-size: clamp(43px, 6vw, 78px); line-height: 1.18; letter-spacing: .02em; }
h1 em { color: var(--blue); font-style: normal; background: linear-gradient(transparent 70%, #bad4ff 0); }
.lead { margin-bottom: 32px; color: var(--muted); font-size: clamp(16px, 2vw, 21px); }
.lead strong { color: var(--coral); font-size: 1.5em; }
.primary-button, .secondary-button {
  display: inline-flex; gap: 20px; align-items: center; border: 0; border-radius: 999px;
  padding: 17px 26px; color: white; background: var(--ink); text-decoration: none; cursor: pointer;
  box-shadow: 0 8px 0 rgb(24 34 61 / 16%); transition: transform .2s, box-shadow .2s;
}
.primary-button:hover, .secondary-button:hover { transform: translateY(-2px); box-shadow: 0 10px 0 rgb(24 34 61 / 16%); }
.primary-button:active, .secondary-button:active { transform: translateY(4px); box-shadow: 0 3px 0 rgb(24 34 61 / 16%); }
.hero-visual { position: relative; display: grid; place-items: center; min-height: 430px; }
.hero-hand { font-size: clamp(220px, 29vw, 390px); filter: drop-shadow(0 25px 15px rgb(24 34 61 / 12%)); animation: hello 2.5s ease-in-out infinite; transform-origin: bottom center; }
.float-bit { position: absolute; display: grid; place-items: center; border-radius: 50%; font-size: 31px; box-shadow: var(--shadow); animation: float 3s ease-in-out infinite; }
.bit-one { width: 90px; height: 90px; left: 2%; top: 8%; color: white; background: var(--blue); }
.bit-zero { width: 72px; height: 72px; right: 5%; bottom: 13%; color: var(--ink); background: var(--yellow); animation-delay: -.8s; }
.spark { position: absolute; color: var(--coral); }
.spark-a { right: 8%; top: 12%; font-size: 45px; }
.spark-b { left: 8%; bottom: 18%; color: var(--mint); font-size: 25px; }

.rule-section { max-width: 1120px; margin: 0 auto; padding: 100px 30px; display: grid; grid-template-columns: 60px 1fr 1.45fr; gap: 28px; align-items: center; }
.section-number { width: 48px; height: 48px; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 50%; font-size: 13px; }
h2 { font-size: clamp(31px, 4vw, 52px); line-height: 1.25; }
.rule-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.rule-card { min-height: 180px; padding: 24px; display: flex; flex-direction: column; justify-content: space-between; border-radius: 28px; }
.closed-card { background: #e9efff; }
.open-card { background: #fff0c7; transform: rotate(2deg); }
.rule-icon { font-size: 57px; }
.rule-card div { display: flex; flex-direction: column; }
.rule-card strong { font-size: 22px; }
.rule-card span:last-child { color: var(--muted); font-size: 13px; margin-top: 5px; }

.play-section { padding: 90px clamp(20px, 7vw, 100px) 110px; background: #eaf3ff; border-radius: 48px; }
.section-heading { max-width: 1080px; margin: 0 auto 45px; display: flex; align-items: end; justify-content: space-between; }
.section-heading h2 { margin-bottom: 0; }
.hint { color: var(--muted); line-height: 1.8; font-size: 14px; }
.playground { max-width: 1080px; min-height: 530px; margin: auto; display: grid; grid-template-columns: 1.5fr .8fr; align-items: center; gap: 44px; padding: 45px; border: 3px solid var(--ink); border-radius: 35px; background: white; box-shadow: 12px 12px 0 var(--ink); }
.challenge-banner {
  grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; gap: 18px;
  margin-bottom: -15px; padding: 12px 20px; border-radius: 18px; background: var(--cream); text-align: center;
}
.challenge-banner > span { color: var(--muted); font-size: 11px; letter-spacing: .12em; }
.challenge-banner p { margin: 0; font-size: 18px; }
.challenge-banner strong { display: inline-grid; place-items: center; width: 42px; height: 42px; margin-right: 3px; border-radius: 50%; color: white; background: var(--coral); font-size: 24px; }
.challenge-banner button {
  margin-left: auto; padding: 9px 14px; border: 2px solid var(--ink); border-radius: 999px;
  color: var(--ink); background: white; font-size: 11px; cursor: pointer; white-space: nowrap;
}
.challenge-banner button:hover { color: white; background: var(--ink); }
.challenge-banner.solved { color: white; background: var(--mint); }
.challenge-banner.solved > span { color: white; }
.challenge-banner.solved strong { color: var(--ink); background: var(--yellow); }
.hand-area { position: relative; min-height: 430px; }
.finger-values { height: 60px; display: grid; grid-template-columns: repeat(4, 1fr) 1.1fr; gap: 7px; align-items: end; text-align: center; }
.finger-values span { color: var(--blue); font-size: 20px; }
.finger-values small { display: block; color: var(--muted); font-size: 9px; }
.hand { position: relative; height: 370px; max-width: 570px; margin: 0 auto; }
.finger {
  position: absolute; z-index: 2; bottom: 125px; width: 76px; border: 3px solid var(--ink); border-radius: 40px 40px 25px 25px;
  background: var(--skin); cursor: pointer; transform-origin: 50% 95%; transition: height .35s cubic-bezier(.2,.8,.2,1), transform .35s, background .2s;
  box-shadow: inset -8px -4px 0 rgb(244 154 105 / 32%);
}
.finger::after { content: "0"; position: absolute; top: 17px; left: 50%; translate: -50%; color: rgb(24 34 61 / 35%); font-size: 18px; }
.finger[aria-pressed="true"] { background: #ffcfaa; }
.finger[aria-pressed="true"]::after { content: "1"; color: var(--blue); }
.pinky { left: 3%; height: 145px; transform: translateY(85px) rotate(-5deg); }
.ring { left: 21%; height: 205px; transform: translateY(115px); }
.middle { left: 39%; height: 235px; transform: translateY(130px); }
.index { left: 57%; height: 215px; transform: translateY(118px); }
.thumb { left: 77%; bottom: 93px; height: 155px; transform: translateY(86px) rotate(45deg); }
.finger[aria-pressed="true"] { transform: translateY(0) rotate(0); }
.thumb[aria-pressed="true"] { transform: translateY(0) rotate(45deg); }
.palm { position: absolute; left: 17%; bottom: 0; width: 65%; height: 165px; z-index: 3; display: grid; place-items: center; border: 3px solid var(--ink); border-radius: 35px 35px 70px 70px; background: var(--skin); box-shadow: inset -16px -8px 0 rgb(244 154 105 / 32%); }
.palm span { color: rgb(24 34 61 / 40%); font-size: 12px; letter-spacing: .2em; }
.number-panel { padding-left: 38px; text-align: center; border-left: 2px dashed #b9c9e1; }
.number-panel > p:first-child { color: var(--muted); font-size: 13px; }
#decimal-value { display: block; color: var(--coral); font-size: 100px; line-height: 1; font-variant-numeric: tabular-nums; }
.binary-row { margin: 14px 0; padding: 12px; border-radius: 13px; color: white; background: var(--ink); font-family: ui-monospace, monospace; font-size: 24px; letter-spacing: .12em; }
.binary-row small { letter-spacing: 0; }
.sum { min-height: 42px; color: var(--muted); font-size: 13px; }
.step-controls { display: flex; justify-content: center; gap: 8px; }
.step-controls button { min-width: 43px; height: 43px; border: 2px solid var(--ink); border-radius: 50%; background: white; cursor: pointer; }
.step-controls #reset-button { padding: 0 15px; border-radius: 999px; font-size: 11px; }
.step-controls button:hover { color: white; background: var(--blue); }

.quiz-section { max-width: 1080px; margin: 100px auto; padding: 70px; display: grid; grid-template-columns: 1fr .7fr; align-items: center; border-radius: 40px; color: white; background: var(--blue); overflow: hidden; }
.quiz-section .section-number { border-color: white; }
.quiz-section .eyebrow { color: var(--yellow); }
.quiz-copy h2 { margin-bottom: 18px; }
.quiz-copy h2 span { display: inline-grid; place-items: center; width: 75px; height: 75px; border-radius: 50%; color: var(--ink); background: var(--yellow); transform: rotate(-6deg); }
.quiz-copy > p:not(.eyebrow, .section-number) { color: #dce7ff; font-size: 14px; }
.secondary-button { margin-top: 16px; color: var(--ink); background: white; font-size: 13px; }
.quiz-badge { justify-self: center; width: 240px; height: 240px; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 3px dashed white; border-radius: 50%; animation: bob 2.5s ease-in-out infinite; }
.quiz-badge strong { color: var(--yellow); font-size: 85px; line-height: 1; }
.quiz-badge span { font-size: 13px; }
.quiz-section.solved { background: var(--mint); }
.quiz-section.solved .quiz-badge { animation: celebrate .7s ease both; }

.fact-section { position: relative; padding: 110px 24px 150px; text-align: center; overflow: hidden; }
.fact-section h2 strong { color: var(--coral); font-size: 1.3em; }
.fact-section > p:not(.eyebrow) { max-width: 600px; margin: 0 auto; color: var(--muted); line-height: 2; }
.binary-tape { position: absolute; bottom: 35px; left: -3%; width: 106%; padding: 15px; color: var(--blue); background: #eaf3ff; font-family: ui-monospace, monospace; font-size: 23px; letter-spacing: .15em; transform: rotate(-2deg); white-space: nowrap; }

.book-section {
  max-width: 1080px; margin: 20px auto 110px; padding: 70px; display: grid;
  grid-template-columns: .75fr 1.25fr; align-items: center; gap: clamp(45px, 7vw, 90px);
  border-radius: 40px; background: #fff0c7;
}
.book-visual { position: relative; min-height: 340px; display: grid; place-items: center; }
.book-cover {
  width: 220px; min-height: 300px; padding: 28px 24px; display: flex; flex-direction: column;
  border: 3px solid var(--ink); border-radius: 4px 18px 18px 4px; color: var(--ink); background: var(--yellow);
  box-shadow: -9px 10px 0 var(--coral), 0 22px 30px rgb(24 34 61 / 18%); transform: rotate(-5deg);
}
.book-cover span { font-size: 13px; line-height: 1.5; }
.book-cover strong { margin: 22px 0 auto; font-size: 33px; line-height: 1.12; }
.book-cover small { align-self: end; padding: 5px 9px; border-radius: 999px; color: white; background: var(--blue); }
.book-spark { position: absolute; display: grid; place-items: center; }
.book-spark-a { top: 3%; right: 3%; color: var(--coral); font-size: 36px; }
.book-spark-b { left: 0; bottom: 8%; width: 55px; height: 55px; border-radius: 50%; color: white; background: var(--blue); font-size: 14px; transform: rotate(8deg); }
.book-copy h2 { margin-bottom: 24px; }
.book-copy > p:not(.eyebrow, .affiliate-label) { color: var(--muted); font-size: 14px; line-height: 2; }
.book-link {
  margin-top: 12px; padding: 17px 22px; display: inline-flex; align-items: center; gap: 18px;
  border-radius: 999px; color: white; background: var(--ink); text-decoration: none;
  box-shadow: 0 7px 0 rgb(24 34 61 / 16%); transition: transform .2s, box-shadow .2s;
}
.book-link:hover { transform: translateY(-2px); box-shadow: 0 9px 0 rgb(24 34 61 / 16%); }
.affiliate-label { margin: 13px 0 0 8px; color: var(--muted); font-size: 10px; font-weight: 500; }
footer { padding: 55px 24px; display: flex; flex-direction: column; align-items: center; gap: 8px; color: white; background: var(--ink); }
footer p { margin: 4px 0 0; }
footer small { color: #aeb6ca; font-size: 11px; }
.associate-disclosure { max-width: 620px; margin-top: 22px; padding-top: 22px; border-top: 1px solid rgb(255 255 255 / 15%); text-align: center; line-height: 1.7; }

button:focus-visible, a:focus-visible { outline: 4px solid var(--yellow); outline-offset: 4px; }
@keyframes hello { 0%,100% { transform: rotate(-5deg); } 50% { transform: rotate(6deg); } }
@keyframes float { 0%,100% { transform: translateY(0) rotate(-5deg); } 50% { transform: translateY(-15px) rotate(5deg); } }
@keyframes bob { 0%,100% { transform: rotate(3deg) translateY(0); } 50% { transform: rotate(-3deg) translateY(-8px); } }
@keyframes celebrate { 50% { transform: scale(1.18) rotate(8deg); } }

@media (max-width: 800px) {
  .intro { min-height: auto; grid-template-columns: 1fr; padding-top: 55px; text-align: center; }
  .hero-visual { min-height: 330px; }
  .hero-hand { font-size: 240px; }
  .rule-section { grid-template-columns: 50px 1fr; }
  .rule-cards { grid-column: 1 / -1; }
  .section-heading { display: block; }
  .hint { margin-top: 20px; }
  .playground { grid-template-columns: 1fr; padding: 30px 18px; box-shadow: 7px 7px 0 var(--ink); }
  .challenge-banner { margin-bottom: -20px; }
  .number-panel { padding: 30px 0 0; border-left: 0; border-top: 2px dashed #b9c9e1; }
  .quiz-section { margin: 70px 20px; padding: 45px 25px; grid-template-columns: 1fr; text-align: center; }
  .quiz-section .section-number { margin-inline: auto; }
  .quiz-badge { width: 170px; height: 170px; margin-top: 40px; }
  .quiz-badge strong { font-size: 60px; }
  .book-section { margin: 70px 20px; padding: 50px 28px; grid-template-columns: 1fr; text-align: center; }
  .book-copy > p:not(.eyebrow, .affiliate-label) { text-align: left; }
}

@media (max-width: 520px) {
  .hero { height: 66px; }
  .header-link { display: none; }
  .intro { border-radius: 0 0 30px 30px; padding-inline: 20px; }
  h1 { font-size: 39px; }
  .rule-section { padding: 75px 20px; grid-template-columns: 1fr; }
  .rule-section .section-number { display: none; }
  .rule-cards { grid-template-columns: 1fr 1fr; }
  .rule-card { min-height: 145px; padding: 18px; }
  .rule-icon { font-size: 42px; }
  .rule-card strong { font-size: 18px; }
  .play-section { padding: 70px 10px 80px; border-radius: 30px; }
  .section-heading { padding-inline: 10px; }
  .playground { border-width: 2px; border-radius: 25px; }
  .challenge-banner { gap: 9px; padding-inline: 10px; }
  .challenge-banner p { font-size: 15px; }
  .challenge-banner > span { display: none; }
  .challenge-banner button { padding-inline: 11px; }
  .hand-area { min-height: 345px; }
  .hand { height: 290px; }
  .finger { width: 17%; bottom: 100px; border-width: 2px; }
  .pinky { height: 115px; transform: translateY(67px) rotate(-5deg); }
  .ring { height: 160px; transform: translateY(88px); }
  .middle { height: 185px; transform: translateY(101px); }
  .index { height: 170px; transform: translateY(92px); }
  .thumb { height: 122px; bottom: 75px; transform: translateY(65px) rotate(45deg); }
  .palm { height: 130px; border-width: 2px; }
  .finger-values span { font-size: 15px; }
  .finger-values small { display: none; }
  #decimal-value { font-size: 80px; }
  .book-section { margin-inline: 12px; padding-inline: 20px; }
  .book-visual { min-height: 300px; }
  .book-cover { width: 190px; min-height: 270px; }
  .book-cover strong { font-size: 29px; }
  .book-link { padding-inline: 18px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

