/* コードしんこう ラボ：よるの おんがくしつ。こい ふちどりと したの かげで、おせる ものを はっきり みせる。
   コードの いろは やくわりで わける（T＝みどり・S＝あお・D＝オレンジ・ハちょうちょうの そと＝むらさき）。 */
:root {
  --ink: #2A2547;
  --ink-soft: #5F5980;
  --card: #FFFFFF;
  --line: #DAD3EC;
  --mute: #F2EFFA;
  --accent: #6C4CF5;
  --accent-deep: #4A2BD9;
  --accent-soft: #ECE6FF;
  --T: #13A065; --T-soft: #DCF5E8;
  --S: #2F7BEF; --S-soft: #E0ECFF;
  --D: #EF6A2B; --D-soft: #FFE6D9;
  --X: #B03BCB; --X-soft: #F6E3FA;
  --maj: #F2A516; --maj-soft: #FFF2D2;
  --min: #3E7FD9; --min-soft: #E1ECFB;
  --dim: #8C8AA3; --dim-soft: #EEEDF3;
  --mel: #FF4B86;
  --ok: #13A065; --ok-soft: #DCF5E8;
  --ng: #E23B47; --ng-soft: #FDE3E5;
  --gold: #F6C032; --gold-edge: #B78300;
  --silver: #C9D1DB; --silver-edge: #7E8A99;
  --bronze: #DA9A63; --bronze-edge: #92582B;
  --f-display: "Mochiy Pop One", "Hiragino Maru Gothic ProN", "BIZ UDPGothic", sans-serif;
  --f-body: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "BIZ UDPGothic", "Meiryo", sans-serif;
  /* ../shared/users.css の いろ */
  --pu-ink: var(--ink);
  --pu-soft: var(--ink-soft);
  --pu-line: var(--line);
  --pu-accent: var(--accent);
  --pu-hl: var(--accent-soft);
  --pu-bg: #FBF8FF;
  --pu-focus: var(--accent);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }

