/* SpineSteward — Book-Trolley Lane Board
   Warm oat screen, teal/rust/ochre stage bands, flat wheel tabs. */

:root {
  --oat: #f6efe1;
  --card: #fffaf0;
  --secondary: #f2e6d0;
  --primary: #2f6f6a;
  --primary-deep: #24544f;
  --accent: #c4623a;
  --ochre: #b8892e;
  --ink: #3a3229;
  --ink-soft: #7a6f60;
  --line: #e3d7c2;
  --danger: #a4432f;
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --bar-h: 78px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  background: var(--oat);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.45;
}

button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }

#app { max-width: 560px; margin: 0 auto; min-height: 100%; }

/* ---------- views ---------- */
.view {
  padding: 16px 16px calc(var(--bar-h) + var(--safe-b) + 22px);
}

/* ---------- trolley handle header ---------- */
.trolley-handle {
  background: var(--primary);
  color: var(--card);
  border-radius: var(--radius);
  padding: 14px 14px 12px;
  box-shadow: 0 2px 0 var(--primary-deep);
}
.handle-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.handle-title {
  font-size: 1.35rem; font-weight: 700; letter-spacing: 0.04em;
}
.handle-knob {
  width: 14px; height: 14px; border-radius: 50%;
  border: 3px solid var(--card); flex: none;
}
.handle-sub { font-size: 0.85rem; opacity: 0.85; margin-top: 4px; text-align: center; }

/* ---------- counters ---------- */
.counter-row {
  display: flex; gap: 12px; margin-top: 14px;
}
.wheel-counter {
  flex: 1; background: var(--secondary); border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
}
.counter-num { font-size: 1.5rem; font-weight: 700; min-width: 1.4em; }
.counter-word { font-size: 0.9rem; color: var(--ink-soft); }

/* wheel dots: filled/hollow only, never check marks */
.wheel-dot {
  width: 14px; height: 14px; border-radius: 50%; flex: none;
  border: 2.5px solid var(--accent);
}
.wheel-dot.fill { background: var(--accent); }
.wheel-dot.teal { border-color: var(--primary); }
.wheel-dot.teal.fill { background: var(--primary); }

/* ---------- nominate strip ---------- */
.nominate-strip {
  width: 100%; margin-top: 14px;
  background: var(--primary); color: var(--card);
  border-radius: var(--radius);
  padding: 18px 18px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 1.15rem; font-weight: 700;
  box-shadow: 0 2px 0 var(--primary-deep);
}
.nominate-strip:active { transform: translateY(1px); box-shadow: none; }
.strip-arrow { font-size: 1.2rem; }

/* ---------- lanes / blocks ---------- */
.lane-block, .lanes { margin-top: 18px; }
.lane-heading, .lane-title {
  font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--ink-soft); margin-bottom: 8px;
}
.lane-group { margin-bottom: 16px; }

/* ---------- spine strips ---------- */
.spine-stack { display: flex; flex-direction: column; gap: 10px; }

.spine-row {
  display: flex; align-items: stretch; gap: 0;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; overflow: hidden;
  box-shadow: 0 1px 2px rgba(58, 50, 41, 0.06);
}
.stage-band {
  width: 10px; flex: none;
}
.stage-band.shortlist { background: var(--accent); }
.stage-band.chosen { background: var(--primary); }
.stage-band.passed { background: var(--ochre); }

.spine-main {
  flex: 1; min-width: 0; padding: 11px 12px 10px;
}
.spine-title {
  font-size: 1.05rem; font-weight: 700; line-height: 1.3;
  overflow-wrap: anywhere;
}
.spine-title.passed-word { text-decoration: line-through; text-decoration-thickness: 1px; color: var(--ink-soft); }
.spine-author { font-size: 0.9rem; color: var(--ink-soft); margin-top: 1px; }
.spine-pitch {
  font-size: 0.9rem; color: var(--ink-soft); margin-top: 5px;
  white-space: pre-line;
}
.spine-stage-word {
  display: inline-block; margin-top: 7px;
  font-size: 0.78rem; letter-spacing: 0.07em; text-transform: uppercase;
  padding: 2px 9px; border-radius: 99px; border: 1px solid var(--line);
  background: var(--secondary);
}
.spine-stage-word.shortlist { color: var(--accent); border-color: var(--accent); }
.spine-stage-word.chosen { color: var(--primary); border-color: var(--primary); }
.spine-stage-word.passed { color: var(--ochre); border-color: var(--ochre); }

.spine-actions {
  display: flex; flex-direction: column; justify-content: center;
  gap: 6px; padding: 8px 10px; border-left: 1px dashed var(--line);
  flex: none;
}
.spine-btn {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--secondary); border: 1px solid var(--line);
  font-size: 0.95rem; display: flex; align-items: center; justify-content: center;
}
.spine-btn:active { transform: scale(0.94); }
.spine-btn.cycle { background: var(--primary); color: var(--card); border-color: var(--primary); }
.spine-btn.delete { color: var(--danger); }

