/* The tour (/tour/): a lesson beside the editor and what archec makes of it. On top of playground.css. */
body.page-tour { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.tour-page { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; padding: 12px max(12px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-bottom)); }

.tour-bar { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 10px; border-radius: 16px; border: var(--hair) solid var(--line); box-shadow: var(--shadow); }
.tour-pick select { max-width: 280px; }
.tour-dots { display: flex; gap: 6px; align-items: center; }
.tour-dot { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--fg-3); display: block; transition: background-color .2s, border-color .2s, transform .15s; }
.tour-dot:hover { border-color: var(--fg); transform: scale(1.15); }
.tour-dot.done { background: var(--ok, #248a3d); border-color: var(--ok, #248a3d); }
.tour-dot[aria-current] { box-shadow: 0 0 0 3px var(--fill-2); border-color: var(--fg); }
.tour-progress { font-size: 13px; color: var(--fg-2); white-space: nowrap; }
.tour-bar .btn .back { transform: rotate(180deg); }
.tour-bar .btn[disabled] { opacity: .4; pointer-events: none; }

.tour-main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 12px; }
.tour-lesson { min-height: 0; overflow: auto; padding: 20px 22px; border-radius: var(--r-l); border: var(--hair) solid var(--line); background: var(--card); box-shadow: var(--shadow); font-size: 15px; line-height: 1.55; }
.tour-lesson .eyebrow { margin-bottom: 6px; }
.tour-lesson h2 { font: 600 24px/1.2 var(--font-display); letter-spacing: -0.02em; margin: 0 0 12px; outline: none; }
.tour-lesson p { margin: 0 0 12px; }
.tour-lesson code { font: 13px var(--mono); background: var(--code-bg); border-radius: 5px; padding: 1px 5px; overflow-wrap: anywhere; }
.tour-task { margin-top: 18px; padding: 14px 16px; border-radius: var(--r); background: var(--fill); border: var(--hair) solid var(--line); }
.tour-task h3 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--fg-2); margin: 0 0 6px; }
.tour-check { display: flex; align-items: center; gap: 8px; font-weight: 600; margin: 12px 0 6px !important; }
.tour-check .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--fg-3); flex: none; }
.tour-check.wait .dot { animation: pulse 1s ease-in-out infinite; }
.tour-check.todo .dot { background: var(--warn); }
.tour-check.err .dot { background: var(--err); }
.tour-check.ok { color: var(--ok, #248a3d); }
.tour-check.ok .dot { background: var(--ok, #248a3d); width: 16px; height: 16px; display: grid; place-items: center; }
.tour-check.ok .dot::after { content: ""; width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.tour-hint { font-size: 14px; color: var(--fg-2); }
.tour-hint strong { color: var(--fg); }
.tour-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tour-finished { margin-top: 16px; padding: 12px 16px; border-radius: var(--r); border: 1.5px solid var(--ok, #248a3d); }
.tour-finished a { color: var(--fg); text-underline-offset: 2px; }
.tour-foot { margin-top: 18px !important; }
.tour-foot .linkbtn { color: var(--fg-3); font-weight: 400; }

.tour-work { min-height: 0; min-width: 0; display: grid; grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.tour-editor .editor-host { overflow: hidden; }
.tour-output .tour-panel { flex: 1; min-height: 0; overflow: auto; }
.tour-output .tour-panel[hidden] { display: none; }
.tour-output .diagram-view { cursor: default; touch-action: auto; overflow: auto; }
.tour-output .diagram-stage { will-change: auto; }
.tour-tests { list-style: none; margin: 0; padding: 10px; display: grid; gap: 8px; font-size: 14px; }
.tour-tests li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: start; padding: 10px 12px; border-radius: 12px; background: var(--fill); }
.tour-tests li.msg { display: block; color: var(--fg-2); background: none; }
.tour-tests .badge { font: 600 12px var(--font); text-transform: uppercase; letter-spacing: .03em; padding: 3px 8px; border-radius: 999px; color: #fff; background: var(--ok, #248a3d); }
.tour-tests .fail .badge { background: var(--err); }
.tour-tests .checks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tour-tests code { font: 12.5px var(--mono); padding: 2px 6px; border-radius: 6px; background: var(--code-bg); overflow-wrap: anywhere; }
.tour-tests code.no { color: var(--err); }
.tour-tests .err { color: var(--err); }
.tour-code { display: flex; flex-direction: column; }
.tour-code .panel-tools[hidden] { display: none; }
.tour-code-text { flex: 1; margin: 0; padding: 12px 16px; font: 12.5px/1.5 var(--mono); color: var(--syn-fg); white-space: pre; overflow: auto; }

:root { --ok: #248a3d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --ok: #30d158; } }
:root[data-theme="dark"] { --ok: #30d158; }
:root[data-theme="dark"] .tour-tests .badge, :root[data-theme="dark"] .tour-check.ok .dot::after { color: #000; border-color: #000; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tour-tests .badge, :root:not([data-theme="light"]) .tour-check.ok .dot::after { color: #000; border-color: #000; } }

/* wide screens: the page is the window, each pane scrolls */
@media (min-width: 901px) {
  body.page-tour { height: 100vh; height: 100dvh; overflow: hidden; }
}
/* phones and narrow windows: one column, the page scrolls */
@media (max-width: 900px) {
  .tour-main { grid-template-columns: minmax(0, 1fr); }
  .tour-lesson { overflow: visible; padding: 16px; }
  .tour-work { grid-template-rows: auto auto; }
  .tour-editor { height: 340px; }
  .tour-output { height: 360px; }
  .tour-dots { display: none; }
  .tour-bar { flex-wrap: wrap; }
  .tour-pick { flex: 1; min-width: 0; }
  .tour-pick select { max-width: none; width: 100%; }
  .tour-bar .btn .lbl { display: none; }
  .tour-bar .btn { padding: 0 10px; }
  .tour-progress { display: none; }
  .tour-bar .pg-spacer { display: none; }
}
