:root{
  --bg:#ffffff;
  --panel:rgba(0,0,0,.04);
  --stroke:rgba(0,0,0,.14);
  --text:rgba(0,0,0,.92);
  --muted:rgba(0,0,0,.66);
  --blue:#3fa9f5;
  --pink:#fe7aab;
  --green:#7ac943;
  --red:#ff1d25;
  --orange:#fe921d;
  --shadow:0 16px 46px rgba(0,0,0,.14);
}

*{ box-sizing:border-box; }

html, body{
  height:100%;
  margin:0;
  overflow:hidden;
  touch-action:manipulation;
  -ms-touch-action:manipulation;
  background:var(--bg);
  color:var(--text);
  font-family:system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

button, input{ font:inherit; }

.hidden{ display:none !important; }

.app{
  position:relative;
  min-height:calc(var(--vh, 1vh) * 100);
  width:100%;
  background:#ffffff;
  overflow:hidden;
}

#appRoot:fullscreen,
#appRoot:-webkit-full-screen,
:fullscreen{
  background:#ffffff;
}

.gameLogo{
  display:none;
  position:fixed;
  top:calc(12px + env(safe-area-inset-top));
  left:calc(14px + env(safe-area-inset-left));
  width:min(166px, 24vw);
  max-height:56px;
  object-fit:contain;
  z-index:20000;
  pointer-events:none;
}

#appRoot:fullscreen .gameLogo,
#appRoot:-webkit-full-screen .gameLogo{
  display:block;
}

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

.hudLeft,
.hudRight,
.pillRow{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}

.pill{
  display:flex;
  align-items:baseline;
  gap:8px;
  padding:9px 11px;
  border-radius:999px;
  border:1px solid var(--stroke);
  background:var(--panel);
  box-shadow:0 8px 22px rgba(0,0,0,.08);
}

.pill .label{
  color:var(--muted);
  font-weight:900;
  font-size:12px;
}

.pill .value{
  color:var(--text);
  font-weight:1000;
  font-size:18px;
}

.modeSwitch{
  display:flex;
  flex-wrap:wrap;
  gap:7px;
  padding:7px;
  border-radius:999px;
  border:1px solid var(--stroke);
  background:rgba(0,0,0,.035);
}

.chip{
  min-width:44px;
  min-height:40px;
  padding:8px 12px;
  border-radius:999px;
  border:2px solid rgba(0,0,0,.14);
  background:rgba(0,0,0,.035);
  color:var(--text);
  cursor:pointer;
  user-select:none;
  font-weight:1000;
}

.chip.active{
  border-color:rgba(63,169,245,.50);
  background:rgba(63,169,245,.17);
  box-shadow:inset 0 0 0 3px rgba(63,169,245,.15), 0 8px 22px rgba(0,0,0,.08);
}

.btn{
  min-height:48px;
  padding:12px 15px;
  border-radius:14px;
  border:2px solid rgba(0,0,0,.15);
  background:rgba(0,0,0,.045);
  color:var(--text);
  box-shadow:0 10px 26px rgba(0,0,0,.10);
  cursor:pointer;
  font-size:16px;
  font-weight:1000;
  user-select:none;
  -webkit-user-select:none;
  touch-action:manipulation;
}

.btn:active{ transform:scale(.99); }

.btn.primary{
  background:rgba(63,169,245,.18);
  border-color:rgba(63,169,245,.42);
}

.btn.ghost{ background:rgba(0,0,0,.035); }

button:disabled,
input:disabled{
  opacity:.45 !important;
  pointer-events:none !important;
  filter:saturate(.85);
}

.overlay{
  position:fixed;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:clamp(12px, 3vw, 28px);
  background:rgba(0,0,0,.34);
  opacity:0;
  visibility:hidden;
  pointer-events:none;
  transition:opacity .16s ease;
  z-index:50000;
}

.overlay.show{
  opacity:1;
  visibility:visible;
  pointer-events:auto;
  z-index:60000;
}

.overlayCard{
  width:min(840px, 94vw);
  max-height:92vh;
  overflow:auto;
  border-radius:18px;
  border:1px solid rgba(0,0,0,.16);
  background:rgba(255,255,255,.98);
  box-shadow:0 22px 70px rgba(0,0,0,.22);
  padding:16px;
  text-align:center;
  pointer-events:auto;
}

.overlayCard.wide{ width:min(1160px, 96vw); }

.modalLogo{
  display:block;
  width:min(180px, 46vw);
  max-height:56px;
  object-fit:contain;
  margin:0 auto 8px;
}

.overlayTitle{
  margin:0 0 8px;
  color:var(--text);
  font-size:34px;
  line-height:1.08;
  font-weight:1100;
}

.overlayText{
  margin:0 auto 12px;
  max-width:72ch;
  color:rgba(0,0,0,.80);
  font-size:18px;
  line-height:1.34;
}

.overlaySmall{
  margin-top:10px;
  color:rgba(0,0,0,.62);
  font-size:13px;
  line-height:1.35;
}

.overlayButtons{
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:center;
  flex-wrap:wrap;
  margin-top:12px;
}

.overlayStatus{
  margin:12px auto 0;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid rgba(254,146,29,.34);
  background:rgba(254,146,29,.13);
  color:rgba(0,0,0,.82);
  font-weight:1000;
  line-height:1.25;
}

