/* HandChords styles. Ink blue base, teal for the chord hand, coral for the modifier hand. */

:root {
  --ink-950: #060b1d;
  --ink-900: #0a1128;
  --ink-800: #0f1a3a;
  --ink-700: #16244d;
  --ink-600: #213266;
  --panel: rgba(16, 27, 62, 0.66);
  --panel-solid: #111c40;
  --line: rgba(190, 210, 255, 0.16);
  --line-strong: rgba(190, 210, 255, 0.32);
  --text: #eaf0ff;
  --muted: #a4b3d9;
  --teal: #2dd4bf;
  --teal-soft: rgba(45, 212, 191, 0.18);
  --coral: #ff7a66;
  --coral-soft: rgba(255, 122, 102, 0.18);
  --radius: 18px;
  --radius-small: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  color: var(--text);
  background:
    radial-gradient(1100px 700px at 15% -10%, rgba(45, 212, 191, 0.14), transparent 60%),
    radial-gradient(900px 700px at 95% 110%, rgba(255, 122, 102, 0.13), transparent 60%),
    linear-gradient(160deg, var(--ink-800), var(--ink-950));
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

h1,
h2,
h3,
p,
ul,
figure,
dl,
dd {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

/* Panels */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: 0 10px 34px rgba(3, 7, 22, 0.38);
}

/* Buttons and fields */

.btn {
  font: inherit;
  font-weight: 600;
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.6rem 1.1rem;
  min-height: 40px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.13);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  color: #04211d;
  background: var(--teal);
  border-color: var(--teal);
}

.btn-primary:hover {
  background: #5fe3d2;
}

.btn-secondary {
  border-color: var(--coral);
  color: #ffd9d2;
  background: var(--coral-soft);
}

.btn-secondary:hover {
  background: rgba(255, 122, 102, 0.3);
}

.btn-ghost {
  padding: 0.45rem 0.9rem;
  min-height: 36px;
  font-size: 0.92rem;
}

.btn-small {
  padding: 0.3rem 0.75rem;
  min-height: 32px;
  font-size: 0.85rem;
}

.btn[aria-pressed="true"] {
  background: var(--teal-soft);
  border-color: var(--teal);
  color: #c9fbf3;
}

:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 2px;
}

select,
input[type="number"] {
  font: inherit;
  color: var(--text);
  background: var(--ink-700);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-small);
  padding: 0.4rem 0.6rem;
  min-height: 36px;
  max-width: 100%;
}

input[type="number"] {
  width: 5rem;
}