html { background: #FFF8EE; }

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #E6DEFF 0, #F3EEFF 260px, #FFF8EE 620px) no-repeat;
  color: var(--ink);
  font-family: var(--f-body);
  font-weight: 500;
  font-size: 16px;
  line-height: 1.7;
  /* こども むけの ぶんは ことばの あいだに スペースを いれて いるので、そこでだけ かいぎょうする */
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
/* おとな むけの ぶんは ふつうに おりかえす */
html.adult .txt, html.adult .role p, html.adult .q-fb p, html.adult .lead-txt { word-break: normal; }

body.has-dock { padding-bottom: calc(150px + env(safe-area-inset-bottom, 0px)); }

button, .btn {
  font: inherit;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}
a { color: inherit; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

.app {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding: calc(8px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.screen { flex: 1; display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* おせる もの（ふちどり＋したの かげ） */
.iconbtn, .btn, .lesson, .level, .lab-card, .pad, .pc, .slot, .preset, .choice, .tone, .nm, .dcol, .tab {
  border: 3px solid var(--ink);
  background: var(--card);
  box-shadow: 0 4px 0 var(--ink);
  text-decoration: none;
}
.iconbtn:active, .btn:active, .lesson:active, .level:active, .lab-card:active, .pad:active, .pc:active, .slot:active,
.preset:active, .choice:active:not(:disabled), .tone:active, .nm:active, .dcol:active, .tab:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--ink);
}

.card {
  border: 3px solid var(--ink);
  border-radius: 20px;
  background: var(--card);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.card h2 { font-family: var(--f-display); font-weight: 400; font-size: 1.15rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 800;
  font-size: .95rem;
  line-height: 1.3;
  text-align: center;
}
.btn.primary { background: var(--accent); color: #fff; }
.btn.big { min-height: 54px; padding: 8px 22px; font-size: 1.1rem; }
.btn.sm { min-height: 36px; padding: 4px 12px; font-size: .85rem; box-shadow: 0 3px 0 var(--ink); }
.btn.tog[aria-pressed="true"] { background: var(--accent-soft); }
.btn.tog[aria-pressed="true"]::before { content: "✓"; color: var(--accent-deep); }

/* ---- うえの バー ---- */

.topbar { display: flex; align-items: center; gap: 8px; min-height: 48px; }

.topbar-title {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-family: var(--f-display);
  font-size: 1.05rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#back:not([hidden]) ~ .user-slot { display: none; }
.user-slot { flex: 0 1 auto; min-width: 0; display: flex; }
.topbar:has(#back[hidden]) .topbar-title { display: none; }
.topbar:has(#back[hidden]) .mode { margin-left: auto; }

.iconbtn {
  width: 46px;
  height: 46px;
  flex: none;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  box-shadow: 0 3px 0 var(--ink);
}
.iconbtn svg { width: 22px; height: 22px; }

/* せつめいの きりかえ（こども・おとな） */
.mode {
  flex: none;
  display: flex;
  padding: 3px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--card);
}
.mode button {
  min-height: 34px;
  padding: 2px 12px;
  border: 0;
  border-radius: 999px;
  background: none;
  font-weight: 800;
  font-size: .85rem;
  color: var(--ink-soft);
}
.mode button[aria-pressed="true"] { background: var(--ink); color: #fff; }

/* ---- ホーム ---- */

.hero { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 4px; text-align: center; }

/* かざりの けんばん（ドミソが ひかって いる） */
.hero-keys {
  position: relative;
  display: flex;
  width: min(240px, 70%);
  height: 54px;
  border: 3px solid var(--ink);
  border-radius: 10px;
  background: var(--card);
  overflow: hidden;
  box-shadow: 0 4px 0 var(--ink);
}
.hero-keys i { flex: 1; border-right: 2px solid var(--ink); }
.hero-keys i:last-child { border-right: 0; }
.hero-keys i.on { background: var(--accent); animation: glow 2.4s ease-in-out infinite; }
.hero-keys i.on:nth-child(6) { animation-delay: .25s; }
.hero-keys i.on:nth-child(10) { animation-delay: .5s; }
.hero-keys i.b { flex: 0 0 0; position: relative; border: 0; }
.hero-keys i.b::after { content: ""; position: absolute; top: 0; left: -7px; width: 14px; height: 32px; background: var(--ink); border-radius: 0 0 3px 3px; }
@keyframes glow { 0%, 100% { background: var(--accent); } 50% { background: #A992FF; } }

.hero h1 {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: clamp(2.1rem, 10vw, 3rem);
  line-height: 1.15;
}
.hero h1 .kicker {
  display: block;
  font-size: .42em;
  letter-spacing: .14em;
  color: var(--accent);
}
.lead { font-weight: 800; color: var(--ink-soft); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 4px;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: var(--card);
  line-height: 1.2;
}
.stat b { font-family: var(--f-display); font-weight: 400; font-size: 1.6rem; line-height: 1.15; }
.stat b small { font-size: .55em; color: var(--ink-soft); }
.stat > span { font-size: .78rem; font-weight: 800; color: var(--ink-soft); }

.sec { font-family: var(--f-display); font-weight: 400; font-size: 1.2rem; margin-top: 4px; }

.lessons, .levels { display: grid; gap: 10px; }

.lesson, .level, .lab-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 18px;
}
.lesson.done { background: #FFFBEF; }
.l-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.4; }
.l-text b { font-weight: 800; font-size: 1.02rem; }
.l-text small { font-weight: 800; font-size: .8rem; color: var(--ink-soft); }
.chev { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

.l-num {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--accent-soft);
  font-family: var(--f-display);
  font-size: 1.15rem;
  line-height: 1;
}
.lesson.done .l-num { background: var(--maj); }

.lesson.adv .l-num { background: #FFE3EC; }
.lesson.adv.done .l-num { background: var(--maj); }
.level.adv { background: #FFF6F9; }
.sec-note { margin-top: -10px; font-weight: 800; font-size: .82rem; color: var(--ink-soft); }

.lab-card { background: var(--accent-soft); }
.lab-icon { font-size: 2.2rem; line-height: 1; }

.level .best { flex: none; font-weight: 800; font-size: .8rem; color: var(--ink-soft); text-align: right; line-height: 1.3; }
.level .best b { font-family: var(--f-display); font-weight: 400; font-size: 1.1rem; color: var(--ink); }

.parents, .credits {
  padding: 12px 14px;
  border: 2px dashed var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .6);
  font-size: .8rem;
  line-height: 1.75;
  color: var(--ink-soft);
  word-break: normal;
}
.credits { border-style: solid; font-size: .74rem; }

/* はなまる（レッスン クリアの しるし） */
.hanamaru {
  position: relative;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background:
    radial-gradient(circle, transparent 0 34%, var(--ng) 35% 44%, transparent 45% 56%, var(--ng) 57% 66%, transparent 67%);
  transform: rotate(-12deg);
}
.hanamaru::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: repeating-conic-gradient(var(--ng) 0 10deg, transparent 10deg 30deg);
  -webkit-mask: radial-gradient(circle, transparent 0 66%, #000 67% 72%, transparent 73%);
  mask: radial-gradient(circle, transparent 0 66%, #000 67% 72%, transparent 73%);
}
.hanamaru.big { width: 84px; height: 84px; animation: stamp .5s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes stamp { from { transform: rotate(-30deg) scale(2.2); opacity: 0; } to { transform: rotate(-12deg) scale(1); opacity: 1; } }

/* メダル。きん・ぎん・どうを いろで わける */
.medal {
  --m: var(--gold);
  --e: var(--gold-edge);
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 2.6em;
  height: 2.6em;
  border: .22em solid var(--e);
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, rgba(255, 255, 255, .75) 0 14%, transparent 15%), var(--m);
  box-shadow: 0 .15em 0 var(--e);
  font-size: 1rem;
}
.medal::after { content: "♪"; font-weight: 800; font-size: 1.1em; color: rgba(0, 0, 0, .45); }
.medal.m2 { --m: var(--silver); --e: var(--silver-edge); }
.medal.m1 { --m: var(--bronze); --e: var(--bronze-edge); }
.medal.m0 { --m: var(--mute); --e: #BDB6D6; border-style: dashed; background: var(--m); box-shadow: none; }
.medal.m0::after { color: #B4ADCB; }
.medal.sm { font-size: .55rem; }
.medal.lg { font-size: .95rem; }
.medal.xl { font-size: 2.2rem; }
.u-medals { display: flex; gap: 6px; }

/* ---- レッスン ---- */

.lesson-body { display: flex; flex-direction: column; gap: 16px; }

.l-head { display: flex; align-items: center; gap: 12px; }
.l-head .l-num.big { width: 52px; height: 52px; font-size: 1.5rem; background: var(--accent); color: #fff; }
.l-head > div { flex: 1; min-width: 0; }
.l-head h1 { font-family: var(--f-display); font-weight: 400; font-size: clamp(1.3rem, 6vw, 1.7rem); line-height: 1.3; }
.l-head p { font-weight: 800; font-size: .85rem; color: var(--ink-soft); }
.l-head .hanamaru { display: none; }
.l-head.done .hanamaru { display: block; }

.txt { display: flex; flex-direction: column; gap: 10px; font-size: 1.02rem; }
.txt b { color: var(--accent-deep); }
html.adult .txt { font-size: .98rem; line-height: 1.85; }

/* ぶんしょうの なかの コード（おすと なる） */
.cc {
  display: inline-block;
  margin: 0 2px;
  padding: 0 9px;
  border: 2px solid var(--ink);
  border-bottom-width: 4px;
  border-radius: 10px;
  background: var(--card);
  font-family: var(--f-display);
  font-weight: 400;
  font-size: .95em;
  line-height: 1.5;
  vertical-align: baseline;
}
.cc:active { transform: translateY(2px); border-bottom-width: 2px; }
.cc.f-T { background: var(--T-soft); }
.cc.f-S { background: var(--S-soft); }
.cc.f-D { background: var(--D-soft); }
.cc.f-X { background: var(--X-soft); }

.cap { font-weight: 800; font-size: .9rem; color: var(--ink-soft); }

/* ド・ミ・ソを かさねる */
.build-row { display: flex; align-items: center; justify-content: center; gap: 18px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column-reverse; gap: 6px; }
.tone {
  width: 120px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 14px;
  border-radius: 14px;
}
.tone b { font-size: 1.25rem; }
.tone small { font-weight: 800; color: var(--ink-soft); }
.tone.on { background: var(--accent); color: #fff; }
.tone.on small { color: #E4DCFF; }
.build-acts { display: flex; flex-direction: column; gap: 12px; }

/* ドレミと アルファベット */
.name-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.nm { display: flex; flex-direction: column; align-items: center; padding: 6px 0; border-radius: 12px; line-height: 1.25; }
.nm b { font-size: 1rem; }
.nm small { font-family: var(--f-display); font-size: 1.05rem; color: var(--accent-deep); }

/* コードの パッド */
.pads { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 10px; }
.pad {
  --c: var(--ink);
  --c-soft: var(--card);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px 7px;
  border-radius: 16px;
  background: var(--c-soft);
  border-top-width: 8px;
  border-top-color: var(--c);
  line-height: 1.25;
}
.pad b { font-family: var(--f-display); font-weight: 400; font-size: 1.35rem; }
.pad small { font-weight: 800; font-size: .76rem; color: var(--ink-soft); }
.pad.sm { flex: 1; min-width: 0; }
.pad.now, .pc.now, .slot.now, .dcol.now, .tc.now { outline: 4px solid var(--mel); outline-offset: 2px; }

/* くらべる */
.cmp-row { display: flex; align-items: center; gap: 8px; }
.cmp-arrow { font-weight: 800; color: var(--ink-soft); }
.cmp-play { flex: none; padding: 6px 10px; }

/* ハちょうちょうの 7つの コード */
.dia-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.dcol {
  --c: var(--ink);
  --c-soft: var(--card);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 0;
  padding: 6px 2px 8px;
  border-radius: 12px;
  background: var(--c-soft);
}
.d-deg { font-weight: 800; font-size: .74rem; color: var(--ink-soft); white-space: nowrap; }
.d-stack { display: flex; flex-direction: column-reverse; gap: 3px; width: 100%; padding: 0 3px; }
.d-stack i {
  display: block;
  padding: 1px 0;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--card);
  font-style: normal;
  font-weight: 800;
  font-size: .72rem;
  text-align: center;
  white-space: nowrap;
}
.d-stack i:first-child { background: var(--c); color: #fff; }
.dcol b { font-family: var(--f-display); font-weight: 400; font-size: 1rem; white-space: nowrap; }

/* てんかいけい */
.inv-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.inv-form {
  --c: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 6px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 4px 0 var(--ink);
}
.inv-form:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.inv-form .d-stack { max-width: 90px; min-width: 0; }
.inv-form .d-stack i { font-size: .85rem; padding: 3px 0; }
.inv-form b { font-weight: 800; font-size: .82rem; line-height: 1.3; text-align: center; }
.inv-form.now { outline: 4px solid var(--mel); outline-offset: 2px; }

/* ならべて くらべる（おわりかた など） */
.rows { display: grid; gap: 10px; }
.row-card {
  padding: 12px 14px;
  border: 3px solid var(--ink);
  border-radius: 18px;
  background: var(--card);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.row-head { display: flex; align-items: center; gap: 8px; }
.row-head h3 { flex: 1; min-width: 0; font-weight: 800; font-size: 1rem; line-height: 1.4; }
.row-chords { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.row-chords i { font-style: normal; font-size: .8rem; color: var(--ink-soft); }
.rc {
  --c: var(--ink);
  --c-soft: var(--mute);
  padding: 0 10px;
  border: 2px solid var(--ink);
  border-bottom: 4px solid var(--c);
  border-radius: 10px;
  background: var(--c-soft);
  font-family: var(--f-display);
  font-size: 1rem;
}
.rc.now { outline: 3px solid var(--mel); outline-offset: 1px; }
.row-card p { font-size: .9rem; }

/* やくわり */
.roles { display: grid; gap: 10px; }
.role {
  --c: var(--ink);
  --c-soft: var(--card);
  padding: 12px 14px;
  border: 3px solid var(--ink);
  border-left: 12px solid var(--c);
  border-radius: 18px;
  background: var(--c-soft);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.role h3 { font-family: var(--f-display); font-weight: 400; font-size: 1.1rem; }
.role p { font-size: .95rem; }
.role-chords { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.role-sub { display: inline-flex; gap: 4px; padding-left: 8px; border-left: 2px dashed var(--ink-soft); }
.role-sub::before { content: "代理"; font-weight: 800; font-size: .75rem; color: var(--ink-soft); align-self: center; }

/* プレーヤー（コードしんこう・きょく） */
.pl-title { font-family: var(--f-display); font-weight: 400; font-size: 1.15rem; }
.pcards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pc {
  --c: var(--ink);
  --c-soft: var(--card);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  padding: 6px 2px;
  border-radius: 14px;
  border-top-width: 7px;
  border-top-color: var(--c);
  background: var(--c-soft);
  line-height: 1.25;
}
.pc b { font-family: var(--f-display); font-weight: 400; font-size: 1.2rem; white-space: nowrap; }
.pc small { font-weight: 800; font-size: .74rem; color: var(--ink-soft); white-space: nowrap; }
.pc em { font-style: normal; font-weight: 800; font-size: .72rem; color: var(--c); white-space: nowrap; }

.ctrl { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ctrl.sub { gap: 8px 10px; }

.seg {
  display: inline-flex;
  padding: 3px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--mute);
}
.seg button {
  min-height: 32px;
  padding: 2px 10px;
  border: 0;
  border-radius: 999px;
  background: none;
  font-weight: 800;
  font-size: .8rem;
  color: var(--ink-soft);
}
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 0 0 2px var(--ink); }

.tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.tab { padding: 4px 12px; border-radius: 999px; font-weight: 800; font-size: .85rem; box-shadow: 0 3px 0 var(--ink); }
.tab[aria-pressed="true"] { background: var(--ink); color: #fff; }

.song-head { display: flex; flex-direction: column; gap: 2px; }
.song-head .by { font-weight: 800; font-size: .8rem; color: var(--ink-soft); }
.song-head .used { font-weight: 800; font-size: .82rem; }

/* きょくの コード（1ますが 1しょうせつ） */
.tl { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px 0; }
.bar { display: flex; min-height: 34px; border-left: 2px solid var(--ink); padding: 0 3px; }
.bar:nth-child(4n) { border-right: 2px solid var(--ink); }
.bar:last-child { border-right: 4px double var(--ink); }
.tc {
  --c: var(--ink);
  --c-soft: var(--mute);
  min-width: 0;
  margin: 0 1px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--c-soft);
  border-bottom: 4px solid var(--c);
  font-family: var(--f-display);
  font-size: .82rem;
  white-space: nowrap;
  overflow: hidden;
}

/* たしかめ もんだい */
.check { background: #FFFDF5; }
.check .hint { font-weight: 800; font-size: .85rem; color: var(--ink-soft); }
.qs { display: flex; flex-direction: column; gap: 14px; }
.qslot + .qslot { padding-top: 14px; border-top: 2px dashed var(--line); }
.check-done { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding-top: 8px; }
.check-done p { font-weight: 800; }
.check-done p b { display: block; font-family: var(--f-display); font-weight: 400; font-size: 1.5rem; color: var(--ng); }

.l-nav { display: flex; justify-content: space-between; gap: 10px; }
.l-nav .btn { max-width: 48%; font-size: .85rem; }

/* ---- もんだい ---- */

.q { display: flex; flex-direction: column; gap: 12px; }
.q-text { display: flex; align-items: flex-start; gap: 8px; font-weight: 800; font-size: 1.08rem; line-height: 1.5; }
.q-text small { display: block; font-size: .8rem; color: var(--ink-soft); }
.q-body { display: flex; flex-direction: column; gap: 10px; }
.picked { min-height: 1.6em; font-weight: 800; font-size: .9rem; }
.dict-pads { grid-template-columns: repeat(3, 1fr); }
.slot.given { border-style: solid; box-shadow: none; opacity: .85; cursor: default; }
.slot.right { outline: 4px solid var(--ok); outline-offset: 2px; }
.slot.wrong { outline: 4px solid var(--ng); outline-offset: 2px; }
.q-no {
  flex: none;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-family: var(--f-display);
  font-size: .85rem;
}
.q-seq { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-family: var(--f-display); font-size: 1.1rem; }
.q-seq span { padding: 0 8px; border: 2px solid var(--ink); border-radius: 10px; background: var(--card); }
.q-seq span.hole { background: var(--maj-soft); border-style: dashed; }
.q-seq i { font-style: normal; font-size: .8rem; color: var(--ink-soft); }
.q .listen { align-self: flex-start; }
.choices { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.choice {
  min-height: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 16px;
  line-height: 1.3;
}
.choice b { font-weight: 800; font-size: 1.1rem; }
.choice small { font-weight: 800; font-size: .74rem; color: var(--ink-soft); }
.choice:disabled { cursor: default; opacity: .55; }
.choice.right { opacity: 1; background: var(--ok-soft); border-color: var(--ok); box-shadow: 0 4px 0 var(--ok); }
.choice.wrong { opacity: 1; background: var(--ng-soft); border-color: var(--ng); box-shadow: 0 4px 0 var(--ng); }
.q-fb { padding: 10px 12px; border-radius: 14px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.q-fb.ok { background: var(--ok-soft); }
.q-fb.ng { background: var(--ng-soft); }
.q-fb > b { font-family: var(--f-display); font-weight: 400; font-size: 1.15rem; }
.q-fb.ok > b { color: var(--ok); }
.q-fb.ng > b { color: var(--ng); }
.q-fb p { font-weight: 800; font-size: .92rem; }

.q-progress { display: flex; justify-content: center; gap: 6px; }
.q-progress span { width: 22px; height: 10px; border-radius: 999px; background: var(--line); }
.q-progress span.now { background: var(--accent); }
.q-progress span.ok { background: var(--ok); }
.q-progress span.ng { background: var(--ng); }
.q-next { display: flex; justify-content: center; min-height: 58px; }

.result { align-items: center; text-align: center; padding: 26px 16px; gap: 10px; }
.result .score b { font-family: var(--f-display); font-weight: 400; font-size: 3.4rem; line-height: 1; }
.result .score span { font-weight: 800; font-size: 1.2rem; color: var(--ink-soft); }
.result .msg { font-weight: 800; font-size: 1.1rem; }
.result .new-best { font-family: var(--f-display); color: var(--mel); }
.result-acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 8px; }

/* ---- つくって みよう ---- */

.lab { display: flex; flex-direction: column; gap: 16px; }
.lead-txt { font-weight: 800; color: var(--ink-soft); }
.lab-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lab-head h2 { margin-right: auto; }
.lab-pads { grid-template-columns: repeat(4, 1fr); }
.slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.slot {
  --c: var(--ink);
  --c-soft: var(--card);
  min-height: 70px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  border-top-width: 7px;
  border-top-color: var(--c);
  background: var(--c-soft);
  line-height: 1.25;
}
.slot b { font-family: var(--f-display); font-weight: 400; font-size: 1.2rem; white-space: nowrap; }
.slot small { font-weight: 800; font-size: .74rem; color: var(--ink-soft); white-space: nowrap; }
.slot.empty { border-style: dashed; box-shadow: none; color: var(--ink-soft); }
.slot.sel { background-image: linear-gradient(0deg, rgba(108, 76, 245, .16), rgba(108, 76, 245, .16)); }
.slot.sel::after { content: "▲"; font-size: .6rem; color: var(--accent); line-height: 1; }
.found { min-height: 1.7em; font-weight: 800; font-size: .92rem; }
.presets { display: grid; gap: 8px; }
.preset { display: flex; flex-direction: column; align-items: flex-start; padding: 8px 12px; border-radius: 14px; text-align: left; line-height: 1.4; box-shadow: 0 3px 0 var(--ink); }
.preset b { font-weight: 800; }
.preset small { font-weight: 800; font-size: .78rem; color: var(--ink-soft); }

/* ---- けんばん ---- */

.kb svg { display: block; width: 100%; height: auto; touch-action: manipulation; -webkit-user-select: none; user-select: none; }
.key { cursor: pointer; }
.key rect { stroke: var(--ink); stroke-width: 1.3; transition: fill .08s; }
.key.w rect { fill: #fff; }
.key.b rect { fill: var(--ink); }
.key text { font-family: var(--f-body); font-weight: 800; text-anchor: middle; pointer-events: none; }
.key .lab { font-size: 8.5px; fill: #fff; }
.key.b .lab { font-size: 6.5px; }
.key .cmark { font-size: 7.5px; fill: #ABA4C4; }
.key .mid { fill: #ABA4C4; }
.key.on .cmark, .key.mel .cmark { display: none; }
.key.on rect { fill: #9177FF; }
.key.on.root rect { fill: var(--accent-deep); }
.key.mel rect { fill: var(--mel); }
.key.bass rect { fill: #12A3A8; }
.key.sel rect { fill: #9177FF; }
.key.good rect { fill: var(--ok); }
.key.bad rect { fill: var(--ng); }
.key.miss rect { fill: var(--ok-soft); stroke: var(--ok); stroke-width: 2.4; stroke-dasharray: 4 3; }
.key.miss .lab { fill: var(--ok); }
.key.miss .cmark { display: none; }
.key.bass .cmark, .key.sel .cmark, .key.good .cmark, .key.bad .cmark { display: none; }
.key.tap rect { fill: #FFD23F; }
.nolabel .key .lab { fill: transparent; }

.q-kb { padding: 6px; border: 3px solid var(--ink); border-radius: 14px; background: var(--mute); }

/* したの けんばん */
.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  border-top: 3px solid var(--ink);
  background: rgba(255, 255, 255, .97);
  padding: 6px max(10px, env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 0px));
  box-shadow: 0 -6px 18px rgba(42, 37, 71, .12);
}
.dock-in { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 4px; }
.dock-top { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; min-height: 30px; line-height: 1.3; }
.dk-sym { font-family: var(--f-display); font-weight: 400; font-size: 1.35rem; }
.dk-notes { font-weight: 800; font-size: .9rem; }
.dk-deg { font-weight: 800; font-size: .8rem; color: var(--ink-soft); }
.dk-mel { font-weight: 800; font-size: .85rem; color: var(--mel); }
.dk-bass { font-weight: 800; font-size: .85rem; color: #0E8388; }
.dk-load { margin-left: auto; font-weight: 800; font-size: .74rem; color: var(--ink-soft); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(160px + env(safe-area-inset-bottom, 0px));
  z-index: 30;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  font-size: .9rem;
}

/* コードの いろ。ぶひんごとの きまった いろ（--c）より あとに かいて、こちらを かたせる */
.f-T { --c: var(--T); --c-soft: var(--T-soft); }
.f-S { --c: var(--S); --c-soft: var(--S-soft); }
.f-D { --c: var(--D); --c-soft: var(--D-soft); }
.f-X { --c: var(--X); --c-soft: var(--X-soft); }
.mm-maj { --c: var(--maj); --c-soft: var(--maj-soft); }
.mm-min { --c: var(--min); --c-soft: var(--min-soft); }
.mm-dim { --c: var(--dim); --c-soft: var(--dim-soft); }

@media (max-width: 420px) {
  .pcards, .slots.n8 { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .pc b, .slot b { font-size: 1.02rem; }
  .pad b { font-size: 1.2rem; }
  .tl { grid-template-columns: repeat(2, 1fr); }
  .bar:nth-child(4n) { border-right: 0; }
  .bar:nth-child(2n) { border-right: 2px solid var(--ink); }
  .dcol b { font-size: .82rem; }
  .d-stack i { font-size: .62rem; }
  .cmp-play { padding: 6px 8px; font-size: .8rem; }
  .mode button { padding: 2px 9px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
