:root {
  --ink: #2c2118;
  --paper: #fff8e8;
  --card: #fffdf6;
  --coral: #ff6b57;
  --sun: #ffd23f;
  --mint: #3ddc97;
  --sky: #4ec4f5;
  --grass: #6fcf6a;
  --shadow: #c9a36a;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #7ad3f0;
  color: var(--ink);
  font-family: "Trebuchet MS", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}

body {
  min-height: 100dvh;
  display: grid;
  place-items: center;
}

button, input, textarea, select { font: inherit; color: inherit; }
input, textarea, select {
  user-select: text;
  -webkit-user-select: text;
  pointer-events: auto;
}

.hidden { display: none !important; }

.stage-bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 18% 12%, #fff6a8 0 12%, transparent 13%),
    linear-gradient(180deg, #5ec8f0 0%, #9be7ff 38%, #fff3b0 70%, #7ed957 70%, #62c458 100%);
  z-index: 0;
}

.stage-bg::before,
.stage-bg::after {
  content: "";
  position: absolute;
  background: #fff;
  opacity: .88;
  border-radius: 999px;
}

.stage-bg::before {
  width: 140px; height: 44px; left: 8%; top: 10%;
  box-shadow: 48px 12px 0 8px #fff, 90px -6px 0 0 #fff;
}

.stage-bg::after {
  width: 120px; height: 38px; right: 10%; top: 16%;
  box-shadow: -40px 10px 0 6px #fff;
}

.app {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100dvh;
  max-width: 430px;
  background:
    linear-gradient(180deg, #4ec4f5 0%, #b8ecff 36%, #fff4c2 68%, #8ee08a 68.2%, #6fcf6a 100%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@media (min-width: 560px) {
  .app {
    height: min(860px, calc(100dvh - 24px));
    border-radius: 36px;
    border: 5px solid var(--ink);
    box-shadow: 0 16px 0 var(--ink), 0 28px 50px rgba(44, 33, 24, .28);
  }
}

.screen {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: calc(12px + var(--safe-t)) 16px calc(14px + var(--safe-b));
}
#screen-home, #screen-class, #screen-me {
  overflow: auto;
  padding-bottom: calc(108px + var(--safe-b));
}
#screen-member {
  overflow: hidden;
  padding-bottom: calc(18px + var(--safe-b));
}

.top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.icon-btn {
  width: 48px;
  height: 48px;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 4px 0 var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}

.icon-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
a.icon-btn { color: inherit; text-decoration: none; }

.music-select {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-weight: 800;
  font-size: 13px;
}
.music-select select {
  flex: 1;
  min-height: 40px;
  border: 3px solid var(--ink);
  border-radius: 12px;
  background: var(--card);
  font: inherit;
  font-weight: 800;
  padding: 0 8px;
}

.copy {
  margin: 8px 0 0;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  opacity: .7;
}

.admin-link {
  display: block;
  text-align: center;
  margin-top: 6px;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  opacity: .72;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.icon-btn svg { width: 24px; height: 24px; }

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  min-height: 0;
  gap: 6px;
  padding-top: 8px;
}

.mascot {
  width: 148px;
  height: 148px;
  animation: bob 2.4s ease-in-out infinite;
}

.mascot svg { width: 100%; height: 100%; }

.speech {
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: 18px;
  padding: 8px 14px;
  font-weight: 800;
  font-size: 15px;
  box-shadow: 0 4px 0 var(--ink);
  position: relative;
}

.speech::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -10px;
  width: 14px;
  height: 14px;
  background: var(--card);
  border-right: 3px solid var(--ink);
  border-bottom: 3px solid var(--ink);
  transform: translateX(-50%) rotate(45deg);
}

.title {
  margin: 8px 0 0;
  font-size: clamp(34px, 10vw, 46px);
  letter-spacing: 2px;
  color: #fff8dc;
  text-shadow:
    3px 3px 0 var(--coral),
    5px 5px 0 var(--ink);
  line-height: 1.1;
}

.sub {
  margin: 0;
  font-weight: 700;
  font-size: 15px;
  opacity: .86;
}

.home-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: auto;
  padding-bottom: 8px;
  flex-shrink: 0;
  position: relative;
  z-index: 13;
}
.chip-login {
  appearance: none;
  min-height: 40px;
  padding: 0 12px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: var(--mint);
  font-weight: 900;
  font-size: 14px;
  box-shadow: 0 3px 0 var(--ink);
  max-width: 52%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.chip-login:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }

