body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #f5f5f5;
  margin: 0;
  padding: 2rem;
  color: #222;
}
.container {
  max-width: 820px;
  margin: 0 auto;
  background: #fff;
  padding: 1.5rem 1.75rem;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
h1 { margin: 0; font-size: 1.4rem; }
h1 .version {
  font-size: 0.65em;
  font-weight: normal;
  color: #999;
  margin-left: 0.4rem;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.icon-btn {
  background: transparent;
  border: 1px solid transparent;
  font-size: 1.3rem;
  line-height: 1;
  padding: 0.3rem 0.5rem;
  cursor: pointer;
  border-radius: 6px;
}
.icon-btn:hover { background: #f0f0f0; border-color: #ddd; }
.modal {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal.hidden { display: none; }
.modal-card {
  background: #fff;
  padding: 1.25rem 1.5rem 1rem;
  border-radius: 10px;
  width: min(460px, 92vw);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.modal-card h2 { margin: 0 0 1rem; font-size: 1.15rem; }
.setting-row {
  display: flex; gap: 0.5rem; align-items: center;
  margin-bottom: 0.7rem; font-size: 0.92rem;
}
.setting-row > label:first-child { flex: 0 0 12rem; }
.setting-row select, .setting-row input[type="number"] {
  padding: 0.3rem 0.45rem; font-size: 0.9rem;
}
.setting-row input[type="number"] { width: 6rem; }
.setting-row .range-sep { color: #666; }
.setting-row.checkbox > label {
  display: flex; gap: 0.5rem; align-items: center;
}
.modal-actions {
  display: flex; gap: 0.5rem; justify-content: flex-end;
  margin-top: 1rem; padding-top: 0.75rem;
  border-top: 1px solid #eee;
}
.controls { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem; flex-wrap: wrap; }
label { font-size: 0.95rem; }
select { padding: 0.35rem 0.5rem; font-size: 0.95rem; }
button {
  padding: 0.4rem 0.85rem;
  font-size: 0.95rem;
  border: 1px solid #ccc;
  background: #fafafa;
  border-radius: 6px;
  cursor: pointer;
}
button:hover:not(:disabled) { background: #f0f0f0; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.active { background: #3b82f6; border-color: #2563eb; color: #fff; }
button.start { background: #10b981; border-color: #059669; color: #fff; }
button.start.running { background: #ef4444; border-color: #dc2626; }
.game-controls { display: flex; gap: 0.5rem; align-items: center; margin: 0.75rem 0; flex-wrap: wrap; }
.status { color: #666; font-size: 0.85rem; min-height: 1.2em; }
.playing {
  font-size: 1.1rem;
  margin: 1rem 0 0.5rem;
  min-height: 1.5em;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.playing.correct { color: #10b981; }
.playing.wrong { color: #ef4444; }
.game-display {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.staff-wrap { position: relative; flex: 1; min-width: 0; }
#staff { display: flex; justify-content: center; }
.mult-badge {
  flex: 0 0 auto;
  min-width: 5.5rem;
  text-align: center;
  font-size: 2.75rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  pointer-events: none;
  color: transparent;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  transition: filter 0.25s ease, transform 0.25s ease, background-image 0.25s ease;
}
.mult-badge.tier-1 {
  background-image: linear-gradient(135deg, #e5e7eb 0%, #6b7280 100%);
}
.mult-badge.tier-2 {
  background-image: linear-gradient(135deg, #6ee7b7 0%, #047857 100%);
}
.mult-badge.tier-3 {
  background-image: linear-gradient(135deg, #fde047 0%, #d97706 100%);
}
.mult-badge.tier-4 {
  background-image: linear-gradient(135deg, #60a5fa 0%, #1d4ed8 100%);
  filter: drop-shadow(0 0 14px rgba(59, 130, 246, 0.55));
  transform: scale(1.08);
}
.mult-badge.hidden { visibility: hidden; }
.float-layer {
  position: absolute; inset: 0;
  pointer-events: none; overflow: visible;
}
.float-score {
  position: absolute;
  font-weight: 700;
  color: #10b981;
  text-shadow: 0 1px 2px rgba(255,255,255,0.8);
  transform: translate(-50%, -50%);
  white-space: nowrap;
  animation: floatUp 1100ms ease-out forwards;
}
@keyframes floatUp {
  0%   { opacity: 0; transform: translate(-50%, -30%) scale(0.7); }
  15%  { opacity: 1; transform: translate(-50%, -55%) scale(1.1); }
  30%  { transform: translate(-50%, -65%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -160%) scale(0.95); }
}
.hint { font-size: 0.8rem; color: #888; margin-top: 1rem; }
.footer { font-size: 0.8rem; color: #888; margin-top: 0.5rem; }
.footer a { color: #666; text-decoration: none; border-bottom: 1px dotted #aaa; }
.footer a:hover { color: #333; border-bottom-color: #333; }
.score { font-size: 0.9rem; color: #444; margin-left: auto; }
.mini-piano {
  position: relative;
  height: 64px;
  margin: 0.75rem auto 0;
  max-width: 640px;
  display: flex;
  user-select: none;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  touch-action: none;
}
.piano-key { cursor: pointer; }
.piano-key.white {
  flex: 1 1 0;
  height: 100%;
  border-right: 1px solid #888;
  box-sizing: border-box;
  position: relative;
}
.piano-key.white:last-of-type { border-right: none; }
.piano-key.black {
  position: absolute;
  top: 0;
  height: 62%;
  border: 1px solid #222;
  border-top: none;
  border-radius: 0 0 3px 3px;
  box-sizing: border-box;
  box-shadow: 0 2px 2px rgba(0,0,0,0.25);
  z-index: 2;
}
.piano-key.active.white {
  box-shadow: inset 0 0 0 3px #2563eb, inset 0 -6px 8px rgba(37,99,235,0.35);
}
.piano-key.active.black {
  box-shadow:
    inset 0 0 0 3px #bfdbfe,
    inset 0 -10px 12px rgba(59,130,246,0.7),
    0 0 10px 2px rgba(96,165,250,0.9);
  z-index: 3;
}
.piano-legend {
  max-width: 640px;
  margin: 0.35rem auto 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: #666;
}
.piano-legend .bar {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right,
    hsl(120, 70%, 80%) 0%,
    hsl(60, 70%, 75%) 33%,
    hsl(30, 75%, 65%) 66%,
    hsl(0, 75%, 60%) 100%);
}
.mini-piano-wrap {
  position: relative;
}
.piano-float-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
  z-index: 10;
}
.piano-float {
  position: absolute;
  font-weight: 800;
  font-size: 1.15rem;
  white-space: nowrap;
  transform: translate(-50%, -50%);
  text-shadow: 0 1px 2px rgba(255,255,255,0.95), 0 0 3px rgba(0,0,0,0.25);
  animation: floatUp 900ms ease-out forwards;
  pointer-events: none;
}
.piano-float.up   { color: #ef4444; }
.piano-float.down { color: #10b981; }