/* ---------- plain heads ---------- */
.plain-head { margin-bottom: 14px; }
.page-title { font-size: 1.5rem; font-weight: 700; }
.page-sub { color: var(--ink-soft); font-size: 0.92rem; margin-top: 2px; }

/* ---------- book slip form ---------- */
.book-slip {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 14px;
  box-shadow: 0 2px 4px rgba(58, 50, 41, 0.06);
}
.slip-label {
  display: block; font-size: 0.95rem; font-weight: 700;
  margin: 14px 2px 6px;
}
.slip-label:first-of-type { margin-top: 2px; }
.req { color: var(--danger); }
.opt { font-weight: 400; color: var(--ink-soft); font-size: 0.85rem; }

.slip-input {
  width: 100%; padding: 12px 12px;
  border: 1.5px solid var(--line); border-radius: 10px;
  background: var(--oat); font-size: 1.05rem;
}
.slip-input:focus { outline: none; border-color: var(--primary); background: var(--card); }
.slip-area { resize: vertical; min-height: 96px; line-height: 1.5; }
.slip-select { appearance: none; -webkit-appearance: none; }

.slip-input.invalid { border-color: var(--danger); background: #fdf1ec; }
.slip-error {
  color: var(--danger); font-size: 0.85rem; margin-top: 5px;
}

.slip-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.slip-save {
  background: var(--primary); color: var(--card);
  border-radius: 12px; padding: 15px; font-size: 1.1rem; font-weight: 700;
  box-shadow: 0 2px 0 var(--primary-deep);
}
.slip-save:active { transform: translateY(1px); box-shadow: none; }
.slip-cancel {
  background: var(--secondary); border: 1px solid var(--line);
  border-radius: 12px; padding: 13px; font-size: 1rem;
}

/* ---------- find ---------- */
.search-rack { display: flex; gap: 10px; align-items: center; }
.search-input {
  flex: 1; min-width: 0;
  padding: 13px 14px; font-size: 1.05rem;
  border: 1.5px solid var(--line); border-radius: 99px; background: var(--card);
}
.search-input:focus { outline: none; border-color: var(--primary); }
.search-clear {
  flex: none; padding: 11px 16px; border-radius: 99px;
  background: var(--secondary); border: 1px solid var(--line); font-size: 0.95rem;
}
.search-count { color: var(--ink-soft); font-size: 0.88rem; margin: 10px 2px 0; }
#search-results { margin-top: 12px; }

/* ---------- empty state: faint trolley wheels ---------- */
.empty-wheels {
  margin-top: 26px; text-align: center;
}
.empty-wheel {
  display: inline-block; width: 34px; height: 34px; border-radius: 50%;
  border: 3px dashed var(--line); margin: 0 6px;
}
.empty-note { color: var(--ink-soft); font-size: 0.95rem; margin-top: 8px; }

/* ---------- bottom cart tabs ---------- */
.cart-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  max-width: 560px; margin: 0 auto;
  display: flex; height: var(--bar-h);
  padding-bottom: var(--safe-b);
  background: var(--secondary);
  border-top: 1px solid var(--line);
  z-index: 10;
}
.cart-tab {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px;
  padding-top: 10px;
}
.tab-word {
  font-size: 0.82rem; color: var(--ink-soft); letter-spacing: 0.03em;
}
.tab-wheel {
  width: 26px; height: 26px; border-radius: 50%;
  background: #d9cbb2;
  border: 3px solid var(--ink-soft);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
/* active wheel rolls slightly forward with soft shadow */
.cart-tab.active .tab-wheel {
  background: var(--primary);
  border-color: var(--primary-deep);
  transform: translateX(3px) rotate(12deg);
  box-shadow: 2px 3px 5px rgba(36, 84, 79, 0.35);
}
.cart-tab.active .tab-word {
  color: var(--primary-deep); font-weight: 700;
}

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--bar-h) + var(--safe-b) + 14px);
  transform: translateX(-50%);
  background: var(--ink); color: var(--card);
  padding: 10px 18px; border-radius: 99px;
  font-size: 0.95rem; z-index: 20;
  opacity: 0; transition: opacity 0.2s ease;
  pointer-events: none; max-width: 90%;
  text-align: center;
}
.toast.show { opacity: 0.95; }

/* ---------- larger screens: keep it phone-shaped ---------- */
@media (min-width: 600px) {
  body { background: #e9dec8; }
  #app { background: var(--oat); box-shadow: 0 0 24px rgba(58,50,41,0.15); }
  .cart-bar { box-shadow: 0 0 24px rgba(58,50,41,0.15); }
}
