/* Tokens, the page column and the header come from ../shared/theme.css;
   this file holds only what is the drill's own. */

:root {
  --stop: #b3261e;
  --stop-ink: #ffffff;
  --reveal: #147d4a;
}

@media (prefers-color-scheme: dark) {
  :root {
    --stop: #ff9c92;
    --stop-ink: #0f1115;
    --reveal: #6ede9f;
  }
}

/* The key pill and the mode selector share a line: the pill keeps its
   natural width, the selector takes the rest, both stretch to one height. */
.key-mode-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.key-mode-row .segmented {
  flex: 1;
}

/* The key pill is the control: it shows the key, tapping it draws a new one. */
.key-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

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

.key-button:hover {
  border-color: var(--muted);
}

.key-button:hover svg {
  color: var(--ink);
}

/* --- levels ----------------------------------------------------------------- */

/* Six fixed levels, three to a row: two full rows, wide enough for their
   degrees. The custom level takes a row of its own under them — it is chosen
   by name rather than read as one more step of the ladder. */
.level-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.level.is-custom {
  grid-column: 1 / -1;
}

/* The switches that shape the custom set, one per degree. */
.custom-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-top: 4px;
}

.degree-toggle {
  padding: 9px 0;
  border: 1px dashed var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--muted);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.degree-toggle:hover:enabled {
  border-color: var(--muted);
}

/* On is the same accent the chosen level wears, and a solid edge: the
   dashed ones are the degrees this level leaves out. */
.degree-toggle.is-on {
  border-style: solid;
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.degree-toggle:disabled {
  cursor: default;
}

.level {
  padding: 10px 2px;
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 13px;
  white-space: nowrap;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  cursor: pointer;
}

.level.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

/* --- the degree card ------------------------------------------------------ */

.board {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.degree-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 220px;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  /* The card is the start/stop control. */
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.degree-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* The stopped card's invitation, over the blank the degree leaves. */
.card-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.card-play .icon {
  width: 44px;
  height: 44px;
  /* Optically centred: a triangle's weight sits left of its box. */
  margin-left: 6px;
}

.card-play .icon-fill {
  fill: currentColor;
}

.degree {
  margin: 0;
  font-size: 96px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  min-height: 96px;
  color: var(--muted);
}

.degree-card.is-revealed .degree {
  color: var(--reveal);
}

@keyframes listening-pulse {
  from {
    opacity: 0.35;
  }
  to {
    opacity: 0.8;
  }
}

.degree-card.is-listening .degree {
  animation: listening-pulse 1.2s ease-in-out infinite alternate;
}

@media (prefers-reduced-motion: reduce) {
  .degree-card.is-listening .degree {
    animation: none;
  }
}

.hint {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  text-align: center;
}

/* --- session --------------------------------------------------------------- */

.stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.stat-line {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.speech-note {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

/* Both pickers on one line. Three instrument segments beside four drone
   segments: weighting the tracks 3:4 gives every segment the same width. */
.sound-picks {
  display: flex;
  gap: 8px;
}

.sound-picks .segmented:first-child {
  flex: 3;
}

.sound-picks .segmented:last-child {
  flex: 4;
}

.segment .icon {
  display: block;
  margin: 0 auto;
}

.segment .icon-stroke {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.segment .icon-fill {
  fill: currentColor;
}

.segmented {
  position: relative;
  display: flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  padding: 3px;
}

.segmented-thumb {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  border-radius: 999px;
  background: var(--accent);
  transition: transform 0.25s ease;
}

.segment {
  position: relative;
  flex: 1;
  min-width: 0;
  padding: 7px 14px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  transition: color 0.25s ease;
}

.segment.is-active {
  color: var(--accent-ink);
}

@media (prefers-reduced-motion: reduce) {
  .segmented-thumb,
  .segment {
    transition: none;
  }
}

.debug-panel {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 240px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 12px;
  color: var(--muted);
}

.debug-panel h2 {
  margin: 0 0 2px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.debug-row {
  display: grid;
  grid-template-columns: 5.2em 1fr 4.2em;
  align-items: center;
  gap: 7px;
}

.debug-row input {
  width: 100%;
  min-width: 0;
  accent-color: var(--accent);
}

.debug-row output {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

@media (max-width: 940px) {
  .debug-panel {
    display: none;
  }
}

.answer-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.answer {
  min-width: 40px;
  padding: 10px 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  font-size: 17px;
  cursor: pointer;
}

.answer:hover:enabled {
  border-color: var(--accent);
}

.answer:disabled {
  opacity: 0.45;
  cursor: default;
}

.answer.is-right {
  background: var(--reveal);
  border-color: var(--reveal);
  color: #fff;
  opacity: 1;
}

.answer.is-wrong {
  background: var(--stop);
  border-color: var(--stop);
  color: var(--stop-ink);
  opacity: 1;
}
