/* CueClasp — Choir Riser Clip Rail theme */

:root {
  --charcoal: #2e3a46;
  --charcoal-deep: #26303a;
  --charcoal-soft: #3a4754;
  --cream: #f3e9d2;
  --cream-dim: #e7d9ba;
  --paper: #faf4e4;
  --brass: #c98a2e;
  --brass-deep: #a96f1f;
  --reed: #5d7a4e;
  --rust: #a8552f;
  --ink: #22303c;
  --line: #d8c9a8;
  --muted: #8b93a0;
  --tab-h: 58px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--charcoal);
  color: var(--cream);
  font-family: Georgia, "Times New Roman", serif;
  -webkit-text-size-adjust: 100%;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
}

/* ---------- Shell ---------- */

#app {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 26px);
  min-height: 100dvh;
}

.view { padding-top: 12px; }
.view[hidden] { display: none; }

/* ---------- Podium rail header ---------- */

.rail-header {
  margin: 14px 2px 18px;
  padding: 10px 14px 12px;
  border-left: 5px solid var(--brass);
  background: var(--charcoal-deep);
  border-radius: 0 10px 10px 0;
}

.rail-clip {
  width: 34px;
  height: 7px;
  background: var(--brass);
  border-radius: 3px;
  margin-bottom: 9px;
}

.rail-title {
  margin: 0;
  font-size: 26px;
  letter-spacing: 0.04em;
  color: var(--cream);
}

.rail-sub, .slip-sub {
  margin: 3px 0 0;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.03em;
}

/* ---------- Step counters ---------- */

.step-counters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 0 2px 16px;
}

.step-counter {
  min-height: 74px;
  padding: 10px 12px;
  text-align: left;
  border-radius: 4px;
  border-top: 4px solid var(--brass);
  background: var(--paper);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.step-counter.counter-ready { border-top-color: var(--reed); }

.counter-num {
  font-size: 30px;
  line-height: 1;
  font-weight: bold;
}

.counter-word {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #6b6350;
}

/* ---------- Brass pin strip ---------- */

.pin-strip {
  display: block;
  width: 100%;
  min-height: 56px;
  margin: 0 2px 22px;
  background: var(--brass);
  color: var(--charcoal-deep);
  font-size: 18px;
  font-weight: bold;
  letter-spacing: 0.06em;
  border-radius: 6px;
  box-shadow: inset 0 -4px 0 var(--brass-deep);
}

.pin-strip:active { transform: translateY(2px); box-shadow: inset 0 -2px 0 var(--brass-deep); }

.section-label {
  margin: 0 2px 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}

/* ---------- Slip cards ---------- */

.slip-header { margin: 14px 2px 16px; }

.slip-title {
  margin: 0;
  font-size: 24px;
  color: var(--cream);
  letter-spacing: 0.03em;
}

.card {
  background: var(--paper);
  color: var(--ink);
  border-radius: 6px;
  border: 1px solid var(--line);
  margin: 0 2px 12px;
}

/* Next-open hero card on Podium */
.next-open {
  position: relative;
  overflow: hidden;
  padding: 16px 16px 14px 22px;
  min-height: 96px;
  width: 100%;
  text-align: left;
  border-left: none;
}

.next-open::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 7px;
  background: var(--band, var(--brass));
}

.next-open .no-song {
  display: block;
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 3px;
}

.next-open .no-passage {
  display: block;
  font-size: 14px;
  line-height: 1.4;
  color: #5c5647;
}

.next-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
}

.part-tag {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #6b6350;
}

.state-toggle {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: 22px;
  border: 1.5px solid var(--line);
  background: var(--cream);
  font-size: 14px;
  color: var(--ink);
}

.state-toggle:active { background: var(--cream-dim); }

.dot {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  flex: none;
  box-sizing: border-box;
}

.dot-open { border: 2.5px solid var(--rust); background: transparent; }
.dot-ready { background: var(--reed); border: 2.5px solid var(--reed); }

/* Spots: grouped slim slips */
.group-title {
  margin: 18px 4px 6px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--brass);
}

.spot-row {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 60px;
  padding: 8px 6px 8px 20px;
}

.spot-row::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 7px;
  background: var(--band, var(--brass));
}

.spot-main {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  text-align: left;
  padding: 0;
}

.spot-row.song-solo .spot-song { display: none; }

.spot-song {
  font-size: 13px;
  font-weight: bold;
  color: #7a6a4a;
}

