/* Woodshed — Music-Stand Slip Rail
   stage-dark single column, warm score-paper slips, brass accents */

:root {
  --stage: #171d26;
  --stage-2: #1e2530;
  --stage-3: #26303e;
  --paper: #f2e3c6;
  --paper-edge: #e2cfa8;
  --ink: #2c2a24;
  --ink-soft: #6b6353;
  --brass: #c47a3d;
  --brass-deep: #9c5c26;
  --brass-hi: #e0a065;
  --reed: #5f7d55;
  --slate: #5a7d9c;
  --rosin: #a34b3f;
  --cream-dim: rgba(242, 227, 198, 0.55);
  --tab-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(196, 122, 61, 0.08), transparent 60%),
    var(--stage);
  color: var(--cream-dim);
  font-family: "Iowan Old Style", "Palatino Linotype", Georgia, "Times New Roman", serif;
  font-size: 16px;
  line-height: 1.45;
  min-height: 100dvh;
}

button { font-family: inherit; }

.shell {
  max-width: 480px;
  margin: 0 auto;
  padding: calc(var(--safe-t) + 20px) 16px calc(var(--tab-h) + var(--safe-b) + 28px);
}

/* ---------- heads & type ---------- */

.view-head { margin-bottom: 18px; }

.kicker {
  margin: 0 0 2px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass-hi);
}

.view-title {
  margin: 0;
  font-size: 30px;
  font-weight: 700;
  color: var(--paper);
  letter-spacing: 0.01em;
}

.rail-label {
  margin: 22px 0 8px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(242, 227, 198, 0.4);
}

/* ---------- stand: rail + current slip ---------- */

.stand-rail {
  position: relative;
  border-radius: 6px;
  background: linear-gradient(180deg, #3a4150, #2b3340 55%, #232a35);
  padding: 18px 10px 14px;
  box-shadow: inset 0 1px 0 rgba(242, 227, 198, 0.12), 0 6px 18px rgba(0, 0, 0, 0.45);
}

.rail-clip {
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%);
  width: 46px;
  height: 14px;
  border-radius: 4px 4px 8px 8px;
  background: linear-gradient(180deg, var(--brass-hi), var(--brass) 60%, var(--brass-deep));
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.stand-slip {
  position: relative;
  background:
    repeating-linear-gradient(180deg, transparent 0 26px, rgba(156, 92, 38, 0.10) 26px 27px),
    var(--paper);
  border-radius: 3px;
  overflow: hidden;
  color: var(--ink);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
  /* clipped top edge like a dog-eared slip */
  clip-path: polygon(0 10px, 7% 2px, 93% 0, 100% 9px, 100% 100%, 0 100%);
}

.stand-slip .slip-body { padding: 18px 14px 12px 14px; }
.stand-slip .slip-strip { position: absolute; top: 0; bottom: 0; left: 0; width: 8px; }
.stand-slip .slip-body { padding-left: 24px; }

.slip-strip.strip-brass { background: var(--brass); }
.slip-strip.strip-reed { background: var(--reed); }
.slip-strip.strip-slate { background: var(--slate); }
.slip-strip.strip-rosin { background: var(--rosin); }

.slip-body {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.slip-text { min-width: 0; flex: 1; }

.slip-piece {
  margin: 0 0 3px;
  font-size: 19px;
  line-height: 1.25;
  color: var(--ink);
}

.slip-passage {
  margin: 0;
  font-size: 14px;
  color: var(--ink-soft);
}

.slip-cue {
  margin: 8px 0 0;
  font-style: italic;
  font-size: 13px;
  color: var(--brass-deep);
}

.slip-cue-none { color: rgba(107, 99, 83, 0.55); font-style: normal; }

/* circular tempo puck */
.slip-tempo {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--paper);
  box-shadow: inset 0 0 0 2px rgba(242, 227, 198, 0.35), 0 2px 5px rgba(0, 0, 0, 0.3);
}

.slip-tempo-sm { width: 44px; height: 44px; }

.puck-brass { background: var(--brass-deep); }
.puck-reed { background: var(--reed); }
.puck-slate { background: var(--slate); }
.puck-rosin { background: var(--rosin); }

.slip-bpm { font-size: 17px; font-weight: 700; line-height: 1; }
.slip-tempo-sm .slip-bpm { font-size: 14px; }
.slip-bpm-word { font-size: 8px; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.85; }

.slip-edit-ghost {
  display: block;
  width: 100%;
  margin: 0;
  padding: 10px 24px 12px;
  background: transparent;
  border: 0;
  border-top: 1px dashed var(--paper-edge);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass-deep);
  cursor: pointer;
}

