@import url('https://fonts.googleapis.com/css2?family=Gowun+Dodum&family=Jua&family=Nunito:wght@700;800;900&display=swap');

:root {
  --navy: #102a43;
  --navy-soft: #173d5c;
  --cream: #fffaf0;
  --paper: #fffef9;
  --coral: #ef6f5e;
  --coral-dark: #d85244;
  --sun: #ffc857;
  --mint: #65c3ad;
  --sky: #b9dff2;
  --line: #dbe4e8;
  --muted: #657786;
  --shadow: 0 22px 70px rgba(16, 42, 67, 0.12);
  --soft-shadow: 0 10px 30px rgba(16, 42, 67, 0.09);
  --abacus-frame-border: #572b19;
  --abacus-frame-light: #b96f3d;
  --abacus-frame-mid: #8c4b29;
  --abacus-frame-dark: #60301d;
  --abacus-grain: rgba(67,27,12,.13);
  --abacus-board-light: #26302f;
  --abacus-board-mid: #151d1c;
  --abacus-board-dark: #0b1111;
  --abacus-rim: #3d2015;
  --abacus-rim-deep: #160d09;
  --abacus-beam-light: #ba7646;
  --abacus-beam-mid: #8d4a2b;
  --abacus-beam-dark: #3e1d13;
  --abacus-beam-edge: #d49a65;
  --abacus-rod-dark: #4a4f4d;
  --abacus-rod-mid: #aeb2aa;
  --abacus-rod-light: #f4ecd5;
  --abacus-one-light: #c95536;
  --abacus-one-mid: #a83524;
  --abacus-one-dark: #4b130e;
  --abacus-one-border: #57150f;
  --abacus-five-light: #dca84e;
  --abacus-five-mid: #b87528;
  --abacus-five-dark: #4f2a12;
  --abacus-five-border: #694017;
  --abacus-label-light: #5f3824;
  --abacus-label-dark: #321b12;
  --abacus-label-ink: #f4dfb4;
}

body[data-abacus-theme="classroom"] {
  --abacus-frame-border: #130e0b;
  --abacus-frame-light: #46352b;
  --abacus-frame-mid: #2c221c;
  --abacus-frame-dark: #16110e;
  --abacus-grain: rgba(214,174,126,.08);
  --abacus-board-light: #262724;
  --abacus-board-mid: #151714;
  --abacus-board-dark: #080a08;
  --abacus-rim: #17110e;
  --abacus-rim-deep: #050403;
  --abacus-beam-light: #4c392d;
  --abacus-beam-mid: #2b211b;
  --abacus-beam-dark: #100c0a;
  --abacus-beam-edge: #735744;
  --abacus-one-light: #75402f;
  --abacus-one-mid: #51261d;
  --abacus-one-dark: #210b08;
  --abacus-one-border: #1c0907;
  --abacus-five-light: #967244;
  --abacus-five-mid: #674823;
  --abacus-five-dark: #2d1a0c;
  --abacus-five-border: #3b240f;
  --abacus-label-light: #4b382b;
  --abacus-label-dark: #1d1510;
  --abacus-label-ink: #d5c09e;
}

body[data-abacus-theme="lacquer"] {
  --abacus-frame-border: #030707;
  --abacus-frame-light: #172522;
  --abacus-frame-mid: #09110f;
  --abacus-frame-dark: #020504;
  --abacus-grain: rgba(116,220,207,.13);
  --abacus-board-light: #11221f;
  --abacus-board-mid: #081411;
  --abacus-board-dark: #020706;
  --abacus-rim: #06100e;
  --abacus-rim-deep: #010302;
  --abacus-beam-light: #21443d;
  --abacus-beam-mid: #0d2823;
  --abacus-beam-dark: #03100d;
  --abacus-beam-edge: #6aa99e;
  --abacus-one-light: #41a18d;
  --abacus-one-mid: #20715f;
  --abacus-one-dark: #073329;
  --abacus-one-border: #062c25;
  --abacus-five-light: #d6c7ac;
  --abacus-five-mid: #948264;
  --abacus-five-dark: #463721;
  --abacus-five-border: #59472d;
  --abacus-label-light: #173a34;
  --abacus-label-dark: #061713;
  --abacus-label-ink: #bce9df;
}

body[data-abacus-theme="aluminum"] {
  --abacus-frame-border: #596468;
  --abacus-frame-light: #dce2e0;
  --abacus-frame-mid: #919c9e;
  --abacus-frame-dark: #596367;
  --abacus-grain: rgba(255,255,255,.16);
  --abacus-board-light: #26383c;
  --abacus-board-mid: #14262a;
  --abacus-board-dark: #071316;
  --abacus-rim: #6f7a7d;
  --abacus-rim-deep: #30383a;
  --abacus-beam-light: #d5dcda;
  --abacus-beam-mid: #929d9d;
  --abacus-beam-dark: #495356;
  --abacus-beam-edge: #f2f5ee;
  --abacus-rod-dark: #596163;
  --abacus-rod-mid: #c5ccca;
  --abacus-rod-light: #ffffff;
  --abacus-one-light: #4f9db2;
  --abacus-one-mid: #2d7285;
  --abacus-one-dark: #133c48;
  --abacus-one-border: #153945;
  --abacus-five-light: #e49b4c;
  --abacus-five-mid: #ba652b;
  --abacus-five-dark: #633017;
  --abacus-five-border: #743b1c;
  --abacus-label-light: #6d797b;
  --abacus-label-dark: #343d3f;
  --abacus-label-ink: #f1f5ef;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--navy);
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 200, 87, 0.14) 0 2px, transparent 3px) 0 0 / 30px 30px,
    var(--cream);
  font-family: "Nunito", "Gowun Dodum", sans-serif;
  line-height: 1.5;
  overflow-x: hidden;
}