.spot-passage {
  font-size: 15px;
  line-height: 1.35;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spot-part {
  font-size: 12px;
  color: #6b6350;
  letter-spacing: 0.05em;
}

.row-state {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 10px;
  border-radius: 22px;
  font-size: 12px;
  color: var(--ink);
  border: 1.5px solid var(--line);
  background: var(--cream);
  flex: none;
}

.row-del {
  min-width: 44px;
  min-height: 44px;
  flex: none;
  color: var(--rust);
  font-size: 15px;
  letter-spacing: 0.02em;
}

/* ---------- Find ---------- */

.search-wrap {
  position: relative;
  margin: 0 2px 14px;
}

#find-input {
  width: 100%;
  min-height: 48px;
  padding: 10px 76px 10px 14px;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  appearance: none;
  -webkit-appearance: none;
}

#find-input::placeholder { color: #9a8f75; }

.search-clear {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  min-height: 40px;
  min-width: 60px;
  font-size: 13px;
  color: var(--brass-deep);
  letter-spacing: 0.05em;
}

.chip-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 2px 16px;
}

.chip {
  min-height: 38px;
  padding: 6px 14px;
  border-radius: 19px;
  font-size: 13px;
  letter-spacing: 0.04em;
  border: 1.5px solid var(--charcoal-soft);
  color: var(--cream-dim);
  background: var(--charcoal-deep);
}

.chip[aria-pressed="true"] {
  background: var(--brass);
  border-color: var(--brass);
  color: var(--charcoal-deep);
  font-weight: bold;
}

.result-note {
  padding: 4px 4px 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

/* ---------- Empty states ---------- */

.empty {
  margin: 8px 2px 16px;
  padding: 22px 18px;
  background: var(--charcoal-deep);
  border: 1px dashed var(--charcoal-soft);
  border-radius: 8px;
  text-align: center;
}

.empty-title {
  display: block;
  font-size: 16px;
  color: var(--cream);
  margin-bottom: 5px;
}

.empty-hint {
  display: block;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.empty .btn {
  margin-top: 14px;
  min-width: 150px;
}

/* ---------- Pin form ---------- */

.slip-form {
  margin: 0 2px;
  padding: 18px 16px 20px;
  background: var(--paper);
  color: var(--ink);
  border-radius: 6px;
  border: 1px solid var(--line);
}

.field { margin-bottom: 16px; }

.field label, .field-label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: #6b6350;
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: var(--cream);
  border: 1.5px solid var(--line);
  border-radius: 6px;
  appearance: none;
  -webkit-appearance: none;
}

.field input:focus {
  outline: 2px solid var(--brass);
  outline-offset: 1px;
}

.field input[aria-invalid="true"] {
  border-color: var(--rust);
  background: #fbeee6;
}

.field-error {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--rust);
}

.state-choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.state-opt {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-size: 15px;
  color: var(--ink);
  border: 1.5px solid var(--line);
  border-radius: 6px;
  background: var(--cream);
}

.state-opt[aria-checked="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--cream);
  font-weight: bold;
}

.state-opt[aria-checked="true"] .dot-open { border-color: var(--brass); }
.state-opt[aria-checked="true"] .dot-ready { background: var(--brass); border-color: var(--brass); }

.form-actions {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.btn {
  min-height: 50px;
  border-radius: 6px;
  font-size: 16px;
  font-weight: bold;
  letter-spacing: 0.04em;
}

.btn-brass {
  background: var(--brass);
  color: var(--charcoal-deep);
  box-shadow: inset 0 -4px 0 var(--brass-deep);
}

.btn-brass:active { transform: translateY(2px); box-shadow: inset 0 -2px 0 var(--brass-deep); }

.btn-ghost {
  background: transparent;
  color: #5c5647;
  border: 1.5px solid var(--line);
}

.btn-danger-ghost {
  display: block;
  width: 100%;
  min-height: 48px;
  margin: 18px 2px 0;
  color: #e08a6d;
  border: 1.5px solid var(--charcoal-soft);
  border-radius: 6px;
  background: var(--charcoal-deep);
}

/* ---------- Riser-step tabs ---------- */

#tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  max-width: 560px;
  margin: 0 auto;
  background: var(--charcoal-deep);
  border-top: 1px solid var(--charcoal-soft);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.tab {
  min-height: var(--tab-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  padding: 8px 2px 7px;
  color: var(--muted);
  position: relative;
}

.tab-step {
  width: 34px;
  height: 5px;
  border-radius: 2px;
  background: var(--charcoal-soft);
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.tab-word {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.tab[aria-current="page"] { color: var(--cream); }
.tab[aria-current="page"] .tab-step {
  background: var(--brass);
  transform: translateY(-4px);
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.35);
}

.tab:active .tab-step { background: var(--cream-dim); }