/* ---------- counter disc ---------- */

.counter-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 20px;
}

.counter-disc {
  flex: none;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #3a4554, var(--stage-2) 70%);
  border: 3px solid var(--brass-deep);
  box-shadow: inset 0 0 0 2px rgba(242, 227, 198, 0.14), 0 4px 10px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--paper);
}

.counter-num { font-size: 26px; font-weight: 700; line-height: 1; }
.counter-word { font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--brass-hi); }

.counter-note {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: rgba(242, 227, 198, 0.45);
}

/* ---------- brass action strip ---------- */

.brass-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 20px;
  padding: 16px 18px;
  border: 0;
  border-radius: 6px;
  background: linear-gradient(180deg, var(--brass-hi), var(--brass) 45%, var(--brass-deep));
  color: #2a1a0c;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.brass-strip:active { transform: translateY(1px); }

.brass-strip-fork,
.brass-strip-fork::before {
  content: "";
  display: block;
  width: 3px;
  height: 16px;
  border-radius: 2px;
  background: #2a1a0c;
  position: relative;
}

.brass-strip-fork::before {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 10px;
  border: 3px solid #2a1a0c;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: transparent;
}

/* ---------- recent row ---------- */

.recent-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.recent-slip {
  display: flex;
  align-items: stretch;
  gap: 8px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: var(--paper);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  -webkit-tap-highlight-color: transparent;
}

.recent-strip { flex: none; width: 5px; }
.recent-strip.strip-brass { background: var(--brass); }
.recent-strip.strip-reed { background: var(--reed); }
.recent-strip.strip-slate { background: var(--slate); }
.recent-strip.strip-rosin { background: var(--rosin); }

.recent-text {
  flex: 1;
  min-width: 0;
  padding: 9px 0 9px 2px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.recent-piece {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-passage {
  font-size: 11.5px;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-puck {
  flex: none;
  align-self: center;
  margin-right: 8px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--paper);
}

/* ---------- about note ---------- */

.about-note {
  display: flex;
  gap: 10px;
  margin-top: 26px;
  padding: 12px 14px;
  border-left: 2px solid var(--brass-deep);
  background: rgba(242, 227, 198, 0.05);
  border-radius: 0 4px 4px 0;
}

.about-tine {
  flex: none;
  width: 3px;
  height: 30px;
  margin-top: 3px;
  border-radius: 2px;
  background: var(--brass);
  position: relative;
}

.about-tine::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 8px;
  border: 2px solid var(--brass);
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
}

.about-note p { margin: 0; font-size: 12.5px; color: rgba(242, 227, 198, 0.55); }
.about-note strong { color: var(--paper); }

/* ---------- empty states ---------- */

.stand-empty { text-align: center; padding: 34px 12px 8px; }

.stand-empty-rail {
  width: 54px;
  height: 74px;
  margin: 0 auto 14px;
  border: 3px solid var(--brass-deep);
  border-top: 0;
  border-radius: 0 0 10px 10px;
  position: relative;
  opacity: 0.7;
}

.stand-empty-rail::before {
  content: "";
  position: absolute;
  top: -6px;
  left: -10px;
  right: -10px;
  height: 8px;
  border-radius: 4px;
  background: var(--brass-deep);
}

.stand-empty-title { margin: 0 0 4px; color: var(--paper); font-size: 18px; }
.stand-empty-sub { margin: 0; font-size: 13.5px; color: rgba(242, 227, 198, 0.5); }

/* ---------- spots: grouped rail ---------- */

.spot-group { margin-bottom: 22px; }

.group-title {
  margin: 0 0 8px;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brass-hi);
  border-bottom: 1px solid rgba(196, 122, 61, 0.35);
  padding-bottom: 5px;
}

.spot-row {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin-bottom: 8px;
  border-radius: 3px;
  overflow: hidden;
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.3);
}

.spot-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px 11px 0;
  padding-left: 0;
  border: 0;
  background: var(--paper);
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.spot-main .slip-strip { flex: none; width: 6px; align-self: stretch; }

.spot-main-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }

.spot-piece {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spot-passage {
  font-size: 13px;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spot-meta { font-size: 11px; color: rgba(107, 99, 83, 0.75); }

.spot-delete {
  flex: none;
  width: 44px;
  border: 0;
  background: #7e3128;
  color: var(--paper);
  font-size: 20px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.spot-delete:active { background: var(--rosin); }

/* ---------- capture form ---------- */

.capture-form {
  background: var(--stage-2);
  border: 1px solid rgba(242, 227, 198, 0.12);
  border-radius: 8px;
  padding: 18px 16px 16px;
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.35);
}

.field { margin-bottom: 16px; }

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cream-dim);
}

