:root {
  --bg: #08080f;
  --ink: #f4f4fa;
  --muted: #9a9ab0;
  --line: rgba(255, 255, 255, 0.14);
  --display: "Russo One", "Saira", system-ui, sans-serif;
  --body: "Saira Semi Condensed", "Saira", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
}

canvas#game { position: fixed; inset: 0; display: block; }

#ui { position: fixed; inset: 0; pointer-events: none; }
#ui > * { pointer-events: auto; }
#ui[data-screen="play"] { display: none; }

button { font: inherit; color: inherit; }

/* ------------------------------------------------------------------ menu */

.menu {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) 1.3fr;
  grid-template-rows: 1fr auto;
  column-gap: 4vw;
  padding: 7vh 0 4vh 5vw;
  background: linear-gradient(90deg, rgba(8, 8, 15, 0.92) 0 45%, rgba(8, 8, 15, 0.55));
}

.brand { align-self: start; }
.brand h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(64px, 11vw, 180px);
  line-height: 0.82;
  letter-spacing: -0.02em;
  display: flex;
  flex-direction: column;
}
.brand h1 .slash { color: #3f6bff; padding-left: 0.42em; }
.brand p { max-width: 30ch; margin: 2.2em 0 0; color: var(--muted); font-size: 17px; line-height: 1.45; }
.brand.small h1 { font-size: clamp(56px, 8vw, 120px); }

.bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-self: center;
}

.bar {
  --i: 0;
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  align-items: end;
  text-align: left;
  border: 0;
  margin-left: calc(var(--i) * 2.2vw);
  padding: 20px 34px 18px 30px;
  min-height: 108px;
  background: var(--accent);
  overflow: hidden;
  cursor: pointer;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 22px 100%, 0 calc(100% - 22px));
  transition: transform 160ms cubic-bezier(.2, .9, .3, 1.3), filter 160ms;
  outline: none;
}
.bar::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(0, 0, 0, 0.18));
  pointer-events: none;
}
.bar:hover, .bar:focus-visible, .bar:focus {
  transform: translateX(-28px);
  filter: brightness(1.15) saturate(1.1);
}
.bar:focus::after {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 8px;
  background: #fff;
}
.bar-glyph {
  position: absolute;
  right: -0.06em;
  bottom: -0.28em;
  font-family: var(--display);
  font-size: 150px;
  line-height: 1;
  color: rgba(0, 0, 0, 0.22);
  pointer-events: none;
  transition: transform 300ms cubic-bezier(.2, .9, .3, 1);
}
.bar:hover .bar-glyph, .bar:focus .bar-glyph { transform: translateX(-24px); }
.bar-title { position: relative; font-family: var(--display); font-size: 44px; line-height: 1; letter-spacing: 0.01em; }
.bar-tagline { position: relative; grid-column: 1; font-size: 16px; opacity: 0.85; margin-top: 6px; }
.bar-meta {
  position: relative;
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  font-family: var(--display);
  font-size: 18px;
  background: rgba(0, 0, 0, 0.35);
  padding: 6px 12px;
  margin-right: 90px;
}

.hint {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.12em;
}

/* ------------------------------------------------------------------ config */

.config {
  position: absolute;
  inset: 0;
  overflow: auto;
  padding: 6vh 5vw;
  background: rgba(8, 8, 15, 0.94);
}
.panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 22px;
  margin-top: 4vh;
}
.panel { border-top: 3px solid var(--ink); padding-top: 14px; }
.panel h2 { font-family: var(--display); font-weight: 400; font-size: 26px; margin: 0 0 14px; letter-spacing: 0.04em; }
.panel .row {
  display: grid;
  grid-template-columns: 1fr 1.1fr 112px;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}
.panel output { font-family: var(--display); font-size: 14px; text-align: right; }
.panel input[type="range"] { width: 100%; accent-color: #3f6bff; }
.keys .row { grid-template-columns: 1fr 104px 104px; }
.key {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  padding: 7px 6px;
  font-family: var(--display);
  font-size: 13px;
  cursor: pointer;
}
.key:hover { background: rgba(255, 255, 255, 0.14); }
.key.listening { background: #3f6bff; border-color: #3f6bff; }
.note { color: var(--muted); font-size: 14px; }

.actions { display: flex; gap: 12px; margin-top: 30px; }
.ghost-btn {
  border: 2px solid var(--ink);
  background: transparent;
  padding: 12px 22px;
  font-family: var(--display);
  font-size: 16px;
  letter-spacing: 0.06em;
  cursor: pointer;
  outline: none;
}
.ghost-btn:hover, .ghost-btn:focus { background: var(--ink); color: var(--bg); }
.ghost-btn.primary { background: var(--accent, #3f6bff); border-color: var(--accent, #3f6bff); color: #fff; }
.ghost-btn.primary:hover, .ghost-btn.primary:focus { filter: brightness(1.2); }

/* ------------------------------------------------------------------ results */

.results {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 8vw;
  background: linear-gradient(90deg, rgba(8, 8, 15, 0.96) 0 55%, rgba(8, 8, 15, 0.6));
  animation: slide-in 380ms cubic-bezier(.2, .9, .3, 1);
}
@keyframes slide-in {
  from { transform: translateX(-60px); opacity: 0; }
}
.results .headline {
  margin: 0;
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: 0.3em;
  color: var(--accent);
}
.results .big {
  margin: 0.05em 0 0;
  font-family: var(--display);
  font-size: clamp(64px, 12vw, 190px);
  line-height: 1;
  letter-spacing: -0.02em;
}
.results .badge {
  display: inline-block;
  align-self: flex-start;
  margin: 18px 0 0;
  padding: 6px 14px;
  background: var(--accent);
  font-family: var(--display);
  font-size: 16px;
}
.results .stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  max-width: 820px;
  gap: 0;
  margin-top: 40px;
  border-top: 1px solid var(--line);
}
.results .stat { padding: 14px 0; border-bottom: 1px solid var(--line); }
.results .stat span { display: block; color: var(--muted); font-size: 13px; letter-spacing: 0.16em; }
.results .stat strong { font-family: var(--display); font-weight: 400; font-size: 30px; }

@media (max-width: 860px) {
  .menu { grid-template-columns: 1fr; padding: 5vh 16px; row-gap: 3vh; overflow: auto; }
  .bar { margin-left: 0; }
  .bar-meta { display: none; }
}