button, input, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid rgba(101, 195, 173, 0.55);
  outline-offset: 3px;
}

.page-glow {
  position: fixed;
  z-index: -1;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  filter: blur(4px);
  pointer-events: none;
}
.page-glow--one { top: 200px; right: -220px; background: rgba(185, 223, 242, 0.45); }
.page-glow--two { top: 1150px; left: -250px; background: rgba(239, 111, 94, 0.12); }

.site-header {
  width: min(1180px, calc(100% - 40px));
  height: 92px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand { display: inline-flex; align-items: center; color: var(--navy); text-decoration: none; }
.brand__mark {
  width: 40px;
  height: 34px;
  margin-right: 11px;
  padding: 4px 6px;
  display: flex;
  justify-content: space-between;
  border: 3px solid var(--navy);
  border-radius: 8px;
  transform: rotate(-2deg);
}
.brand__mark span { position: relative; width: 3px; background: var(--navy); border-radius: 2px; }
.brand__mark span::after {
  content: "";
  position: absolute;
  top: 9px;
  left: 50%;
  width: 9px;
  height: 7px;
  background: var(--coral);
  border-radius: 50%;
  transform: translateX(-50%);
}
.brand__mark span:nth-child(2)::after { top: 15px; background: var(--sun); }
.brand__mark span:nth-child(3)::after { top: 5px; background: var(--mint); }
.brand__name { font-family: "Jua", sans-serif; font-size: 25px; letter-spacing: -0.04em; }
.brand__tag { margin: 2px 0 0 13px; color: #8b9aa5; font-size: 10px; letter-spacing: 0.17em; }

.header-actions { display: flex; align-items: center; gap: 12px; }
.record-pill {
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255,255,255,.7);
  border: 1px solid rgba(16,42,67,.1);
  border-radius: 99px;
  font-size: 12px;
}
.record-pill > span { color: var(--muted); }
.record-pill strong { color: var(--coral-dark); font-size: 13px; }
.icon-button {
  width: 42px;
  height: 42px;
  padding: 10px;
  background: var(--navy);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.icon-button svg { width: 100%; height: 100%; fill: white; }
.icon-sound-off { display: none; }
.icon-button[aria-pressed="false"] .icon-sound-on { display: none; }
.icon-button[aria-pressed="false"] .icon-sound-off { display: block; }

main { overflow: clip; }
.hero {
  position: relative;
  width: min(1180px, calc(100% - 40px));
  min-height: 560px;
  margin: 18px auto 70px;
  padding: 88px 88px;
  background: var(--navy);
  border-radius: 34px 34px 110px 34px;
  color: white;
  overflow: hidden;
  box-shadow: 0 28px 80px rgba(16, 42, 67, .22);
}
.hero::before {
  content: "";
  position: absolute;
  right: -70px;
  bottom: -100px;
  width: 540px;
  height: 540px;
  border: 2px solid rgba(255,255,255,.09);
  border-radius: 50%;
  box-shadow: 0 0 0 65px rgba(255,255,255,.035), 0 0 0 130px rgba(255,255,255,.022);
}
.hero::after {
  content: "";
  position: absolute;
  right: 98px;
  bottom: 58px;
  width: 320px;
  height: 185px;
  border: 16px solid var(--abacus-frame-mid);
  border-radius: 16px;
  background:
    linear-gradient(to bottom, transparent 67px, var(--abacus-beam-light) 68px 73px, var(--abacus-beam-dark) 74px 76px, transparent 77px),
    repeating-linear-gradient(90deg, transparent 0 33px, var(--abacus-rod-dark) 34px, var(--abacus-rod-light) 35px 36px, var(--abacus-rod-dark) 37px),
    linear-gradient(145deg, var(--abacus-board-light), var(--abacus-board-dark));
  transform: rotate(4deg);
  box-shadow:
    inset 0 0 0 3px var(--abacus-rim-deep),
    inset 0 4px 3px rgba(255,224,177,.28),
    14px 18px 0 rgba(0,0,0,.14),
    18px 24px 26px rgba(0,0,0,.18);
}
.hero__eyebrow {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--sun);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .08em;
}
.hero h1 {
  position: relative;
  z-index: 1;
  margin: 20px 0 20px;
  font-family: "Jua", sans-serif;
  font-size: clamp(43px, 5vw, 68px);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -.045em;
}
.hero h1 em { color: var(--sun); font-style: normal; }
.hero > p {
  position: relative;
  z-index: 1;
  margin: 0;
  color: rgba(255,255,255,.72);
  font-family: "Gowun Dodum", sans-serif;
  font-size: 16px;
  line-height: 1.85;
}
.hero__actions { position: relative; z-index: 2; display: flex; gap: 12px; margin-top: 34px; }
.button {
  min-height: 50px;
  padding: 0 24px;
  border: 0;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}
.button:hover { transform: translateY(-2px); }
.button--primary { background: var(--coral); color: white; box-shadow: 0 8px 22px rgba(239,111,94,.3); }
.button--primary span { margin-left: 18px; }
.button--primary:hover { background: #fa7967; }
.button--ghost { color: white; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.2); }
.button--ghost:hover { background: rgba(255,255,255,.13); }
.hero__doodle { position: absolute; z-index: 3; color: var(--sun); }
.hero__doodle--star { right: 405px; top: 102px; font-size: 38px; transform: rotate(15deg); }
.hero__doodle--line { right: 77px; top: 128px; width: 80px; height: 50px; border-top: 3px solid var(--mint); border-radius: 50%; transform: rotate(35deg); }
.hero__chips { position: absolute; z-index: 3; right: 52px; top: 45px; display: flex; gap: 7px; transform: rotate(2deg); }
.hero__chips span { padding: 5px 10px; background: rgba(255,255,255,.1); border-radius: 99px; color: rgba(255,255,255,.7); font-size: 10px; }

.section-shell { width: min(1060px, calc(100% - 40px)); margin-left: auto; margin-right: auto; }
.calculator-section, .games-section { scroll-margin-top: 22px; }
.section-heading { margin-bottom: 25px; display: flex; align-items: end; justify-content: space-between; }
.section-heading h2 { margin: 8px 0 0; font-family: "Jua", sans-serif; font-size: clamp(31px, 4vw, 42px); font-weight: 400; letter-spacing: -.035em; }
.section-heading > p { margin: 0 4px 3px 0; color: var(--muted); font-family: "Gowun Dodum"; font-size: 13px; line-height: 1.7; text-align: right; }
.kicker { font-size: 11px; font-weight: 900; letter-spacing: .13em; }
.kicker--coral { color: var(--coral-dark); }
.kicker--mint { color: #248f78; }

.calculator-card {
  background: rgba(255,255,255,.84);
  border: 1px solid rgba(16,42,67,.1);
  border-radius: 27px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.formula-builder {
  padding: 24px 28px;
  display: grid;
  grid-template-columns: 1fr 100px 1fr auto;
  align-items: end;
  gap: 12px;
  background: #f2f6f5;
  border-bottom: 1px solid var(--line);
}
.formula-builder label { min-width: 0; display: grid; gap: 7px; color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: .07em; }
.formula-builder input, .formula-builder select {
  min-width: 0;
  width: 100%;
  height: 50px;
  padding: 0 16px;
  color: var(--navy);
  background: white;
  border: 1px solid #d4e0e4;
  border-radius: 12px;
  font-family: "Nunito", sans-serif;
  font-size: 20px;
  font-weight: 900;
}
.formula-builder select { text-align: center; cursor: pointer; appearance: none; }
.formula-builder input::-webkit-inner-spin-button { display: none; }
.button--sun { display: flex; align-items: center; gap: 8px; color: var(--navy); background: var(--sun); box-shadow: 0 8px 18px rgba(255,200,87,.26); }
.button--sun svg { width: 16px; fill: currentColor; }

.demo-stage { padding: 28px 34px 31px; }
.demo-stage__topline { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.demo-expression { display: flex; align-items: center; gap: 13px; font-size: clamp(21px, 3vw, 29px); font-weight: 900; letter-spacing: -.02em; }
.demo-expression__equals { color: #9aabb5; }
.demo-expression strong { min-width: 65px; color: var(--coral-dark); font-size: 1.25em; }
.speed-control { padding: 4px; display: flex; align-items: center; gap: 2px; background: #edf2f2; border-radius: 10px; }
.speed-control > span { padding: 0 8px; color: var(--muted); font-size: 10px; font-weight: 900; }
.speed-control button { padding: 6px 9px; background: transparent; border: 0; border-radius: 7px; color: #788a96; font-size: 10px; font-weight: 800; cursor: pointer; }
.speed-control button.is-active { color: var(--navy); background: white; box-shadow: 0 2px 7px rgba(16,42,67,.1); }

.abacus-workshop {
  margin-bottom: 25px;
  padding: 13px 14px;
  display: flex;
  align-items: center;
  gap: 18px;
  background: linear-gradient(120deg, #f7f4ec, #eef3f1);
  border: 1px solid #dde5e2;
  border-radius: 17px;
}
.abacus-workshop__copy { flex: 0 0 168px; display: grid; gap: 2px; }
.abacus-workshop__copy span { color: #9a6a45; font-size: 8px; font-weight: 900; letter-spacing: .16em; }
.abacus-workshop__copy strong { font-family: "Gowun Dodum"; font-size: 12px; }
.abacus-theme-options { flex: 1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.abacus-theme-button {
  min-width: 0;
  min-height: 49px;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--navy);
  background: rgba(255,255,255,.78);
  border: 1px solid #d8e1df;
  border-radius: 11px;
  text-align: left;
  cursor: pointer;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.abacus-theme-button:hover { transform: translateY(-1px); border-color: #a6bbb6; }
.abacus-theme-button[aria-pressed="true"] { border-color: var(--mint); box-shadow: 0 0 0 2px rgba(101,195,173,.18), 0 5px 12px rgba(16,42,67,.08); }
.abacus-theme-button > span { min-width: 0; display: grid; }
.abacus-theme-button strong { overflow: hidden; font-size: 10px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.abacus-theme-button small { overflow: hidden; color: var(--muted); font-family: "Gowun Dodum"; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.theme-swatch {
  flex: 0 0 auto;
  width: 29px;
  height: 29px;
  border: 3px solid #392119;
  border-radius: 7px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.16), 0 2px 4px rgba(16,42,67,.15);
}
.theme-swatch--classroom { background: repeating-linear-gradient(90deg, transparent 0 6px, #a5aaa1 7px 8px), linear-gradient(#2b2c28 0 45%, #4d392d 46% 54%, #171916 55%); border-color: #1a120e; }
.theme-swatch--walnut { background: repeating-linear-gradient(90deg, transparent 0 6px, #d9d1b9 7px 8px), linear-gradient(#29302e 0 45%, #9b5934 46% 54%, #111817 55%); border-color: #8c4b29; }
.theme-swatch--lacquer { background: radial-gradient(circle at 18% 20%, #70c5b8 0 2px, transparent 3px), radial-gradient(circle at 78% 76%, #d9b7df 0 2px, transparent 3px), repeating-linear-gradient(90deg, transparent 0 6px, #aebbb7 7px 8px), #07110f; border-color: #06100e; }
.theme-swatch--aluminum { background: repeating-linear-gradient(90deg, transparent 0 6px, #f2f5ef 7px 8px), linear-gradient(#26383c 0 45%, #b8c0be 46% 54%, #0a171a 55%); border-color: #8d9799; }

.abacus-wrap {
  position: relative;
  padding: 12px;
  border: 1px solid var(--abacus-frame-border);
  border-radius: 21px;
  background:
    linear-gradient(105deg, rgba(255,255,255,.19), transparent 23%, rgba(0,0,0,.16) 62%, transparent 78%),
    repeating-linear-gradient(7deg, transparent 0 8px, var(--abacus-grain) 9px 10px),
    linear-gradient(145deg, var(--abacus-frame-light) 0%, var(--abacus-frame-mid) 45%, var(--abacus-frame-dark) 100%);
  box-shadow:
    inset 0 2px 1px rgba(255,235,196,.48),
    inset 0 -3px 5px rgba(52,20,10,.35),
    0 12px 24px rgba(47,24,14,.18);
}
body[data-abacus-theme="lacquer"] .abacus-wrap {
  background:
    linear-gradient(118deg, transparent 0 18%, rgba(111,211,198,.3) 19%, transparent 20% 48%, rgba(219,177,221,.24) 49%, transparent 50% 77%, rgba(236,211,141,.24) 78%, transparent 79%),
    linear-gradient(105deg, rgba(255,255,255,.12), transparent 23%, rgba(0,0,0,.3) 62%, transparent 78%),
    linear-gradient(145deg, var(--abacus-frame-light), var(--abacus-frame-mid) 45%, var(--abacus-frame-dark));
  box-shadow: inset 0 1px 1px rgba(174,242,230,.22), inset 0 -3px 7px #000, 0 12px 25px rgba(4,18,16,.23);
}
body[data-abacus-theme="aluminum"] .abacus-wrap {
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.15) 0 1px, rgba(0,0,0,.035) 1px 3px),
    linear-gradient(145deg, var(--abacus-frame-light), var(--abacus-frame-mid) 48%, var(--abacus-frame-dark));
  box-shadow: inset 0 2px 2px rgba(255,255,255,.75), inset 0 -3px 5px rgba(31,47,52,.26), 0 12px 24px rgba(27,52,58,.16);
}
.abacus {
  --rod-count: 7;
  position: relative;
  height: 300px;
  padding: 16px 35px 20px;
  display: grid;
  grid-template-columns: repeat(var(--rod-count), 1fr);
  background:
    radial-gradient(circle at 45% 20%, rgba(255,255,255,.055), transparent 35%),
    linear-gradient(145deg, var(--abacus-board-light) 0%, var(--abacus-board-mid) 54%, var(--abacus-board-dark) 100%);
  border: 5px solid var(--abacus-rim);
  border-radius: 12px;
  box-shadow:
    inset 0 0 0 2px var(--abacus-rim-deep),
    inset 0 13px 24px rgba(255,255,255,.035),
    inset 0 -12px 22px rgba(0,0,0,.42),
    0 2px 2px rgba(255,225,182,.18);
  overflow: hidden;
}
.abacus::before {
  content: "";
  position: absolute;
  z-index: 3;
  top: 99px;
  left: 0;
  right: 0;
  height: 13px;
  background:
    repeating-linear-gradient(4deg, transparent 0 11px, var(--abacus-grain) 12px 13px),
    linear-gradient(to bottom, var(--abacus-beam-light) 0%, var(--abacus-beam-mid) 38%, var(--abacus-frame-dark) 72%, var(--abacus-beam-dark) 100%);
  border-top: 1px solid var(--abacus-beam-edge);
  border-bottom: 2px solid var(--abacus-rim-deep);
  box-shadow: 0 4px 7px rgba(0,0,0,.48), inset 0 1px rgba(255,234,196,.3);
}
.rod { position: relative; height: 100%; min-width: 30px; }
.rod::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 4px;
  background: linear-gradient(90deg, var(--abacus-rod-dark) 0%, var(--abacus-rod-mid) 22%, var(--abacus-rod-light) 48%, var(--abacus-rod-mid) 70%, var(--abacus-rod-dark) 100%);
  box-shadow: 1px 0 2px rgba(0,0,0,.48), -1px 0 rgba(255,255,255,.12);
  transform: translateX(-50%);
}
.bead {
  position: absolute;
  z-index: 2;
  left: 50%;
  width: min(64px, 80%);
  height: 25px;
  padding: 0;
  background:
    radial-gradient(ellipse at 50% 3%, rgba(255,208,171,.48), transparent 42%),
    linear-gradient(to bottom, var(--abacus-one-light) 0%, var(--abacus-one-mid) 42%, var(--abacus-one-mid) 70%, var(--abacus-one-dark) 100%);
  border: 1px solid var(--abacus-one-border);
  border-radius: 50% 50% 44% 44% / 58% 58% 45% 45%;
  box-shadow:
    inset 0 3px 2px rgba(255,219,190,.25),
    inset 0 -4px 4px rgba(47,7,4,.42),
    0 2px 0 #3a0f0b,
    0 5px 7px rgba(0,0,0,.44);
  transform: translateX(-50%);
  transition: top .33s cubic-bezier(.22,.8,.28,1), filter .2s ease;
}
.bead::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 18%;
  right: 18%;
  height: 3px;
  border-radius: 50%;
  background: rgba(255,231,208,.22);
}
.bead::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 42%;
  background: linear-gradient(90deg, #29100b, #733326 48%, #260c08);
  border-radius: 50%;
  box-shadow: inset 0 0 2px #120504, 0 0 0 1px rgba(255,203,171,.12);
  transform: translate(-50%, -50%);
}
.bead--five {
  top: 15px;
  background:
    radial-gradient(ellipse at 50% 3%, rgba(255,239,184,.62), transparent 42%),
    linear-gradient(to bottom, var(--abacus-five-light) 0%, var(--abacus-five-mid) 43%, var(--abacus-five-mid) 71%, var(--abacus-five-dark) 100%);
  border-color: var(--abacus-five-border);
  box-shadow:
    inset 0 3px 2px rgba(255,239,190,.32),
    inset 0 -4px 4px rgba(55,28,8,.4),
    0 2px 0 #3d210e,
    0 5px 7px rgba(0,0,0,.42);
}
.bead--five.is-active { top: 70px; }
.bead--one[data-index="0"] { top: 156px; }
.bead--one[data-index="1"] { top: 181px; }
.bead--one[data-index="2"] { top: 206px; }
.bead--one[data-index="3"] { top: 231px; }
.bead--one[data-index="0"].is-active { top: 112px; }
.bead--one[data-index="1"].is-active { top: 137px; }
.bead--one[data-index="2"].is-active { top: 162px; }
.bead--one[data-index="3"].is-active { top: 187px; }
.bead.is-moving { filter: brightness(1.22) saturate(1.08); }
.abacus[data-interactive="true"] .bead:hover { filter: brightness(1.12); }
.rod-label {
  position: absolute;
  z-index: 4;
  top: 72px;
  left: 50%;
  min-width: 19px;
  padding: 1px 4px;
  color: var(--abacus-label-ink);
  background: linear-gradient(var(--abacus-label-light), var(--abacus-label-dark));
  border: 1px solid var(--abacus-beam-edge);
  border-radius: 3px;
  font-size: 9px;
  line-height: 1.15;
  text-align: center;
  text-shadow: 0 1px #1b0c07;
  white-space: nowrap;
  transform: translateX(-50%);
}
.rod.is-ones .rod-label {
  color: #40260f;
  background: linear-gradient(#f0d187, #b98a3b);
  border-color: #f7dfa2;
  text-shadow: 0 1px rgba(255,255,255,.45);
}
.rod.is-changing::after {
  content: "";
  position: absolute;
  z-index: 5;
  top: 94px;
  left: 50%;
  width: 8px;
  height: 8px;
  background: var(--sun);
  border-radius: 50%;
  transform: translate(-50%,-50%);
  box-shadow: 0 0 0 6px rgba(255,200,87,.18);
  animation: pulse .7s ease infinite alternate;
}
@keyframes pulse { to { box-shadow: 0 0 0 11px rgba(255,200,87,0); } }

.playback-bar { margin-top: 22px; display: flex; align-items: center; gap: 16px; }
.playback-button {
  flex: 0 0 auto;
  width: 49px;
  height: 49px;
  padding: 14px;
  color: white;
  background: var(--coral);
  border: 0;
  border-radius: 50%;
  box-shadow: 0 7px 18px rgba(239,111,94,.28);
  cursor: pointer;
}
.playback-button svg { width: 100%; height: 100%; fill: currentColor; }
.pause-icon { display: none; }
.playback-button.is-playing .play-icon { display: none; }
.playback-button.is-playing .pause-icon { display: block; }
.playback-copy { flex: 1; min-width: 0; }
.playback-copy__row { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.playback-copy__row span { color: var(--muted); font-size: 11px; }
.progress-track { height: 5px; margin: 7px 0 5px; background: #e6ecec; border-radius: 10px; overflow: hidden; }
.progress-track span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--coral), var(--sun)); border-radius: inherit; transition: width .35s ease; }
.playback-copy p { margin: 0; color: var(--muted); font-family: "Gowun Dodum"; font-size: 11px; }

.games-section { padding-top: 110px; padding-bottom: 95px; }
.daily-stamp {
  min-width: 128px;
  padding: 11px 17px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 13px;
  border: 1px dashed var(--coral);
  border-radius: 14px;
  transform: rotate(2deg);
}
.daily-stamp span { color: var(--muted); font-size: 9px; font-weight: 900; }
.daily-stamp strong { color: var(--coral-dark); font-size: 14px; }
.game-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 17px; }
.game-card {
  position: relative;
  min-height: 430px;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(16,42,67,.1);
  border-radius: 23px;
  background: white;
  box-shadow: var(--soft-shadow);
  overflow: hidden;
  transition: transform .25s ease, box-shadow .25s ease;
}
.game-card:hover { transform: translateY(-6px) rotate(-.3deg); box-shadow: 0 19px 45px rgba(16,42,67,.15); }
.game-card:nth-child(2):hover { transform: translateY(-6px) rotate(.3deg); }
.game-card__number { position: absolute; z-index: 3; top: 15px; left: 18px; color: rgba(16,42,67,.55); font-size: 9px; font-weight: 900; letter-spacing: .12em; }
.game-card__art { position: relative; height: 190px; overflow: hidden; }
.game-card--read .game-card__art { background: var(--sky); }
.game-card--set .game-card__art { background: #f9b2a6; }
.game-card--flash .game-card__art { background: #ffe092; }
.mini-abacus {
  position: absolute;
  left: 42px;
  top: 60px;
  width: 145px;
  height: 88px;
  display: flex;
  justify-content: space-around;
  border: 8px solid var(--abacus-frame-mid);
  border-radius: 11px;
  background: linear-gradient(145deg, var(--abacus-board-light), var(--abacus-board-dark));
  box-shadow: inset 0 0 0 2px var(--abacus-rim-deep), 5px 8px 12px rgba(39,20,12,.24);
  transform: rotate(-6deg);
}
.mini-abacus::after { content: ""; position: absolute; top: 30px; left: 0; right: 0; height: 6px; background: linear-gradient(var(--abacus-beam-light), var(--abacus-beam-dark)); box-shadow: 0 2px 3px rgba(0,0,0,.42); }
.mini-abacus span { position: relative; width: 3px; background: linear-gradient(90deg, var(--abacus-rod-dark), var(--abacus-rod-light) 48%, var(--abacus-rod-dark)); }
.mini-abacus span::before, .mini-abacus span::after { content: ""; position: absolute; left: 50%; width: 20px; height: 10px; border: 1px solid var(--abacus-one-border); border-radius: 50%; background: linear-gradient(var(--abacus-one-light), var(--abacus-one-dark)); box-shadow: inset 0 2px 2px rgba(255,255,255,.24), 0 2px 3px rgba(0,0,0,.38); transform: translateX(-50%); }
.mini-abacus span::before { top: 15px; background: linear-gradient(var(--abacus-five-light), var(--abacus-five-dark)); border-color: var(--abacus-five-border); }
.mini-abacus span::after { top: 45px; }
.art-question { position: absolute; right: 46px; top: 54px; color: white; font-family: "Jua"; font-size: 80px; transform: rotate(9deg); text-shadow: 5px 7px 0 rgba(16,42,67,.13); }
.target-bubble {
  position: absolute;
  left: 47px;
  top: 48px;
  padding: 12px 19px;
  color: white;
  background: var(--navy);
  border-radius: 15px 15px 15px 3px;
  font-size: 24px;
  font-weight: 900;
  transform: rotate(-4deg);
}
.finger { position: absolute; right: 48px; bottom: -7px; font-size: 88px; filter: saturate(.6); transform: rotate(-15deg); }
.bolt { position: absolute; left: 62px; top: 17px; color: var(--coral); font-family: "Jua"; font-size: 135px; line-height: 1; transform: rotate(8deg); text-shadow: 6px 6px 0 rgba(16,42,67,.1); }
.flash-numbers { position: absolute; top: 45px; right: 45px; display: grid; gap: 6px; color: var(--navy); font-size: 17px; font-weight: 900; transform: rotate(5deg); }
.flash-numbers span:nth-child(2) { margin-left: 18px; color: var(--coral-dark); font-size: 24px; }
.game-card__body { flex: 1; padding: 25px 27px 24px; display: flex; flex-direction: column; }
.difficulty { color: var(--muted); font-size: 9px; font-weight: 900; letter-spacing: .08em; }
.game-card h3 { margin: 6px 0 7px; font-family: "Jua"; font-size: 28px; font-weight: 400; }
.game-card p { margin: 0; color: var(--muted); font-family: "Gowun Dodum"; font-size: 12px; line-height: 1.7; }
.game-start { margin-top: auto; padding: 14px 0 0; display: flex; align-items: center; justify-content: space-between; background: transparent; border: 0; border-top: 1px solid #edf0f0; font-size: 12px; font-weight: 900; cursor: pointer; }
.game-start span { display: grid; place-items: center; width: 27px; height: 27px; color: white; background: var(--navy); border-radius: 50%; transition: transform .2s ease; }
.game-start:hover span { transform: translateX(3px); }

.tip-strip {
  margin-bottom: 85px;
  padding: 22px 27px;
  display: flex;
  align-items: center;
  gap: 16px;
  color: white;
  background: var(--navy);
  border-radius: 18px;
  box-shadow: var(--soft-shadow);
}
.tip-strip__icon { width: 37px; height: 37px; display: grid; place-items: center; color: var(--navy); background: var(--sun); border-radius: 50%; font-family: "Jua"; font-size: 21px; }
.tip-strip > div:nth-child(2) { display: grid; }
.tip-strip > div:nth-child(2) span { color: var(--sun); font-size: 9px; font-weight: 900; }
.tip-strip > div:nth-child(2) strong { font-size: 13px; }
.tip-legend { margin-left: auto; display: flex; gap: 23px; color: rgba(255,255,255,.68); font-size: 10px; }
.tip-legend span { display: flex; align-items: center; gap: 8px; }
.legend-bead { width: 24px; height: 11px; border-radius: 50%; background: var(--coral); }
.legend-bead--top { background: var(--sun); }

footer {
  min-height: 130px;
  padding: 37px max(40px, calc((100% - 1060px) / 2));
  display: flex;
  align-items: center;
  color: white;
  background: #0d2437;
}
.brand--footer { color: white; }
.brand--footer .brand__mark { border-color: white; }
.brand--footer .brand__mark span { background: white; }
footer p { margin: 0 0 0 30px; color: rgba(255,255,255,.52); font-family: "Gowun Dodum"; font-size: 11px; }
footer > span { margin-left: auto; color: rgba(255,255,255,.35); font-size: 10px; }

.game-dialog {
  width: min(820px, calc(100% - 30px));
  max-height: calc(100vh - 30px);
  padding: 0;
  border: 0;
  border-radius: 27px;
  color: var(--navy);
  background: var(--paper);
  box-shadow: 0 35px 100px rgba(8,28,43,.35);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.game-dialog::backdrop { background: rgba(7,25,39,.7); backdrop-filter: blur(7px); }
.dialog-shell { min-height: min(570px, calc(100dvh - 30px)); display: flex; flex-direction: column; }
.dialog-topbar { padding: 22px 27px 17px; display: grid; grid-template-columns: 1fr auto 40px; align-items: center; gap: 22px; }
.dialog-kicker { color: var(--coral-dark); font-size: 9px; font-weight: 900; letter-spacing: .12em; }
.dialog-topbar h2 { margin: 2px 0 0; font-family: "Jua"; font-size: 29px; font-weight: 400; }
.round-status { display: flex; gap: 12px; font-size: 12px; }
.round-status span { color: var(--muted); }
.round-status strong { color: var(--coral-dark); }
.dialog-close { width: 38px; height: 38px; background: #edf2f2; border: 0; border-radius: 50%; font-size: 23px; cursor: pointer; }
.game-progress { height: 5px; background: #e4ebea; }
.game-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--mint), var(--sun)); transition: width .3s ease; }
.game-content { flex: 1; padding: 24px 42px 36px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: radial-gradient(circle at 50% 40%, white, #f8f8f1); text-align: center; }
.game-prompt { margin-bottom: 14px; }
.game-prompt span { display: block; color: var(--muted); font-size: 11px; font-weight: 900; }
.game-prompt strong { display: block; margin-top: 4px; font-family: "Jua"; font-size: 25px; font-weight: 400; }
.game-content .abacus-wrap { width: min(100%, 650px); }
.game-content .abacus { height: 245px; padding-left: 23px; padding-right: 23px; border-width: 7px; }
.game-content .abacus::before { top: 79px; height: 9px; }
.game-content .bead { height: 20px; }
.game-content .bead--five { top: 10px; }
.game-content .bead--five.is-active { top: 53px; }
.game-content .bead--one[data-index="0"] { top: 130px; }
.game-content .bead--one[data-index="1"] { top: 150px; }
.game-content .bead--one[data-index="2"] { top: 170px; }
.game-content .bead--one[data-index="3"] { top: 190px; }
.game-content .bead--one[data-index="0"].is-active { top: 90px; }
.game-content .bead--one[data-index="1"].is-active { top: 110px; }
.game-content .bead--one[data-index="2"].is-active { top: 130px; }
.game-content .bead--one[data-index="3"].is-active { top: 150px; }
.game-content .rod.is-changing::after { top: 76px; }
.choice-grid { width: min(100%, 560px); margin-top: 19px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.choice-button, .check-button, .answer-form button, .next-button {
  min-height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 13px;
  color: white;
  background: var(--navy);
  font-weight: 900;
  cursor: pointer;
}
.choice-button { color: var(--navy); background: white; border: 1px solid #d8e2e3; font-size: 18px; box-shadow: 0 4px 12px rgba(16,42,67,.07); }
.choice-button:hover { border-color: var(--coral); transform: translateY(-2px); }
.choice-button:disabled { cursor: default; transform: none; }
.choice-button.is-correct { color: white; background: var(--mint); border-color: var(--mint); }
.choice-button.is-wrong { color: white; background: var(--coral); border-color: var(--coral); }
.set-readout { margin: 15px 0; color: var(--muted); font-size: 12px; }
.set-readout strong { margin-left: 7px; color: var(--coral-dark); font-size: 21px; }
.check-button { min-width: 170px; background: var(--coral); }
.flash-stage { width: min(100%, 590px); min-height: 300px; display: grid; place-items: center; border: 1px solid #dae5e4; border-radius: 22px; background: var(--navy); box-shadow: inset 0 0 50px rgba(255,255,255,.04); }
.flash-countdown { color: var(--sun); font-family: "Jua"; font-size: 80px; animation: popIn .4s ease; }
.flash-value { color: white; font-family: "Jua"; font-size: clamp(60px, 13vw, 105px); animation: popIn .3s ease; }
.flash-value small { font-size: .3em; color: var(--sky); }
@keyframes popIn { from { opacity: 0; transform: scale(.6) rotate(-5deg); } to { opacity: 1; transform: scale(1); } }
.answer-form { margin-top: 19px; display: flex; gap: 9px; }
.answer-form input { width: 190px; height: 50px; padding: 0 16px; border: 2px solid #d5e0e1; border-radius: 13px; font-size: 20px; font-weight: 900; text-align: center; }
.answer-form button { background: var(--coral); }
.feedback { min-height: 27px; margin-top: 13px; font-size: 13px; font-weight: 900; }
.feedback--right { color: #258d76; }
.feedback--wrong { color: var(--coral-dark); }
.result-view { max-width: 520px; }
.result-emoji { font-size: 64px; }
.result-view h3 { margin: 8px 0; font-family: "Jua"; font-size: 38px; font-weight: 400; }
.result-view p { margin: 0 0 24px; color: var(--muted); font-family: "Gowun Dodum"; }
.result-score { margin-bottom: 25px; display: flex; justify-content: center; gap: 45px; }
.result-score span { display: grid; color: var(--muted); font-size: 10px; }
.result-score strong { color: var(--navy); font-size: 25px; }
.next-button { margin: 15px auto 0; background: var(--coral); }

.toast {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: 26px;
  padding: 12px 19px;
  color: white;
  background: var(--navy);
  border-radius: 99px;
  box-shadow: 0 10px 35px rgba(16,42,67,.3);
  font-size: 12px;
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 15px);
  transition: .25s ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.confetti { position: fixed; z-index: 50; top: -20px; width: 9px; height: 15px; border-radius: 2px; pointer-events: none; animation: confettiFall 1.5s cubic-bezier(.2,.7,.4,1) forwards; }
@keyframes confettiFall { to { transform: translate(var(--drift), 105vh) rotate(720deg); opacity: .3; } }

@media (max-width: 880px) {
  .hero { padding: 70px 55px; min-height: 590px; }
  .hero::after { right: 65px; bottom: 35px; width: 270px; height: 150px; }
  .hero__doodle--star { right: 290px; }
  .formula-builder { grid-template-columns: 1fr 86px 1fr; }
  .formula-submit { grid-column: 1 / -1; justify-content: center; }
  .abacus-workshop { align-items: stretch; flex-direction: column; gap: 10px; }
  .abacus-workshop__copy { flex-basis: auto; }
  .game-card__body { padding-left: 20px; padding-right: 20px; }
}

@media (max-width: 700px) {
  .site-header { height: 77px; }
  .brand__tag, .record-pill > span { display: none; }
  .record-pill { padding: 8px 11px; }
  .hero { min-height: 600px; margin-top: 8px; padding: 56px 28px; border-radius: 26px 26px 75px 26px; }
  .hero h1 { font-size: 42px; }
  .hero > p br { display: none; }
  .hero__actions { align-items: stretch; flex-direction: column; width: 220px; }
  .hero::after { right: -10px; bottom: 45px; width: 240px; height: 132px; border-width: 12px; }
  .hero__chips, .hero__doodle--line { display: none; }
  .hero__doodle--star { right: 28px; top: 32px; }
  .section-heading { align-items: start; flex-direction: column; gap: 12px; }
  .section-heading > p { text-align: left; }
  .formula-builder { padding: 19px; grid-template-columns: 1fr 70px 1fr; gap: 7px; }
  .formula-builder input, .formula-builder select { padding: 0 9px; font-size: 17px; }
  .demo-stage { padding: 22px 15px; }
  .abacus-workshop { margin-bottom: 20px; padding: 11px; }
  .abacus-theme-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .abacus-theme-button { min-height: 52px; }
  .demo-stage__topline { align-items: flex-start; flex-direction: column; gap: 13px; }
  .speed-control { align-self: flex-end; }
  .abacus { height: 245px; padding-left: 12px; padding-right: 12px; border-width: 6px; }
  .rod { min-width: 0; }
  .abacus::before { top: 80px; height: 9px; }
  .bead { width: 85%; height: 20px; }
  .bead--five { top: 10px; }
  .bead--five.is-active { top: 53px; }
  .bead--one[data-index="0"] { top: 130px; }
  .bead--one[data-index="1"] { top: 150px; }
  .bead--one[data-index="2"] { top: 170px; }
  .bead--one[data-index="3"] { top: 190px; }
  .bead--one[data-index="0"].is-active { top: 90px; }
  .bead--one[data-index="1"].is-active { top: 110px; }
  .bead--one[data-index="2"].is-active { top: 130px; }
  .bead--one[data-index="3"].is-active { top: 150px; }
  .rod.is-changing::after { top: 76px; }
  .rod-label { top: 54px; }
  .game-grid { grid-template-columns: 1fr; }
  .game-card { min-height: 390px; }
  .game-card__art { height: 175px; }
  .games-section { padding-top: 75px; }
  .section-heading--games { flex-direction: row; align-items: end; }
  .daily-stamp { min-width: 110px; }
  .tip-strip { align-items: flex-start; }
  .tip-legend { display: none; }
  footer { flex-wrap: wrap; gap: 12px; }
  footer p { width: 100%; margin-left: 0; }
  footer > span { margin-left: 0; }
  .dialog-topbar { padding: 17px; grid-template-columns: 1fr auto 38px; gap: 8px; }
  .game-content { padding: 18px 13px 27px; }
  .game-content .abacus { height: 220px; padding-left: 7px; padding-right: 7px; }
  .choice-grid { grid-template-columns: 1fr; }
  .flash-stage { min-height: 260px; }
}

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