/* Crossharp — vintage blues-club palette: warm darks, amber, brass. */
:root {
  --bg: #15100c;
  --panel: #211a13;
  --panel2: #2c2218;
  --ink: #f3ead9;
  --muted: #b3a48c;
  --accent: #e8a33d;       /* brass */
  --accent2: #c96f2f;      /* copper */
  --good: #7fc97f;
  --bad: #e26d5c;
  --blow: #e8a33d;
  --draw: #6fb3d2;
  --bent: #c77dff;
  --border: #3d3023;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { -webkit-text-size-adjust: 100%; } /* iOS: don't auto-inflate text in landscape */
body {
  background:
    radial-gradient(1200px 500px at 70% -10%, rgba(232,163,61,.07), transparent),
    var(--bg);
  color: var(--ink);
  font: 15px/1.55 Georgia, "Times New Roman", serif;
  display: flex; flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;           /* iOS Safari: dynamic vh, no jump when the URL bar hides */
  overscroll-behavior-y: none;  /* kill pull-to-refresh / rubber-band over fixed nav */
}
a { color: var(--accent); }

/* iOS touch polish: no grey tap flash, no long-press callout/selection on chrome */
button, .tab-chip, .hd-cell, .lesson-tile, .routine-row, nav, .choice {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none; user-select: none;
}

header {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 10px 18px; background: var(--panel); border-bottom: 1px solid var(--border);
  /* iOS notch / translucent status bar: keep the brand clear of the inset */
  padding-top: calc(10px + env(safe-area-inset-top));
}
.brand { font-size: 20px; font-weight: 700; }
.brand span { color: var(--accent); font-style: italic; }
.brand small { color: var(--muted); font-size: 11px; font-style: normal; margin-left: 6px; }
nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
nav button {
  background: transparent; color: var(--muted); border: none;
  padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 14px; font-family: inherit;
}
nav button:hover { color: var(--ink); background: var(--panel2); }
nav button.active { color: var(--ink); background: var(--panel2); box-shadow: inset 0 -2px 0 var(--accent); }
.mic-status { font-size: 12px; color: var(--muted); }

main { flex: 1; padding: 22px; max-width: 1080px; margin: 0 auto; width: 100%; }
h1 { font-size: 26px; margin: 0 0 4px; font-style: italic; }
h2 { font-size: 18px; margin: 20px 0 8px; color: var(--accent); }
.muted { color: var(--muted); }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.btn { background: linear-gradient(180deg, var(--accent), var(--accent2)); color: #1b130a; border: none;
  font-weight: 700; padding: 10px 18px; border-radius: 10px; cursor: pointer; font-family: inherit; font-size: 15px; }
.btn:hover { filter: brightness(1.08); }
.ghost { background: var(--panel2); color: var(--ink); border: 1px solid var(--border);
  padding: 8px 14px; border-radius: 9px; cursor: pointer; font-family: inherit; font-size: 14px; }
.ghost:hover { border-color: var(--accent); }
.pill { display: inline-block; font-size: 11px; padding: 2px 10px; border-radius: 99px;
  background: var(--panel2); color: var(--muted); border: 1px solid var(--border); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
select, input[type=range] { background: var(--panel2); color: var(--ink); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 10px; font-family: inherit; }

.today-card { border-left: 3px solid var(--accent); }
.ch-bar { fill: var(--panel2); stroke: var(--border); stroke-width: .5; }
.ch-ok { fill: var(--good); opacity: .85; }
.ch-lab { fill: var(--muted); font-size: 11px; }
.take-row { margin-top: 10px; align-items: center; }
.take-row audio { height: 36px; }

/* lessons */
.level-title { font-size: 12px; text-transform: uppercase; letter-spacing: 2px; color: var(--accent2); margin: 18px 0 8px; }
.lesson-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.lesson-tile { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; cursor: pointer; transition: .15s; }
.lesson-tile:hover { border-color: var(--accent); transform: translateY(-2px); }
.lesson-tile h3 { margin: 0 0 4px; font-size: 15px; }
.lesson-tile .meta { font-size: 12px; color: var(--muted); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 99px; background: var(--border); margin-right: 5px; }
.dot.on { background: var(--good); }
.lesson-body p { margin: 9px 0; }
.lesson-body ul, .lesson-body ol { margin: 8px 0; padding-left: 22px; }
.lesson-body li { margin: 5px 0; }

/* questions */
.q-wrap { text-align: center; }
.q-prompt { font-size: 18px; margin: 10px 0 14px; }
.choices { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.choice { background: var(--panel2); border: 1px solid var(--border); color: var(--ink);
  padding: 12px 18px; border-radius: 10px; cursor: pointer; font-size: 15px; min-width: 110px; font-family: inherit; }
.choice:hover { border-color: var(--accent); }
.choice.correct { border-color: var(--good); background: rgba(127,201,127,.12); color: var(--good); }
.choice.wrong { border-color: var(--bad); background: rgba(226,109,92,.12); color: var(--bad); }
.feedback { margin: 14px 0; min-height: 24px; }
.feedback.ok { color: var(--good); }
.feedback.no { color: var(--bad); }
.grade-row { display: flex; gap: 10px; justify-content: center; margin-top: 12px; }
.session-bar { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; margin-bottom: 8px; }

/* stats */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; text-align: center; }
.stat .n { font-size: 28px; font-weight: 700; color: var(--accent); }
.stat .l { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
table { border-collapse: collapse; width: 100%; margin-top: 8px; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--muted); }

/* tab chips */
.tab-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; margin: 10px 0; }
.tab-chip { display: inline-flex; flex-direction: column; align-items: center; min-width: 38px;
  background: var(--panel2); border: 1px solid var(--border); border-radius: 9px; padding: 5px 7px;
  cursor: pointer; transition: .1s; line-height: 1.15; }
.tab-chip:hover { border-color: var(--accent); }
.tab-chip.playing { border-color: var(--accent); background: rgba(232,163,61,.18); transform: scale(1.08); }
.tab-chip .tab-arrow { font-size: 12px; }
.tab-chip.blow .tab-arrow { color: var(--blow); }
.tab-chip.draw .tab-arrow { color: var(--draw); }
.tab-chip .tab-hole { font-size: 18px; font-weight: 700; }
.tab-chip .tab-bend { font-size: 12px; color: var(--bent); font-weight: 700; }
.tab-chip.bent { border-color: rgba(199,125,255,.4); }
.tab-chip .tab-note { font-size: 10px; color: var(--muted); }
.tab-space { width: 16px; }

/* harp diagram */
.harp-diagram { overflow-x: auto; padding: 6px 0; }
.hd-grid { display: grid; gap: 4px; min-width: 640px; }
.hd-rowlabel { font-size: 11px; color: var(--muted); display: flex; align-items: center; justify-content: flex-end; padding-right: 8px; }
.hd-holeno { text-align: center; font-weight: 700; color: var(--accent); padding: 2px 0;
  background: linear-gradient(180deg, #3a2e1f, #2a2014); border-radius: 5px; border: 1px solid var(--border); }
.hd-cell { background: var(--panel2); border: 1px solid var(--border); border-radius: 7px;
  padding: 7px 2px; text-align: center; cursor: pointer; color: var(--ink); font-family: inherit; transition: .1s; }
.hd-cell:hover { border-color: var(--accent); }
.hd-cell.blow { box-shadow: inset 0 2px 0 rgba(232,163,61,.5); }
.hd-cell.draw { box-shadow: inset 0 -2px 0 rgba(111,179,210,.5); }
.hd-cell.bent { background: rgba(199,125,255,.10); }
.hd-cell.over { background: rgba(226,109,92,.10); }
.hd-cell .hd-note { font-size: 13px; font-weight: 600; }
.hd-cell.hl { outline: 2px solid var(--accent); }
.hd-cell.hl-root { outline: 2px solid var(--good); }
.hd-cell.hl-blue { outline: 2px solid var(--bent); }
.hd-cell.hl-target { outline: 3px solid var(--accent); background: rgba(232,163,61,.2); }
.hd-empty { }

/* bend gauge */
.gauge-wrap { display: flex; gap: 24px; justify-content: center; align-items: stretch; margin: 14px 0; }
.gauge { position: relative; width: 90px; height: 260px; background: var(--panel2);
  border: 1px solid var(--border); border-radius: 12px; }
.gauge .zone { position: absolute; left: 0; right: 0; background: rgba(127,201,127,.25);
  border-top: 1px solid var(--good); border-bottom: 1px solid var(--good); }
.gauge .needle { position: absolute; left: 4px; right: 4px; height: 4px; background: var(--accent);
  border-radius: 2px; transition: top .06s linear; box-shadow: 0 0 8px var(--accent); }
.gauge .glabel { position: absolute; left: 100%; margin-left: 8px; font-size: 12px; color: var(--muted); transform: translateY(-50%); white-space: nowrap; }
.gauge-side { display: flex; flex-direction: column; justify-content: center; gap: 8px; text-align: left; }
.bend-progress { width: 160px; height: 12px; background: var(--panel2); border: 1px solid var(--border); border-radius: 99px; overflow: hidden; }
.bend-progress > div { height: 100%; width: 0%; background: linear-gradient(90deg, var(--good), #b6e3b6); transition: width .1s; }
.cents-read { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* jam */
.bar-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.bar-cell { background: var(--panel2); border: 1px solid var(--border); border-radius: 9px;
  text-align: center; padding: 12px 4px; font-weight: 700; transition: .1s; }
.bar-cell.now { border-color: var(--accent); background: rgba(232,163,61,.18); transform: scale(1.04); }
.beat-lights { display: flex; gap: 10px; justify-content: center; margin: 8px 0; }
.beat-dot { width: 16px; height: 16px; border-radius: 50%; background: var(--panel2); border: 1px solid var(--border); }
.beat-dot.on { background: var(--good); box-shadow: 0 0 10px var(--good); }
.beat-dot.miss { background: rgba(226,109,92,.5); border-color: var(--bad); }

/* breathing pacer */
.breath-pacer { display: flex; justify-content: center; align-items: center; height: 210px; margin: 6px 0; }
.breath-orb {
  width: 170px; height: 170px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; text-align: center;
  background: radial-gradient(circle at 50% 38%, rgba(232,163,61,.38), rgba(201,111,47,.14));
  border: 2px solid var(--accent); color: var(--ink); font-weight: 700; font-size: 17px;
  transform: scale(0.55); transition: transform .12s linear;
  box-shadow: 0 0 34px rgba(232,163,61,.22);
}

/* daily routine */
.routine-row { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--border); cursor: pointer; }
.routine-row:last-child { border-bottom: none; }
.routine-check { font-size: 18px; color: var(--accent); width: 22px; text-align: center; }
.routine-row.done .routine-label { text-decoration: line-through; color: var(--muted); }
.routine-label { flex: 1; }
.routine-go { padding: 4px 12px; }

@media (max-width: 700px) {
  main { padding: 12px; }
  h1 { font-size: 22px; }
  .lesson-list { grid-template-columns: 1fr; }
  .hd-cell { padding: 10px 2px; } /* fatter touch targets */
  .hd-grid { min-width: 700px; }
  .tap-pad { width: 180px; height: 180px; } /* thumb-friendly */
  .gauge-wrap { flex-direction: row; gap: 14px; }
  .gauge { width: 70px; height: 220px; }
  .gauge .glabel { font-size: 10px; }
  .bar-grid { grid-template-columns: repeat(4, 1fr); gap: 5px; }
  .bar-cell { padding: 9px 2px; font-size: 13px; }
  .take-row audio { width: 170px; }
  .mic-status { display: none; }

  /* iOS-style bottom tab bar */
  header { padding-bottom: 6px; }
  nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
    background: var(--panel); border-top: 1px solid var(--border);
    display: flex; justify-content: space-around; gap: 0;
    padding: 6px 2px calc(6px + env(safe-area-inset-bottom));
  }
  nav button {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    font-size: 10px; padding: 4px 4px; flex: 1; min-width: 0;
  }
  nav button::before { content: attr(data-icon); font-size: 19px; }
  nav button.active { box-shadow: none; background: transparent; color: var(--accent); }
  body { padding-bottom: 86px; }
}
@media (pointer: coarse) {
  .choice { padding: 14px 16px; }
  .ghost, .btn { padding: 11px 16px; }
  .tab-chip { min-width: 44px; padding: 7px 9px; }
  .tab-chip .tab-hole { font-size: 20px; }
}
