/* Claude.ai-inspired warm cream + clay aesthetic */
:root {
  --bg: #F4F1E8;
  --bg-elev: #FFFFFF;
  --bg-elev-2: #FAF7EE;
  --border: #E5DECF;
  --text: #1F1B16;
  --text-dim: #6B5E4F;
  --accent: #C96442;
  --accent-2: #8B6F47;
  --warn: #D97706;
  --bad: #B91C1C;
  --good: #15803D;
  --shadow: 0 2px 12px rgba(72, 56, 40, 0.08);
  --radius: 14px;
  font-family: 'Söhne', -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button {
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  transition: all .15s;
}
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
button.primary:hover { filter: brightness(1.08); }
button:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea {
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: 10px;
  font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 28px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 800; font-size: 19px; }
.logo { color: var(--accent); font-size: 26px; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.nav a {
  padding: 6px 12px; border-radius: 8px; color: var(--text-dim); font-size: 14px;
  font-weight: 500;
}
.nav a:hover { background: var(--bg-elev-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent); color: #fff; }
.status { display: flex; gap: 14px; align-items: center; font-size: 14px; }
.mic-dot { width: 10px; height: 10px; border-radius: 50%; background: #C7B9A4; }
.mic-dot.active { background: var(--good); box-shadow: 0 0 8px var(--good); }
.mic-dot.denied { background: var(--bad); }
.streak { color: var(--text-dim); }
#auth-btn { font-size: 13px; padding: 6px 12px; }

.outlet { padding: 32px 24px; max-width: 1100px; margin: 0 auto; }

h1 { font-size: 32px; margin: 0 0 12px; letter-spacing: -0.5px; font-weight: 700; }
h2 { font-size: 20px; margin: 28px 0 12px; font-weight: 600; }
p { color: var(--text-dim); line-height: 1.65; margin: 0 0 12px; }

.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.tile {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  cursor: pointer;
  transition: all .18s;
  text-decoration: none;
  color: var(--text);
  display: block;
}
.tile:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 6px 16px rgba(201, 100, 66, 0.15); text-decoration: none; }
.tile .icon { font-size: 30px; margin-bottom: 10px; display: block; }
.tile h3 { margin: 0 0 6px; font-size: 16px; font-weight: 600; }
.tile p { margin: 0; font-size: 13px; }

.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(31, 27, 22, .45);
  display: flex; align-items: center; justify-content: center; z-index: 100;
  backdrop-filter: blur(4px);
}
.modal {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px; max-width: 480px; width: 90%;
  box-shadow: 0 12px 48px rgba(72, 56, 40, .25);
}
.modal h2 { margin-top: 0; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 20px; }

/* Pitch meter */
.meter {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}
.meter .note { font-size: 64px; font-weight: 800; color: var(--accent); margin: 0; min-height: 80px; font-variant-numeric: tabular-nums; letter-spacing: -1px; }
.meter .cents-bar {
  position: relative; height: 12px; background: var(--bg); border-radius: 6px; margin: 14px auto; max-width: 320px; overflow: hidden; border: 1px solid var(--border);
}
.meter .cents-bar::before { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--text-dim); }
.meter .cents-needle {
  position: absolute; top: 0; bottom: 0; width: 4px; background: var(--accent); border-radius: 2px;
  left: 50%; transform: translateX(-50%); transition: left .08s, background .08s;
}
.meter .cents-label { color: var(--text-dim); font-size: 13px; font-variant-numeric: tabular-nums; }
.meter .clarity { color: var(--text-dim); font-size: 12px; margin-top: 4px; }

/* Pitch ladder */
.ladder-wrap { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
canvas.ladder { width: 100%; height: 480px; display: block; background: #FAF7EE; border-radius: 10px; }

/* Theory */
.lesson { display: grid; grid-template-columns: 240px 1fr; gap: 24px; }
.lesson-list { list-style: none; padding: 0; margin: 0; }
.lesson-list li { padding: 10px 14px; border-radius: 8px; cursor: pointer; color: var(--text-dim); font-size: 14px; }
.lesson-list li:hover { background: var(--bg-elev-2); color: var(--text); }
.lesson-list li.active { background: var(--accent); color: #fff; font-weight: 600; }
.lesson-list li.done::after { content: ' ✓'; color: var(--good); }
.lesson-list li.active.done::after { color: #fff; }
.lesson-body { background: var(--bg-elev); padding: 28px; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); }
.lesson-body h2 { margin-top: 0; }
.lesson-body p, .lesson-body li { color: var(--text); }

/* Ear training */
.ear-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin: 16px 0; }
.ear-options button { padding: 14px; }
.ear-feedback { font-size: 18px; margin-top: 12px; min-height: 28px; }
.ear-feedback.good { color: var(--good); }
.ear-feedback.bad { color: var(--bad); }

/* History */
.history-list { list-style: none; padding: 0; }
.history-list li { padding: 12px 14px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: 12px; }

/* Auth */
.auth-card { max-width: 420px; margin: 40px auto; }
.auth-card label { display: block; font-size: 13px; color: var(--text-dim); margin: 14px 0 6px; }
.auth-card input { width: 100%; }
.auth-card button { width: 100%; margin-top: 18px; }
.auth-card .switch { text-align: center; font-size: 14px; margin-top: 14px; color: var(--text-dim); }
.auth-card .err { color: var(--bad); font-size: 14px; margin-top: 8px; min-height: 20px; }
.auth-card .ok { color: var(--good); font-size: 14px; margin-top: 8px; min-height: 20px; }

/* Coach markdown */
.coach-out { background: var(--bg-elev-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; line-height: 1.65; }
.coach-out h2, .coach-out h3 { margin-top: 16px; }
.coach-out h2:first-child, .coach-out h3:first-child { margin-top: 0; }
.coach-out ul { padding-left: 20px; }
.coach-out code { background: var(--bg); padding: 2px 6px; border-radius: 4px; font-size: 13px; }

@media (max-width: 720px) {
  .lesson { grid-template-columns: 1fr; }
  .outlet { padding: 16px 12px; }
  canvas.ladder { height: 360px; }
  .topbar { padding: 10px 16px; gap: 12px; }
  h1 { font-size: 26px; }
}
