/* ==========================================================================
   Afinador · Clube do Iniciante
   ========================================================================== */

@font-face {
  font-family: "Jakarta";
  src: url("../fonts/plus-jakarta-sans-latin.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #050914;
  --bg-raised: #0b1228;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.075);
  --surface-3: rgba(255, 255, 255, 0.11);
  --border: rgba(255, 255, 255, 0.08);
  --border-2: rgba(255, 255, 255, 0.14);

  --text: #f3f6ff;
  --text-2: #aab5cf;
  --text-3: #6f7c99;

  --primary: #4c74ff;
  --primary-2: #2f55e8;
  --primary-soft: rgba(76, 116, 255, 0.16);

  --good: #2ee59d;
  --warn: #ffb547;
  --bad: #ff6b6b;
  --neutral: #dfe6ff;

  --tone: var(--neutral);
  --tone-soft: rgba(223, 230, 255, 0.1);

  --radius: 18px;
  --radius-sm: 12px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  color-scheme: dark;
}

body[data-tone="good"] { --tone: var(--good); --tone-soft: rgba(46, 229, 157, 0.14); }
body[data-tone="warn"] { --tone: var(--warn); --tone-soft: rgba(255, 181, 71, 0.14); }
body[data-tone="bad"]  { --tone: var(--bad);  --tone-soft: rgba(255, 107, 107, 0.14); }

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background: transparent;
  color: var(--text);
  font-family: "Jakarta", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

button, a, summary { touch-action: manipulation; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }
img, svg { display: block; }
h1, h2, h3, p { margin: 0; }

.ico {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: 10px;
}

[hidden] { display: none !important; }

/* ---------- Fundo vivo (muda de cor com a afinação) ---------- */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(120% 70% at 50% 110%, rgba(33, 58, 140, 0.18), transparent 60%),
    var(--bg);
}
.glow {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.7s var(--ease);
}
.glow-neutral { background: radial-gradient(90% 55% at 50% -8%, rgba(64, 104, 255, 0.34), transparent 70%); }
.glow-good    { background: radial-gradient(90% 55% at 50% -8%, rgba(46, 229, 157, 0.30), transparent 70%); }
.glow-warn    { background: radial-gradient(90% 55% at 50% -8%, rgba(255, 181, 71, 0.26), transparent 70%); }
.glow-bad     { background: radial-gradient(90% 55% at 50% -8%, rgba(255, 107, 107, 0.26), transparent 70%); }
body[data-tone="neutral"] .glow-neutral,
body[data-tone="good"] .glow-good,
body[data-tone="warn"] .glow-warn,
body[data-tone="bad"] .glow-bad { opacity: 1; }

/* ---------- Estrutura do app ---------- */
.app {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: calc(var(--safe-top) + 12px) 16px 0;
}

