.header-left { display: flex; align-items: center; gap: 14px; }

.lib-toggle {
  all: unset;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  margin-left: -6px;
  color: var(--ink);
}
.lib-toggle:hover { background: var(--paper-hover); }

.shortcuts { font-size: 12px; color: var(--muted); }

.workspace {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
}

/* Library: the wrapper collapses its width while the panel slides out left. */
.lib-wrap {
  flex: 0 0 auto;
  align-self: stretch;
  width: 250px;
  overflow: hidden;
  transition: width .4s var(--ease);
}
.library {
  width: 250px;
  box-sizing: border-box;
  padding: 28px 24px 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: transform .4s var(--ease), opacity .3s ease, visibility 0s;
}
.lib-closed .lib-wrap { width: 0; }
.lib-closed .library {
  transform: translateX(-100%);
  opacity: 0;
  visibility: hidden;
  transition: transform .4s var(--ease), opacity .3s ease, visibility 0s .4s;
}
.lib-list { display: flex; flex-direction: column; gap: 2px; }

.lib-item {
  all: unset;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 10px;
  border-radius: 4px;
}
.lib-item:hover,
.lib-item[aria-current="true"] { background: var(--paper-active); }
.lib-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lib-item-title { font-size: 16px; line-height: 1.3; }
.lib-item-author { font-family: var(--mono); font-size: 11px; color: var(--muted); }

.lib-rule { height: 1px; background: var(--rule); margin: 12px 10px; }

.lib-paste {
  all: unset;
  cursor: pointer;
  padding: 9px 10px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink);
}
.lib-paste:hover { background: var(--paper-hover); }
.lib-paste:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Main column */
.main {
  flex: 1 1 520px;
  min-width: 0;
  padding: 40px 32px 64px;
  display: flex;
  justify-content: center;
}
.column {
  width: 100%;
  max-width: 660px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.reader { display: flex; flex-direction: column; gap: 32px; }
.reader[hidden], .editor[hidden] { display: none; }

/* Paste-your-own editor */
.editor { display: flex; flex-direction: column; gap: 16px; }
.draft-title {
  font-family: var(--serif);
  font-size: 28px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--rule);
  padding: 6px 0;
  color: var(--ink);
  outline: none;
}
.draft {
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.7;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 16px 18px;
  color: var(--ink);
  resize: vertical;
}
.row { display: flex; gap: 10px; flex-wrap: wrap; }

/* Passage */
.heading { display: flex; flex-direction: column; gap: 6px; }
.heading h1 {
  margin: 0;
  font-size: 34px;
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.15;
  text-wrap: balance;
}
.byline { font-size: 12px; color: var(--muted); }

.lines {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.line {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: baseline;
  column-gap: 16px;
  font-size: 21px;
  line-height: 1.75;
}
.line-num {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  text-align: right;
}
.line-text { text-wrap: pretty; }

.line-blank,
.line-hint,
.line-peek {
  all: unset;
  cursor: pointer;
}
.line-blank {
  justify-self: start;
  color: transparent;
  user-select: none;
  border-bottom: 1px solid var(--underline);
  line-height: 1.2;
  margin-bottom: 6px;
}
.line-blank:hover { border-bottom-color: var(--ink); }
.line-hint { color: var(--faint); letter-spacing: 0.04em; }
.line-hint:hover { color: var(--muted); }
.line-peek { color: var(--accent); font-style: italic; }
.line-blank:focus-visible,
.line-hint:focus-visible,
.line-peek:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Controls */
.controls {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
}
.controls-main { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.progress { flex: 1; min-width: 140px; display: flex; flex-direction: column; gap: 6px; }
.ticks { display: flex; gap: 3px; }
.tick { flex: 1; height: 4px; border-radius: 1px; background: var(--rule); }
.tick.on { background: var(--ink); }
.progress-label { font-size: 11px; color: var(--muted); }

.options { display: flex; gap: 28px; flex-wrap: wrap; align-items: center; }
.segmented {
  display: flex;
  border: 1px solid var(--rule-strong);
  border-radius: 4px;
  overflow: hidden;
}
.segmented button {
  all: unset;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 12px;
  padding: 6px 10px;
  background: transparent;
  color: var(--ink);
}
.segmented button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.segmented button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

@media (prefers-reduced-motion: reduce) {
  .lib-wrap, .library, .lib-closed .library { transition: none; }
}
