/* ─── UI Components ─────────────────────────────── */

/* ── Cards ── */
.card {
  border-radius: var(--r-lg);
  padding: var(--sp-5) var(--sp-6);
  border: 1.5px solid var(--c-border);
  background: var(--c-white);
  box-shadow: var(--sh-sm);
}

.card h3 {
  font-size: var(--fs-xl);
  font-weight: 800;
  margin-bottom: var(--sp-3);
  word-break: keep-all;
}

.card p, .card li {
  font-size: var(--fs-base);
  line-height: 1.65;
  color: var(--c-mid);
  word-break: keep-all;
}

.card ul { list-style: none; display: flex; flex-direction: column; gap: var(--sp-2); }
.card ul li { padding-left: 18px; position: relative; }
.card ul li::before { content: '▸'; position: absolute; left: 0; font-weight: 700; color: currentColor; }
.card ul.plain li { padding-left: 0; }
.card ul.plain li::before { content: none; }

.num-badge {
  width: 40px; height: 40px;
  border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: var(--fs-lg);
  color: var(--c-white);
  margin-bottom: var(--sp-3);
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}

/* ── Highlight / Key message box ── */
.key-box {
  border-radius: var(--r-lg);
  padding: var(--sp-5) var(--sp-7);
  border-left: 7px solid currentColor;
  font-size: var(--fs-xl);
  font-weight: 700;
  line-height: 1.6;
  word-break: keep-all;
  box-shadow: var(--sh-sm);
}

.key-box.large {
  font-size: var(--fs-2xl);
  font-weight: 800;
  padding: var(--sp-6) var(--sp-8);
}

/* ── Section badge/chip ── */
.chip {
  display: inline-flex;
  align-items: center;
  border-radius: var(--r-full);
  padding: 5px 16px;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ── Code block ── */
.code-wrap {
  position: relative;
  margin: var(--sp-3) 0;
}

.code-block {
  display: block;
  background: #1A1F35;
  border-radius: var(--r-md);
  padding: var(--sp-5) var(--sp-6);
  color: #CDD6F4;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
  font-size: var(--fs-sm);
  line-height: 1.75;
  overflow-x: auto;
  white-space: pre;
  tab-size: 2;
}

.copy-btn {
  position: absolute;
  top: var(--sp-3);
  right: var(--sp-3);
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.7);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: var(--r-sm);
  padding: var(--sp-1) var(--sp-3);
  font-size: var(--fs-xs);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
  user-select: none;
  white-space: nowrap;
}

.copy-btn:hover, .copy-btn:focus-visible {
  background: rgba(255,255,255,.2);
  color: var(--c-white);
  outline: none;
}

.copy-btn.copied {
  background: rgba(14, 138, 110, .4);
  color: #6EE7B7;
  border-color: rgba(14,138,110,.4);
}

/* ── Navigation bar ── */
#nav-bar {
  position: fixed;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  background: rgba(15, 23, 42, .90);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: var(--sp-2) var(--sp-5);
  border-radius: var(--r-full);
  border: 1px solid rgba(255,255,255,.10);
  box-shadow: var(--sh-xl);
}

.nav-btn {
  background: rgba(255,255,255,.12);
  color: var(--c-white);
  border: none;
  border-radius: var(--r-full);
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: background var(--t-fast);
  flex-shrink: 0;
}

.nav-btn:hover { background: rgba(255,255,255,.25); }

.nav-btn:focus-visible {
  outline: 2px solid var(--c-blue-light);
  outline-offset: 2px;
}

.nav-count {
  color: rgba(255,255,255,.85);
  font-size: var(--fs-sm);
  font-weight: 700;
  min-width: 60px;
  text-align: center;
  letter-spacing: .02em;
}

.nav-sep {
  width: 1px; height: 20px;
  background: rgba(255,255,255,.15);
  flex-shrink: 0;
}

.nav-tool-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,.55);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--r-sm);
  transition: color var(--t-fast), background var(--t-fast);
  white-space: nowrap;
}

.nav-tool-btn:hover {
  color: var(--c-white);
  background: rgba(255,255,255,.10);
}

.nav-tool-btn:focus-visible {
  outline: 2px solid var(--c-blue-light);
  outline-offset: 2px;
}

/* ── Progress bar ── */
#progress-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 200;
  background: rgba(255,255,255,.10);
}

#progress-fill {
  height: 100%;
  background: var(--c-blue-light);
  transition: width var(--t-slow);
}