.field {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.field-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.field-stack {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.3rem;
}

.field-stack select {
  width: 100%;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.95rem;
}

.check input {
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.15rem;
  accent-color: var(--teal);
  flex: none;
}

/* Start screen */

.start {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 96px;
}

.start-card {
  width: 100%;
  max-width: 460px;
  padding: 32px 24px 26px;
  text-align: center;
}

.start-mark {
  width: 132px;
  height: 132px;
  margin: 0 auto 14px;
}

.start-mark svg {
  width: 100%;
  height: 100%;
  display: block;
  animation: slow-spin 48s linear infinite;
}

@keyframes slow-spin {
  to {
    transform: rotate(360deg);
  }
}

.start-title {
  font-size: clamp(2.1rem, 9vw, 2.9rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.start-tagline {
  margin-top: 10px;
  color: var(--muted);
  font-size: 1.05rem;
}

.start-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}

.start-actions .btn {
  width: 100%;
  min-height: 50px;
  font-size: 1.05rem;
}

.start-privacy {
  margin-top: 18px;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Stage */

.stage {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(700px 520px at 50% 42%, rgba(45, 212, 191, 0.1), transparent 70%),
    linear-gradient(170deg, var(--ink-800), var(--ink-950));
}

.stage-video {
  position: absolute;
  width: 2px;
  height: 2px;
  opacity: 0;
  pointer-events: none;
}

.stage-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.stage.no-camera .stage-canvas {
  display: none;
}

.topbar {
  position: relative;
  z-index: 2;
  margin: 8px 8px 0;
  padding: 8px 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}

.brand {
  font-weight: 800;
  letter-spacing: -0.01em;
  font-size: 1.05rem;
  margin-right: 4px;
}

.topbar-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  min-width: 0;
}

.topbar-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: auto;
}

.stage-body {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.hud {
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: safe center;
  gap: 14px;
  padding: 14px 10px 56px;
}

/* Degree wheel */

.wheel-wrap {
  position: relative;
  flex: none;
  width: min(80vw, 46vh, 340px);
  min-width: 232px;
  aspect-ratio: 1;
}

.wheel {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 10px 26px rgba(3, 7, 22, 0.5));
}

.wheel-disc {
  fill: rgba(8, 14, 36, 0.62);
  stroke: var(--line);
  stroke-width: 1;
}

.wheel-seg {
  fill: rgba(33, 50, 102, 0.82);
  stroke: rgba(33, 50, 102, 0.82);
  stroke-width: 6;
  stroke-linejoin: round;
  transition: fill 0.12s ease, stroke 0.12s ease;
}

.wheel-seg.active {
  fill: var(--teal);
  stroke: var(--teal);
}

.wheel[data-quality="minor"] .wheel-seg.active {
  fill: #14897c;
  stroke: var(--teal);
  stroke-width: 3;
}

.wheel-name {
  fill: var(--text);
  font-size: 17px;
  font-weight: 700;
  text-anchor: middle;
}

.wheel-sub {
  fill: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-anchor: middle;
}

.wheel-label.active .wheel-name {
  fill: #04211d;
}

.wheel-label.active .wheel-sub {
  fill: #0b4a42;
}

.wheel[data-quality="minor"] .wheel-label.active .wheel-name,
.wheel[data-quality="minor"] .wheel-label.active .wheel-sub {
  fill: #eafffb;
}

.wheel-center {
  position: absolute;
  inset: 21%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
}

.chord-name {
  font-size: clamp(1.7rem, 8.6vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.05;
  white-space: nowrap;
}

.chord-numeral {
  min-height: 1.5em;
  margin-top: 4px;
  font-size: clamp(0.95rem, 4.2vw, 1.2rem);
  font-weight: 600;
  color: var(--teal);
}

/* Readouts */

.readouts {
  width: 100%;
  max-width: 640px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  flex: none;
}

.readout {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
}

.readout-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.readout-title {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.readout-value {
  margin-left: auto;
  font-weight: 700;
}

.readout-chord .readout-head .readout-value {
  color: var(--teal);
}

.readout-mod .readout-head .readout-value {
  color: var(--coral);
}

.readout-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
}

.readout-key {
  color: var(--muted);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid currentColor;
  flex: none;
  transition: background-color 0.12s ease, box-shadow 0.12s ease;
}

.dot-chord {
  color: var(--teal);
}

.dot-mod {
  color: var(--coral);
}

.dot.on {
  background: currentColor;
  box-shadow: 0 0 10px currentColor;
}

.tilt {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tilt-end {
  font-size: 0.75rem;
  color: var(--muted);
}

.tilt-track {
  position: relative;
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(45, 212, 191, 0.5) 0 32.5%, rgba(190, 210, 255, 0.16) 32.5% 100%);
}

.tilt-threshold {
  position: absolute;
  left: 32.5%;
  top: -3px;
  width: 2px;
  height: 14px;
  background: var(--line-strong);
}

.tilt-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--teal);
  border: 2px solid var(--ink-900);
  transform: translate(-50%, -50%);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.chip.active {
  color: #33120c;
  background: var(--coral);
  border-color: var(--coral);
}

.meter {
  display: grid;
  grid-template-columns: 3.6rem 1fr 3rem;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}

.meter-label {
  color: var(--muted);
}

.meter-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(190, 210, 255, 0.16);
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--coral);
}

.meter.fixed .meter-fill {
  background: rgba(255, 122, 102, 0.42);
}

.meter-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Dock panels: guide and songs */

.dock {
  position: relative;
  flex: none;
  margin: 0 8px 8px;
  padding: 14px 16px 18px;
  max-height: 48vh;
  max-height: 48dvh;
  overflow-y: auto;
}

.dock-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.dock-title {
  font-size: 1.15rem;
  font-weight: 700;
  min-width: 0;
}

