:root {
  --ink: #1b233e;
  --muted: #65728f;
  --panel: #ffffff;
  --teal: #099695;
  --green: #6abb4a;
  --orange: #f7941d;
  --blue: #1e7fc3;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #eef1f5;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  color: var(--ink);
  font-family: "Nunito", "Avenir Next Rounded", "Trebuchet MS", Verdana, sans-serif;
  background: #eef1f5;
  overflow-x: hidden;
}

a {
  color: inherit;
}

.home-shell {
  width: min(100%, 560px);
  min-height: 100vh;
  min-height: 100svh;
  margin: 0 auto;
  padding: calc(28px + env(safe-area-inset-top)) 18px calc(26px + env(safe-area-inset-bottom));
  display: grid;
  align-content: start;
  gap: 16px;
}

.home-header {
  padding: 8px 2px 5px;
  color: var(--ink);
  text-align: center;
}

.brand-mark {
  width: clamp(41px, 12vw, 59px);
  height: auto;
  display: block;
  margin: 0 auto 8px;
}

.home-header h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(2rem, 8.8vw, 3rem);
  line-height: 1;
  font-weight: 900;
  white-space: nowrap;
}

.category-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 0 5px;
  scrollbar-width: none;
}

.category-tabs::-webkit-scrollbar {
  display: none;
}

.category-tab {
  flex: 0 0 auto;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 7px 12px;
  color: #1a7086;
  background: rgba(255, 255, 255, 0.9);
  font-size: 0.86rem;
  line-height: 1;
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(22, 49, 95, 0.13);
}

.category-tab.is-active {
  color: #fff;
  background: var(--teal);
}

.category-tab.is-rhythm {
  color: #7b569e;
  background: rgba(245, 240, 255, 0.92);
}

.category-tab.is-memory {
  color: #9f5b90;
  background: rgba(255, 240, 247, 0.94);
}

.category-tab.is-instrument {
  color: #397d23;
  background: rgba(239, 249, 234, 0.94);
}

.game-list {
  display: grid;
  gap: 11px;
  margin-top: 2px;
}

.game-card {
  min-height: 104px;
  display: grid;
  grid-template-columns: 88px 1fr auto;
  align-items: stretch;
  gap: 15px;
  padding: 10px 14px 10px 10px;
  border: 1px solid rgba(214, 226, 246, 0.76);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(27, 73, 122, 0.14);
  backdrop-filter: blur(7px);
  -webkit-tap-highlight-color: transparent;
}

.game-card:active {
  transform: translateY(2px);
}

.game-card[aria-disabled="true"] {
  opacity: 0.94;
  pointer-events: none;
}

.game-icon {
  width: 88px;
  min-height: 84px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--game-color);
}

.game-icon-chord-triangle {
  background: #099695;
  box-shadow: inset 0 -10px 18px rgba(0, 110, 119, 0.18);
}

.menu-chord-triangle {
  position: relative;
  width: 64px;
  height: 58px;
  display: block;
}

.chord-line,
.chord-note {
  position: absolute;
}

.chord-line {
  height: 4px;
  border-radius: 999px;
  background: #c8d2e5;
  transform-origin: left center;
  opacity: 0.92;
}

.chord-line-top {
  width: 34px;
  left: 15px;
  top: 18px;
}

.chord-line-left {
  width: 34px;
  left: 20px;
  top: 25px;
  transform: rotate(66deg);
}

.chord-line-right {
  width: 34px;
  left: 44px;
  top: 25px;
  transform: rotate(114deg);
}

.chord-note {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  font-weight: 900;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.82), 0 4px 8px rgba(25, 55, 82, 0.2);
}

.chord-note-c {
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  background: #ee3438;
}

.chord-note-e {
  left: 3px;
  top: 5px;
  color: #3b2c18;
  background: #ffc629;
}

.chord-note-g {
  right: 3px;
  top: 5px;
  background: #17a6ac;
}

.game-icon-question-card {
  background: #1e7fc3;
}

.menu-question-card {
  width: 58px;
  height: 58px;
  border: 3px dashed rgba(30, 127, 195, 0.46);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #1b233e;
  background: #f8fcff;
  font-size: 2.2rem;
  line-height: 1;
  font-weight: 900;
  box-shadow: 0 6px 12px rgba(18, 68, 110, 0.18);
}

