/* SNOWTONE — シマエガナと30日の音楽理論 */
:root {
  --snow: #f5f8fc;
  --snow-2: #e9eff7;
  --card: #ffffff;
  --ink: #1d2433;
  --ink-2: #48526a;
  --mist: #7f8aa0;
  --faint: #b8c1d1;
  --line: rgba(29, 36, 51, .09);
  --line-2: rgba(29, 36, 51, .16);
  --navy: #26324c;
  --navy-d: #151d30;
  --berry: #c8463d;          /* rowan berries in the snow */
  --ok: #2b9a86;
  --ok-bg: #e3f4ef;
  --ng: #d0533f;
  --ng-bg: #fbe9e5;
  --sky: #dce9f7;
  /* degree colours, shared with CHORD ANATOMY */
  --c-root: #d49526;
  --c-third: #d4573f;
  --c-fifth: #23897c;
  --c-seventh: #7358c4;
  --c-tension: #4a8c30;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Hiragino Kaku Gothic ProN", system-ui, sans-serif;
  --acc: "Noto Music", "Apple Symbols", "Segoe UI Symbol", serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --pop: cubic-bezier(.34, 1.56, .64, 1);
  --top: 58px;
  --r: 18px;
  --shadow: 0 18px 40px -26px rgba(30, 50, 90, .45);
  --shadow-sm: 0 6px 16px -10px rgba(30, 50, 90, .4);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.75; font-weight: 500;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  background: radial-gradient(120% 60% at 50% -10%, #e4edf8 0%, rgba(228, 237, 248, 0) 60%), var(--snow);
  background-attachment: fixed;
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2.5px solid #6f8fc8; outline-offset: 2px; border-radius: 8px; }
.acc { font-family: var(--acc); font-weight: 400; font-size: .95em; line-height: 1; position: relative; top: -.08em; margin: 0; }
[hidden] { display: none !important; }

/* ── header / footer ───────────────────────────────── */
.top { position: sticky; top: 0; z-index: 30; height: var(--top); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 max(18px, env(safe-area-inset-left)); background: rgba(245, 248, 252, .82); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.brand-mark { width: 34px; height: 34px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-title { font-family: var(--serif); font-weight: 600; font-size: 17px; letter-spacing: .2em; font-variation-settings: "SOFT" 100; }
.brand-sub { font-size: 11px; color: var(--mist); letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-nav { display: flex; align-items: center; gap: 8px; }
.chip { display: inline-flex; align-items: center; justify-content: center; height: 36px; min-width: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, .7); text-decoration: none; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.chip-icon { padding: 0; width: 38px; }
.chip:hover { background: #fff; }
.foot { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 40px 20px calc(30px + env(safe-area-inset-bottom)); color: var(--mist); font-size: 12px; }
.foot-links { display: flex; gap: 18px; align-items: center; }
.foot a { text-decoration: none; }
.foot .playground { font-family: var(--serif); font-weight: 700; letter-spacing: .32em; font-size: 13px; background: linear-gradient(90deg, #b9a78a, #a8802f); -webkit-background-clip: text; background-clip: text; color: transparent; }
.foot-about { background: none; border: 0; padding: 0; color: var(--mist); font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }

.view { max-width: 640px; margin: 0 auto; padding: 0 18px; }
.intro-static { padding: 40px 0; color: var(--ink-2); font-size: 14px; }
.intro-static h1 { font-size: 20px; }

/* ── shared bits ───────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 26px; border-radius: 16px; border: 0; font-size: 16px; font-weight: 900; letter-spacing: .04em; text-decoration: none; transition: transform .12s var(--ease), box-shadow .12s, background .2s, opacity .2s; }
.btn-main { background: var(--navy); color: #fff; box-shadow: 0 4px 0 var(--navy-d); }
.btn-main:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--navy-d); }
.btn-main:disabled { background: #d3dae6; color: #8b95a8; box-shadow: 0 4px 0 #bec7d6; cursor: default; }
.btn-sub { background: #fff; color: var(--navy); border: 2px solid var(--line-2); box-shadow: 0 3px 0 var(--line-2); }
.btn-sub:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line-2); }
.btn-ghost { background: none; color: var(--mist); min-height: 40px; font-weight: 700; font-size: 14px; }
.btn-warn { background: var(--ng); color: #fff; box-shadow: 0 4px 0 #a33a2a; }
.btn-sm { min-height: 40px; padding: 0 16px; font-size: 14px; border-radius: 12px; }
.stage { position: relative; }
.stage canvas { position: absolute; display: block; pointer-events: none; }
.stage .bird-fallback { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: contain; }
.bubble { position: relative; margin: 0; background: #fffaf2; border-radius: 20px; padding: 14px 16px 12px; box-shadow: 0 0 0 1.5px #eedcc4, 0 10px 20px -14px rgba(120, 80, 40, .4); font-size: 15px; line-height: 1.65; font-weight: 700; color: #3b2d23; min-height: 1.65em; }
.bubble[data-name]::before { content: attr(data-name); position: absolute; top: -9px; left: 14px; padding: 0 9px; border-radius: 999px; background: #8b664d; color: #fff; font-size: 10.5px; line-height: 18px; font-weight: 900; letter-spacing: .08em; }
.bubble .term { color: #c4532d; }
.bubble:empty { visibility: hidden; }
.bubble.pop { animation: bub .42s var(--pop); }
@keyframes bub { from { transform: scale(.94) translateY(4px); opacity: .2; } to { transform: none; opacity: 1; } }

/* ── home ──────────────────────────────────────────── */
.home { padding-bottom: 20px; }
.hero { position: relative; display: flex; flex-direction: column; align-items: center; padding-top: 14px; }
.stage-home { width: min(100%, 440px); height: clamp(290px, 56vw, 370px); cursor: pointer; margin-top: -10px; }
.bubble-home { order: -1; max-width: 340px; text-align: center; margin-top: 10px; z-index: 2; }
.bubble-home::after { content: ""; position: absolute; left: 50%; bottom: -8px; width: 16px; height: 16px; background: #fffaf2; transform: translateX(-50%) rotate(45deg); border-radius: 0 0 4px 0; box-shadow: 1.5px 1.5px 0 #eedcc4; }
.today { position: relative; background: var(--card); border-radius: 24px; padding: 22px 22px 18px; box-shadow: var(--shadow), 0 0 0 1px var(--line); margin-top: -18px; text-align: center; }
.today-k { margin: 0; font-size: 12px; font-weight: 900; letter-spacing: .14em; color: var(--berry); }
.today-title { margin: 6px 0 2px; font-size: 22px; line-height: 1.4; font-weight: 900; }
.today-day { display: block; font-family: var(--serif); font-weight: 600; font-size: 13px; letter-spacing: .24em; color: var(--mist); margin-bottom: 2px; }
.today-sub { margin: 0; color: var(--mist); font-size: 13px; }
.today-btns { margin: 16px 0 6px; display: flex; flex-direction: column; gap: 10px; }
.today-btns .btn { width: 100%; }
.today.is-rest .today-k { color: var(--ok); }
.meters { display: flex; justify-content: center; gap: 10px; margin-top: 12px; }
.meter { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px 6px 10px; border-radius: 999px; background: var(--snow); font-size: 12px; color: var(--mist); }
.meter svg { width: 18px; height: 18px; color: #6f8fc8; }
.meter b { font-size: 16px; color: var(--ink); font-weight: 900; }
.meter b i { font-style: normal; font-size: 11px; color: var(--mist); font-weight: 700; }

/* the branch: 30 perches */
.branch { list-style: none; margin: 34px 0 0; padding: 0; }
.unit { position: relative; padding: 18px 0 8px; }
.unit + .unit { margin-top: 14px; border-top: 1px dashed var(--line-2); }
.unit-head { display: flex; align-items: center; gap: 10px; justify-content: center; }
.unit-n { font-family: var(--serif); font-weight: 600; font-size: 12px; letter-spacing: .24em; color: var(--mist); }
.unit-t { font-size: 17px; font-weight: 900; }
.friend { width: 28px; height: 28px; display: inline-block; animation: perk 2.8s ease-in-out infinite; }
.friend svg { width: 100%; height: 100%; }
@keyframes perk { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-8deg) translateY(-1px); } }
.unit-sub { margin: 0 auto 6px; text-align: center; color: var(--mist); font-size: 12.5px; max-width: 30em; }
.perches { list-style: none; margin: 0; padding: 10px 0 0; position: relative; }
.perches::before { content: ""; position: absolute; left: 50%; top: 24px; bottom: 40px; width: 7px; margin-left: -3.5px; border-radius: 4px; background: repeating-linear-gradient(180deg, #eceae4 0 22px, #2c2a30 22px 25px, #eceae4 25px 40px, #4b4850 40px 42px); opacity: .55; }
.perch { position: relative; display: flex; justify-content: center; padding: 6px 0; }
.perch.p1 { transform: translateX(-62px); }
.perch.p3 { transform: translateX(62px); }
.perch button { display: flex; flex-direction: column; align-items: center; gap: 4px; background: none; border: 0; padding: 0; width: 132px; }
.perch-dot { position: relative; display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: #fff; border: 2px solid var(--line-2); box-shadow: 0 5px 0 #d9e0eb; font-family: var(--serif); font-weight: 600; font-size: 20px; color: var(--mist); transition: transform .15s var(--ease); }
.perch-dot svg { width: 28px; height: 28px; }
.perch button:active .perch-dot { transform: translateY(3px); box-shadow: 0 2px 0 #d9e0eb; }
.perch-t { position: relative; font-size: 12px; line-height: 1.4; color: var(--mist); text-align: center; font-weight: 700; background: var(--snow); padding: 1px 8px; border-radius: 8px; }
.perch.is-done .perch-dot { background: var(--navy); border-color: var(--navy); color: #fff; box-shadow: 0 5px 0 var(--navy-d); }
.perch.is-done .perch-t { color: var(--ink-2); }
.perch.is-next .perch-dot { border: 3px solid var(--navy); color: var(--navy); width: 74px; height: 74px; font-size: 24px; box-shadow: 0 5px 0 #c7d0de, 0 0 0 8px rgba(38, 50, 76, .08); animation: breathe 2.2s ease-in-out infinite; }
.perch.is-next .perch-t { color: var(--ink); }
@keyframes breathe { 50% { box-shadow: 0 5px 0 #c7d0de, 0 0 0 14px rgba(38, 50, 76, .03); } }

/* ── onboarding ────────────────────────────────────── */
body[data-screen="onb"] .foot, body[data-screen="lesson"] .foot, body[data-screen="lesson"] .top, body[data-screen="done"] .top { display: none; }
.onb { min-height: calc(100vh - var(--top)); min-height: calc(100dvh - var(--top)); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 10px 0 30px; text-align: center; }
.stage-onb { width: min(100%, 400px); height: clamp(260px, 46vh, 360px); }
.bubble-onb { max-width: 380px; margin-top: -4px; text-align: left; }
.onb-btns { display: flex; flex-direction: column; gap: 10px; width: min(100%, 360px); margin-top: 18px; }
.onb-midi-msg { margin: 0; color: var(--mist); font-size: 12.5px; min-height: 1.5em; }
.onb-brand { margin: 26px 0 0; display: flex; flex-direction: column; gap: 2px; color: var(--mist); font-size: 12px; }
.logo-word { font-family: var(--serif); font-weight: 600; letter-spacing: .3em; font-size: 15px; color: var(--ink-2); }

/* ── lesson ────────────────────────────────────────── */
body[data-screen="lesson"] { overflow: hidden; }
body[data-screen="lesson"] .view { max-width: none; padding: 0; }
.lesson { height: 100vh; height: 100dvh; display: grid; grid-template-rows: auto 1fr auto auto; max-width: 760px; margin: 0 auto; }
.l-top { display: flex; align-items: center; gap: 12px; padding: calc(10px + env(safe-area-inset-top)) 16px 6px; }
.x { width: 40px; height: 40px; border-radius: 12px; border: 0; background: none; color: var(--mist); display: grid; place-items: center; flex: none; }
.x:hover { background: rgba(29, 36, 51, .05); }
.prog { flex: 1; height: 14px; border-radius: 999px; background: #e1e7f0; overflow: hidden; }
.prog i { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, #7fa3d6, #3e5c94); transition: width .5s var(--ease); position: relative; }
.prog i::after { content: ""; position: absolute; left: 8px; right: 8px; top: 3px; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .35); }
.l-day { font-family: var(--serif); font-weight: 600; font-size: 12px; letter-spacing: .18em; color: var(--mist); flex: none; }
.l-main { min-height: 0; display: flex; flex-direction: column; padding: 4px 16px 0; }
.l-birdrow { display: flex; align-items: flex-end; gap: 6px; min-height: 92px; flex: none; }
.stage-l { width: 96px; height: 96px; flex: none; margin-left: -8px; transition: width .4s var(--ease), height .4s var(--ease); }
.l-birdrow.tall .stage-l { width: 150px; height: 150px; }
.bubble-l { flex: 1; margin-bottom: 18px; }
.bubble-l::after { content: ""; position: absolute; left: -7px; bottom: 16px; width: 14px; height: 14px; background: #fffaf2; transform: rotate(45deg); border-radius: 0 0 0 4px; box-shadow: -1.5px 1.5px 0 #eedcc4; }
.l-birdrow.quiet .bubble-l { visibility: hidden; }
.l-card { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 6px 2px 14px; overscroll-behavior: contain; }
.l-card.in > * { animation: rise .38s var(--ease) both; }
.l-card.in > *:nth-child(2) { animation-delay: .04s; }
.l-card.in > *:nth-child(3) { animation-delay: .08s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.txt { margin: 0 0 12px; font-size: 15px; line-height: 1.9; font-weight: 500; color: var(--ink); background: var(--card); border-radius: 14px; padding: 10px 16px 14px; box-shadow: 0 0 0 1px rgba(29, 36, 51, .1), 0 8px 18px -16px rgba(30, 50, 90, .5); }
.txt p { margin: 0; }
.tbl { width: 100%; border-collapse: collapse; margin: 2px 0 0; font-size: 14px; line-height: 1.55; }
.tbl th, .tbl td { padding: 7px 8px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.tbl thead th { padding-top: 2px; font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--mist); border-bottom-color: rgba(29, 36, 51, .16); }
.tbl tbody th { font-weight: 800; white-space: nowrap; }
.tbl tbody tr:last-child th, .tbl tbody tr:last-child td { border-bottom: 0; }
.tbl th:first-child, .tbl td:first-child { padding-left: 0; }
.tbl .tbl-sub { display: block; font-size: 11px; font-weight: 500; color: var(--mist); }
.txt .tbl-note { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 14px; line-height: 1.8; }
.txt .txt-k { display: flex; align-items: center; gap: 5px; margin: 0 0 4px; font-size: 11px; line-height: 1.6; font-weight: 900; letter-spacing: .14em; color: #6f8fc8; }
.txt .term, .q .term, .fb-why .term, .aside-text .term { color: #2b5cad; font-weight: 700; background: linear-gradient(transparent 62%, #dfe9f9 62%); padding: 0 1px; }
.q .term { font-weight: 900; }
.q { margin: 2px 0 14px; font-size: 19px; font-weight: 900; line-height: 1.55; }
.task { margin: 2px 0 10px; font-size: 18px; font-weight: 900; line-height: 1.55; }
.hint-keys { margin: -6px 0 10px; color: var(--mist); font-size: 13px; }
.opts { display: grid; gap: 10px; }
.opts.two { grid-template-columns: 1fr 1fr; }
.opt { min-height: 54px; padding: 10px 16px; border-radius: 14px; border: 2px solid var(--line-2); background: #fff; box-shadow: 0 4px 0 #dde3ec; font-size: 17px; font-weight: 700; text-align: center; transition: transform .1s, background .15s, border-color .15s; }
.opt:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 #dde3ec; }
.opt.is-sel { border-color: #6f8fc8; background: #edf3fc; box-shadow: 0 4px 0 #b8c9e6; color: var(--navy); }
.opt.is-ok { border-color: var(--ok); background: var(--ok-bg); box-shadow: 0 4px 0 #a7dccf; color: #1d6e5f; }
.opt.is-ng { border-color: var(--ng); background: var(--ng-bg); box-shadow: 0 4px 0 #efbcb2; color: #9b3324; }
.opt:disabled { cursor: default; }
.plays { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.play { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 14px 0 12px; border-radius: 999px; border: 1.5px solid var(--line-2); background: #fff; font-size: 13.5px; font-weight: 700; color: var(--navy); }
.play svg { color: #6f8fc8; }
.play.is-on { background: var(--navy); color: #fff; border-color: var(--navy); }
.play.is-on svg { color: #fff; }
.big-play { display: grid; place-items: center; width: 84px; height: 84px; margin: 0 auto 18px; border-radius: 50%; border: 0; background: var(--navy); color: #fff; box-shadow: 0 5px 0 var(--navy-d); }
.big-play.is-on { animation: ping 1s ease-out infinite; }
@keyframes ping { 0% { box-shadow: 0 5px 0 var(--navy-d), 0 0 0 0 rgba(38, 50, 76, .3); } 100% { box-shadow: 0 5px 0 var(--navy-d), 0 0 0 18px rgba(38, 50, 76, 0); } }
.dots { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 12px; }
.dots i { width: 12px; height: 12px; border-radius: 50%; background: #dfe5ee; transition: background .2s, transform .25s var(--pop); }
.dots i.on { background: var(--ok); transform: scale(1.15); }
.skip { display: inline-block; margin-top: 4px; background: none; border: 0; padding: 6px 2px; color: var(--mist); font-size: 12.5px; text-decoration: underline; text-underline-offset: 3px; }
.aside { margin: 4px 0 12px; padding: 10px 14px; border-radius: 14px; border: 1.5px dashed #e4cfb3; background: #fffcf6; }
.aside-bird { margin: 0; display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; color: #5b4636; font-weight: 700; line-height: 1.7; }
.aside-bird .term { color: #c4532d; }
.aside-ico { width: 24px; height: 24px; flex: none; margin-top: 1px; }
.aside-ico svg { width: 100%; height: 100%; }
.aside-btn { margin: 6px 0 0 32px; background: none; border: 0; padding: 0; color: #4e6ea8; font-weight: 700; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.aside-text { margin: 8px 0 2px; padding: 10px 12px; border-radius: 10px; background: #fff; box-shadow: 0 0 0 1px rgba(29, 36, 51, .08); font-size: 13.5px; line-height: 1.85; color: var(--ink-2); font-weight: 500; }
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin: 0 0 14px; }
.chips.many { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); }
.chip-c { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 4px 9px; border-radius: 14px; border: 1.5px solid var(--line-2); background: #fff; box-shadow: 0 3px 0 #dde3ec; }
.chip-c:active { transform: translateY(2px); box-shadow: 0 1px 0 #dde3ec; }
.chip-c.is-on { border-color: var(--navy); background: #eef3fb; }
.c-top { font-size: 11.5px; color: var(--mist); font-weight: 600; }
.c-sym { font-size: 17px; font-weight: 900; line-height: 1.3; }
.c-sub { font-size: 10.5px; color: var(--mist); font-weight: 700; line-height: 1.3; text-align: center; }
.chip-c.fn-T .c-sub { color: #2f7d6f; }
.chip-c.fn-SD .c-sub { color: #9a6a12; }
.chip-c.fn-D .c-sub { color: #b0402f; }
.chip-c.fn-T { border-color: rgba(47, 125, 111, .35); }
.chip-c.fn-SD { border-color: rgba(154, 106, 18, .35); }
.chip-c.fn-D { border-color: rgba(176, 64, 47, .35); }
/* songs & jams */
.song-t { margin: 0 0 6px; font-size: 16px; font-weight: 900; }
.song-k { display: inline-block; margin-right: 8px; padding: 0 8px; border-radius: 6px; background: var(--sky); color: var(--navy); font-size: 11px; letter-spacing: .1em; vertical-align: 2px; }
.song-now { display: flex; align-items: baseline; gap: 14px; min-height: 52px; }
.song-chord { font-size: 38px; font-weight: 900; line-height: 1.2; letter-spacing: .01em; }
.song-next { font-size: 15px; color: var(--mist); font-weight: 700; }
.song-bar { height: 6px; border-radius: 6px; background: #e1e7f0; overflow: hidden; margin: 6px 0 8px; }
.song-bar i { display: block; height: 100%; width: 0; background: #7fa3d6; transition: width .3s var(--ease); }
.song-help { margin: 0 0 8px; color: var(--ink-2); font-size: 13.5px; }
.song-end { margin: 6px 0; }
.jam-btns { margin: 8px 0 4px; }
/* keyboard */
.l-kb { padding: 6px 10px 0; }
.kb-wrap { position: relative; height: clamp(116px, 21vh, 178px); padding: 8px 6px 6px; border-radius: 16px 16px 10px 10px; background: linear-gradient(#2a3348, #1d2433); box-shadow: 0 10px 24px -14px rgba(20, 30, 60, .6); }
.kb { position: relative; width: 100%; height: 100%; touch-action: none; user-select: none; -webkit-user-select: none; }
.kb-wrap { overflow: hidden; }
.kb.is-sliding { pointer-events: none; will-change: transform; }
/* middle C: a small mark at the bottom of the key, so the octave is always easy to find */
.key.wk[data-mid]::after { content: ''; position: absolute; left: 50%; bottom: 5px; width: 14px; height: 3px; margin-left: -7px; border-radius: 2px; background: #9db6dd; pointer-events: none; }
.key { position: absolute; top: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }
.wk { height: 100%; background: linear-gradient(#fdfdfd, #f1f3f7 85%, #e7eaf0); border-radius: 0 0 7px 7px; border: 1px solid rgba(0, 0, 0, .18); border-top: 0; z-index: 1; padding-bottom: 8px; box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .05); }
.bk { height: 61%; background: linear-gradient(#3b3e48, #18191e 70%, #101114); border-radius: 0 0 5px 5px; z-index: 2; padding-bottom: 7px; box-shadow: 0 3px 4px rgba(0, 0, 0, .35), inset 0 -4px 0 rgba(255, 255, 255, .06); }
.wk.on { background: linear-gradient(#e8f0fb, #d6e3f5); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .04); }
.bk.on { background: linear-gradient(#4c5a78, #2c3650); box-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
.klab { font-size: 11px; font-weight: 700; color: #8a93a6; line-height: 1; pointer-events: none; }
.kdot { display: none; pointer-events: none; }
.mk .kdot { display: grid; place-items: center; min-width: 24px; height: 24px; padding: 0 4px; border-radius: 12px; color: #fff; font-size: 11.5px; font-weight: 900; margin-bottom: 6px; font-family: var(--sans); letter-spacing: -.02em; }
.bk.mk .kdot { min-width: 20px; height: 20px; font-size: 10.5px; margin-bottom: 4px; }
.mk-root .kdot { background: var(--c-root); }
.mk-third .kdot { background: var(--c-third); }
.mk-fifth .kdot { background: var(--c-fifth); }
.mk-seventh .kdot { background: var(--c-seventh); }
.mk-tension .kdot { background: var(--c-tension); }
.mk-avoid .kdot { background: #fff; color: #7f8aa0; box-shadow: inset 0 0 0 2px #9aa3b3; }
.mk-hint .kdot { background: var(--navy); }
.bk.mk-hint .kdot { background: #fff; color: var(--navy); }
.mk-ok .kdot { background: var(--ok); }
.mk-ng .kdot { background: var(--ng); }
/* after a wrong answer: a chord note that was left out */
.mk-miss .kdot { background: #fff; color: var(--ok); box-shadow: inset 0 0 0 2px var(--ok); }
.mk-next .kdot { background: var(--berry); animation: nudge 1s ease-in-out infinite; }
.mk-soon .kdot { background: rgba(200, 70, 61, .28); min-width: 12px; height: 12px; }
.mk-dim .kdot { background: #c8ced9; }
/* the note a finger moves away from (e.g. the bottom A in a line cliché) */
.mk-from .kdot { background: #fff; color: var(--c-root); box-shadow: inset 0 0 0 1.5px var(--c-root); opacity: .75; }
.mk-scale .kdot { background: #8fb0dd; }
.wk.mk-scale { background: linear-gradient(#f4f8fe, #e3edf9); }
.mk-scale .kdot:empty { min-width: 10px; height: 10px; }
.mk-g2 .kdot, .mk-g3 .kdot { min-width: 12px; height: 12px; }
.mk-g2 .kdot { background: #7fa3d6; }
.mk-g3 .kdot { background: #e2a93b; }
.mk-ok .kdot:empty, .mk-ng .kdot:empty, .mk-miss .kdot:empty, .mk-hint .kdot:empty, .mk-root .kdot:empty, .mk-third .kdot:empty { min-width: 14px; height: 14px; }
.wk.mk-next { background: linear-gradient(#fff, #fbe7e4); }
.bk.mk-next { background: linear-gradient(#6a2f2a, #3a1916); }
@keyframes nudge { 50% { transform: translateY(-3px); } }
.wk.sel { background: linear-gradient(#e5edfb, #cddcf4); box-shadow: inset 0 -4px 0 #6f8fc8; }
.bk.sel { background: linear-gradient(#5574ad, #2d4677); }
.fl-ok { animation: flok .6s ease-out; }
.fl-ng { animation: flng .5s ease-out; }
@keyframes flok { 0% { filter: none; } 20% { filter: drop-shadow(0 0 6px rgba(43, 154, 134, .9)) brightness(1.04); } 100% { filter: none; } }
@keyframes flng { 0%, 100% { transform: none; } 25% { transform: translateX(-2px); } 50% { transform: translateX(2px); } 75% { transform: translateX(-1px); } }
.wk.fl-ng { background: linear-gradient(#fff, #f9d7d0); }
/* footer of the lesson: turns green or rose after an answer */
.l-foot { padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid transparent; transition: background .25s; }
.l-foot .btn { width: 100%; }
.l-foot.ok { background: var(--ok-bg); border-top-color: rgba(43, 154, 134, .2); }
.l-foot.ng { background: var(--ng-bg); border-top-color: rgba(208, 83, 63, .2); }
.l-foot.ok .btn-main { background: var(--ok); box-shadow: 0 4px 0 #1d7363; }
.l-foot.ng .btn-main { background: var(--ng); box-shadow: 0 4px 0 #a33a2a; }
.fb:empty { display: none; }
.fb { margin-bottom: 10px; animation: rise .3s var(--ease); }
.fb-h { margin: 0; font-size: 18px; font-weight: 900; }
.ok .fb-h { color: #1d6e5f; }
.ng .fb-h { color: #a33a2a; }
.fb-a { font-size: 14px; font-weight: 700; margin-left: 6px; }
.fb-why { margin: 4px 0 0; font-size: 13.5px; line-height: 1.75; color: var(--ink-2); }

/* ── praise ────────────────────────────────────────── */
.done { position: relative; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px 0 30px; overflow: hidden; }
.done-k { margin: 0; font-family: var(--serif); font-weight: 600; letter-spacing: .2em; font-size: 13px; color: var(--berry); }
.stage-done { width: min(100%, 380px); height: clamp(250px, 40vh, 340px); margin: -8px 0 -14px; }
.praise { margin: 0; font-size: clamp(22px, 6vw, 30px); line-height: 1.45; font-weight: 900; max-width: 15em; animation: rise .6s .25s var(--pop) both; }
.done-sub { display: flex; align-items: center; gap: 6px; justify-content: center; margin: 8px 0 0; color: var(--ink-2); font-size: 13.5px; }
.done-sub svg { width: 26px; height: 26px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: min(100%, 420px); margin: 22px 0 22px; }
.stat { background: #fff; border-radius: 16px; padding: 12px 6px 10px; box-shadow: 0 0 0 1px var(--line), var(--shadow-sm); display: flex; flex-direction: column; align-items: center; animation: rise .5s var(--pop) both; }
.stat:nth-child(1) { animation-delay: .5s; } .stat:nth-child(2) { animation-delay: .62s; } .stat:nth-child(3) { animation-delay: .74s; }
.stat svg { width: 18px; height: 18px; color: #6f8fc8; }
.stat b { font-size: 26px; font-weight: 900; line-height: 1.2; }
.stat b i, .stat > i { font-style: normal; font-size: 13px; color: var(--mist); }
.stat:first-child { flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: baseline; }
.stat:first-child span { width: 100%; }
.stat span { font-size: 11.5px; color: var(--mist); font-weight: 700; }
.stat.up b { color: var(--navy); animation: bump .6s 1.1s var(--pop); }
@keyframes bump { 40% { transform: scale(1.3); } }
.done-btns { display: flex; flex-direction: column; gap: 10px; width: min(100%, 360px); }
.done-bye { margin: 14px 0 0; color: var(--mist); font-size: 12.5px; }
.snow { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.done > *:not(.snow) { position: relative; z-index: 1; }
.snow i { position: absolute; top: -20px; left: var(--x); width: 9px; height: 9px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px rgba(111, 143, 200, .18), 0 2px 6px rgba(111, 143, 200, .25); transform: scale(var(--s)); animation: fall var(--d) linear var(--w) infinite; opacity: .95; }
@keyframes fall { to { transform: translate(28px, 105vh) scale(var(--s)); } }
.done.is-grad .praise { color: var(--navy); }

/* ── modal ─────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(20, 28, 44, .38); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.m-sheet { position: relative; width: min(100%, 520px); max-height: 88vh; overflow-y: auto; background: #fff; border-radius: 22px 22px 0 0; padding: 22px 22px calc(26px + env(safe-area-inset-bottom)); animation: up .32s var(--ease); }
@keyframes up { from { transform: translateY(30px); opacity: .4; } }
@media (min-width: 640px) { .modal { align-items: center; } .m-sheet { border-radius: 22px; } }
.m-x { position: absolute; right: 12px; top: 12px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--snow); color: var(--mist); display: grid; place-items: center; }
.m-body h3 { margin: 0 0 12px; font-size: 18px; font-weight: 900; padding-right: 36px; }
.m-body p { margin: 0 0 12px; font-size: 14px; line-height: 1.85; color: var(--ink-2); }
.m-body p.small { font-size: 12px; color: var(--mist); }
.m-btns { display: flex; gap: 10px; margin-top: 14px; }
.m-btns .btn { flex: 1; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); font-weight: 700; font-size: 14px; }
.row.col { flex-direction: column; align-items: flex-start; gap: 6px; }
.row small { color: var(--mist); font-weight: 500; font-size: 12.5px; line-height: 1.6; }
.midi-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--snow); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button, .seg a { border: 0; background: none; padding: 6px 12px; border-radius: 9px; font-size: 13px; font-weight: 700; color: var(--mist); text-decoration: none; }
.seg [aria-pressed="true"] { background: #fff; color: var(--navy); box-shadow: var(--shadow-sm); }
.link { background: none; border: 0; padding: 0; color: #4e6ea8; font-weight: 700; font-size: 13.5px; text-decoration: underline; text-underline-offset: 3px; }
.link.warn { color: var(--ng); }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--mist); font-weight: 700; }
.field input { height: 48px; border-radius: 12px; border: 2px solid var(--line-2); padding: 0 14px; font: inherit; font-size: 16px; color: var(--ink); }
.cert-out img { width: 100%; border-radius: 10px; margin-top: 14px; box-shadow: var(--shadow-sm); }
body.modal-open { overflow: hidden; }

/* ── larger screens ────────────────────────────────── */
@media (min-width: 720px) {
  .stage-l { width: 120px; height: 120px; }
  .l-birdrow { min-height: 112px; }
  .l-birdrow.tall .stage-l { width: 190px; height: 190px; }
  .q { font-size: 21px; }
  .opts:not(.two) { grid-template-columns: repeat(3, 1fr); }
  .kb-wrap { height: clamp(150px, 26vh, 220px); }
  .l-foot { display: flex; align-items: center; gap: 18px; }
  .l-foot .fb { flex: 1; margin: 0; }
  .l-foot .btn { width: auto; min-width: 200px; margin-left: auto; }
}
@media (max-height: 640px) {
  .l-birdrow { min-height: 72px; }
  .stage-l { width: 76px; height: 76px; }
  .kb-wrap { height: 110px; }
  .q { font-size: 17px; margin-bottom: 10px; }
  .opt { min-height: 46px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .snow { display: none; }
}
.dots.big i { width: 16px; height: 16px; }

/* a little snow behind the bird on the home and welcome screens */
.hero, .onb { position: relative; }
.hero > *:not(.snow), .onb > *:not(.snow) { position: relative; z-index: 1; }
.snow-soft { position: absolute; inset: -20px -18px 0; overflow: hidden; pointer-events: none; z-index: 0; -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent); }
.snow-soft i { position: absolute; top: -12px; left: var(--x); width: 7px; height: 7px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px rgba(111, 143, 200, .14), 0 2px 5px rgba(111, 143, 200, .18); opacity: .9; transform: scale(var(--s)); animation: drift var(--d) linear var(--w) infinite; }
@keyframes drift { to { transform: translate(22px, 560px) scale(var(--s)); } }

/* Shimaegana's little marks (sparkles, ?, anger, sighs) */
.bird-fx { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.fx { position: absolute; display: block; animation: fxin 2.2s var(--pop) both; }
.fx svg { width: 100%; height: 100%; display: block; overflow: visible; }
.fx-cheer, .fx-dance, .fx-anger { left: 8%; width: 84%; top: 14%; height: 34%; }
.fx-sparkle { left: 10%; width: 80%; top: 6%; height: 42%; }
.fx-sparkle1 { right: 17%; width: 12%; top: 8%; aspect-ratio: 1; }
.fx-question { right: 16%; width: 12%; top: 4%; aspect-ratio: 40 / 56; }
.fx-wave { left: 10%; width: 18%; top: 16%; aspect-ratio: 1; }
.fx-sigh { left: 6%; width: 22%; top: 4%; aspect-ratio: 1; }
.fx.fx-bust.fx-cheer, .fx.fx-bust.fx-dance, .fx.fx-bust.fx-anger { top: 6%; height: 40%; left: 0; width: 100%; }
.fx.fx-bust.fx-sparkle { top: 0; height: 50%; left: 0; width: 100%; }
.fx.fx-bust.fx-question, .fx.fx-bust.fx-sparkle1 { right: 0; width: 24%; top: 0; }
.fx.fx-bust.fx-sigh { left: -4%; width: 34%; top: -4%; }
.fx.fx-bust.fx-wave { left: -2%; width: 28%; top: 10%; }
@keyframes fxin { 0% { opacity: 0; transform: scale(.6); } 12% { opacity: 1; transform: scale(1.06); } 20% { transform: scale(1); } 78% { opacity: 1; } 100% { opacity: 0; transform: translateY(-6%); } }
.fx-dance svg, .fx-wave svg { animation: wig .35s ease-in-out infinite alternate; }
@keyframes wig { to { transform: rotate(-6deg); } }

/* Japanese: break lines only between phrases (the <wbr> marks come from text-ja.js) */
html[lang="ja"] :is(.bubble, .txt, .q, .opt, .fb, .aside, .story, .today-title, .today-sub, .today-k, .unit-t, .unit-sub, .perch-t, .praise, .done-sub, .done-bye, .song-help, .song-t, .hint-keys, .m-body, .onb-midi-msg, .btn, .play, .row, .c-sub, .skip, .intro-static) {
  word-break: keep-all; overflow-wrap: anywhere; line-break: strict;
}
.bubble, .txt p, .q, .fb-why, .aside-text, .praise { text-wrap: pretty; }
/* ruby (furigana), when switched on in Settings */
ruby { ruby-position: over; ruby-align: center; }
rt { font-size: .5em; font-weight: 700; letter-spacing: 0; line-height: 1; color: inherit; opacity: .78; user-select: none; }
.btn rt, .opt rt, .play rt { font-weight: 500; }
body.ruby .bubble { line-height: 2.05; }
body.ruby .txt { line-height: 2.25; }
body.ruby .q, body.ruby .task { line-height: 1.95; }
body.ruby .fb-why, body.ruby .aside-text, body.ruby .aside-bird { line-height: 2.1; }
body.ruby .opt { line-height: 1.8; padding-top: 6px; }
body.ruby .perch-t, body.ruby .unit-sub, body.ruby .today-sub { line-height: 1.9; }
body.ruby .today-title { line-height: 1.75; }
/* nothing may widen the page sideways on phones (the bird's canvas is drawn larger than its box) */
html, body { overflow-x: hidden; }
@supports (overflow: clip) { html, body { overflow-x: clip; } }
.view, .hero, .onb, .done { overflow-x: clip; }

/* ── readings (よみもの): a warm paper card, apart from the blue explanation card and the bird's bubble ── */
.story { margin: 0 0 12px; padding: 14px 16px 14px; border-radius: 16px; background: linear-gradient(#fffaf0, #fff6e8); box-shadow: 0 0 0 1px #ecdcc0, 0 10px 22px -18px rgba(120, 80, 30, .6); color: #3d2f24; }
.story-k { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; font-size: 11px; line-height: 1.6; font-weight: 900; letter-spacing: .14em; color: #a0663d; }
.story-t { margin: 0 0 6px; font-size: 17px; line-height: 1.6; font-weight: 900; color: #3d2f24; }
.story-lead { margin: 0; font-size: 14px; line-height: 1.85; color: #5b4636; font-weight: 500; }
.story-btn { margin: 10px 0 0; display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; border: 1.5px solid #d9bd97; background: #fff; color: #7a4a26; font-weight: 800; font-size: 13.5px; cursor: pointer; }
.story-btn::after { content: ''; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform .2s; }
.story-btn[aria-expanded="true"]::after { transform: translateY(1px) rotate(-135deg); }
.story-body { margin: 12px 0 0; padding: 12px 0 0; border-top: 1px dashed #e4cfb3; }
.story-body p { margin: 0 0 10px; font-size: 14.5px; line-height: 1.9; font-weight: 500; text-wrap: pretty; }
.story-h { margin: 12px 0 4px; font-size: 13.5px; line-height: 1.6; font-weight: 900; color: #8a5530; }
.story-h:first-child { margin-top: 0; }
.story .term { color: #a0461f; font-weight: 700; background: linear-gradient(transparent 62%, #f8e4cf 62%); padding: 0 1px; }
.story .plays { margin-top: 4px; }
.story-link { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 12px 0 0; padding: 11px 14px; border-radius: 12px; background: #1f2a44; color: #fff; text-decoration: none; font-weight: 800; font-size: 13.5px; line-height: 1.6; }
.story-link span { flex: none; }
.story-link:hover { background: #2c3a5c; }
body.ruby .story-body p, body.ruby .story-lead { line-height: 2.3; }
/* the old colours: dark naturals, light sharps */
.kb-rev .wk { background: linear-gradient(#4a3a30, #2e231c 85%, #241a14); border-color: rgba(0, 0, 0, .5); }
.kb-rev .wk .klab { color: #e9dccb; }
.kb-rev .bk { background: linear-gradient(#fbf6ec, #e9dfcf 75%, #d9ccb7); box-shadow: 0 3px 4px rgba(0, 0, 0, .35), inset 0 -4px 0 rgba(0, 0, 0, .08); }

/* ── the word book ── */
.term[data-g] { cursor: pointer; text-decoration: underline dotted 1.5px; text-underline-offset: 4px; text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); }
.term[data-g]:focus-visible { outline: 2px solid #6f8fc8; outline-offset: 2px; border-radius: 3px; }
.book-btn { margin: 12px auto 0; display: flex; align-items: center; gap: 7px; padding: 8px 16px; border-radius: 999px; border: 1.5px solid #d9bd97; background: #fffaf1; color: #7a4a26; font-weight: 800; font-size: 13.5px; cursor: pointer; }
.book-btn:hover { background: #fff3e0; }
.m-body .g-k { display: flex; align-items: center; gap: 6px; margin: 0 0 4px; font-size: 11px; font-weight: 900; letter-spacing: .14em; color: #a0663d; }
.m-body.is-gloss h3 { margin-top: 0; }
.m-body .g-lead { margin: 0 0 10px; font-size: 13px; color: var(--ink-2); line-height: 1.7; }
.m-body .g-def { color: var(--ink); margin: 0 0 10px; font-size: 14.5px; line-height: 1.9; font-weight: 500; text-wrap: pretty; }
.g-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.g-day { font-size: 12px; font-weight: 800; color: #8a7a6a; background: #f4ede3; border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.g-day.is-done { color: #2f6f4f; background: #e3f2e9; }
.g-unit { margin: 16px 0 6px; font-size: 12.5px; font-weight: 900; letter-spacing: .06em; color: #5b6b8a; }
.g-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.g-list details { border-radius: 12px; background: #fffaf1; box-shadow: 0 0 0 1px #ecdcc0; }
.g-list summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; cursor: pointer; font-weight: 800; font-size: 14px; color: #3d2f24; }
.g-list summary::-webkit-details-marker { display: none; }
.g-list summary .g-day { font-size: 11px; }
.g-list .g-entry { padding: 0 12px 12px; }
.g-list .g-foot .g-day { display: none; }
body.ruby .m-body .g-def { line-height: 2.3; }
.m-body .g-hint { display: inline-block; margin-top: 4px; color: #7a4a26; }
.g-more { margin: 14px 0 2px; padding: 10px 12px 10px; border-radius: 12px; background: #f3f6fb; }
.m-body .g-more-k { margin: 0 0 4px; font-size: 11px; font-weight: 900; letter-spacing: .12em; color: #5b6b8a; }
.m-body .g-more-t { margin: 0; font-size: 14px; line-height: 1.9; font-weight: 500; color: var(--ink); text-wrap: pretty; }
.m-body .g-see-k { margin-top: 10px; }
.g-see-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.m-body a.g-see { display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 8px; padding: 8px 12px; border-radius: 10px; background: #fff; box-shadow: 0 0 0 1px #d6dfee; color: var(--ink); text-decoration: none; transition: box-shadow .15s, transform .15s; }
.m-body a.g-see:hover { box-shadow: 0 0 0 1.5px #7f98c6; transform: translateY(-1px); }
.g-see-w { font-size: 11.5px; font-weight: 900; letter-spacing: .06em; color: #2b5cad; }
.g-see-why { grid-column: 1; font-size: 13px; line-height: 1.6; font-weight: 600; color: var(--ink-2); }
.g-see-go { grid-column: 2; grid-row: 1 / span 2; color: #2b5cad; font-weight: 900; }
.g-list .g-more { background: #fff; }
.m-body .term { color: #2b5cad; font-weight: 700; }

/* ── the extras (おかわり): a warm, separate branch at the end; locked until graduation ── */
.unit.is-extra .unit-head .unit-t { color: #a0461f; }
.unit.is-extra .perch-dot { background: #fff6e8; border-color: #e4c39c; color: #8a5530; box-shadow: 0 5px 0 #ecd6b8; }
.unit.is-extra .perch.is-done .perch-dot { background: #c4532d; border-color: #c4532d; color: #fff; box-shadow: 0 5px 0 #9c3e20; }
.unit.is-extra .perch.is-next .perch-dot { border-color: #c4532d; color: #c4532d; }
.unit.is-extra.is-locked .perches { opacity: .7; filter: saturate(.7); }
.unit.is-extra .perch.is-shut .perch-dot { color: #b08a66; }
.unit.is-extra .perch.is-shut .perch-dot svg { width: 20px; height: 20px; }
.unit.is-extra .perch.is-soon .perch-dot { background: var(--snow); border-style: dashed; box-shadow: none; color: #c9b59c; }
.unit.is-extra .perch.is-soon .perch-t { color: #a8998a; }
.perch-tag { display: block; margin: 2px auto 0; font-size: 10.5px; font-weight: 800; letter-spacing: .04em; color: #a8998a; }
.perch-tag.is-trial { color: #c4532d; }
/* the おかわり window: the bird asks for birdseed money; codoc's form opens below */
.m-body.is-oka .oka-say { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 14px; padding: 14px 16px; border-radius: 16px; background: linear-gradient(#fffaf0, #fff6e8); box-shadow: 0 0 0 1px #ecdcc0; color: #3d2f24; font-size: 15px; line-height: 1.85; font-weight: 700; }
.oka-ico { flex: none; width: 34px; height: 34px; margin-top: 2px; }
.oka-ico svg { width: 100%; height: 100%; }
.m-body.is-oka .oka-note { margin: 0 0 14px; font-size: 13.5px; line-height: 1.8; color: var(--ink-2); }
.oka-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.oka-btns .btn { flex: 1 1 200px; }
.oka-codoc { margin-top: 14px; }
.m-body.is-oka .oka-msg { margin: 0 0 8px; font-size: 13px; color: var(--ink-2); }
.m-body.is-oka .oka-small { margin: 8px 0 0; font-size: 12px; line-height: 1.7; color: #8a8f9c; }
.oka-pass { margin-top: 16px; padding-top: 12px; border-top: 1px dashed #e4cfb3; }
.oka-pass summary { cursor: pointer; font-size: 13px; font-weight: 800; color: #7a4a26; }
.oka-pass form { display: flex; gap: 8px; margin-top: 10px; }
.oka-pass input { flex: 1; min-width: 0; height: 38px; padding: 0 12px; border-radius: 10px; border: 1.5px solid #d9bd97; font: inherit; font-size: 15px; letter-spacing: .06em; background: #fff; color: var(--ink); }
.oka-pass input:focus { outline: 2px solid #c4532d; outline-offset: 1px; }
.unit-lock { display: flex; align-items: center; justify-content: center; gap: 5px; margin-top: 6px; font-size: 12px; font-weight: 800; color: #8a7a6a; }
.unit.is-extra .perch.is-next .perch-dot { box-shadow: 0 5px 0 #ecd6b8, 0 0 0 8px rgba(196, 83, 45, .1); }

/* ── the sound button: on / off, and a soft pulse while the page is still waiting for its first tap ── */
.snd { position: relative; }
.snd .snd-off { display: none; }
.snd.is-off .snd-on { display: none; }
.snd.is-off .snd-off { display: block; }
.snd.is-off { color: var(--mist); }
.snd .snd-dot { position: absolute; top: 7px; right: 7px; width: 7px; height: 7px; border-radius: 50%; background: #c4532d; opacity: 0; transform: scale(.4); transition: opacity .3s, transform .3s; }
.snd.is-wait .snd-dot { opacity: 1; transform: none; animation: sndPulse 1.6s ease-in-out infinite; }
.snd.is-wait .w1, .snd.is-wait .w2 { opacity: .35; }
.snd:not(.is-wait):not(.is-off) .w1 { animation: sndWave 2.4s ease-in-out infinite; }
.snd:not(.is-wait):not(.is-off) .w2 { animation: sndWave 2.4s ease-in-out .2s infinite; }
@keyframes sndPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(196, 83, 45, .45); } 50% { box-shadow: 0 0 0 6px rgba(196, 83, 45, 0); } }
@keyframes sndWave { 0%, 70%, 100% { opacity: 1; } 85% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .snd .snd-dot, .snd .w1, .snd .w2 { animation: none !important; } }

/* ── larger screens: keep the keyboard close under the words instead of pinned to the bottom ──
   the lesson becomes a column; the words, keyboard and button sit together in the middle, and when the
   words grow (a "tell me" note opened) the group simply takes more room and the words scroll if they must */
@media (min-width: 720px) {
  .lesson { display: flex; flex-direction: column; }
  .l-top, .l-kb, .l-foot { flex: none; }
  .l-main { flex: 0 1 auto; min-height: min(280px, 38vh); margin-top: auto; }
  .l-card { flex: 1 1 auto; }
  .l-foot { margin-bottom: auto; }
  .l-kb { padding-top: 10px; }
}
.top .brand-sub, .top .brand-sub * { white-space: nowrap !important; }
@media (max-width: 420px) {
  .top { gap: 8px; padding: 0 max(12px, env(safe-area-inset-left)); }
  .top-nav { gap: 6px; }
  .top .chip-icon { width: 34px; min-width: 34px; height: 34px; }
  .top .chip-lang { padding: 0 10px; height: 34px; }
  .brand { gap: 7px; }
  .brand-title { letter-spacing: .14em; font-size: 16px; }
}

/* write-a-tune step: four bars of beats to fill */
.wr { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 8px; margin: 0 0 6px; }
@media (min-width: 520px) { .wr { grid-template-columns: repeat(4, 1fr); } }
.wr-bar { padding: 5px 5px 6px; border-radius: 12px; background: #fff; box-shadow: 0 0 0 1px #dde4ef; }
.wr-ch { display: block; margin: 0 2px 3px; font-size: 12.5px; font-weight: 800; color: var(--ink-2); }
.wr-cells { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.wr-cells i { display: flex; align-items: center; justify-content: center; height: 30px; border-radius: 8px; background: #f1f4f9; font-style: normal; font-size: 12.5px; font-weight: 800; color: var(--ink); }
.wr-cells i.is-cur { box-shadow: inset 0 0 0 2px #7f98c6; background: #fff; }
.wr-cells i.is-note { background: #e4ecf9; color: #2b5cad; }
.wr-cells i.is-tie { background: #e4ecf9; color: #7f98c6; }
.wr-cells i.is-rest { color: #b4bccb; }
.wr-btns { display: flex; gap: 6px; margin-top: 6px; }
.wr-btns .btn { flex: 1 1 0; min-width: 0; padding-left: 4px; padding-right: 4px; }
.wr-links { display: flex; gap: 14px; margin: 6px 0 0; }
.done.is-xgrad .praise { color: #a0461f; }

/* three short answers side by side; a hint when more of the card is below the fold */
.opts.three { grid-template-columns: repeat(3, 1fr); gap: 8px; }
.opts.three .opt { padding-left: 6px; padding-right: 6px; }
.l-main { position: relative; }
.more-hint { position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%); z-index: 3; display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 12px 0 14px; border: 0; border-radius: 999px; background: rgba(36, 48, 76, .86); color: #fff; font: inherit; font-size: 12.5px; font-weight: 800; letter-spacing: .04em; box-shadow: 0 4px 14px rgba(20, 30, 50, .22); cursor: pointer; animation: moreHint 1.6s ease-in-out infinite; }
.more-hint svg { width: 14px; height: 14px; }
.more-hint[hidden] { display: none; }
@keyframes moreHint { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, 3px); } }
@media (prefers-reduced-motion: reduce) { .more-hint { animation: none; } }
@media (max-width: 719px) { body.has-kb .opt { min-height: 48px; padding-top: 8px; padding-bottom: 8px; } }