/* ---------- Topo ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  min-width: 0;
}
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  box-shadow: 0 6px 18px rgba(40, 80, 255, 0.35);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand-text strong { font-size: 18px; font-weight: 800; letter-spacing: -0.02em; }
.brand-text small {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-top: 3px;
  white-space: nowrap;
}
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  text-decoration: none;
  transition: background 0.2s, color 0.2s, transform 0.15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:active { transform: scale(0.94); }

.btn-install {
  height: 40px;
  padding: 0 14px 0 12px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  color: #dbe5ff;
  background: linear-gradient(180deg, rgba(76, 116, 255, 0.28), rgba(76, 116, 255, 0.14));
  border: 1px solid rgba(120, 152, 255, 0.45);
  box-shadow: 0 0 0 0 rgba(76, 116, 255, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  animation: install-pulse 2.8s var(--ease) 1.5s 3;
  transition: transform 0.15s, background 0.2s;
}
.btn-install .ico { width: 18px; height: 18px; }
.btn-install .long { display: none; }
@media (min-width: 420px) { .btn-install .long { display: inline; } }
.btn-install:hover { background: linear-gradient(180deg, rgba(76, 116, 255, 0.38), rgba(76, 116, 255, 0.2)); }
.btn-install:active { transform: scale(0.96); }
@keyframes install-pulse {
  0% { box-shadow: 0 0 0 0 rgba(76, 116, 255, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.12); }
  70%, 100% { box-shadow: 0 0 0 12px rgba(76, 116, 255, 0), inset 0 1px 0 rgba(255, 255, 255, 0.12); }
}

/* ---------- Seletor de afinação ---------- */
.tuning-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 12px 9px 9px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  text-align: left;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}
.tuning-chip:hover { background: var(--surface-2); border-color: var(--border-2); }
.tuning-chip:active { transform: scale(0.99); }
.tuning-chip-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: #9fb5ff;
  flex: none;
}
.tuning-chip-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; flex: 1; }
.tuning-chip-text small { font-size: 11.5px; font-weight: 600; color: var(--text-3); }
.tuning-chip-text strong { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tuning-chip-notes {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text-2);
  white-space: nowrap;
}
.tuning-chip-chevron { color: var(--text-3); width: 18px; height: 18px; }

/* ---------- Medidor ---------- */
.tuner {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.gauge {
  position: relative;
  width: 100%;
  max-width: 420px;
  aspect-ratio: 340 / 214;
}
.gauge-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }

.gauge-ticks line { stroke: rgba(255, 255, 255, 0.2); stroke-width: 1.5; stroke-linecap: round; }
.gauge-ticks line.major { stroke: rgba(255, 255, 255, 0.42); stroke-width: 2; }
.gauge-ticks line.center { stroke: var(--good); stroke-width: 3; opacity: 0.9; }
.gauge-track { fill: none; stroke: rgba(255, 255, 255, 0.07); stroke-width: 12; stroke-linecap: round; }
.gauge-zone { fill: none; stroke: var(--good); stroke-opacity: 0.35; stroke-width: 12; stroke-linecap: round; transition: stroke-opacity 0.3s; }
body[data-tone="good"] .gauge-zone { stroke-opacity: 0.9; }
.gauge-fill { fill: none; stroke: var(--tone); stroke-width: 12; stroke-linecap: round; opacity: 0.85; transition: stroke 0.25s; }
.gauge-marker { transition: opacity 0.4s; }
.gauge-marker-glow { fill: var(--tone); opacity: 0.55; transition: fill 0.25s; }
.gauge-marker-dot { fill: var(--tone); stroke: #fff; stroke-width: 3; transition: fill 0.25s; }
.gauge-marker-core { fill: #fff; }
.gauge-label {
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.14em;
  fill: var(--text-3);
}
body[data-state="idle"] .gauge-marker { opacity: 0.35; }
body[data-state="idle"] .gauge-fill,
body[data-state="listening"] .gauge-fill { opacity: 0; }
.gauge.is-over .gauge-marker-dot { animation: over-pulse 0.9s ease-in-out infinite; }
@keyframes over-pulse { 50% { opacity: 0.45; } }

.readout {
  position: absolute;
  left: 0;
  right: 0;
  top: 27%;
  bottom: 0;
  display: grid;
  place-items: center;
  text-align: center;
  pointer-events: none;
}
.readout-idle, .readout-live {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: opacity 0.35s var(--ease), transform 0.45s var(--ease);
}
.readout-live { opacity: 0; transform: scale(0.94); }
body:not([data-state="idle"]) .readout-live { opacity: 1; transform: none; }
body:not([data-state="idle"]) .readout-idle { opacity: 0; transform: scale(1.06); }

.idle-orb {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #cdd9ff;
  background: radial-gradient(circle at 50% 35%, rgba(90, 128, 255, 0.4), rgba(40, 70, 190, 0.18));
  border: 1px solid rgba(140, 170, 255, 0.35);
  position: relative;
}
.idle-orb .ico { width: 34px; height: 34px; stroke-width: 1.8; }
.idle-orb::before, .idle-orb::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border: 1px solid rgba(120, 152, 255, 0.45);
  animation: ripple 2.8s var(--ease) infinite;
}
.idle-orb::after { animation-delay: 1.4s; }
@keyframes ripple {
  from { transform: scale(1); opacity: 0.9; }
  to { transform: scale(1.75); opacity: 0; }
}
.idle-text { margin-top: 14px; font-size: 16px; font-weight: 700; color: var(--text-2); }

.note {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  line-height: 1;
  color: var(--text);
  transition: color 0.25s, text-shadow 0.25s, opacity 0.3s;
}
.note-letter {
  font-size: clamp(76px, 25vw, 104px);
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 0.92;
}
.note-acc {
  font-family: ui-sans-serif, system-ui, "Segoe UI Symbol", "Apple Symbols", sans-serif;
  font-size: clamp(30px, 9vw, 40px);
  font-weight: 700;
  margin-left: 2px;
  margin-top: 2px;
}
.note-acc:empty, .note-octave:empty { display: none; }
.note-octave {
  font-size: clamp(20px, 6vw, 26px);
  font-weight: 700;
  color: var(--text-3);
  align-self: flex-end;
  margin-left: 2px;
  margin-bottom: 4px;
}
body[data-state="listening"] .note { opacity: 0.35; }
body[data-tone="good"] .note { color: var(--good); text-shadow: 0 0 34px rgba(46, 229, 157, 0.55); }

.note-name {
  margin-top: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-2);
}
.note-meta {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.note-meta b { color: var(--text-2); font-weight: 800; }
.note-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-3); }

