/* ── Tonal ───────────────────────────────────────────────────────────────────── */

#canvas-wrap {
  background: #0a0a0a;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
  padding: 0;
  position: relative;
}

.tn-hide { display: none !important; }

/* ── Sine-wave texture ───────────────────────────────────────────────────────── */
/* Inline SVG sine path tiled horizontally — purely decorative */

#tn-texture {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='40'%3E%3Cpath d='M0 20 C15 5 25 5 30 20 S45 35 60 20 S90 5 120 20' stroke='%231a1a1a' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 120px 40px;
}

/* ── Shared logo ─────────────────────────────────────────────────────────────── */

.tn-logo {
  width: 160px;
  height: auto;
  display: block;
  filter: brightness(0) invert(1);
}

/* ── Shared typography ───────────────────────────────────────────────────────── */

.tn-directions {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  line-height: 1.72;
  color: rgba(255,255,255,0.45);
  max-width: 300px;
  text-align: center;
}

.tn-prompt {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: rgba(255,255,255,0.5);
  text-align: center;
}

.tn-status-text {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  min-height: 1.2em;
  text-align: center;
}

.tn-tap-hint {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.25);
}

/* ── Splash ──────────────────────────────────────────────────────────────────── */

#tn-splash {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  text-align: center;
  padding: 0 28px;
  z-index: 1;
}

#tn-logo {
  width: 200px;
  height: auto;
  display: block;
  filter: brightness(0) invert(1);
}

#tn-start-btn {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.9);
  border: 1px solid rgba(255,255,255,0.18);
  padding: 13px 52px;
  border-radius: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, border-color 0.15s;
}

#tn-start-btn:hover  { background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.3); }
#tn-start-btn:active { background: rgba(255,255,255,0.05); }

/* ── Reveal phase ────────────────────────────────────────────────────────────── */

#tn-reveal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  z-index: 1;
}

#tn-reveal-logo {
  width: 160px;
  height: auto;
  display: block;
  filter: brightness(0) invert(1);
}

#tn-bars-wrap {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

.tn-bar {
  width: 44px;
  height: 160px;
  border-radius: 6px;
  background: #1a1a1a;
  transition: background-color 0.25s ease, opacity 0.3s ease, box-shadow 0.3s ease;
  flex-shrink: 0;
}

/* Active state: full brightness with glow */
.tn-bar--active {
  box-shadow: 0 0 20px 4px var(--bar-glow, rgba(255,255,255,0.2));
}

/* Dimmed state: bar revealed but note done */
.tn-bar--dimmed {
  opacity: 0.55;
}

/* ── Phase logo (shown in reveal, bar-show, bar-pick, bar-result, result) ─────── */

.tn-phase-logo {
  width: 160px;
  height: auto;
  display: block;
  filter: brightness(0) invert(1);
}

/* ── Shared bar-label ────────────────────────────────────────────────────────── */

.tn-bar-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  text-align: center;
}

/* ── Bar show phase ──────────────────────────────────────────────────────────── */

#tn-bar-show {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  z-index: 1;
  padding: 0 28px;
}

#tn-show-swatch {
  width: 80px;
  height: 200px;
  border-radius: 8px;
}

.tn-countdown {
  font-family: 'DM Sans', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.02em;
  min-height: 2.4rem;
  text-align: center;
}

/* ── Bar pick phase ──────────────────────────────────────────────────────────── */

#tn-bar-pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  z-index: 1;
  padding: 0 28px;
}

.tn-picker-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

/* Hidden native color input — triggered via label click */
#tn-single-input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  border: none;
  padding: 0;
}

.tn-pick-swatch-large {
  width: 80px;
  height: 200px;
  border-radius: 8px;
  background: #808080;
  cursor: pointer;
  border: 2px solid rgba(255,255,255,0.15);
  transition: border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.tn-pick-swatch-large:hover { border-color: rgba(255,255,255,0.4); }

#tn-single-submit {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.9);
  border: 1px solid rgba(255,255,255,0.18);
  padding: 13px 52px;
  border-radius: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, border-color 0.15s;
}

#tn-single-submit:hover  { background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.3); }
#tn-single-submit:active { background: rgba(255,255,255,0.05); }

/* ── Per-bar result phase ────────────────────────────────────────────────────── */

#tn-bar-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  z-index: 1;
  padding: 0 28px;
}

.tn-bar-score-text {
  font-family: 'DM Sans', sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  color: rgba(255,255,255,0.9);
  letter-spacing: 0.01em;
  text-align: center;
}

.tn-bar-result-row {
  display: flex;
  flex-direction: row;
  gap: 24px;
  align-items: flex-start;
}

.tn-bar-result-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.tn-result-bar-tall {
  width: 80px;
  height: 160px;
  border-radius: 8px;
}

#tn-bar-next-btn {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.9);
  border: 1px solid rgba(255,255,255,0.18);
  padding: 13px 52px;
  border-radius: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, border-color 0.15s;
}

#tn-bar-next-btn:hover  { background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.3); }
#tn-bar-next-btn:active { background: rgba(255,255,255,0.05); }

/* ── Result phase ────────────────────────────────────────────────────────────── */

#tn-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  z-index: 1;
  padding: 0 20px;
}

#tn-result-logo {
  width: 160px;
  height: auto;
  display: block;
  filter: brightness(0) invert(1);
}

#tn-result-pairs {
  display: flex;
  flex-direction: row;
  gap: 10px;
}

.tn-result-pair {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.tn-result-bar {
  width: 44px;
  height: 80px;
  border-radius: 5px;
}

.tn-result-divider {
  width: 44px;
  height: 1px;
  background: rgba(255,255,255,0.1);
  margin: 2px 0;
}

.tn-result-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  text-align: center;
}

.tn-result-score {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.04em;
  text-align: center;
}

.tn-total-score {
  font-family: 'DM Sans', sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
  color: rgba(255,255,255,0.9);
  letter-spacing: 0.01em;
}

.tn-bar-scores {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(255,255,255,0.35);
  letter-spacing: 0.02em;
}

.tn-tone-btns {
  display: flex;
  gap: 8px;
}

.tn-tone-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.5);
  padding: 9px 14px;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}

.tn-tone-btn:hover  { border-color: rgba(255,255,255,0.35); color: rgba(255,255,255,0.8); }
.tn-tone-btn:active { background: rgba(255,255,255,0.06); }

.tn-result-btns {
  display: flex;
  gap: 10px;
}

.tn-btn-primary {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.9);
  border: 1px solid rgba(255,255,255,0.18);
  padding: 12px 28px;
  border-radius: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}

.tn-btn-primary:hover  { background: rgba(255,255,255,0.14); }
.tn-btn-primary:active { background: rgba(255,255,255,0.04); }

.tn-btn-ghost {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.4);
  padding: 12px 28px;
  border-radius: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.12s, color 0.12s;
}

.tn-btn-ghost:hover  { border-color: rgba(255,255,255,0.25); color: rgba(255,255,255,0.65); }
.tn-btn-ghost:active { background: rgba(255,255,255,0.04); }
