:root {
  color-scheme: light;
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", sans-serif;
  --ink: #313347;
  --paper: #fff5dc;
  --coral: #ef6f66;
  --mint: #58b99f;
  --mustard: #e4ad42;
  --sky: #8fd5d8;
  --night: #45486e;
  background: #f8c77e;
  color: var(--ink);
}
* { box-sizing: border-box; }
html { min-height: 100%; background: #f8c77e; }
body { min-height: 100vh; margin: 0; overflow-x: hidden; background: radial-gradient(circle at 12% 4%, rgba(255,255,255,.7), transparent 22rem), linear-gradient(150deg, #f7d99b, #f3a97f 60%, #8bc8c4); }
button, a { font: inherit; }
button { color: inherit; }
a:focus-visible, button:focus-visible, canvas:focus-visible { outline: 4px solid #fff; outline-offset: 4px; }
.masthead { display: flex; justify-content: space-between; align-items: center; width: min(94vw, 1120px); min-height: 64px; margin: auto; }
.masthead a { color: var(--ink); font-weight: 800; text-decoration: none; }
.masthead button, .reset { border: 2px solid var(--ink); border-radius: 999px; background: rgba(255,245,220,.8); padding: .55rem .9rem; font-weight: 900; cursor: pointer; box-shadow: 3px 3px 0 var(--ink); }
main { width: min(94vw, 1120px); margin: 0 auto; padding-bottom: 3rem; }
.intro { padding: clamp(1.2rem, 4vw, 2.6rem) 0 1.5rem; text-align: center; }
.eyebrow, .manual-kicker { margin: 0 0 .55rem; color: #715063; font: 900 .72rem/1 ui-monospace, monospace; letter-spacing: .18em; }
h1 { margin: 0; font-size: clamp(3rem, 8vw, 6rem); line-height: .87; letter-spacing: -.06em; text-shadow: 4px 4px 0 rgba(255,255,255,.55); }
h1 span { display: block; color: #fff4d0; -webkit-text-stroke: 2px var(--ink); text-shadow: 5px 5px 0 var(--coral); }
.intro > p:last-child { margin: 1.3rem 0 0; font-size: clamp(1rem, 2vw, 1.25rem); font-weight: 800; }
.game-layout { display: grid; grid-template-columns: minmax(0, 670px) minmax(260px, 1fr); gap: 1.4rem; align-items: start; }
.game-column, .manual { border: 3px solid var(--ink); border-radius: 26px; overflow: hidden; background: var(--paper); box-shadow: 9px 9px 0 rgba(49,51,71,.25); }
.hud { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 3px solid var(--ink); background: #fffaf0; }
.hud div { padding: .7rem .55rem; text-align: center; border-right: 2px dashed rgba(49,51,71,.3); }
.hud div:last-child { border-right: 0; }
.hud span, .harmony span { display: block; font: 900 .64rem/1 ui-monospace, monospace; letter-spacing: .11em; color: #715063; }
.hud strong { display: block; margin-top: .3rem; font-size: clamp(.95rem, 2vw, 1.25rem); }
.game-shell { position: relative; aspect-ratio: 540 / 760; background: #596080; overflow: hidden; }
canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.start-panel { position: absolute; inset: 0; display: grid; align-content: center; justify-items: center; padding: 2rem; text-align: center; color: #fff9e9; background: linear-gradient(rgba(49,51,71,.24), rgba(49,51,71,.72)); backdrop-filter: blur(2px); }
.start-panel[hidden] { display: none; }
.start-kicker { margin: 0; font: 900 .72rem/1 ui-monospace, monospace; letter-spacing: .14em; color: #ffd778; }
.start-panel h2 { margin: .8rem 0; font-size: clamp(2rem, 6vw, 3.6rem); line-height: 1.06; text-shadow: 3px 3px 0 #313347; }
.start-panel p { max-width: 29rem; font-weight: 800; line-height: 1.7; }
.start-panel button { min-width: min(100%, 300px); border: 3px solid var(--ink); border-radius: 999px; padding: 1rem 1.4rem; background: #ffe06e; box-shadow: 5px 5px 0 var(--ink); font-weight: 950; font-size: 1.1rem; cursor: pointer; }
.start-panel .share { margin-top: .8rem; color: #fff; background: var(--ink); box-shadow: 5px 5px 0 #ef6f66; }
.flash { position: absolute; inset: 0; pointer-events: none; background: #fff8be; opacity: 0; }
.flash.is-on { animation: flash .36s ease-out; }
@keyframes flash { 0% { opacity: .75; } 100% { opacity: 0; } }
.live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.pads { display: grid; grid-template-columns: repeat(3, 1fr); gap: .55rem; padding: .75rem; border-top: 3px solid var(--ink); background: #fffaf0; }
.pad { position: relative; min-height: 78px; border: 3px solid var(--ink); border-radius: 18px; cursor: pointer; box-shadow: 4px 4px 0 var(--ink); transition: transform 80ms ease, box-shadow 80ms ease; }
.pad:active, .pad.is-hit { transform: translate(3px,3px); box-shadow: 1px 1px 0 var(--ink); }
.pad span, .pad small { display: block; font-weight: 800; }
.pad span { font-size: .62rem; opacity: .72; }
.pad strong { display: block; margin: .1rem 0; font-size: clamp(1.25rem, 3vw, 1.75rem); }
.pad small { font-size: .7rem; }
.pad-drum { background: #f48678; }
.pad-bell { background: #f5c64f; }
.pad-horn { background: #66c8ae; }
.harmony { display: grid; grid-template-columns: 90px 1fr; align-items: center; gap: .8rem; padding: .7rem 1rem; border-top: 2px dashed rgba(49,51,71,.35); background: #fffaf0; }
.harmony strong { display: block; font-size: 1.05rem; }
progress { width: 100%; height: 16px; border: 2px solid var(--ink); border-radius: 999px; overflow: hidden; background: #dfd6c3; }
progress::-webkit-progress-bar { background: #dfd6c3; }
progress::-webkit-progress-value { background: linear-gradient(90deg,#ef6f66,#e8c64a,#58b99f); }
progress::-moz-progress-bar { background: linear-gradient(90deg,#ef6f66,#e8c64a,#58b99f); }
.hint { min-height: 54px; margin: 0; padding: .9rem 1rem; text-align: center; border-top: 2px dashed rgba(49,51,71,.35); background: #313347; color: #fff8df; font-weight: 850; }
.manual { padding: clamp(1.2rem, 3vw, 1.8rem); }
.manual h2 { margin: 0; font-size: clamp(1.7rem, 3vw, 2.4rem); }
.manual ol { display: grid; gap: 1rem; margin: 1.4rem 0; padding: 0; list-style: none; }
.manual li { display: grid; grid-template-columns: 44px 1fr; gap: .8rem; align-items: start; }
.manual li > span { display: grid; place-items: center; aspect-ratio: 1; border: 2px solid var(--ink); border-radius: 50%; background: #ffe06e; font-weight: 950; }
.manual strong { font-size: 1.05rem; }
.manual li p, .save-note { margin: .25rem 0 0; color: #655d68; line-height: 1.55; font-size: .86rem; }
.keyboard { padding: .8rem; border: 2px dashed var(--ink); border-radius: 14px; background: #d8eee4; font-weight: 800; font-size: .82rem; }
.records { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; margin: 1.2rem 0; }
.records div { padding: .7rem; border: 2px solid var(--ink); border-radius: 12px; background: #fffaf0; }
.records dt { font-size: .7rem; color: #715063; font-weight: 800; }
.records dd { margin: .18rem 0 0; font-size: 1.25rem; font-weight: 950; }
.reset { width: 100%; }
footer { width: min(94vw,1120px); margin: auto; padding: 1.5rem 0 2.5rem; text-align: center; font-weight: 800; }
body.capture { height: 100dvh; overflow: hidden; background: #313347; }
body.capture .masthead, body.capture .intro, body.capture .manual, body.capture footer, body.capture [data-account] { display: none !important; }
body.capture main { width: 100%; height: 100dvh; padding: 0; }
body.capture .game-layout, body.capture .game-column { display: block; width: 100%; height: 100%; border: 0; border-radius: 0; box-shadow: none; }
body.capture .game-column { display: grid; grid-template-rows: auto minmax(0,1fr) auto auto auto; }
body.capture .game-shell { min-height: 0; aspect-ratio: auto; }
body.capture canvas { width: 100%; height: 100%; object-fit: contain; background: #596080; }
body.capture .hud, body.capture .pads, body.capture .harmony, body.capture .hint { border-left: 0; border-right: 0; border-radius: 0; }
@media (max-width: 780px) {
  .masthead { min-height: 54px; }
  main { width: min(100%, 620px); padding: 0 .55rem 2rem; }
  .intro { padding: .75rem 0 1rem; }
  .game-layout { display: block; }
  .game-column { border-radius: 20px; }
  .manual { margin-top: 1rem; }
  .hud div { padding: .55rem .2rem; }
  .pad { min-height: 70px; }
}
@media (max-width: 420px) {
  h1 { font-size: 3.25rem; }
  .intro > p:last-child { margin-top: .8rem; font-size: .9rem; }
  .game-shell { height: 56vh; max-height: none; aspect-ratio: auto; }
  .pads { gap: .35rem; padding: .5rem; }
  .pad { min-height: 62px; border-radius: 14px; }
  .pad strong { font-size: 1.2rem; }
  .hint { min-height: 48px; padding: .72rem .6rem; font-size: .82rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
  .pad { transition: none; }
}