/* ---------- Status / instrução ---------- */
.status {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px 11px 11px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  min-height: 64px;
  transition: background 0.3s, border-color 0.3s;
}
body[data-state="detecting"] .status {
  background: var(--tone-soft);
  border-color: color-mix(in srgb, var(--tone) 40%, transparent);
}
.status-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex: none;
  color: var(--tone);
  background: var(--tone-soft);
  transition: color 0.25s, background 0.25s;
}
.status-icon .ico { width: 22px; height: 22px; stroke-width: 2.4; }
.status-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.status-text strong { font-size: 16.5px; font-weight: 800; letter-spacing: -0.01em; }
.status-text small { font-size: 13.5px; color: var(--text-2); font-weight: 500; margin-top: 2px; }
.status.is-bump .status-icon { animation: bump 0.5s var(--spring); }
@keyframes bump { 40% { transform: scale(1.18); } }

/* ---------- Cordas ---------- */
.strings { display: flex; flex-direction: column; gap: 10px; }
.strings-head { display: flex; align-items: center; gap: 8px; min-height: 32px; }
.progress { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.progress-text { font-size: 13px; font-weight: 700; color: var(--text-2); }
.progress-bar {
  height: 4px;
  border-radius: 99px;
  background: var(--surface-2);
  overflow: hidden;
  max-width: 180px;
}
.progress-bar i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #22c98a, var(--good));
  transition: width 0.6s var(--ease);
}

