/* Kind Keys — CongoSky brand kit. Text colours follow the surface they sit on. */

html {
  min-height: 100%;
  background: var(--sand);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--bone);
  font-family: var(--font-body);
  line-height: 1.6;
  background:
    linear-gradient(180deg, rgba(47, 53, 37, 0.04), rgba(47, 53, 37, 0) 30%),
    var(--sand);
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

/* ── CongoSky chrome (light / sand surface) ── */

.congosky-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 980px;
  margin: 0 auto;
  padding: 14px 24px 0;
}

.congosky-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--olive-deep);
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.congosky-brand img {
  border-radius: 8px;
  background: var(--olive-deep);
}

.congosky-badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--camel);
  color: var(--olive-deep);
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.congosky-back {
  margin-left: auto;
  color: var(--link-light);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.congosky-back:hover {
  color: var(--olive-deep);
}

.congosky-foot {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 24px 24px;
  color: var(--bonedim);
  font-size: 14px;
  text-align: center;
}

.congosky-foot p {
  margin: 0;
}

.congosky-foot a {
  color: var(--link-light);
  font-weight: 700;
}

button,
input {
  font: inherit;
}

.app {
  box-sizing: border-box;
  width: 100%;
  max-width: 980px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px;
}

/* ── Hero (light / sand surface) ── */

.hero {
  padding: 18px 0 10px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--bonedim);
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 720px;
  margin-bottom: 12px;
  color: var(--olive-deep);
  font-family: var(--font-head);
  font-size: 46px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.015em;
}

