:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #1c2233;
  --muted: #5d6578;
  /* Основний колір EduProstir (--primary і --primary-hover сайту, шкала --pink-*), щоб кнопки були як «Надіслати». */
  --accent: #e0185c;
  --accent-hover: #ba0f4b;
  --accent-text: #ffffff;
  --ring: #ff3377;
  --border: #e3e6ee;
  --error: #c62828;
  --ok: #1b8a4b;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

#canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  border: 0;
  background: #1d1d1d;
  outline: none;
  touch-action: none;
  user-select: none;
  visibility: hidden;
}
#canvas.ready { visibility: visible; }

#splash {
  position: fixed;
  inset: 0;
  z-index: 10;
  overflow: auto;
  background: var(--bg);
}
#splash.done { display: none; }

.stage {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

.stage-inner {
  width: min(560px, 100%);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.splash-title { margin: 0; font-size: 28px; line-height: 1.2; }
.project-copy { margin: 0; color: var(--muted); }
.lesson-title { margin: 0; font-size: 20px; font-weight: 600; }

.lesson-list { display: flex; flex-direction: column; gap: 10px; }
.lesson-list[hidden] { display: none; }
.lesson-link {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}
.lesson-link span { color: var(--muted); font-weight: 400; white-space: nowrap; }
.lesson-link:hover, .lesson-link:focus-visible { border-color: var(--accent); }

.launch-panel {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
}
.launch-panel[hidden] { display: none; }
.panel-loading, .panel-ready { display: none; flex-direction: column; gap: 10px; }
#stage-card[data-phase=loading] .panel-loading,
#stage-card[data-phase=ready] .panel-ready,
#stage-card[data-phase=console] .panel-ready { display: flex; }

.progress-track { height: 8px; overflow: hidden; border-radius: 999px; background: #eceef4; }
.progress-fill { width: 0; height: 100%; background: var(--accent); transition: width .2s; }
.progress-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; }
.splash-status { margin: 0; color: var(--muted); font-size: 14px; }
.splash-status.error { color: var(--error); }

.start-btn {
  padding: 14px 20px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
}
.start-btn:hover:not(:disabled) { background: var(--accent-hover); }
.start-btn:focus-visible, .edu-finish-btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--ring) 50%, transparent); outline-offset: 2px; }
.start-btn:disabled { opacity: .5; cursor: default; }
.note, .gpu-warning-text { margin: 0; color: var(--muted); font-size: 14px; }
.note[hidden], .gpu-warning[hidden], .gpu-ack-row[hidden] { display: none; }
.gpu-warning { margin-top: 12px; }
.gpu-ack-row { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }

.startup-console summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.console-box {
  height: 200px;
  margin-top: 8px;
  overflow: auto;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  font: 12px/1.45 ui-monospace, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}
.console-line { margin: 0; }
.console-line.warn { color: #a15c00; }
.console-line.error { color: var(--error); }
.console-prefix { color: #9aa1ad; }

.credits { margin: 0; color: var(--muted); font-size: 13px; }
.credits a { color: inherit; }

.edu-progress {
  position: fixed;
  left: 50%;
  bottom: 12px;
  z-index: 5;
  transform: translateX(-50%);
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(20, 24, 36, .85);
  color: #fff;
  font-size: 14px;
  pointer-events: none;
}
.edu-progress[hidden] { display: none; }
.edu-progress.done { background: var(--ok); }

/* Картка після уроку: наступний урок або список уроків. Блендер лишається відкритим, тож картка внизу й невелика. */
.edu-finish {
  position: fixed;
  left: 50%;
  bottom: 16px;
  z-index: 6;
  transform: translateX(-50%);
  width: min(420px, calc(100vw - 32px));
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--card);
  color: var(--text);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .35);
}
.edu-finish[hidden] { display: none; }
.edu-finish-title { margin: 0; font-weight: 700; color: var(--ok); }
.edu-finish-text { margin: 4px 0 12px; color: var(--muted); font-size: 14px; }
.edu-finish-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.edu-finish-btn {
  flex: 1;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}
.edu-finish-btn:hover { background: var(--accent-hover); }
.edu-finish-btn[hidden] { display: none; }
.edu-finish-btn.secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.edu-finish-btn.secondary:hover { background: var(--card); border-color: var(--accent); }
.lesson-link.done { color: var(--muted); }
.lesson-link.next { border-color: var(--accent); }
.lesson-link.free { border-style: dashed; }
