/* The Ledger — the story screen. A page, not a dashboard: one column,
   generous leading, and blank ruled lines where a page is unwritten. */

.screen--ledger {
  overflow-y: auto;
  justify-content: flex-start; /* the centred-overflow trap again */
  padding: calc(20px + env(safe-area-inset-top, 0px)) 16px
           calc(24px + env(safe-area-inset-bottom, 0px));
}

.ledger {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.ledger__head h2 {
  font-family: var(--font-display, 'Cinzel', serif);
  font-size: var(--fs-6); /* one ladder step for every meta-screen head */
  color: var(--c-text-bright);
  letter-spacing: 0.06em;
}

.ledger__sub {
  margin-top: 4px;
  color: var(--c-text-dim);
  font-size: 0.85rem;
}

.ledger__count {
  color: var(--c-text-dim);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.ledger__body {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.ledger__chapter {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ledger__chapter-title {
  font-family: var(--font-display, 'Cinzel', serif);
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--c-text-dim);
  border-bottom: 1px solid var(--c-border);
  padding-bottom: 6px;
}

.ledger__entry {
  padding: 12px 14px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-left: 2px solid var(--c-border);
  border-radius: 8px;
}

.ledger__entry-title {
  font-family: var(--font-display, 'Cinzel', serif);
  font-size: 0.98rem;
  color: var(--c-text-bright);
  margin-bottom: 5px;
}

.ledger__entry-text {
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--c-text);
}

/* Unwritten: the ruling is there, the sentence is not. */
.ledger__entry--blank {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 16px 14px;
  background: none;
  border-color: transparent;
  border-left-color: var(--c-border);
}

.ledger__entry--blank span {
  height: 1px;
  background: var(--c-border);
  opacity: 0.7;
}

.ledger__entry--blank span:nth-child(1) { width: 42%; }
.ledger__entry--blank span:nth-child(2) { width: 88%; }
.ledger__entry--blank span:nth-child(3) { width: 66%; }

/* The spine reads as the important thing it is. */
.ledger__chapter--acts .ledger__entry--act {
  border-left-color: var(--c-gold-dim);
  box-shadow: inset 0 0 26px rgba(0, 0, 0, 0.35);
}

.ledger__chapter--acts .ledger__entry-title {
  color: var(--c-gold);
}

/* A run left something unread. */
.btn--marked::after {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 8px;
  border-radius: 50%;
  background: var(--c-gold);
  box-shadow: 0 0 8px var(--c-gold);
  vertical-align: middle;
}

/* A page that landed since the last reading — the eye finds it first */
.ledger__entry--fresh {
  border-left: 2px solid var(--c-accent);
  padding-left: 12px;
  box-shadow: -6px 0 18px -8px var(--c-glow);
}

/* The world that carried an act — a record stamp, not part of the prose */
.ledger__entry-world {
  margin-top: 6px;
  font-family: var(--font-ui);
  font-size: var(--fs-2);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-accent);
  opacity: 0.85;
}

/* ── Story toast — the phone's only voice for a found fragment ──
   (the journal is hidden on mobile; without this the Ledger grew silently) */
.story-toast {
  position: fixed;
  left: 50%;
  top: calc(env(safe-area-inset-top, 0px) + 54px);
  transform: translate(-50%, -12px);
  max-width: min(86vw, 420px);
  padding: 10px 18px;
  font-family: var(--font-ui);
  font-size: var(--fs-3);
  font-weight: 600;
  text-align: center;
  color: var(--c-text-bright);
  background: color-mix(in srgb, var(--c-surface) 88%, transparent);
  border: 1px solid color-mix(in srgb, var(--c-accent) 40%, transparent);
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 18px color-mix(in srgb, var(--c-glow) 40%, transparent);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: var(--z-gate);
}

.story-toast--live {
  opacity: 1;
  transform: translate(-50%, 0);
}
