/* RehearseReel — Cassette-Lab Drill Deck */

:root {
  --cream: #f4e9d8;
  --cream-deep: #ecdfc8;
  --card: #fbf4e6;
  --teal: #256e6a;
  --teal-soft: rgba(37, 110, 106, 0.35);
  --persimmon: #e7663d;
  --persimmon-deep: #c74f2a;
  --ink: #372b21;
  --ink-soft: #6f5f50;
  --shell: #2e3d3b;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
button { font: inherit; color: inherit; cursor: pointer; }

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 18px 16px calc(108px + env(safe-area-inset-bottom, 0px));
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

.tab-title {
  font-size: 13px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--teal); margin: 2px 0 12px;
}

/* Wide persimmon add strip */
.strip {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  background: var(--persimmon); color: #fff7ec; border: none; border-radius: 16px;
  padding: 16px 18px; margin: 2px 0 16px; min-height: 56px;
  font-size: 17px; font-weight: 700; letter-spacing: .02em;
  box-shadow: 0 3px 0 var(--persimmon-deep);
}
.strip:active { transform: translateY(1px); box-shadow: 0 2px 0 var(--persimmon-deep); }
.strip-plus { font-size: 24px; line-height: 1; font-weight: 400; }

/* Cassette face cards */
.face {
  background: var(--card); border: 2px solid var(--teal); border-radius: 18px;
  padding: 16px; box-shadow: 0 3px 0 var(--teal-soft);
}
.face-lg { padding: 18px 16px 20px; }
.face-kicker {
  margin: 0 0 10px; font-size: 12px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-soft);
}
.face-window {
  display: flex; align-items: center; gap: 12px;
  background: rgba(46, 61, 59, 0.08); border: 1px solid var(--teal-soft);
  border-radius: 12px; padding: 14px 12px;
}
.reel {
  flex: none; width: 54px; height: 54px; border-radius: 50%;
  border: 5px solid var(--shell);
  background: repeating-conic-gradient(from 8deg, var(--shell) 0 9deg, transparent 9deg 60deg);
  position: relative;
}
.reel::after {
  content: ""; position: absolute; inset: 16px; border-radius: 50%;
  background: var(--shell);
}
.face-center { flex: 1; min-width: 0; }
.focus-chip {
  display: inline-block; background: var(--teal); color: var(--cream);
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  padding: 3px 10px; border-radius: 999px; margin-bottom: 8px;
}
.face-phrase { margin: 0; font-size: 19px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.counter-stack { flex: none; display: flex; flex-direction: column; gap: 8px; }
.counter {
  width: 50px; height: 50px; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 2px solid var(--teal); background: var(--card); line-height: 1;
}
.counter strong { font-size: 16px; }
.counter small {
  font-size: 8px; letter-spacing: .06em; text-transform: uppercase;
  margin-top: 2px; color: var(--ink-soft);
}
.counter.c-open { border-color: var(--persimmon); }
.counter.c-open strong { color: var(--persimmon); }
.face-note { margin: 12px 2px 14px; color: var(--ink-soft); font-size: 14px; }
.tape-line {
  height: 5px; margin: 12px 14px 14px; border-radius: 3px;
  background: var(--shell); transform: rotate(-1.2deg);
}

/* Buttons */
.btn {
  border-radius: 12px; border: 2px solid transparent;
  min-height: 48px; padding: 12px 16px;
  font-size: 16px; font-weight: 700;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--persimmon); color: #fff7ec; box-shadow: 0 3px 0 var(--persimmon-deep); }
.btn.primary:active { box-shadow: 0 2px 0 var(--persimmon-deep); }
.btn.block { display: block; width: 100%; }
.btn.ghost { background: transparent; border-color: var(--teal); color: var(--teal); }
.btn.danger { background: transparent; border-color: var(--persimmon); color: var(--persimmon); }
.btn.danger.armed { background: var(--persimmon); color: #fff7ec; }
.face .btn.primary { margin-top: 4px; }

/* Empty states */
.empty-face { text-align: center; padding: 26px 18px 24px; }
.empty-title { font-size: 18px; font-weight: 700; margin: 14px 0 6px; }
.empty-text { color: var(--ink-soft); font-size: 14px; margin: 0 0 16px; }
.empty-line {
  color: var(--ink-soft); font-size: 15px;
  background: var(--card); border: 1px dashed var(--teal-soft);
  border-radius: 12px; padding: 16px; margin: 12px 0 0;
}
.empty-line .btn { margin-top: 12px; }

/* Filter chips */
.chip-row { display: flex; gap: 8px; margin-bottom: 14px; }
.chip {
  flex: 1; min-height: 40px; border-radius: 999px;
  border: 2px solid var(--teal-soft); background: transparent;
  color: var(--teal); font-size: 14px; font-weight: 700;
}
.chip.on { background: var(--teal); border-color: var(--teal); color: var(--cream); }

/* Cassette-spine rows */
.spine-group { margin-bottom: 18px; }
.group-label {
  font-size: 12px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-soft); margin: 0 2px 8px;
}
.spine {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: var(--card); border: 1px solid var(--teal-soft); border-radius: 10px;
  padding: 10px 12px 10px 0; margin-bottom: 8px; min-height: 58px; text-align: left;
}
.spine:active { background: var(--cream-deep); }
.spine-band { flex: none; width: 10px; align-self: stretch; }
.spine-dot { flex: none; width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--teal); }
.spine-dot.filled { background: var(--teal); }
.spine-dot.hollow { border-color: var(--persimmon); }
.spine-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.spine-phrase { font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.spine-focus { font-size: 12px; color: var(--ink-soft); }
.spine-state {
  flex: none; font-size: 11px; letter-spacing: .08em;
  text-transform: uppercase; font-weight: 700;
}
.spine-state.is-open { color: var(--persimmon); }
.spine-state.is-done { color: var(--teal); }

/* Form fields */
.field { margin-bottom: 14px; }
.field label, .field-label {
  display: block; font-size: 13px; font-weight: 700;
  margin-bottom: 6px; color: var(--ink);
}
.field label em, .field-label em {
  font-style: normal; font-weight: 400; color: var(--ink-soft); font-size: 12px;
}
.field input, .field textarea {
  width: 100%; font-size: 16px; font-family: inherit; color: var(--ink);
  background: #fdf8ee; border: 2px solid var(--teal-soft); border-radius: 10px;
  padding: 12px; min-height: 48px; margin: 0;
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--teal); }
.field input.invalid { border-color: var(--persimmon); }
.field-error { color: var(--persimmon); font-size: 13px; margin: 6px 2px 0; }
.search-field { margin-bottom: 4px; }
#find-results { margin-top: 12px; }