.game-icon-beet-card {
  background: #ffdce9;
}

.menu-beet-card {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #ffe4ee;
  border: 2px solid rgba(151, 64, 143, 0.14);
  box-shadow: inset 0 -6px 0 rgba(151, 64, 143, 0.04);
}

.menu-beet-card img {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.game-icon-melody-stack {
  background: #7b569e;
}

.menu-melody-stack {
  position: relative;
  width: 70px;
  height: 66px;
  display: block;
}

.memory-card {
  position: absolute;
  width: 42px;
  height: 42px;
  border: 3px dashed rgba(27, 35, 62, 0.26);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #1b233e;
  background: rgba(255, 255, 255, 0.92);
  font-size: 1.6rem;
  line-height: 1;
  font-weight: 900;
  box-shadow: 0 7px 12px rgba(27, 35, 62, 0.16);
}

.memory-card-c {
  left: 3px;
  bottom: 1px;
  transform: rotate(-8deg);
}

.memory-card-e {
  left: 18px;
  bottom: 14px;
  z-index: 2;
  transform: rotate(5deg);
}

.memory-card-g {
  right: 2px;
  top: 2px;
  z-index: 3;
  transform: rotate(-4deg);
}

.game-icon-bells-instrument {
  background: #f1e606;
}

.game-icon-bell-sort-tray {
  background: #ea6ba3;
}

.menu-bell-sort-tray {
  position: relative;
  width: 72px;
  height: 56px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.34);
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.08), inset 0 2px 0 rgba(255, 255, 255, 0.34);
}

.menu-bell-sort-tray .sort-chip {
  display: grid;
  place-items: center;
  border-radius: 5px;
  color: #fff;
  font-size: 0.72rem;
  line-height: 1;
  font-weight: 900;
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.16), inset 0 -2px 0 rgba(0, 0, 0, 0.16);
}

