
:root{
  --bg:#ffffff;
  --ink:#0b1220;
  --muted:#52607a;
  --line:rgba(10,15,30,.12);
  --shadow:0 10px 30px rgba(10,15,30,.10);
  --ring:rgba(10,15,30,.08);
  --pad:92px;
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  background:var(--bg);
  color:var(--ink);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}
.topbarWrap{
  border-bottom:1px solid var(--line);
  background:#fff;
}
.topbar{
  max-width:1200px;
  margin:0 auto;
  display:flex;
  align-items:center;
  gap:14px;
  padding:12px clamp(16px, 3vw, 32px);
  flex-wrap:wrap;
}
.brand{min-width:180px}
.title{font-weight:800}
.subtitle{color:var(--muted); font-size:12px}
.pill{
  border:1px solid var(--line);
  background:#fff;
  border-radius:999px;
  padding:8px 12px;
  font-weight:650;
  cursor:pointer;
}
.pill:hover{box-shadow:0 2px 12px rgba(0,0,0,.06)}
.pill.danger{border-color:rgba(220,38,38,.25); color:#b91c1c}
.pill.badge{cursor:default; font-weight:800}
.stats{display:flex; gap:10px; margin-left:auto}
.stat{
  border:1px solid var(--line);
  border-radius:14px;
  padding:8px 12px;
  min-width:78px;
  text-align:center;
  background:#fff;
}
.stat .k{font-size:12px; color:var(--muted)}
.stat .v{font-size:16px; font-weight:800}
.actions{display:flex; gap:10px; align-items:center}
.wrap{
  min-height: calc(100vh - 62px - 28px);
  display:flex;
  justify-content:center;
  align-items:center;
  padding:12px 12px 20px;
}
.game{
  width:min(680px, 96vw);
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:12px;
}
.ring{
  position:relative;
  width:min(520px, 86vw);
  aspect-ratio: 1 / 1;
  border-radius:50%;
  background: radial-gradient(circle at 50% 50%, #fff 0 44%, rgba(10,15,30,.08) 44% 46%, #fff 46% 100%);
  box-shadow: var(--shadow);
  border:1px solid rgba(10,15,30,.10);
  overflow:visible;
}

.centerArea{
  position:absolute;
  inset:30%;
  border-radius:50%;
  background:#fff;
  border:1px solid rgba(10,15,30,.10);
  box-shadow: 0 14px 34px rgba(10,15,30,.10);
  display:grid;
  place-items:center;
  z-index:2;
}
.startBtnCenter{
  padding:12px 20px;
  border-radius:14px;
}
.padBtn{
  z-index:3;
  position:absolute;
  width:var(--pad); height:var(--pad);
  border-radius:50%;
  border:1px solid rgba(0,0,0,.12);
  box-shadow:0 8px 18px rgba(0,0,0,.10);
  display:grid;
  place-items:center;
  font-weight:900;
  letter-spacing:.5px;
  cursor:pointer;
  user-select:none;
  -webkit-tap-highlight-color: transparent;
}
.padBtn:active{transform:scale(.97)}
.padBtn.pressed{filter:brightness(1.06); box-shadow:0 10px 26px rgba(0,0,0,.16)}
.c0{background:#ef4444}
.c1{background:#f97316}
.c2{background:#facc15}
.c3{background:#22c55e}
.c4{background:#06b6d4}
.c5{background:#3b82f6}
.c6{background:#a855f7}

.micro{
  margin-top:6px;
  color:var(--muted);
  text-align:center;
  max-width: 52ch;
  padding: 0 10px;
  line-height:1.35;
}
.startBtn{
  border:0;
  background:#0b1220;
  color:#fff;
  padding:10px 18px;
  border-radius:12px;
  font-weight:850;
  cursor:pointer;
  box-shadow:0 10px 18px rgba(0,0,0,.12);
}
.startBtn:hover{filter:brightness(1.05)}

.modal{
  position:fixed;
  inset:0;
  background:rgba(10,15,30,.40);
  display:grid;
  place-items:center;
  padding: max(16px, env(safe-area-inset-top)) 14px max(16px, env(safe-area-inset-bottom));
  z-index:50;
}
.modal[hidden]{display:none !important;}
.modalCard{
  width:min(720px, 94vw);
  background:#fff;
  border-radius:16px;
  border:1px solid var(--line);
  box-shadow: var(--shadow);
  padding:14px;
}
.modalHead{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding-bottom:10px;
  border-bottom:1px solid var(--line);
}
.modalTitle{font-weight:900}
.grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:12px;
  padding-top:12px;
}
.field{display:flex; flex-direction:column; gap:6px; font-weight:700;}
.field span{font-size:12px; color:var(--muted); font-weight:800}
.field select{
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--line);
  font-weight:700;
  background:#fff;
}
.hint{margin-top:10px; color:var(--muted); font-size:12px}

@media (max-width:560px){
  .stats{margin-left:0}
  .grid{grid-template-columns: 1fr}
  :root{--pad:82px}
}


.centerBtn{
  width: 86%;
  border: 1px solid rgba(10,15,30,.14);
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
  border-radius: 14px;
  font-weight: 850;
  line-height: 1.15;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 10px 18px rgba(0,0,0,.10);
}
.centerBtn:hover{filter: brightness(1.02)}
.centerBtn:active{transform: scale(.98)}


/* --- Tap/click shift fix for pad buttons --- */
.padBtn{
  box-sizing: border-box;
  transform: translateZ(0);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.padBtn:active{
  transform: none !important; /* prevent press "bounce" shifting layout */
}

.padBtn:focus{
  outline: none;
}

.padBtn:focus-visible{
  outline: 2px solid rgba(0,0,0,.25);
  outline-offset: 2px;
}
/* --- end tap/click shift fix --- */


/* Keep layout stable when microcopy text changes */
.micro{ min-height: 2.8em; }


/* --- Mobile spacing: bring the ring closer to the top stats bar --- */
@media (max-width: 600px){
  .wrap{
    min-height: auto;
    justify-content:flex-start;
    align-items:stretch;
    padding: 10px 10px 22px;
  }
  .game{ gap: 8px; }
  .topbar{ padding: 10px 12px; }
}
/* --- end mobile spacing --- */


/* Pad label color fix */
.padBtn{ color:#000; }

/* Listening dim effect (like Solfege Sally) */
.game.isListening .padWrap,
.game.isListening .centerArea{
  filter: brightness(0.72);
  transition: filter 180ms ease;
}
.game:not(.isListening) .padWrap,
.game:not(.isListening) .centerArea{
  transition: filter 180ms ease;
}
@media (prefers-reduced-motion: reduce){
  .game.isListening .padWrap,
  .game.isListening .centerArea,
  .game:not(.isListening) .padWrap,
  .game:not(.isListening) .centerArea{
    transition: none;
  }
}


/* Remove sound badge (Synth/Sample) */
#soundBadge{ display:none !important; }