/* Teaching layout — soft pastel page, neutral panels */

:root {
  --bg: #e8f0f4;
  --panel: #fdfdfd;
  --border: #c5ccd4;
  --border-strong: #9aa3ad;
  --text: #1c1c1f;
  --text-secondary: #4a4a52;
  --muted: #6e6e78;
  --fill-soft: #eef3f6;
  --fill-active: #dde5ea;
  --shadow: rgba(0, 0, 0, 0.06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --text-lg: 1.375rem;
  --text-base: 1.125rem;
  --text-sm: 1rem;
  --radius: 8px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 56rem;
  margin: 0 auto;
  padding: 1.75rem 1.25rem 2.5rem;
}

.page-header h1 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 650;
  letter-spacing: -0.02em;
  margin: 0 0 0.75rem;
  color: var(--text);
}

.lede {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  margin: 0;
  max-width: 52ch;
}

.toolbar {
  display: flex;
  gap: 0.5rem;
  margin: 1.5rem 0 1.25rem;
}

.btn {
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  padding: 0.55rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}

.btn:hover {
  background: var(--fill-soft);
}

.btn:active {
  background: var(--fill-active);
}

.btn-ghost {
  border-color: var(--border);
  color: var(--text-secondary);
}

.diagram {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  padding: 1.1rem 1.25rem;
  box-shadow: 0 1px 3px var(--shadow);
}

.panel-ram.is-pulse {
  animation: panelPulse 0.95s ease;
}

@keyframes panelPulse {
  0%,
  100% {
    box-shadow: 0 1px 3px var(--shadow);
  }
  50% {
    box-shadow: 0 0 0 3px var(--fill-active);
  }
}

.panel-title {
  font-size: 1.125rem;
  font-weight: 650;
  margin: 0 0 0.85rem;
  color: var(--text);
  letter-spacing: -0.01em;
}

.panel-inbound .panel-title {
  margin-bottom: 0.65rem;
}

.inbound-slot {
  min-height: 3.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.75rem;
  font-size: var(--text-base);
  font-weight: 500;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--fill-soft);
  color: var(--text);
  animation: chipIn 0.6s ease forwards;
}

.chip.muted {
  color: var(--text-secondary);
}

@keyframes chipIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 52rem) {
  .split {
    grid-template-columns: 1fr;
  }
}

.block {
  margin-top: 1rem;
}

.block:first-of-type {
  margin-top: 0;
}

.block-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.4rem;
}

.hint {
  font-weight: 400;
  color: var(--muted);
}

.kv-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: var(--text-base);
  font-variant-numeric: tabular-nums;
}

.kv-list li {
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.2s ease;
}

.kv-list li:last-child {
  border-bottom: none;
}

.kv-list li.is-scan {
  background: var(--fill-active);
}

.kv-list li.is-new {
  animation: rowFlash 0.75s ease;
}

@keyframes rowFlash {
  from {
    background: var(--fill-active);
  }
  to {
    background: transparent;
  }
}

.empty-note {
  font-size: var(--text-sm);
  color: var(--muted);
  margin: 0.25rem 0 0;
  font-style: italic;
}

.wal-lines {
  margin: 0;
  padding: 0.65rem 0.75rem;
  font-family: ui-monospace, "Cascadia Code", "SF Mono", Menlo, monospace;
  font-size: 1rem;
  line-height: 1.5;
  background: var(--fill-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 11rem;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.wal-lines .line {
  display: block;
  animation: lineIn 0.48s ease;
}

@keyframes lineIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.sstable-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: stretch;
}

.sstable-card {
  flex: 1 1 10rem;
  min-width: 8rem;
  padding: 0.6rem 0.75rem;
  font-size: var(--text-sm);
  font-weight: 600;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  transition: border-color 0.25s ease, box-shadow 0.25s ease, opacity 0.6s ease, transform 0.6s ease;
}

.sstable-card.is-open {
  border-color: var(--text);
  box-shadow: 0 0 0 2px var(--fill-active);
}

.sstable-card.is-old {
  opacity: 0.55;
}

.sstable-card .preview {
  margin-top: 0.45rem;
  font-weight: 400;
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-family: ui-monospace, monospace;
}

.sstable-card.is-merging {
  animation: lift 1.2s ease forwards;
}

.sstable-card.dissolve {
  animation: cardDissolve 1.15s ease forwards;
}

@keyframes lift {
  to {
    transform: translateY(-10px);
    box-shadow: 0 8px 24px var(--shadow);
  }
}

@keyframes cardDissolve {
  to {
    opacity: 0;
    transform: scale(0.96);
  }
}

.bloom-block .bloom-face {
  font-size: 1.5rem;
  font-weight: 700;
  padding: 0.75rem 1rem;
  text-align: center;
  border: 2px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--fill-soft);
  color: var(--text);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.bloom-block.is-maybe .bloom-face {
  border-color: var(--text);
  background: var(--fill-active);
}

.bloom-block.is-no .bloom-face {
  border-color: var(--border-strong);
  background: var(--fill-active);
  color: var(--text-secondary);
}

.merge-visual {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.merge-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.merge-col {
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--fill-soft);
}

.merge-col strong {
  display: block;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.merge-col .entry {
  font-family: ui-monospace, monospace;
  font-size: 0.875rem;
}

.merge-col .entry.strike {
  text-decoration: line-through;
  opacity: 0.45;
}

.merge-col .entry.keep {
  font-weight: 600;
  color: var(--text);
}

.merge-note {
  font-size: var(--text-sm);
  margin: 0 0 0.5rem;
  color: var(--text-secondary);
}

.read-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
}

.read-item,
.read-result {
  font-size: var(--text-lg);
  font-weight: 500;
}

.read-arrow {
  font-size: 1.75rem;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.48s ease;
}

.read-arrow.is-on {
  opacity: 1;
}

.flush-bar {
  height: 10px;
  background: var(--fill-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  margin-top: 0.5rem;
  overflow: hidden;
  opacity: 0;
  max-height: 0;
  transition: opacity 0.3s ease, max-height 0.3s ease, margin 0.3s ease;
}

.flush-bar.is-on {
  opacity: 1;
  max-height: 2rem;
  margin-top: 0.65rem;
}

.flush-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--text-secondary);
  border-radius: 999px;
  transition: width 1.5s ease;
}

.flush-bar.is-full .flush-bar-fill {
  width: 100%;
}

.hidden {
  display: none !important;
}

.narration-wrap {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.narration {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  margin: 0 0 0.75rem;
  min-height: 3.2em;
}

.timeline {
  height: 6px;
  background: var(--fill-soft);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.timeline-fill {
  height: 100%;
  width: 0%;
  background: var(--text-secondary);
  border-radius: 999px;
  transition: width 0.38s linear;
}