.status-row { display: flex; gap: 8px; }
.status-btn {
  flex: 1; min-height: 44px; border-radius: 10px;
  border: 2px solid var(--teal-soft); background: transparent;
  color: var(--teal); font-weight: 700;
}
.status-btn.on { background: var(--teal); border-color: var(--teal); color: var(--cream); }

#drill-form .btn.block { margin-top: 6px; }

/* Practice overlay */
#overlay {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(244, 233, 216, 0.97); overflow-y: auto;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom, 0px));
}
#overlay[hidden] { display: none; }
.practice { max-width: 420px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.practice-phrase { margin: 10px 0 4px; font-size: 22px; font-weight: 700; line-height: 1.3; }
.practice-note { margin: 8px 0 0; color: var(--ink-soft); font-size: 14px; }
.practice-meta { margin: 12px 0 0; font-size: 12px; color: var(--ink-soft); }
.practice-actions { display: flex; flex-direction: column; gap: 10px; }

/* Bottom tab bar — four flat cassette-reel silhouettes */
#tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: space-around; align-items: stretch;
  background: var(--shell); border-top: 3px solid var(--teal);
  padding: 8px 6px calc(10px + env(safe-area-inset-bottom, 0px));
}
.tab-btn {
  background: none; border: none; color: #9db8b2;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 4px 10px; min-width: 64px; min-height: 56px;
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
.tab-reel {
  width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid currentColor;
  background: repeating-conic-gradient(from 8deg, currentColor 0 10deg, transparent 10deg 60deg);
  position: relative;
  transition: transform .25s ease, box-shadow .25s ease;
}
.tab-reel::after {
  content: ""; position: absolute; inset: 7px; border-radius: 50%;
  background: currentColor;
}
.tab-btn.active { color: var(--cream); }
.tab-btn.active .tab-reel {
  transform: rotate(12deg);
  box-shadow: 0 4px 9px rgba(0, 0, 0, 0.4);
}

@media (prefers-reduced-motion: reduce) {
  .tab-reel { transition: none; }
  .btn:active, .strip:active { transform: none; }
}
