/* Grados Escala Mayor — Storm Studios */
:root {
  --bg: #0c0c14;
  --bg-grad-1: #10101c;
  --bg-grad-2: #0a0a12;
  --surface: #161d2c;
  --surface-2: #1b2436;
  --surface-3: #202b41;
  --outline: #2c3a52;
  --text: #ede8df;
  --muted: rgba(237, 232, 223, 0.6);
  --muted-2: rgba(237, 232, 223, 0.42);
  --gold: #c9a86c;
  --gold-bright: #e0c184;
  --gold-dim: rgba(201, 168, 108, 0.14);
  --teal: #6ec4d5;
  --coral: #e16d5a;
  --green: #64c48d;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 13px;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(1100px 600px at 50% -10%, rgba(201, 168, 108, 0.08), transparent 60%),
    linear-gradient(180deg, var(--bg-grad-1), var(--bg-grad-2));
}

#app {
  max-width: 660px;
  margin: 0 auto;
  padding: 22px 16px 64px;
  min-height: 100vh;
}

.screen { display: flex; flex-direction: column; gap: 18px; }

/* ---------- tipografía ---------- */
.display {
  font-size: clamp(1.9rem, 6vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  text-align: center;
  background: linear-gradient(120deg, var(--gold-bright), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.headline { font-size: 1.5rem; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
.lead { font-size: 1.02rem; color: var(--muted); margin: 0; text-align: center; line-height: 1.5; }
.muted { color: var(--muted); margin: 0; line-height: 1.5; }
.muted.small { font-size: 0.85rem; }
.warn { color: var(--coral); margin: 0; font-weight: 500; }

/* ---------- cards ---------- */
.card {
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
  border: 1px solid var(--outline);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card-inner {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}
.section-card { display: flex; flex-direction: column; gap: 0; }
.section-title { font-size: 1.12rem; font-weight: 600; margin: 0 0 12px; }
.section-body { display: flex; flex-direction: column; gap: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* ---------- intro ---------- */
.intro { justify-content: center; min-height: calc(100vh - 90px); }
.intro-card { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.logo-badge {
  width: 96px; height: 96px; border-radius: 26px;
  background: var(--gold-dim);
  border: 1px solid rgba(201, 168, 108, 0.3);
  display: grid; place-items: center;
}
.logo-mark { font-size: 2.6rem; color: var(--gold-bright); }
.credits { width: 100%; text-align: left; }
.credits h4 { margin: 0 0 4px; font-size: 0.95rem; color: var(--gold); }
.credits p { margin: 0; color: var(--muted); font-size: 0.92rem; }

/* ---------- botones ---------- */
.btn {
  font-family: var(--font);
  font-size: 0.98rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  padding: 13px 18px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.06s ease, background 0.15s ease, opacity 0.15s ease;
  color: var(--text);
}
.btn:active { transform: scale(0.985); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn-primary {
  background: linear-gradient(120deg, var(--gold), #b9914f);
  color: #1a1407;
  box-shadow: 0 8px 22px rgba(201, 168, 108, 0.25);
}
.btn-primary:hover:not(:disabled) { background: linear-gradient(120deg, var(--gold-bright), var(--gold)); }
.btn-outline { background: transparent; border-color: var(--outline); color: var(--text); }
.btn-outline:hover:not(:disabled) { border-color: var(--gold); background: var(--gold-dim); }
.btn-outline.danger { color: var(--coral); border-color: rgba(225, 109, 90, 0.4); }
.btn-outline.danger:hover:not(:disabled) { background: rgba(225, 109, 90, 0.12); border-color: var(--coral); }
.btn-answer {
  background: var(--surface-3);
  border: 1px solid var(--outline);
  font-weight: 700;
  font-family: var(--mono);
  letter-spacing: 0.02em;
  padding: 12px 16px;
  min-width: 58px;
}
.btn-answer:hover:not(:disabled) { border-color: var(--gold); color: var(--gold-bright); background: var(--gold-dim); }

.icon-btn {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--outline);
  color: var(--text); font-size: 1.2rem; cursor: pointer; flex-shrink: 0;
}
.icon-btn:hover { border-color: var(--gold); color: var(--gold-bright); }

/* ---------- topbar interno ---------- */
.topbar { display: flex; align-items: center; gap: 12px; }
.topbar-title { font-size: 1.05rem; font-weight: 600; }

/* ---------- home ---------- */
.summary-card { display: flex; flex-direction: column; gap: 14px; }
.pill-row { display: flex; flex-wrap: wrap; gap: 10px; }
.pill {
  flex: 1; min-width: 96px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  display: flex; flex-direction: column; gap: 3px;
}
.pill-label { font-size: 0.72rem; color: var(--muted-2); text-transform: uppercase; letter-spacing: 0.05em; }
.pill-value { font-size: 1.15rem; font-weight: 700; }

.mode-card { display: flex; flex-direction: column; gap: 16px; }
.mode-head { display: flex; gap: 14px; align-items: flex-start; }
.mode-icon {
  width: 50px; height: 50px; border-radius: 16px; flex-shrink: 0;
  background: var(--gold-dim); display: grid; place-items: center; font-size: 1.5rem;
}
.mode-title { margin: 0 0 4px; font-size: 1.15rem; font-weight: 600; }
.mode-sub { margin: 0; color: var(--muted); font-size: 0.9rem; line-height: 1.45; }

/* ---------- metrics ---------- */
.summary-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.metric {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  padding: 13px 15px;
  display: flex; flex-direction: column; gap: 4px;
}
.metric-label { font-size: 0.72rem; color: var(--muted-2); text-transform: uppercase; letter-spacing: 0.05em; }
.metric-value { font-size: 1.05rem; font-weight: 700; }

/* ---------- fields / chips ---------- */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field label, .field-label { font-size: 0.9rem; font-weight: 600; color: var(--muted); }
.select {
  width: 100%;
  background: var(--surface-3);
  color: var(--text);
  border: 1px solid var(--outline);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.98rem;
  font-family: var(--font);
  cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%), linear-gradient(135deg, var(--gold) 50%, transparent 50%);
  background-position: calc(100% - 18px) center, calc(100% - 13px) center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.select:focus { outline: none; border-color: var(--gold); }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-row.scroll-x { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; -webkit-overflow-scrolling: touch; }
.chip {
  background: var(--surface-3);
  border: 1px solid var(--outline);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 15px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--mono);
  cursor: pointer;
  transition: all 0.13s ease;
  white-space: nowrap;
}
.chip:hover { border-color: var(--gold); }
.chip.selected { background: var(--gold); color: #1a1407; border-color: var(--gold); }
.chip.chord-chip { font-family: var(--font); }
.field-label { margin: 10px 0 8px; }

/* ---------- legend ---------- */
.legend-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.legend-item { display: flex; gap: 8px; align-items: baseline; font-size: 0.85rem; }
.legend-code { font-family: var(--mono); font-weight: 700; color: var(--gold); min-width: 48px; }
.legend-name { color: var(--muted); }

/* ---------- training ---------- */
.answers .btn-answer { flex: 0 0 auto; }
.feedback-card { display: flex; flex-direction: column; gap: 8px; }
.feedback-title { margin: 0; font-size: 1.05rem; font-weight: 600; }
.feedback-title.idle { color: var(--muted); }
.feedback-title.success { color: var(--green); }
.feedback-title.error { color: var(--coral); }
.feedback-body { margin: 0; font-size: 1.02rem; line-height: 1.45; }

.switch-row { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.switch-row input { width: 46px; height: 26px; cursor: pointer; accent-color: var(--gold); }

.survival-row { display: flex; align-items: center; gap: 16px; }
.hearts { display: flex; gap: 6px; }
.heart { font-size: 1.35rem; color: var(--coral); }
.heart.lost { color: var(--outline); }

.acc-item { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; font-size: 0.88rem; }
.acc-item:last-child { margin-bottom: 0; }
.bar { width: 100%; height: 8px; background: rgba(0, 0, 0, 0.35); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-bright)); border-radius: 99px; transition: width 0.3s ease; }

.finished-card { display: flex; flex-direction: column; gap: 12px; animation: rise 0.3s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- stats ---------- */
.stat-card { display: flex; flex-direction: column; gap: 10px; }
.stat-head { display: flex; justify-content: space-between; align-items: baseline; }
.stat-deg { font-size: 1.02rem; font-weight: 600; }
.stat-frac { font-family: var(--mono); font-weight: 700; color: var(--gold); }

/* ---------- dialog ---------- */
.overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 20px; z-index: 50;
  animation: fade 0.18s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.dialog { max-width: 380px; width: 100%; display: flex; flex-direction: column; gap: 12px; }
.dialog h3 { margin: 0; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }

.hidden { display: none !important; }

/* ---------- responsive ---------- */
@media (max-width: 420px) {
  .legend-grid { grid-template-columns: 1fr; }
  #app { padding: 18px 12px 56px; }
}

/* scrollbar sutil */
.scroll-x::-webkit-scrollbar { height: 6px; }
.scroll-x::-webkit-scrollbar-thumb { background: var(--outline); border-radius: 99px; }
