:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #14141f;
  --bg-tertiary: #1e1e2e;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #606070;
  --accent: #00d4ff;
  --accent-secondary: #00ff88;
  --danger: #ff4466;
  --focus-ring: #00d4ff;
  --focus-glow: rgba(0, 212, 255, 0.4);
  --radius-md: 12px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  width: 600px; height: 600px; overflow: hidden;
  background: #000;
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
#app { width: 100%; height: 100%; position: relative; }
.screen { width: 100%; height: 100%; position: absolute; top: 0; left: 0; display: flex; flex-direction: column; }
.screen.hidden { display: none; }
.focusable { transition: all 0.15s ease; border: 2px solid transparent; cursor: pointer; outline: none; }
.focusable:focus { border-color: var(--focus-ring); box-shadow: 0 0 20px var(--focus-glow); }
.hidden { display: none !important; }

/* ---- shared chrome ---- */
.hdr {
  flex: 0 0 auto;
  padding: 22px 24px 14px;
  border-bottom: 1px solid var(--bg-tertiary);
  background: var(--bg-primary);
}
.title {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.1;
  color: var(--text-primary);
}
.sub {
  margin-top: 6px;
  font-size: 16px;
  color: var(--text-secondary);
}
.hint {
  flex: 0 0 auto;
  padding: 12px 24px 16px;
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  letter-spacing: 0.3px;
}
.acc { color: var(--accent); font-weight: 700; }

/* ---- root grid ---- */
.roots {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 1fr;
  gap: 12px;
  padding: 20px 24px;
  align-content: center;
}
.rootBtn {
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 26px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 88px;
}
.rootBtn:focus { transform: scale(1.04); background: #26263a; }
.rootBtn .acc { font-size: 0.7em; }

/* ---- mode list ---- */
.modes {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 24px;
}
.modeBtn {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  min-height: 64px;
  justify-content: center;
}
.modeBtn:focus { transform: translateX(4px); background: var(--bg-tertiary); }
.mName { font-size: 21px; font-weight: 700; color: var(--text-primary); }
.mSub { font-size: 13px; color: var(--text-secondary); }
.modes::-webkit-scrollbar { width: 6px; }
.modes::-webkit-scrollbar-thumb { background: #33334a; border-radius: 3px; }

/* ---- result ---- */
.notes {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: center;
  gap: 10px;
  padding: 22px 16px 10px;
}
.chip {
  background: var(--bg-tertiary);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  padding: 12px 10px;
  min-width: 62px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all 0.12s ease;
}
.chip.root { border-color: var(--accent-secondary); }
.chip.playing { transform: translateY(-6px) scale(1.06); box-shadow: 0 0 22px var(--focus-glow); }
.chip .nm { font-size: 28px; font-weight: 800; line-height: 1; }
.chip.root .nm { color: var(--accent-secondary); }
.chip .nm .acc { font-size: 0.6em; vertical-align: super; }
.chip .q { font-size: 13px; color: var(--text-secondary); font-weight: 600; }

.formula {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4px 24px;
  font-size: 17px;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

.actions {
  flex: 0 0 auto;
  display: flex;
  gap: 12px;
  padding: 8px 24px 4px;
}
.btn {
  flex: 1 1 0;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.btn:focus { transform: translateY(-2px); }
.btn-primary { background: #0d2b33; color: var(--accent); }