h2 {
  margin-bottom: 8px;
  color: var(--olive);
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.intro,
.panel p {
  max-width: 700px;
  color: var(--bone);
  font-size: 18px;
  line-height: 1.5;
}

/* ── Cards (light / khaki surface) ── */

.panel,
.controls,
.stage,
.transport {
  border: 1px solid var(--line);
  border-top: var(--gold-edge) solid var(--camel);
  border-radius: var(--radius);
  background: rgba(212, 196, 168, 0.55);
  box-shadow: 0 12px 40px rgba(47, 53, 37, 0.08);
  color: var(--bone);
}

.transport {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
  padding: 14px 18px;
}

.beat-pulse-slot {
  display: flex;
  flex: 0 0 28px;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
}

.beat-pulse {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(74, 82, 52, 0.25);
  transform: scale(1);
  transition: transform 90ms linear, background 90ms linear;
}

.beat-pulse.is-soft {
  background: var(--grass);
  transform: scale(1.15);
}

.beat-pulse.is-strong {
  background: var(--camel);
  transform: scale(1.3);
}

.secondary-button.is-on {
  background: var(--camel);
  color: var(--olive-deep);
  box-shadow: inset 0 0 0 2px rgba(47, 53, 37, 0.12);
}

.tempo-control {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  color: var(--olive-deep);
  font-weight: 700;
}

.tempo-control input[type="range"] {
  width: 130px;
  accent-color: var(--olive);
}

.tempo-value {
  min-width: 64px;
  color: var(--bonedim);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.panel {
  display: table;
  box-sizing: border-box;
  width: 100%;
  margin: 22px 0;
  padding: 20px;
}

.panel > div {
  display: table-cell;
  vertical-align: middle;
}

.panel p {
  color: var(--bonedim);
  font-size: 16px;
}

.panel strong {
  color: var(--olive-deep);
}

.start-button,
.secondary-button {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--font-head);
  font-weight: 700;
}

.start-button {
  display: table-cell;
  min-width: 150px;
  padding: 16px 22px;
  background: var(--camel);
  color: var(--olive-deep);
  vertical-align: middle;
}

.secondary-button {
  padding: 12px 16px;
  background: var(--olive);
  color: var(--sand);
}

.start-button:hover,
.secondary-button:hover {
  filter: brightness(1.04);
}

.stage {
  position: relative;
  overflow: hidden;
  padding: 20px;
  background: rgba(212, 196, 168, 0.7);
}

.keyboard {
  position: relative;
  z-index: 2;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.white-keys {
  display: flex;
  height: 220px;
}

.piano-key {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border: 0;
  cursor: pointer;
  font-family: var(--font-body);
}

/* ── Piano keys (white / light and black / dark surfaces) ── */

.key-white {
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  border-right: 1px solid var(--dust);
  border-bottom: 1px solid var(--dust);
  border-radius: 0 0 8px 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f4f4f4 78%, #e3e3e3 100%);
  color: var(--olive-deep);
  box-shadow: inset 0 -8px 0 rgba(47, 53, 37, 0.08);
}

.key-white:first-child {
  border-left: 1px solid var(--dust);
  border-radius: 0 0 0 8px;
}

.key-white:last-child {
  border-radius: 0 0 8px 0;
}

.key-black {
  position: absolute;
  top: 0;
  z-index: 3;
  width: 6.2%;
  height: 58%;
  border: 1px solid var(--olive-deep);
  border-radius: 0 0 6px 6px;
  background: linear-gradient(180deg, #3a3f32 0%, var(--olive-deep) 100%);
  box-shadow: 0 8px 10px rgba(47, 53, 37, 0.45);
  color: var(--sand);
  pointer-events: none;
}

.key-muted {
  opacity: 0.28;
  cursor: default;
}

.key-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  padding: 0 4px 12px;
  pointer-events: none;
}

.key-letter {
  font-size: 15px;
  font-weight: 700;
}

.key-note {
  margin-top: 4px;
  color: var(--bonedim);
  font-size: 11px;
}

.key-black .key-label {
  padding-bottom: 8px;
}

.key-black .key-letter {
  font-size: 11px;
  color: var(--sand);
}

.key-black .key-note {
  font-size: 9px;
  color: var(--khaki);
}

.piano-key.is-active.key-white {
  background: linear-gradient(180deg, #efefef 0%, #d8d8d8 78%, #c8c8c8 100%);
  transform: translateY(2px);
  box-shadow: inset 0 -3px 0 rgba(47, 53, 37, 0.12);
}

.piano-key.is-leading.key-white {
  box-shadow: inset 0 -8px 0 rgba(47, 53, 37, 0.08), inset 0 0 0 3px var(--camel);
}

.piano-key.is-active.key-white.is-leading {
  box-shadow: inset 0 -3px 0 rgba(47, 53, 37, 0.12), inset 0 0 0 3px var(--camel);
}

.note-trail {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1;
  height: 100%;
  pointer-events: none;
}

.bubble {
  position: absolute;
  bottom: 18px;
  width: 34px;
  height: 34px;
  margin-left: -17px;
  border-radius: 50%;
  background: rgba(232, 184, 32, 0.75);
  animation: float-note 1.5s ease-out forwards;
}

.controls {
  margin-top: 22px;
  padding: 18px;
}

.controls label {
  display: inline-block;
  margin: 0 20px 14px 0;
  color: var(--olive-deep);
  font-weight: 700;
}

.controls input {
  display: block;
  width: 180px;
  margin-top: 8px;
  accent-color: var(--olive);
}

.status {
  min-height: 24px;
  margin: 18px 0 0;
  color: var(--bonedim);
  font-size: 16px;
}

/* ── Mode switch ── */

.mode-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}

.mode-button {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(212, 196, 168, 0.45);
  color: var(--bonedim);
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.mode-button.is-active {
  border-color: var(--olive);
  background: var(--olive-deep);
  color: var(--sand);
}

.is-hidden {
  display: none;
}

/* ── Learn panel ── */

.learn-panel {
  margin-bottom: 22px;
  padding: 20px;
  border: 1px solid var(--line);
  border-top: var(--gold-edge) solid var(--camel);
  border-radius: var(--radius);
  background: rgba(212, 196, 168, 0.55);
}

.learn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.learn-col-wide {
  grid-column: 1 / -1;
}

.learn-hint,
.song-blurb {
  margin: 0 0 12px;
  color: var(--bonedim);
  font-size: 15px;
}

.level-ladder {
  margin: 0;
  padding: 0;
  list-style: none;
}

.level-ladder li {
  margin-bottom: 8px;
}

.level-button {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(232, 223, 204, 0.65);
  color: var(--bone);
  font-family: var(--font-body);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.level-button strong {
  display: block;
  color: var(--olive-deep);
  font-family: var(--font-head);
  font-size: 15px;
}

.level-button span {
  color: var(--bonedim);
  font-size: 13px;
}

.level-button.is-active {
  border-color: var(--camel);
  box-shadow: inset 0 0 0 1px var(--camel);
  background: rgba(232, 184, 32, 0.18);
}

.song-list {
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 280px;
  overflow-y: auto;
}

.song-list li {
  margin-bottom: 8px;
}

.song-button {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(232, 223, 204, 0.65);
  color: var(--bone);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.song-button .era {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--khaki);
  color: var(--olive-deep);
  font-family: var(--font-head);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  vertical-align: middle;
}

.song-button.is-active {
  border-color: var(--olive);
  background: rgba(74, 82, 52, 0.12);
}

.trainer-song-title {
  margin: 0 0 6px;
  color: var(--olive-deep);
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 700;
}

.trainer-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.trainer-mode {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(232, 223, 204, 0.65);
  color: var(--bone);
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.trainer-mode.is-active {
  background: var(--olive);
  border-color: var(--olive);
  color: var(--sand);
}

.trainer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.trainer-actions .start-button,
.trainer-actions .secondary-button {
  display: inline-block;
}

.trainer-hud {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: baseline;
}

.trainer-score {
  color: var(--olive-deep);
  font-family: var(--font-head);
  font-size: 28px;
  font-weight: 700;
}

.trainer-progress {
  color: var(--bonedim);
  font-size: 15px;
}

/* ── Note highway (Guitar Hero style) ── */

.note-highway {
  position: relative;
  height: 200px;
  margin-bottom: 14px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(47, 53, 37, 0.92) 0%, rgba(47, 53, 37, 0.78) 100%);
  overflow: hidden;
}

.hit-line {
  position: absolute;
  right: 0;
  bottom: 18%;
  left: 0;
  z-index: 2;
  height: 3px;
  background: var(--camel);
  box-shadow: 0 0 12px rgba(232, 184, 32, 0.65);
}

.hit-line::after {
  content: "Play here";
  position: absolute;
  top: -22px;
  right: 12px;
  color: var(--camel);
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.falling-notes {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.fall-note {
  position: absolute;
  width: 34px;
  height: 34px;
  margin-left: -17px;
  border-radius: 8px;
  background: var(--camel);
  color: var(--olive-deep);
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 700;
  line-height: 34px;
  text-align: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  transform: translateY(-50%);
  transition: background 120ms linear;
}

.fall-note.is-hit {
  background: var(--sand);
}

.fall-note.is-perfect {
  background: #b8e986;
  box-shadow: 0 0 16px rgba(184, 233, 134, 0.8);
}

.fall-note.is-good {
  background: var(--emu);
}

.fall-note.is-miss {
  background: var(--terracotta);
  opacity: 0.75;
}

.fall-note.is-echo-prompt {
  width: 42px;
  height: 42px;
  margin-left: -21px;
  border-radius: 50%;
  background: var(--camel);
  font-size: 16px;
  line-height: 42px;
  box-shadow: 0 0 20px rgba(232, 184, 32, 0.85);
  animation: echo-pulse 900ms ease-in-out infinite;
}

@keyframes echo-pulse {
  0%,
  100% {
    transform: translateY(-50%) scale(1);
  }

  50% {
    transform: translateY(-50%) scale(1.08);
  }
}

.stage.has-highway {
  padding-top: 14px;
}

@keyframes float-note {
  0% {
    opacity: 0.95;
    transform: translateY(0) scale(0.6);
  }

  100% {
    opacity: 0;
    transform: translateY(-230px) scale(1.35);
  }
}

@media (prefers-reduced-motion: reduce) {
  .piano-key,
  .bubble,
  .fall-note.is-echo-prompt {
    animation: none;
    transition: none;
  }
}

/* ── PWA + access ── */

.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  z-index: 20;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--olive-deep);
  color: var(--sand);
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus {
  left: 12px;
  top: 12px;
}

.offline-status {
  margin: 10px 0 0;
  color: var(--bonedim);
  font-size: 14px;
}

.offline-status.is-offline {
  color: var(--olive);
  font-weight: 700;
}

.install-button {
  margin-top: 10px;
}

.control-hint,
.mode-explainer,
.access-lede {
  margin: 6px 0 0;
  color: var(--bonedim);
  font-size: 14px;
  line-height: 1.45;
}

.controls select {
  display: block;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(232, 223, 204, 0.8);
  color: var(--bone);
  font-family: var(--font-body);
  font-size: 15px;
}

.access-panel {
  margin-top: 22px;
  padding: 18px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--olive);
  border-radius: var(--radius);
  background: rgba(212, 196, 168, 0.45);
}

.access-panel h2 {
  margin-bottom: 8px;
  color: var(--olive-deep);
  font-family: var(--font-head);
  font-size: 20px;
}

.access-toggle {
  display: block;
  margin: 10px 0;
  color: var(--bone);
  font-weight: 700;
  cursor: pointer;
}

.access-toggle input {
  margin-right: 10px;
  accent-color: var(--olive);
}

body.calm-mode .bubble,
body.calm-mode .beat-pulse.is-strong {
  display: none;
}

body.calm-mode .beat-pulse.is-soft {
  opacity: 0.45;
}

body.calm-mode .note-highway {
  background: linear-gradient(180deg, rgba(47, 53, 37, 0.82) 0%, rgba(47, 53, 37, 0.68) 100%);
}

.stage.keys-large .white-keys {
  height: 260px;
}

.stage.keys-large .key-letter {
  font-size: 18px;
}

@media (max-width: 740px) {
  .app {
    padding: 16px;
  }

  h1 {
    font-size: 34px;
  }

  .panel,
  .panel > div,
  .start-button {
    display: block;
  }

  .start-button {
    width: 100%;
    margin-top: 12px;
  }

  .white-keys {
    height: 180px;
  }

  .key-letter {
    font-size: 12px;
  }

  .key-note {
    font-size: 9px;
  }

  .learn-grid {
    grid-template-columns: 1fr;
  }

  .note-highway {
    height: 160px;
  }

  .trainer-actions .start-button,
  .trainer-actions .secondary-button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .piano-key,
  .bubble {
    animation: none;
    transition: none;
  }
}
