/*
  Everything that is not the shop floor: the manager's note, the results, the
  history, and the coach marks.

  The note and the results are both "a piece of paper on the counter" — same
  card, same paper, same brass rule — because §14A wants the scenario card to
  feel like part of the bookstore rather than a game-mode screen.
*/

.sheet {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.4rem 1.1rem calc(1.4rem + env(safe-area-inset-bottom, 0px));
  gap: 1rem;
  -webkit-overflow-scrolling: touch;
}

.card {
  position: relative;
  width: 100%;
  max-width: 30rem;
  padding: 1.5rem 1.35rem 1.4rem;
  border-radius: 4px;
  background:
    linear-gradient(180deg, var(--paper-warm), #f6ecd9);
  box-shadow: var(--shadow-2), 0 1px 0 rgba(255,255,255,.7) inset;
}
/* The torn-from-a-pad top edge. */
.card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(90deg, var(--oak), var(--brass) 40%, var(--oak-light));
}

.card-dateline {
  font-size: .7rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: .5rem;
}

.card-title {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: .015em;
  line-height: 1.1;
  margin-bottom: .65rem;
}
.card-title .icon { color: var(--oak); }

/* The manager's voice. Italic serif, indented like a note left on the counter. */
.card-note {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.02rem;
  line-height: 1.45;
  color: var(--ink-soft);
  padding-left: .75rem;
  border-left: 2px solid var(--paper-edge);
  margin-bottom: .85rem;
}

.card-instruction {
  font-size: .92rem;
  line-height: 1.5;
  color: var(--ink);
  margin-bottom: 1rem;
}
.card-instruction b { font-weight: 700; }