.field label .req { color: var(--brass-hi); font-style: normal; font-size: 10px; margin-left: 6px; }
.field label .opt { color: rgba(242, 227, 198, 0.35); font-style: normal; font-size: 10px; margin-left: 6px; }

.field input,
.field textarea {
  display: block;
  width: 100%;
  padding: 11px 12px;
  font: inherit;
  font-size: 16px; /* prevents iOS zoom-on-focus */
  color: var(--paper);
  background: var(--stage);
  border: 1px solid rgba(242, 227, 198, 0.22);
  border-radius: 5px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.field textarea { resize: vertical; min-height: 74px; }

.field input:focus,
.field textarea:focus {
  border-color: var(--brass);
  box-shadow: 0 0 0 2px rgba(196, 122, 61, 0.3);
}

.field input::placeholder,
.field textarea::placeholder { color: rgba(242, 227, 198, 0.3); }

.tempo-input-wrap { position: relative; }
.tempo-input-wrap input { padding-right: 52px; }

.tempo-unit {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brass-hi);
  pointer-events: none;
}

.field-err {
  margin: 6px 0 0;
  font-size: 12.5px;
  color: #e08a7e;
}

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

.btn {
  flex: 1;
  padding: 14px 12px;
  border: 0;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.btn-save {
  background: linear-gradient(180deg, var(--brass-hi), var(--brass) 50%, var(--brass-deep));
  color: #2a1a0c;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
}

.btn-delete {
  flex: 0 0 34%;
  background: transparent;
  border: 1px solid var(--rosin);
  color: #e08a7e;
}

.btn:active { transform: translateY(1px); }

.form-hint {
  margin: 14px 0 0;
  padding: 10px 12px;
  background: rgba(95, 125, 85, 0.18);
  border-left: 2px solid var(--reed);
  border-radius: 0 4px 4px 0;
  font-size: 13px;
  color: var(--paper);
}

/* ---------- find ---------- */

.search-wrap { position: relative; margin-bottom: 12px; }

.search-input {
  width: 100%;
  padding: 12px 40px 12px 14px;
  font: inherit;
  font-size: 16px;
  color: var(--paper);
  background: var(--stage-2);
  border: 1px solid rgba(242, 227, 198, 0.22);
  border-radius: 6px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.search-input:focus { border-color: var(--brass); box-shadow: 0 0 0 2px rgba(196, 122, 61, 0.3); }
.search-input::placeholder { color: rgba(242, 227, 198, 0.3); }
.search-input::-webkit-search-cancel-button { display: none; }

.search-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: rgba(242, 227, 198, 0.12);
  color: var(--paper);
  font-size: 18px;
  cursor: pointer;
}

.find-meta {
  margin: 0 0 10px;
  font-size: 12px;
  color: rgba(242, 227, 198, 0.5);
  font-style: italic;
}

.find-results .find-row:last-child { margin-bottom: 0; }

/* ---------- bottom tab bar: four tuning forks ---------- */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: flex;
  height: calc(var(--tab-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: linear-gradient(180deg, #222b37, #171d26);
  border-top: 1px solid rgba(196, 122, 61, 0.4);
  box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.45);
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 0;
  background: transparent;
  color: rgba(242, 227, 198, 0.45);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

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

/* flat matte fork silhouette */
.fork {
  position: relative;
  width: 22px;
  height: 26px;
  opacity: 0.75;
}

.fork-stem,
.fork-arm {
  position: absolute;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.18s ease;
}

.fork-stem { left: 50%; bottom: 0; width: 3px; height: 13px; transform: translateX(-50%); }

.fork-arm { top: 1px; width: 3px; height: 13px; }
.fork-arm-l { left: 3px; transform: rotate(6deg); transform-origin: bottom center; }
.fork-arm-r { right: 3px; transform: rotate(-6deg); transform-origin: bottom center; }

/* active fork: brass, tilted on a short shadow */
.tab.is-active { color: var(--brass-hi); }
.tab.is-active .fork { opacity: 1; filter: drop-shadow(2px 2px 2px rgba(0, 0, 0, 0.55)); }
.tab.is-active .fork-stem { transform: translateX(-50%) rotate(-8deg); }
.tab.is-active .fork-arm-l { transform: rotate(-4deg); }
.tab.is-active .fork-arm-r { transform: rotate(-18deg); }

.tab:active .fork { opacity: 1; }