.overlay.firstScreen{
  background:#ffffff;
  backdrop-filter:none;
  overflow:auto;
  -webkit-overflow-scrolling:touch;
}

.overlay.firstScreen .overlayCard{
  width:min(780px, 100%);
  max-width:780px;
  min-height:min(720px, calc((var(--vh, 1vh) * 100) - clamp(32px, 8vw, 84px)));
  border:0;
  border-radius:0;
  background:transparent;
  box-shadow:none;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  padding:clamp(10px, 3vw, 28px);
}

.overlay.firstScreen .kidstrumentLogo{
  display:block;
  width:min(300px, 74vw);
  max-height:24vh;
  object-fit:contain;
  margin:0 auto clamp(14px, 3vw, 26px);
}

.overlay.firstScreen .overlayTitle{
  font-size:48px;
}

.guideBadge{
  display:inline-flex;
  align-items:center;
  margin:0 auto 8px;
  padding:7px 12px;
  border-radius:999px;
  border:1px solid rgba(63,169,245,.34);
  background:rgba(63,169,245,.14);
  color:rgba(0,0,0,.84);
  font-weight:1100;
  font-size:14px;
}

.guideLead{
  max-width:900px;
  margin:0 auto 10px;
  color:rgba(0,0,0,.80);
  font-size:18px;
  font-weight:900;
  line-height:1.32;
  text-align:center;
}

.guideGrid{
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:10px;
  text-align:left;
  margin-top:10px;
}

.guidePanel{
  border-radius:16px;
  border:1px solid rgba(0,0,0,.12);
  background:rgba(0,0,0,.03);
  padding:12px;
}

.guideHeading{
  margin-bottom:6px;
  color:var(--text);
  font-size:17px;
  font-weight:1100;
}

.guideList{
  margin:0;
  padding-left:18px;
  color:rgba(0,0,0,.82);
  font-size:16px;
  font-weight:900;
  line-height:1.35;
}

.guideList li{ margin:6px 0; }

.levelPicker{
  width:min(980px, 96%);
  margin:0 auto;
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(220px, 1fr));
  gap:10px;
  text-align:left;
}

.levelOption{
  display:block;
  cursor:pointer;
  user-select:none;
}

.levelOption input{
  position:absolute;
  opacity:0;
  pointer-events:none;
}

.levelCard{
  height:100%;
  border-radius:16px;
  border:2px solid rgba(0,0,0,.14);
  background:rgba(255,255,255,.96);
  box-shadow:0 12px 32px rgba(0,0,0,.12);
  padding:12px;
  transition:transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}

.levelHead{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:8px;
}

.levelTitle{
  color:var(--text);
  font-size:18px;
  font-weight:1100;
}

.levelTag{
  padding:6px 10px;
  border-radius:999px;
  border:1px solid rgba(0,0,0,.14);
  background:rgba(0,0,0,.04);
  color:rgba(0,0,0,.76);
  font-size:12px;
  font-weight:1100;
  white-space:nowrap;
}

.levelDesc{
  color:rgba(0,0,0,.72);
  font-size:13px;
  font-weight:900;
  line-height:1.25;
}

.levelOption input:checked + .levelCard{
  border-color:rgba(63,169,245,.55);
  box-shadow:0 14px 32px rgba(0,0,0,.12), inset 0 0 0 4px rgba(63,169,245,.16);
  transform:translateY(-1px);
}

.compareWrap{
  margin:10px auto 6px;
  width:min(1100px, 98%);
  padding:12px;
  border-radius:16px;
  border:1px solid rgba(0,0,0,.14);
  background:rgba(0,0,0,.03);
  box-shadow:0 12px 30px rgba(0,0,0,.10);
}

.compareLabelRow{
  display:flex;
  justify-content:space-between;
  gap:10px;
  margin-bottom:10px;
}

.compareLabel{
  width:50%;
  text-align:center;
  color:rgba(0,0,0,.78);
  font-size:18px;
  font-weight:1100;
}

.compareMount{
  width:100%;
  height:320px;
  overflow:hidden;
  border-radius:14px;
  border:1px solid rgba(0,0,0,.12);
  background:rgba(255,255,255,.90);
}

.feedbackDetails{ margin-top:8px; }

.feedbackWhy{
  width:min(960px, 96%);
  margin:0 auto 10px;
  padding:12px;
  border-radius:14px;
  border:1px solid rgba(0,0,0,.12);
  background:rgba(0,0,0,.03);
  color:rgba(0,0,0,.82);
  font-weight:900;
  line-height:1.32;
  text-align:left;
}

@media (max-width:980px){
  .guideGrid{ grid-template-columns:1fr; }
}

@media (max-width:640px){
  .gameLogo{
    width:min(116px, 34vw);
    max-height:42px;
  }
  .overlay.firstScreen .overlayTitle{ font-size:36px; }
  .overlayText{ font-size:16px; }
  .overlayTitle{ font-size:30px; }
}

@media (max-height:620px){
  .overlay.firstScreen .overlayCard{
    min-height:auto;
    justify-content:flex-start;
  }
  .overlay.firstScreen .kidstrumentLogo{
    width:min(240px, 64vw);
    max-height:18vh;
  }
}