.card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  margin-bottom: 1.1rem;
}
.stat {
  flex: 1 1 7rem;
  padding: .55rem .7rem .6rem;
  border-radius: var(--radius);
  background: rgba(184, 135, 63, .10);
  box-shadow: inset 0 0 0 1px rgba(184, 135, 63, .22);
}
.stat-label {
  font-size: .64rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 700;
}
.stat-value {
  font-family: var(--serif);
  font-size: 1.28rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.stat-value small { font-size: .72rem; font-weight: 600; color: var(--ink-faint); }

.card-actions { display: flex; flex-direction: column; gap: .55rem; }
.card-actions .btn { width: 100%; }

/* The section map on the note: what is on the floor today, in floor order. */
.floorplan {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  margin-bottom: 1rem;
}
.floorplan-chip {
  display: inline-flex;
  align-items: center;
  gap: .28rem;
  padding: .22rem .5rem .24rem .34rem;
  border-radius: 999px;
  background: rgba(255,255,255,.6);
  box-shadow: inset 0 0 0 1px var(--paper-edge);
  font-size: .7rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.floorplan-chip .icon { color: var(--chip-colour, var(--oak-dark)); }
.floorplan-chip.is-featured {
  background: rgba(184, 135, 63, .18);
  box-shadow: inset 0 0 0 1px rgba(184, 135, 63, .4);
  color: var(--ink);
}

/* ── Header ─────────────────────────────────────────────────────────────── */

.topbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: .3rem;
  padding: .7rem .8rem .2rem;
}
.topbar .wordmark { font-size: 1.35rem; }
.topbar-spacer { flex: 1 1 auto; }
.topbar-shift {
  font-size: .7rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ── Results (§11) ──────────────────────────────────────────────────────── */

/*
  A quiet ledger, not an arcade cabinet. Each line appears in sequence — books,
  then what sold, then the money — so the reveal has a beat to it without any
  of it taking long enough to be in the way.
*/
.ledger { margin: .2rem 0 1rem; }
.ledger-row {
  display: flex;
  align-items: baseline;
  gap: .6rem;
  padding: .42rem 0;
  border-bottom: 1px dashed rgba(120, 88, 54, .22);
  opacity: 0;
  transform: translateY(4px);
  animation: ledger-in .34s ease forwards;
}
.ledger-row:last-child { border-bottom: 0; }
.ledger-label { color: var(--ink-soft); font-size: .88rem; }
.ledger-value {
  margin-left: auto;
  font-family: var(--serif);
  font-size: 1.02rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.ledger-row.is-total { border-top: 2px solid rgba(120, 88, 54, .3); border-bottom: 0; margin-top: .3rem; padding-top: .6rem; }
.ledger-row.is-total .ledger-label { color: var(--ink); font-weight: 700; }
.ledger-row.is-total .ledger-value { font-size: 1.5rem; }
@keyframes ledger-in { to { opacity: 1; transform: none; } }

.verdict {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  padding: .9rem 0 .2rem;
}
.stars { display: flex; gap: .18rem; color: rgba(120, 88, 54, .28); }
.star.is-lit { color: var(--brass); }
.verdict-grade {
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 700;
}
.verdict-margin { font-size: .84rem; color: var(--ink-soft); }
.verdict-margin.is-over { color: var(--good); font-weight: 600; }

.badge-official {
  display: inline-block;
  padding: .18rem .5rem;
  border-radius: 999px;
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  background: rgba(79, 124, 70, .16);
  color: var(--good);
}
.badge-practice { background: rgba(120, 88, 54, .14); color: var(--ink-soft); }

/* ── Employee of the Month (§12) ────────────────────────────────────────── */

.board { display: flex; flex-direction: column; gap: .3rem; margin: .4rem 0 .9rem; }
.board-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .45rem .6rem;
  border-radius: var(--radius);
  background: rgba(255,255,255,.45);
}
.board-row.is-you {
  background: rgba(184, 135, 63, .16);
  box-shadow: inset 0 0 0 1px rgba(184, 135, 63, .38);
}
.board-place {
  width: 1.4rem;
  font-family: var(--serif);
  font-weight: 700;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
.board-row.is-you .board-place { color: var(--oak-dark); }
.board-name { font-weight: 600; }
.board-row.is-you .board-name { font-weight: 800; }
.board-revenue {
  margin-left: auto;
  font-family: var(--serif);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.board-foot { font-size: .8rem; color: var(--ink-soft); text-align: center; }

/* ── History ────────────────────────────────────────────────────────────── */

.history { display: flex; flex-direction: column; gap: .18rem; }
.history-row {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .4rem .3rem;
  border-bottom: 1px solid rgba(120, 88, 54, .13);
  font-size: .86rem;
}
.history-day { width: 3.6rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.history-scenario {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-stars { color: var(--brass); letter-spacing: -.04em; font-size: .78rem; }
.history-revenue { font-weight: 700; font-variant-numeric: tabular-nums; width: 3.6rem; text-align: right; }
.empty { color: var(--ink-faint); font-size: .88rem; text-align: center; padding: 1.4rem 0; }

.summary {
  display: flex;
  gap: .5rem;
  margin-bottom: 1rem;
}

/* ── Coach marks (§14B) ─────────────────────────────────────────────────── */

/*
  Contextual, one line, and never a modal. It points at the thing it is talking
  about and it goes away on the next successful action rather than needing a
  dismissal — §14B is explicit that onboarding must not be modal-heavy.
*/
.coach {
  position: absolute;
  left: 50%;
  z-index: 45;
  width: min(20rem, calc(100vw - 2rem));
  transform: translateX(-50%);
  padding: .6rem .8rem .65rem;
  border-radius: var(--radius);
  background: var(--paper-warm);
  box-shadow: var(--shadow-2);
  font-size: .84rem;
  line-height: 1.4;
  color: var(--ink);
  animation: coach-in .26s cubic-bezier(.2,.9,.3,1);
}
.coach.is-above { bottom: calc(var(--cover-h) + 92px); }
.coach.is-below { top: 84px; }
.coach b { font-weight: 700; }
.coach-dismiss {
  display: block;
  margin: .45rem 0 0 auto;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--oak-dark);
}
@keyframes coach-in { from { opacity: 0; transform: translate(-50%, 6px); } }

/* The one guided moment: the first-ever book, with its target section named. */
.coach-hint {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .1rem .38rem;
  border-radius: 4px;
  background: rgba(184, 135, 63, .18);
  font-weight: 700;
}
.coach-hint .icon { width: 13px; height: 13px; }

/* ── Settings ───────────────────────────────────────────────────────────── */

.settings {
  position: absolute;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(44, 33, 24, .38);
  padding: 1rem;
}
.settings-panel {
  width: 100%;
  max-width: 26rem;
  padding: 1.1rem 1.1rem calc(1.1rem + env(safe-area-inset-bottom, 0px));
  border-radius: var(--radius-lg) var(--radius-lg) 8px 8px;
  background: var(--paper-warm);
  box-shadow: var(--shadow-2);
}
.settings-row {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .7rem 0;
  border-bottom: 1px solid var(--paper-edge);
}
.settings-row:last-of-type { border-bottom: 0; }
.settings-label { font-weight: 600; }
.settings-sub { font-size: .78rem; color: var(--ink-faint); }
.settings-row .btn { margin-left: auto; }

/* ── The end of the shift, before the results ───────────────────────────── */

/*
  §11 asks for the final shelves to stay visible briefly. This is that pause:
  the floor dims a little, everything stops responding, and one word sits over
  it for a beat.
*/
.curtain {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(247, 240, 228, .35);
  backdrop-filter: blur(1px);
  animation: curtain-in .4s ease;
}
.curtain-word {
  font-family: var(--serif);
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink);
  text-shadow: 0 2px 0 rgba(255,255,255,.7);
}
@keyframes curtain-in { from { opacity: 0; } }