.chip {
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  white-space: nowrap;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.chip .ico { width: 15px; height: 15px; }
@media (max-width: 400px) {
  #btnReset { width: 32px; padding: 0; justify-content: center; }
  #btnReset span { display: none; }
}
.chip:hover { background: var(--surface-2); color: var(--text); }
.chip-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); transition: background 0.2s, box-shadow 0.2s; }
.chip-auto.is-on { color: #dce5ff; background: var(--primary-soft); border-color: rgba(120, 152, 255, 0.4); }
.chip-auto.is-on .chip-dot { background: #7c9bff; box-shadow: 0 0 8px #7c9bff; }

.strings-row {
  display: grid;
  grid-template-columns: repeat(var(--count, 6), minmax(0, 1fr));
  gap: 8px;
}
.string {
  position: relative;
  height: 88px;
  padding-top: 6px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  transition: background 0.25s, border-color 0.25s, transform 0.15s, box-shadow 0.25s;
}
.string:hover { background: var(--surface-2); }
.string:active { transform: scale(0.95); }
.string-letter { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; }
.string-letter sup {
  font-family: ui-sans-serif, system-ui, "Segoe UI Symbol", "Apple Symbols", sans-serif;
  font-size: 13px;
  margin-left: 1px;
}
.string-name { font-size: 12px; font-weight: 700; color: var(--text-2); }
.string-num { font-size: 10.5px; font-weight: 700; color: var(--text-3); margin-top: 1px; }
.string-line {
  width: 66%;
  margin-top: 7px;
  height: var(--thick, 2px);
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(200, 210, 235, 0.25), rgba(235, 240, 255, 0.7), rgba(200, 210, 235, 0.25));
  transform-origin: center;
}
.string-check {
  position: absolute;
  top: -6px;
  right: -6px;
  z-index: 1;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--bg);
  display: grid;
  place-items: center;
  background: var(--good);
  color: #052e1c;
  transform: scale(0);
  transition: transform 0.35s var(--spring);
}
.string-check .ico { width: 12px; height: 12px; stroke-width: 3.4; }
.string-lock {
  position: absolute;
  top: 7px;
  left: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #7c9bff;
  box-shadow: 0 0 8px #7c9bff;
  opacity: 0;
  transition: opacity 0.2s;
}

.string.is-tuned { border-color: rgba(46, 229, 157, 0.35); }
.string.is-tuned .string-letter { color: var(--good); }
.string.is-tuned .string-check { transform: scale(1); }
.string.is-selected { border-color: rgba(124, 155, 255, 0.7); box-shadow: inset 0 0 0 1px rgba(124, 155, 255, 0.5); }
.string.is-selected .string-lock { opacity: 1; }
.string.is-target {
  background: var(--tone-soft);
  border-color: color-mix(in srgb, var(--tone) 70%, transparent);
  box-shadow: 0 8px 24px -10px var(--tone);
}
.string.is-target .string-line,
.string.is-playing .string-line { animation: vibrate 0.09s linear infinite alternate; background: var(--tone); }
.string.is-playing .string-line { background: #9fb5ff; }
@keyframes vibrate {
  from { transform: scaleY(1) translateY(-1px); }
  to { transform: scaleY(2.2) translateY(1px); }
}
.string.is-next::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 13px;
  border: 1.5px dashed rgba(160, 182, 255, 0.45);
  animation: next-breathe 1.8s ease-in-out infinite;
  pointer-events: none;
}
@keyframes next-breathe { 50% { opacity: 0.25; } }
.string.is-pop { animation: pop 0.6s var(--spring); }
@keyframes pop { 30% { transform: scale(1.1); } }

.strings-hint { font-size: 12.5px; color: var(--text-3); text-align: center; font-weight: 500; }

body[data-mode="chromatic"] .progress,
body[data-mode="chromatic"] #btnReset,
body[data-mode="chromatic"] .chip-auto { visibility: hidden; }

/* ---------- Controles (fixos no rodapé) ---------- */
.controls {
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin: 0 -16px;
  padding: 14px 16px calc(var(--safe-bottom) + 16px);
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(to top, var(--bg) 55%, rgba(5, 9, 20, 0));
}