/* ── TOC Panel ── */
#toc-panel {
  position: fixed;
  top: 0; left: -320px; bottom: 0;
  width: 300px;
  z-index: 500;
  background: var(--c-white);
  box-shadow: 4px 0 32px rgba(0,0,0,.18);
  transition: left var(--t-mid);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#toc-panel.open { left: 0; }

.toc-panel-head {
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.toc-panel-head h2 {
  font-size: var(--fs-base);
  font-weight: 700;
  color: var(--c-dark);
}

.toc-close-btn {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--c-pale);
  padding: var(--sp-1);
  border-radius: var(--r-sm);
  transition: color var(--t-fast);
  display: flex; align-items: center; justify-content: center;
}

.toc-close-btn:hover { color: var(--c-dark); }
.toc-close-btn:focus-visible { outline: 2px solid var(--c-blue); outline-offset: 2px; }

#toc-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-2) 0;
}

.toc-section-label {
  padding: var(--sp-3) var(--sp-5) var(--sp-1);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--c-pale);
}

.toc-item {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5);
  cursor: pointer;
  transition: background var(--t-fast);
  border-left: 3px solid transparent;
  text-align: left;
  width: 100%;
  background: none;
  border-right: none;
  border-top: none;
  border-bottom: none;
}

.toc-item:hover { background: var(--c-bg); }

.toc-item.active {
  background: var(--c-blue-bg);
  border-left-color: var(--c-blue);
}

.toc-item:focus-visible {
  outline: 2px solid var(--c-blue);
  outline-offset: -2px;
}

.toc-item-num {
  font-size: var(--fs-xs);
  color: var(--c-pale);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  padding-top: 2px;
  min-width: 20px;
}

.toc-item-title {
  font-size: var(--fs-sm);
  line-height: 1.45;
  color: var(--c-dark);
  word-break: keep-all;
}

.toc-item.active .toc-item-title {
  font-weight: 600;
  color: var(--c-blue);
}

.toc-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 499;
  background: rgba(0,0,0,.35);
}

.toc-overlay.visible { display: block; }

/* ── Timer widget ── */
#timer-widget {
  position: fixed;
  bottom: 72px;
  right: 20px;
  z-index: 300;
  display: none;
  flex-direction: row;
  align-items: center;
  gap: var(--sp-4);
  background: rgba(15,23,42,.93);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1.5px solid rgba(255,255,255,.12);
  border-radius: var(--r-xl);
  padding: var(--sp-3) var(--sp-5);
  box-shadow: var(--sh-xl);
  user-select: none;
}

#timer-label {
  color: rgba(255,255,255,.60);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  max-width: 120px;
  line-height: 1.3;
}

#timer-display {
  color: var(--c-white);
  font-size: 1.9rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  min-width: 76px;
  text-align: center;
  letter-spacing: .02em;
}

#timer-display.warning { color: #FCA5A5; }

.timer-btn {
  background: rgba(255,255,255,.12);
  color: var(--c-white);
  border: none;
  border-radius: var(--r-md);
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: background var(--t-fast);
  flex-shrink: 0;
}

.timer-btn:hover { background: rgba(255,255,255,.22); }
.timer-btn:focus-visible { outline: 2px solid var(--c-blue-light); outline-offset: 2px; }

@keyframes timer-done {
  0%, 100% { background: rgba(15,23,42,.93); }
  50%       { background: rgba(185,28,28,.55); }
}
.timer-done { animation: timer-done .7s ease 4; }

/* ── Quiz component ── */
.quiz-item {
  border-radius: var(--r-lg);
  border: 1.5px solid var(--c-border);
  overflow: hidden;
  margin-bottom: var(--sp-3);
}

.quiz-question {
  padding: var(--sp-4) var(--sp-5);
  background: var(--c-white);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
}

.quiz-question p {
  font-size: var(--fs-lg);
  font-weight: 600;
  line-height: 1.5;
  word-break: keep-all;
  flex: 1;
}

.quiz-reveal-btn {
  flex-shrink: 0;
  background: var(--c-blue);
  color: var(--c-white);
  border: none;
  border-radius: var(--r-md);
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--fs-sm);
  font-weight: 700;
  cursor: pointer;
  transition: background var(--t-fast);
  white-space: nowrap;
}

.quiz-reveal-btn:hover { background: var(--c-blue-light); }
.quiz-reveal-btn:focus-visible { outline: 2px solid var(--c-blue); outline-offset: 2px; }