.btn {
  appearance: none;
  border: 3px solid var(--ink);
  border-radius: 20px;
  min-height: 56px;
  padding: 0 18px;
  font-weight: 800;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 6px 0 var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--ink); }
.btn:disabled { opacity: .55; cursor: default; transform: none; }

.btn-primary { background: var(--coral); color: #fffdf6; }
.btn-sun { background: var(--sun); }
.btn-mint { background: var(--mint); color: var(--ink); }
.btn-paper { background: var(--card); }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.tiny {
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  opacity: .75;
  margin: 0;
}

.help-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 16px 0 auto;
}

.help-card {
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: 20px;
  padding: 14px 16px;
  box-shadow: 0 5px 0 var(--ink);
}

.help-card h3 {
  margin: 0 0 6px;
  font-size: 18px;
}

.help-card p {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  font-weight: 650;
}

.screen h2 {
  margin: 0;
  font-size: 24px;
  text-align: center;
}

.top-row h2 {
  flex: 1;
}

.scrollable {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  min-height: 0;
  padding: 8px 2px 20px;
  touch-action: pan-y;
  scrollbar-width: none;
}
.scrollable::-webkit-scrollbar { display: none; }

.world {
  margin-bottom: 18px;
}

.world-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  margin: 0 0 10px;
  font-size: 16px;
}

.world-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 3px solid var(--ink);
}

.level-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.level-node {
  appearance: none;
  border: 3px solid var(--ink);
  background: var(--card);
  border-radius: 22px;
  min-height: 92px;
  box-shadow: 0 5px 0 var(--ink);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 4px;
  font-weight: 800;
}