.btn-primary {
  flex: 1;
  height: 58px;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #fff;
  background: linear-gradient(180deg, #5b80ff 0%, var(--primary-2) 100%);
  border: 1px solid rgba(160, 185, 255, 0.45);
  box-shadow: 0 14px 34px -10px rgba(60, 100, 255, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform 0.15s, box-shadow 0.25s, background 0.25s, flex 0.4s var(--ease);
}
.btn-primary:hover { box-shadow: 0 18px 40px -10px rgba(60, 100, 255, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.25); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.18);
}
.btn-primary-icon .ico { width: 18px; height: 18px; stroke-width: 2.3; }
.btn-primary.is-busy { pointer-events: none; opacity: 0.85; }
.btn-primary.is-busy .btn-primary-icon { animation: spin-pulse 1s ease-in-out infinite; }
@keyframes spin-pulse { 50% { transform: scale(0.8); opacity: 0.6; } }
.btn-block { width: 100%; flex: none; }

body[data-state="listening"] .controls .btn-primary,
body[data-state="detecting"] .controls .btn-primary {
  flex: 0 0 auto;
  padding: 0 20px 0 14px;
  background: var(--surface-2);
  border-color: var(--border-2);
  box-shadow: none;
  font-size: 16px;
}

.meter {
  flex: 1;
  height: 58px;
  border-radius: 18px;
  display: none;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: var(--surface);
  border: 1px solid var(--border);
}
body[data-state="listening"] .meter,
body[data-state="detecting"] .meter { display: flex; animation: fade-in 0.4s var(--ease); }
.meter-bars { display: flex; align-items: center; gap: 3px; height: 26px; }
.meter-bars i {
  width: 4px;
  height: 100%;
  border-radius: 3px;
  background: var(--tone);
  transform: scaleY(0.15);
  transform-origin: center;
  transition: background 0.25s;
}
.meter-text { font-size: 14.5px; font-weight: 700; color: var(--text-2); }
.meter-text::after { content: "…"; }

@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } }

/* ---------- Guia ---------- */
.guide {
  padding: 56px 16px 24px;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(11, 18, 40, 0.6), transparent 320px);
  scroll-margin-top: 0;
}
.guide-inner { max-width: 720px; margin: 0 auto; }
.eyebrow {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8aa3ff;
}
.guide h2 {
  font-size: clamp(24px, 6vw, 32px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-top: 8px;
  text-wrap: balance;
}
.guide-sub { margin-top: 48px !important; }
.guide-lead { color: var(--text-2); margin-top: 8px; }
.steps {
  list-style: none;
  padding: 0;
  margin: 24px 0 0;
  display: grid;
  gap: 12px;
}
.steps li {
  position: relative;
  padding: 18px 18px 18px 66px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
}
.step-num {
  position: absolute;
  left: 16px;
  top: 16px;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #cfdaff;
  background: var(--primary-soft);
}
.steps h3 { font-size: 16.5px; font-weight: 800; }
.steps p { color: var(--text-2); margin-top: 4px; font-size: 15px; }
.steps b { color: var(--text); }
.t-good { color: var(--good) !important; }

.string-table {
  list-style: none;
  padding: 0;
  margin: 18px 0 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}
.string-table li {
  display: grid;
  grid-template-columns: 44px 36px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--surface);
}
.string-table li + li { border-top: 1px solid var(--border); }
.string-table span { color: var(--text-3); font-weight: 700; font-size: 14px; }
.string-table b { font-size: 18px; font-weight: 800; }
.string-table em { font-style: normal; font-weight: 600; color: var(--text-2); }
.string-table small { color: var(--text-3); font-size: 13px; }

.faq { margin-top: 18px; display: grid; gap: 10px; }
.faq details {
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: background 0.2s;
}
.faq details[open] { background: var(--surface-2); }
.faq summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 48px 16px 18px;
  font-weight: 700;
  position: relative;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "";
  position: absolute;
  right: 20px;
  top: 50%;
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--text-3);
  border-bottom: 2px solid var(--text-3);
  transform: translateY(-70%) rotate(45deg);
  transition: transform 0.25s var(--ease);
}
.faq details[open] summary::after { transform: translateY(-30%) rotate(-135deg); }
.faq details p { padding: 0 18px 18px; color: var(--text-2); margin-top: -4px; }