.quiz-answer {
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--c-border);
  display: none;
}

.quiz-answer.visible { display: block; }

.quiz-answer-label {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: var(--sp-2);
}

.quiz-answer-text {
  font-size: var(--fs-base);
  line-height: 1.65;
  word-break: keep-all;
}

/* ── Track selector ── */
.track-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--sp-5);
}

.track-card {
  border-radius: var(--r-xl);
  padding: var(--sp-7) var(--sp-5);
  text-align: center;
  cursor: pointer;
  border: 2.5px solid transparent;
  transition: transform var(--t-mid), box-shadow var(--t-mid), border-color var(--t-mid);
  user-select: none;
}

.track-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--sh-lg);
}

.track-card.selected {
  border-color: currentColor;
  box-shadow: var(--sh-md);
}

.track-card:focus-visible {
  outline: 2px solid var(--c-blue);
  outline-offset: 2px;
}

.track-letter {
  font-size: 3rem;
  font-weight: 900;
  line-height: 1;
}

.track-name {
  font-size: var(--fs-xl);
  font-weight: 800;
  margin: var(--sp-3) 0 var(--sp-2);
  word-break: keep-all;
}

.track-role {
  font-size: var(--fs-sm);
  opacity: .75;
  word-break: keep-all;
}

.track-goal {
  font-size: var(--fs-base);
  margin-top: var(--sp-3);
  font-weight: 600;
  line-height: 1.45;
  word-break: keep-all;
}

/* ── Tab switcher (segmented control style) ── */
.tab-group { display: flex; flex-direction: column; gap: 0; }

.tab-buttons {
  display: flex;
  gap: 4px;
  margin-bottom: var(--sp-4);
  background: var(--c-border);
  padding: 4px;
  border-radius: var(--r-lg);
  width: fit-content;
}

.tab-btn {
  padding: var(--sp-2) var(--sp-5);
  border-radius: var(--r-md);
  border: none;
  background: transparent;
  color: var(--c-mid);
  font-size: var(--fs-base);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
  white-space: nowrap;
  letter-spacing: -.01em;
}

.tab-btn.active {
  background: var(--c-blue);
  color: var(--c-white);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(27, 95, 204, .30);
}

.tab-btn:hover:not(.active) {
  background: var(--c-white);
  color: var(--c-dark);
}

.tab-btn:focus-visible { outline: 2px solid var(--c-blue); outline-offset: 3px; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Inline icon in text ── */
.icon-inline {
  display: inline-block;
  width: 1em; height: 1em;
  vertical-align: middle;
  margin-right: 4px;
}

/* ── Cover: big message ── */
.big-message {
  font-size: var(--fs-4xl);
  font-weight: 900;
  line-height: 1.3;
  word-break: keep-all;
  max-width: 800px;
}

.cover-eyebrow {
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  opacity: .75;
  margin-bottom: var(--sp-4);
}

.cover-sub {
  font-size: var(--fs-xl);
  opacity: .85;
  line-height: 1.65;
  margin-top: var(--sp-5);
  word-break: keep-all;
  max-width: 640px;
}

.cover-meta {
  display: flex;
  gap: var(--sp-4);
  margin-top: var(--sp-8);
  flex-wrap: wrap;
  justify-content: center;
}

.cover-meta-item {
  background: rgba(255,255,255,.20);
  border: 1px solid rgba(255,255,255,.20);
  border-radius: var(--r-lg);
  padding: var(--sp-3) var(--sp-5);
  font-size: var(--fs-base);
  font-weight: 600;
  color: rgba(255,255,255,.95);
}

/* ── Section cover specific ── */
.section-icon {
  font-size: 3.5rem;
  margin-bottom: var(--sp-5);
}

.section-cover-title {
  font-size: var(--fs-5xl);
  font-weight: 900;
  line-height: 1.2;
  word-break: keep-all;
  max-width: 700px;
}

.section-cover-time {
  font-size: var(--fs-xl);
  opacity: .8;
  margin-top: var(--sp-4);
}

.section-cover-steps {
  display: flex;
  gap: var(--sp-4);
  margin-top: var(--sp-7);
  flex-wrap: wrap;
  justify-content: center;
}

.section-cover-step {
  background: rgba(255,255,255,.22);
  border-radius: var(--r-lg);
  padding: var(--sp-3) var(--sp-5);
  font-size: var(--fs-base);
  font-weight: 600;
  border: 1px solid rgba(255,255,255,.18);
}