.level-node:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }
.level-node.locked { background: #d9d0c3; color: #6b5d50; cursor: default; }
.level-node.guest-lock { background: #e8fff4; color: var(--ink); }
.level-node.guest-lock .num { font-size: 13px; letter-spacing: 0; }
.need-mem { position: relative; }
.need-mem::after {
  content: "会员";
  position: absolute;
  top: -7px;
  right: 10px;
  font-size: 10px;
  font-weight: 900;
  background: var(--sun);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 0 6px;
  line-height: 16px;
  box-shadow: 0 2px 0 var(--ink);
}
.mode-tile.need-mem::after { right: 6px; top: -8px; }
.level-node.current { background: var(--sun); animation: pulse 1.6s ease-in-out infinite; }
.level-node .num { font-size: 22px; line-height: 1; }
.level-node .stars { letter-spacing: 1px; font-size: 13px; color: #e09a3a; }
.level-node .name { font-size: 11px; font-weight: 700; opacity: .8; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.hud {
  display: grid;
  grid-template-columns: 48px 1fr auto auto;
  gap: 8px;
  align-items: center;
}

.chip {
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: 14px;
  min-height: 40px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  box-shadow: 0 3px 0 var(--ink);
}

.hearts { gap: 4px; padding-right: 8px; }
.hearts svg { width: 20px; height: 20px; }
.hearts .gone { opacity: .28; filter: grayscale(1); }

.timer.warn { background: #ffd0c8; color: #b42318; }

.props {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 10px 0 6px;
}

.prop {
  appearance: none;
  border: 3px solid var(--ink);
  background: var(--card);
  border-radius: 16px;
  min-height: 52px;
  box-shadow: 0 4px 0 var(--ink);
  cursor: pointer;
  font-weight: 800;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.15;
  padding: 4px;
}

.prop small { font-size: 10px; opacity: .7; font-weight: 700; }
.prop:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.prop.on { background: #c8f5d8; }
.prop.used,
.prop:disabled {
  opacity: .48;
  cursor: default;
  transform: none;
  box-shadow: 0 2px 0 var(--ink);
}

.play-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.progress-line {
  width: min(100%, 280px);
  height: 10px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-line > span {
  display: block;
  height: 100%;
  background: var(--mint);
  width: 0;
}

.combo-banner {
  height: 28px;
  font-weight: 900;
  color: var(--coral);
  font-size: 20px;
  text-shadow: 0 2px 0 #fff;
}

.card-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.card-prompt {
  margin: 0 10px;
  text-align: center;
  font-weight: 800;
  font-size: 14px;
  line-height: 1.4;
  min-height: 2.6em;
}

.card {
  width: min(78vw, 280px);
  height: min(50vw, 186px);
  background: var(--card);
  border: 4px solid var(--ink);
  border-radius: 32px;
  box-shadow: 0 8px 0 var(--ink);
  display: grid;
  place-items: center;
  touch-action: none;
  cursor: grab;
  animation: pop-in .38s cubic-bezier(.2, 1.4, .3, 1) both;
}

.card.dragging { cursor: grabbing; z-index: 5; box-shadow: 0 14px 0 var(--ink); }
.card.shake { animation: shake .42s ease; }
.card.fly { transition: transform .28s ease, opacity .28s ease; opacity: 0; transform: scale(.4); }
.card.shielded { box-shadow: 0 8px 0 var(--ink), 0 0 0 6px #7b6cff; }
.card svg { width: 92%; height: 88%; pointer-events: none; }
.card .q-img { width: 88%; height: 88%; object-fit: contain; pointer-events: none; }

.card-name {
  font-weight: 900;
  font-size: 20px;
}

.card-name:empty { display: none; }

.bin .solfege {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.4px;
}

.bins {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding-top: 8px;
}

.bins.n2 .bin { flex: 1 1 42%; }
.bins.n3 .bin { flex: 1 1 28%; }
.bins.n4 .bin { flex: 1 1 42%; min-height: 76px; }
.bins.n5 .bin { flex: 1 1 28%; }

.bin {
  appearance: none;
  flex: 1 1 30%;
  min-width: 96px;
  min-height: 84px;
  border: 3px solid var(--ink);
  border-radius: 18px;
  background: var(--card);
  box-shadow: 0 5px 0 var(--ink);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 4px 8px;
  font-weight: 800;
  font-size: 14px;
  transition: transform .15s ease, box-shadow .15s ease;
}

.bin svg { width: 44px; height: 38px; pointer-events: none; }
.bin:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }
.bin.hinted {
  animation: glow .8s ease-in-out infinite;
  transform: translateY(-3px);
}

.bins.shuffle .bin { animation: pop-in .35s ease both; }

.overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  background: rgba(44, 33, 24, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.panel {
  width: min(100%, 360px);
  max-height: min(86dvh, 640px);
  overflow-y: auto;
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: 28px;
  box-shadow: 0 10px 0 var(--ink);
  padding: 18px 16px 16px;
  text-align: center;
}

.panel h2 { margin: 0 0 8px; font-size: 24px; }
.panel p { margin: 0 0 14px; font-weight: 700; line-height: 1.45; }
.panel .btn { width: 100%; margin-top: 8px; }
#overlay-gate .panel { background: linear-gradient(180deg, #fffdf6 0%, #e8fff4 100%); }
#overlay-gate h2 { font-size: 22px; }

.stars-big {
  font-size: 32px;
  letter-spacing: 6px;
  color: #e09a3a;
  min-height: 40px;
  margin-bottom: 6px;
}

.count-num {
  font-size: 72px;
  font-weight: 900;
  color: #fff;
  text-shadow: 4px 4px 0 var(--ink);
}

.ad-frame {
  width: min(100%, 360px);
  height: min(72dvh, 520px);
  background: #111;
  border: 4px solid var(--ink);
  border-radius: 24px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 0 var(--ink);
}

.ad-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #fff;
  font-weight: 800;
  padding: 8px 12px;
  font-size: 13px;
  background: rgba(0,0,0,.35);
}

.ad-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
}

.ad-body svg { width: 140px; height: 140px; animation: bob 1.2s ease-in-out infinite; }
.ad-body h3 { margin: 0; font-size: 28px; }
.ad-body p { margin: 0; font-weight: 800; font-size: 16px; }

.ad-bar {
  height: 10px;
  background: rgba(0,0,0,.25);
}
.ad-bar > span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--sun);
}

.ad-claim {
  padding: 10px;
  background: var(--paper);
}

.fx {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 30;
  overflow: hidden;
}

.float-text {
  position: absolute;
  left: 50%;
  top: 38%;
  transform: translate(-50%, 0);
  font-weight: 900;
  font-size: 28px;
  color: var(--coral);
  text-shadow: 0 3px 0 #fff, 2px 4px 0 var(--ink);
  animation: rise .8s ease forwards;
}

.dot {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  animation: burst .7s ease-out forwards;
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes pop-in {
  0% { transform: scale(.62) rotate(-8deg); opacity: 0; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-9px) rotate(-3deg); }
  40% { transform: translateX(9px) rotate(3deg); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

@keyframes pulse {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 5px 0 var(--ink), 0 0 0 0 rgba(255, 210, 63, .6); }
  50% { box-shadow: 0 5px 0 var(--ink), 0 0 0 8px rgba(255, 210, 63, .35); }
}

@keyframes rise {
  to { transform: translate(-50%, -48px); opacity: 0; }
}

@keyframes burst {
  to { transform: translate(var(--dx), var(--dy)) scale(.2); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .mascot, .card, .bin, .level-node.current, .ad-body svg { animation: none !important; }
  .float-text, .dot { animation: none !important; }
}

.brand-home {
  flex: 0 0 auto;
  padding-top: 0;
  gap: 4px;
}
.brand-home .mascot { width: 132px; height: 132px; }
.mascot-sm { width: 72px; height: 72px; }
.brand-home .title {
  font-size: clamp(28px, 8vw, 36px);
  margin-top: 2px;
}
.home-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 6px 0 8px;
}
.stat-chip {
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: 14px;
  padding: 6px 4px;
  text-align: center;
  box-shadow: 0 3px 0 var(--ink);
}
.stat-chip b { display: block; font-size: 16px; line-height: 1.2; }
.stat-chip span { font-size: 11px; font-weight: 700; opacity: .72; }
.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.mode-tile {
  appearance: none;
  border: 3px solid var(--ink);
  background: var(--card);
  border-radius: 16px;
  min-height: 58px;
  box-shadow: 0 4px 0 var(--ink);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 6px 4px;
  font-weight: 800;
}
.mode-tile strong { font-size: 15px; }
.mode-tile small { font-size: 11px; opacity: .7; font-weight: 700; }
.mode-tile:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.home-actions { gap: 8px; }
.home-foot { margin-top: 2px; }
.legal {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  margin: 4px 0 0;
}
.legal a, .text-link { color: var(--ink); opacity: .72; background: none; border: 0; box-shadow: none; min-height: 0; padding: 0; font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; display: inline; }
.hear-btn {
  min-height: 36px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: #fff6c8;
  font-weight: 800;
  font-size: 14px;
  box-shadow: 0 3px 0 var(--ink);
  padding: 0 12px;
}
.hear-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.teach-panel .teach-art {
  height: 96px;
  display: grid;
  place-items: center;
  margin: 6px 0;
}
.teach-panel .teach-art svg { height: 92px; width: auto; max-width: 100%; }
.radar {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.radar-row { display: grid; grid-template-columns: 72px 1fr 40px; gap: 8px; align-items: center; font-size: 13px; font-weight: 800; }
.radar-bar { height: 10px; background: #fff; border: 2px solid var(--ink); border-radius: 99px; overflow: hidden; }
.radar-bar > span { display: block; height: 100%; background: var(--mint); }
.cert-sheet {
  background: #fffdf6;
  border: 4px solid var(--ink);
  border-radius: 20px;
  padding: 18px 14px;
  text-align: center;
  box-shadow: 0 8px 0 var(--ink);
}
.cert-sheet h3 { margin: 8px 0 4px; font-size: 22px; }
.cert-sheet p { margin: 4px 0; font-weight: 700; line-height: 1.45; }
.rhythm-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.rhythm-track {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 12px 0;
  min-height: 28px;
}
.rhythm-beat {
  width: 22px;
  height: 22px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: #fff;
  transition: transform .12s ease, background .12s ease;
}
.rhythm-beat.on { background: var(--coral); transform: scale(1.25); }
#screen-rhythm .card { margin: 8px auto; }
.rhythm-drum {
  width: 128px;
  height: 128px;
  margin: 10px 0 8px;
  border: 4px solid var(--ink);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffd97a 0%, #ffb703 42%, #fb8500 100%);
  box-shadow: 0 8px 0 var(--ink), inset 0 -10px 0 rgba(44,33,24,.12);
  font-weight: 900;
  font-size: 36px;
  color: var(--ink);
  cursor: pointer;
}
.rhythm-drum:disabled { opacity: .45; cursor: default; box-shadow: 0 4px 0 var(--ink); }
.rhythm-drum:not(:disabled):active { transform: translateY(4px) scale(.96); box-shadow: 0 4px 0 var(--ink); }
.rhythm-drum.hit-ok { background: radial-gradient(circle at 35% 30%, #c8f5d8 0%, #3ddc97 70%); }
.rhythm-drum.hit-bad { background: radial-gradient(circle at 35% 30%, #ffd0c8 0%, #ff6b57 70%); }
.rhythm-prep {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: linear-gradient(180deg, rgba(78,196,245,.88) 0%, rgba(255,246,200,.94) 55%, rgba(142,224,138,.9) 100%);
  border-radius: 24px;
}
.rhythm-prep.hidden { display: none; }
.prep-orb {
  position: relative;
  width: 168px;
  height: 168px;
  display: grid;
  place-items: center;
}
.prep-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.prep-track { fill: none; stroke: rgba(44,33,24,.18); stroke-width: 8; }
.prep-fill {
  fill: none;
  stroke: #ff6b57;
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 327;
  stroke-dashoffset: 327;
}
.rhythm-prep.running .prep-fill { animation: prep-draw var(--prep-dur, 3s) linear forwards; }
.prep-num {
  position: relative;
  z-index: 1;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: #fffdf6;
  border: 4px solid var(--ink);
  box-shadow: 0 8px 0 var(--ink);
  display: grid;
  place-items: center;
  font-size: 64px;
  font-weight: 900;
  color: var(--ink);
  line-height: 1;
}
.prep-num.pop { animation: prep-pop .38s cubic-bezier(.2, 1.4, .3, 1); }
.prep-label {
  margin: 0;
  font-weight: 900;
  font-size: 20px;
  background: #fffdf6;
  border: 3px solid var(--ink);
  border-radius: 18px;
  padding: 8px 18px;
  box-shadow: 0 4px 0 var(--ink);
}
.prep-pips { display: flex; gap: 10px; }
.prep-pips span {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  background: #fff;
  box-shadow: 0 2px 0 var(--ink);
}
.prep-pips span.on { background: #ffd23f; transform: scale(1.15); }
@keyframes prep-draw {
  to { stroke-dashoffset: 0; }
}
@keyframes prep-pop {
  0% { transform: scale(.55); }
  70% { transform: scale(1.12); }
  100% { transform: scale(1); }
}
#screen-play.ear-mode .card { background: #fff6c8; }
.lesson-art { height: 120px; display: grid; place-items: center; }
.lesson-art svg { height: 110px; width: 100%; }

@media (max-height: 740px) {
  .brand-home .mascot { width: 108px; height: 108px; }
  .mascot-sm { width: 56px; height: 56px; }
  .mode-tile { min-height: 50px; }
  .btn { min-height: 48px; font-size: 16px; }
  .home-stats { margin: 4px 0 6px; }
}

.tabbar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  padding: 8px 12px calc(10px + var(--safe-b));
  background: rgba(255, 253, 246, .94);
  border-top: 3px solid var(--ink);
}
.tab {
  appearance: none;
  min-height: 44px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: var(--card);
  font-weight: 900;
  font-size: 16px;
  box-shadow: 0 3px 0 var(--ink);
}
.tab.on { background: var(--sun); }
.tab:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.streak-chip { font-size: 13px; }
.piano-strip { width: min(78vw, 280px); min-height: 36px; }
.piano-strip svg { width: 100%; height: 40px; }
.mem-profile { text-align: center; }
.mem-avatar { width: 92px; height: 92px; margin: 0 auto 6px; }
.mem-avatar svg { width: 100%; height: 100%; }
.mem-stat-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin: 10px 0 8px;
}
.mem-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.mem-tabs button {
  min-height: 44px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: var(--card);
  font-weight: 900;
  box-shadow: 0 3px 0 var(--ink);
}
.mem-tabs button.on { background: var(--sun); }
.code-row { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.code-row input { flex: 1; min-width: 0; }
.code-row button { flex: 0 0 auto; min-width: 118px; padding: 0 10px; }
.field-row { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.field-row input, .field-row select {
  flex: 1;
  min-height: 44px;
  border: 3px solid var(--ink);
  border-radius: 12px;
  background: #fff;
  font: inherit;
  font-weight: 800;
  padding: 0 10px;
}
.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  font-weight: 800;
}
#screen-class .top-row, #screen-me .top-row { justify-content: center; }
#props.hidden { display: none !important; }