.btn-back {
  margin: 36px auto 0;
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
  font-size: 14.5px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.btn-back .ico { width: 17px; height: 17px; }

.site-footer {
  text-align: center;
  padding: 28px 16px calc(var(--safe-bottom) + 36px);
  font-size: 13px;
  color: var(--text-2);
}
.site-footer .muted { color: var(--text-3); margin-top: 4px; }

/* ---------- Bottom sheets ---------- */
.sheet {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  overflow: hidden;
  display: none;
}
.sheet[open] { display: flex; align-items: flex-end; justify-content: center; }
.sheet::backdrop { background: transparent; }
.sheet::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(2, 4, 12, 0.6);
  opacity: 0;
  transition: opacity 0.3s;
}
.sheet.is-open::before { opacity: 1; }
.sheet-panel {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: calc(100% - var(--safe-top) - 24px);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #111a36 0%, #0a1026 100%);
  border: 1px solid var(--border-2);
  border-bottom: 0;
  border-radius: 26px 26px 0 0;
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.5);
  transform: translateY(100%);
  transition: transform 0.42s var(--ease);
  will-change: transform;
}
.sheet.is-open .sheet-panel { transform: translateY(0); }
.sheet.is-dragging .sheet-panel { transition: none; }
.sheet-grabber {
  touch-action: none;
  width: 40px;
  height: 5px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.22);
  margin: 10px auto 0;
  flex: none;
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px 8px 22px;
  flex: none;
  touch-action: none;
}
.sheet-head h2 { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.sheet-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 22px calc(var(--safe-bottom) + 24px);
}
.sheet-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  margin: 22px 0 10px;
}
.sheet-note { margin-top: 10px; font-size: 13.5px; color: var(--text-3); }
.sheet-note b { color: var(--text-2); }
.sheet-text { font-size: 15.5px; color: var(--text-2); margin-top: 12px; }

.tuning-list { display: grid; gap: 8px; }
.tuning-group-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  margin: 10px 0 2px;
}
.tuning-group-label:first-child { margin-top: 0; }
.tuning-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 14px;
  border-radius: 14px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: background 0.2s, border-color 0.2s;
}
.tuning-option:hover { background: var(--surface-2); }
.tuning-option[aria-checked="true"] { background: var(--primary-soft); border-color: rgba(124, 155, 255, 0.6); }
.tuning-option-radio {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--text-3);
  flex: none;
  display: grid;
  place-items: center;
  transition: border-color 0.2s;
}
.tuning-option[aria-checked="true"] .tuning-option-radio { border-color: #7c9bff; }
.tuning-option[aria-checked="true"] .tuning-option-radio::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #7c9bff;
}
.tuning-option-text { flex: 1; display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.tuning-option-text strong { font-size: 15px; font-weight: 700; }
.tuning-option-text small { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.tuning-option-notes { font-size: 13px; font-weight: 800; letter-spacing: 0.1em; color: var(--text-2); white-space: nowrap; }

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
}
.segmented button {
  padding: 10px 8px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.2;
  color: var(--text-2);
  transition: background 0.2s, color 0.2s;
}
.segmented button strong { font-size: 14.5px; font-weight: 800; }
.segmented button small { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.segmented button[aria-checked="true"] { background: var(--surface-3); color: var(--text); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3); }

.stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.stepper .icon-btn { width: 44px; height: 44px; border-radius: 12px; }
.stepper output { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }

.install-hero { display: flex; align-items: center; gap: 14px; }
.install-hero img { width: 64px; height: 64px; border-radius: 16px; box-shadow: 0 10px 26px rgba(40, 80, 255, 0.4); }
.install-hero strong { display: block; font-size: 18px; font-weight: 800; }
.install-hero small { color: var(--text-3); font-weight: 600; }
.perks { list-style: none; padding: 0; margin: 18px 0 4px; display: grid; gap: 10px; }
.perks li { display: flex; align-items: center; gap: 12px; font-size: 14.5px; color: var(--text-2); }
.perks .ico { color: var(--good); width: 20px; height: 20px; }

.howto { list-style: none; padding: 0; margin: 20px 0 0; display: none; gap: 10px; }
.howto ol { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 10px; }
.howto.is-visible { display: grid; }
.howto li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 15px;
  line-height: 1.4;
}
.howto-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  font-size: 13.5px;
  font-weight: 800;
  background: var(--primary-soft);
  color: #cfdaff;
}
.kbd {
  display: inline-grid;
  place-items: center;
  vertical-align: middle;
  width: 28px;
  height: 28px;
  margin: -4px 2px 0;
  border-radius: 8px;
  background: var(--surface-3);
  border: 1px solid var(--border-2);
  color: #9fc0ff;
}
.kbd .ico { width: 16px; height: 16px; }
.howto-alert {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 181, 71, 0.12);
  border: 1px solid rgba(255, 181, 71, 0.35);
  color: #ffe0b0;
  font-size: 14.5px;
}