.menu-bell-sort-tray .sort-chip-c { background: #e72829; }
.menu-bell-sort-tray .sort-chip-d { background: #f39422; }
.menu-bell-sort-tray .sort-chip-e { background: #f1e606; color: #5a4a06; }
.menu-bell-sort-tray .sort-chip-f { background: #6abb4a; }

.game-icon-tuner-dial {
  background: #099695;
  box-shadow: inset 0 -10px 18px rgba(0, 110, 119, 0.18);
}

.menu-tuner-dial {
  position: relative;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: inset 0 -6px 0 rgba(20, 38, 65, 0.06), 0 4px 8px rgba(20, 38, 65, 0.2);
  overflow: hidden;
}

.menu-tuner-dial .tuner-dial-ring {
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  border: 3px solid #d8e1ef;
  border-top-color: #e72829;
  border-right-color: #f39422;
  border-bottom-color: #6abb4a;
  border-left-color: #099695;
  transform: rotate(-45deg);
}

.menu-tuner-dial .tuner-dial-needle {
  position: absolute;
  left: 50%;
  bottom: 50%;
  width: 3px;
  height: 24px;
  margin-left: -1.5px;
  background: #1b233e;
  border-radius: 999px;
  transform-origin: 50% 100%;
  transform: rotate(14deg);
}

.menu-tuner-dial .tuner-dial-hub {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: #099695;
  border: 2px solid #fff;
}

.menu-bell-card {
  width: 68px;
  height: 68px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 -8px 0 rgba(27, 35, 62, 0.08);
}

.menu-bell-card img {
  width: 62px;
  height: 62px;
  object-fit: contain;
  filter: drop-shadow(0 3px 2px rgba(27, 35, 62, 0.15));
}

.menu-pinbell-card {
  position: relative;
  width: 68px;
  height: 68px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #1b2245;
  box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.menu-pinbell-card .pinbell-led {
  position: absolute;
  top: 7px;
  left: 50%;
  transform: translateX(-50%);
  font-family: "Courier New", monospace;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1px;
  color: #ff5a5a;
  background: #0c1024;
  border-radius: 3px;
  padding: 1px 5px;
}

.menu-pinbell-card .pinbell-ball {
  position: absolute;
  top: 30px;
  left: 26px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #e72829;
  box-shadow: inset -2px -2px 0 rgba(0, 0, 0, 0.25);
}

.menu-pinbell-card .pinbell-flippers {
  position: absolute;
  bottom: 9px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
}

.menu-pinbell-card .pinbell-flippers i {
  display: block;
  width: 18px;
  height: 5px;
  border-radius: 999px;
  background: #ffd25b;
}

.menu-pinbell-card .pinbell-flippers i:first-child { transform: rotate(20deg); }
.menu-pinbell-card .pinbell-flippers i:last-child { transform: rotate(-20deg); }

.menu-jump-card {
  position: relative;
  width: 68px;
  height: 68px;
  border-radius: 8px;
  background: #bfeaf7;
  box-shadow: inset 0 -8px 0 rgba(27, 35, 62, 0.08);
  overflow: hidden;
}
.menu-jump-card img {
  position: absolute;
  left: 20px;
  top: 8px;
  width: 30px;
  height: 30px;
  object-fit: contain;
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.9));
}
.menu-jump-card .jump-plat {
  position: absolute;
  height: 7px;
  border-radius: 999px;
}
.menu-jump-card .jp-1 { width: 26px; left: 6px; bottom: 8px; background: #e72829; }
.menu-jump-card .jp-2 { width: 26px; right: 6px; bottom: 24px; background: #f39422; }
.menu-jump-card .jp-3 { width: 26px; left: 10px; bottom: 40px; background: #f1e606; }

.menu-breaker-card {
  position: relative;
  width: 68px;
  height: 68px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 6px;
  background: #9fd9f0;
  box-shadow: inset 0 -8px 0 rgba(27, 35, 62, 0.08);
  overflow: hidden;
}

.menu-breaker-card .breaker-row { display: flex; gap: 4px; }

.menu-breaker-card .bk {
  display: block;
  width: 16px;
  height: 8px;
  border-radius: 3px;
}
.menu-breaker-card .bk-c { background: #e72829; }
.menu-breaker-card .bk-d { background: #f39422; }
.menu-breaker-card .bk-e { background: #f1e606; }
.menu-breaker-card .bk-f { background: #6abb4a; }
.menu-breaker-card .bk-g { background: #099695; }
.menu-breaker-card .bk-a { background: #7b569e; }

.menu-breaker-card .breaker-ball {
  position: absolute;
  left: 38px;
  top: 38px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(27, 35, 62, 0.3);
}

.menu-breaker-card .breaker-paddle {
  position: absolute;
  left: 50%;
  bottom: 7px;
  transform: translateX(-50%);
  width: 30px;
  height: 7px;
  border-radius: 999px;
  background: #099695;
}

.menu-pipes-card {
  width: 68px;
  height: 68px;
  border-radius: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  padding: 5px;
  background: #1b2245;
  box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.menu-pipes-card .pipe-tile {
  position: relative;
  border-radius: 5px;
  overflow: hidden;
}

.menu-pipes-card .pipe-tile-c { background: #e72829; }
.menu-pipes-card .pipe-tile-e { background: #f1e606; }
.menu-pipes-card .pipe-tile-g { background: #099695; }
.menu-pipes-card .pipe-tile-a { background: #7b569e; }

.menu-pipes-card .pipe-straight {
  position: absolute;
  top: 50%;
  left: -2px;
  right: -2px;
  height: 9px;
  transform: translateY(-50%);
  background: #fdf8ee;
  border-top: 2px solid rgba(27, 34, 69, 0.4);
  border-bottom: 2px solid rgba(27, 34, 69, 0.4);
}

.menu-pipes-card .pipe-straight.pipe-vert {
  top: -2px;
  bottom: -2px;
  left: 50%;
  right: auto;
  width: 9px;
  height: auto;
  transform: translateX(-50%);
  border: none;
  border-left: 2px solid rgba(27, 34, 69, 0.4);
  border-right: 2px solid rgba(27, 34, 69, 0.4);
}

.menu-pipes-card .pipe-elbow {
  position: absolute;
  top: -9px;
  right: -9px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 9px solid #fdf8ee;
  border-top-color: transparent;
  border-right-color: transparent;
  transform: rotate(45deg);
  box-sizing: content-box;
}

.menu-pipes-card .pipe-elbow.pipe-flip {
  top: auto;
  right: auto;
  bottom: -9px;
  left: -9px;
  transform: rotate(225deg);
}

.menu-bellrun-card {
  position: relative;
  width: 68px;
  height: 68px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #9fe0f7;
  box-shadow: inset 0 -8px 0 rgba(27, 35, 62, 0.08);
  overflow: hidden;
}

.menu-bellrun-card img {
  position: relative;
  width: 40px;
  height: 40px;
  object-fit: contain;
  transform: translateY(8px) rotate(10deg);
  filter: drop-shadow(0 3px 2px rgba(27, 35, 62, 0.15));
}

.menu-bellrun-card .bellrun-ground {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 12px;
  background: linear-gradient(180deg, #6abb4a 0 5px, #8a5a34 5px);
}

.menu-bellrun-card .bellrun-brick {
  position: absolute;
  top: 7px;
  right: 9px;
  width: 18px;
  height: 18px;
  border-radius: 3px;
  background: #f5b52a;
  color: #7d4720;
  font-size: 13px;
  font-weight: 900;
  display: grid;
  place-items: center;
}

.menu-flappy-card {
  position: relative;
  width: 68px;
  height: 68px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 -8px 0 rgba(27, 35, 62, 0.08);
  overflow: hidden;
}

.menu-flappy-card img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  transform: rotate(-14deg) translateY(-2px);
  filter: drop-shadow(0 3px 2px rgba(27, 35, 62, 0.15));
}

.menu-flappy-card .flappy-trail {
  position: absolute;
  left: 6px;
  top: 50%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transform: translateY(-50%);
}

.menu-flappy-card .flappy-trail i {
  display: block;
  height: 4px;
  border-radius: 999px;
  background: rgba(27, 35, 62, 0.22);
}

.menu-flappy-card .flappy-trail i:nth-child(1) { width: 14px; }
.menu-flappy-card .flappy-trail i:nth-child(2) { width: 9px; }
.menu-flappy-card .flappy-trail i:nth-child(3) { width: 12px; }

.game-icon svg {
  width: 58px;
  height: 58px;
  fill: none;
  stroke: currentColor;
  stroke-width: 4.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.game-icon circle {
  fill: rgba(255, 255, 255, 0.16);
}

.game-copy {
  min-width: 0;
  align-self: center;
}

.game-copy h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.38rem, 6vw, 1.78rem);
  line-height: 1.08;
  font-weight: 900;
}

.game-copy p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.25;
  font-weight: 800;
}

.game-arrow {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--game-color, var(--teal));
  color: #fff;
  align-self: center;
  box-shadow: 0 8px 16px rgba(0, 153, 153, 0.18);
}

.game-card[aria-disabled="true"] .game-arrow {
  opacity: 0.42;
}

.game-arrow svg {
  width: 22px;
  height: 22px;
}

@media (min-width: 700px) {
  body {
    padding: 18px;
  }

  .home-shell {
    min-height: min(844px, calc(100vh - 36px));
    padding-inline: 24px;
    border-radius: 30px;
    overflow: hidden;
  }
}

@media (max-width: 374px) {
  .home-shell {
    padding-inline: 14px;
  }

  .game-card {
    grid-template-columns: 70px 1fr 40px;
    gap: 9px;
    padding: 9px 12px 9px 9px;
  }

  .game-icon {
    width: 70px;
    min-height: 70px;
  }

  .game-icon svg {
    width: 50px;
    height: 50px;
  }

  .menu-chord-triangle {
    transform: scale(0.9);
  }

  .menu-question-card {
    width: 52px;
    height: 52px;
    font-size: 2rem;
  }

  .menu-beet-card {
    width: 56px;
    height: 56px;
  }

  .menu-beet-card img {
    width: 49px;
    height: 49px;
  }

  .menu-bell-card {
    transform: scale(0.9);
  }

  .menu-flappy-card {
    transform: scale(0.9);
  }

  .menu-bellrun-card {
    transform: scale(0.9);
  }

  .menu-pinbell-card {
    transform: scale(0.9);
  }

  .menu-melody-stack {
    transform: scale(0.9);
  }

  .game-copy h2 {
    font-size: 1.08rem;
  }

  .game-arrow {
    width: 40px;
    height: 40px;
  }
}