.guide-section + .guide-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.guide-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.guide-chord {
  color: var(--teal);
}

.guide-mod {
  color: var(--coral);
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
}

.guide-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px 6px;
  border-radius: var(--radius-small);
  background: rgba(255, 255, 255, 0.05);
  text-align: center;
}

.guide-item-title {
  color: var(--text);
  font-weight: 700;
  font-size: 0.86rem;
}

.guide-item-note {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.25;
}

.guide-notes {
  margin-top: 8px;
  color: var(--text);
  font-size: 0.88rem;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.guide-keys {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 12px;
  font-size: 0.88rem;
  align-items: center;
}

.guide-keys dt {
  white-space: nowrap;
}

kbd {
  display: inline-block;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 7px;
  background: var(--ink-600);
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
}

.hand-glyph {
  display: block;
}

/* Songs */

.song-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.song-button {
  width: 100%;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  border-radius: var(--radius-small);
  padding: 0.7rem 0.9rem;
}

.song-meta {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.82rem;
  white-space: nowrap;
}

.guided-now {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-small);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid transparent;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}

.guided-now.matched {
  border-color: var(--teal);
  background: var(--teal-soft);
}

.guided-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.guided-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.guided-step-name {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.guided-step-numeral {
  color: var(--teal);
  font-weight: 600;
  min-height: 1.4em;
}

.guided-glyphs {
  display: flex;
  gap: 10px;
  flex: none;
}

.glyph-figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 72px;
}

.glyph-figure figcaption {
  font-size: 0.68rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.2;
}

.glyph-chord {
  color: var(--teal);
}

.glyph-mod {
  color: var(--coral);
}

.glyph-mod.dim {
  opacity: 0.4;
}

.guided-lyric {
  min-height: 1.5em;
  margin-top: 10px;
  font-style: italic;
}

.guided-next {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.92rem;
}

.guided-next span {
  color: var(--text);
  font-weight: 700;
}

.guided-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.guided-progress-track {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: rgba(190, 210, 255, 0.16);
  overflow: hidden;
}

.guided-progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--teal), var(--coral));
  border-radius: 999px;
  transition: width 0.2s ease;
}

.guided-progress-text {
  font-size: 0.82rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.guided-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 2px;
  gap: 2px;
}

.btn-seg {
  border-color: transparent;
  background: transparent;
  min-height: 32px;
  padding: 0.25rem 0.9rem;
  font-size: 0.88rem;
}

#guidedHint {
  margin-top: 8px;
  min-height: 1.3em;
}

.guided-summary {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-small);
  background: var(--teal-soft);
  border: 1px solid var(--teal);
}

/* Settings dialog */

.dialog {
  color: var(--text);
  background: var(--panel-solid);
  width: min(92vw, 440px);
  max-height: 90vh;
  padding: 20px;
}

.dialog::backdrop {
  background: rgba(4, 8, 22, 0.66);
}

.dialog-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Status message */

.status {
  position: fixed;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: 60;
  width: max-content;
  max-width: min(92vw, 560px);
  margin: 0;
  padding: 9px 16px;
  border-radius: 16px;
  background: rgba(8, 14, 36, 0.92);
  border: 1px solid var(--line-strong);
  font-size: 0.9rem;
  text-align: center;
  pointer-events: none;
}

.status:empty {
  display: none;
}

.status[data-kind="error"] {
  border-color: var(--coral);
  color: #ffe1dc;
}

/* Wider screens */

@media (min-width: 560px) {
  .readouts {
    grid-template-columns: 1fr 1fr;
  }

  .start-card {
    padding: 40px 36px 32px;
  }
}

@media (max-width: 519px) {
  .brand {
    display: none;
  }

  .topbar-buttons {
    margin-left: 0;
  }
}

@media (min-width: 920px) {
  .stage-body {
    flex-direction: row;
    align-items: flex-start;
  }

  .hud {
    align-self: stretch;
  }

  .dock {
    width: 380px;
    margin: 12px 12px 12px 0;
    max-height: calc(100% - 24px);
  }

  .topbar {
    margin: 12px 12px 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