.mic-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: rgba(255, 107, 107, 0.14);
  color: var(--bad);
}
.mic-icon .ico { width: 26px; height: 26px; }
.sheet-actions { display: grid; gap: 10px; margin-top: 20px; }

.btn-secondary {
  width: 100%;
  height: 50px;
  margin-top: 14px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
}
.sheet-actions .btn-secondary { margin-top: 0; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  top: calc(var(--safe-top) + 12px);
  z-index: 50;
  max-width: calc(100% - 32px);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px 11px 18px;
  border-radius: 16px;
  background: rgba(22, 31, 60, 0.94);
  border: 1px solid var(--border-2);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  font-size: 14.5px;
  font-weight: 600;
  opacity: 0;
  transform: translate(-50%, -16px);
  pointer-events: none;
  transition: opacity 0.3s var(--ease), transform 0.4s var(--ease);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast-text { min-width: 0; }
.toast-action {
  flex: none;
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 14px;
  color: #fff;
  background: var(--primary);
}

.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 60; }

/* ---------- Telas baixas (iPhone SE, Android pequenos) ---------- */
@media (max-height: 760px) {
  .app { gap: 10px; padding-top: calc(var(--safe-top) + 8px); }
  .tuner { gap: 10px; }
  .gauge { max-width: 340px; }
  .tuning-chip { padding-top: 6px; padding-bottom: 6px; }
  .tuning-chip-icon { width: 34px; height: 34px; }
  .string { height: 76px; padding-top: 4px; }
  .string-line { margin-top: 5px; }
  .strings-hint { display: none; }
  .status { min-height: 58px; padding-top: 8px; padding-bottom: 8px; }
  .note-name { margin-top: 4px; }
  .note-meta { margin-top: 6px; }
}
@media (max-height: 640px) {
  .gauge { max-width: 290px; }
  .note-letter { font-size: 72px; }
}

@media (max-width: 360px) {
  .btn-install span { display: none; }
  .btn-install { width: 40px; padding: 0; justify-content: center; }
  .tuning-chip-notes { display: none; }
  .string-letter { font-size: 19px; }
}

/* ---------- Telas grandes ---------- */
@media (min-width: 720px) {
  .app { padding-top: calc(var(--safe-top) + 24px); gap: 18px; }
  .steps { grid-template-columns: 1fr 1fr; }
  .controls { background: none; }
  .sheet[open] { align-items: center; }
  .sheet-panel { border-radius: 26px; border-bottom: 1px solid var(--border-2); transform: translateY(24px) scale(0.98); opacity: 0; transition: transform 0.35s var(--ease), opacity 0.25s; }
  .sheet.is-open .sheet-panel { transform: none; opacity: 1; }
  .sheet-grabber { display: none; }
}

/* ---------- Instalado como app ---------- */
@media (display-mode: standalone) {
  .btn-install { display: none !important; }
}

/* ---------- Menos movimento ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
