:root {
  --bg: #f6f6f9; --card: #ffffff; --fg: #16161b; --muted: #55555f; --line: #dcdce4;
  --accent: #c2185b; --accent-fg: #ffffff; --accent-soft: #fbe3ee;
  --ok: #1b7f3b; --ok-soft: #e3f4e8; --warn: #9a4b00; --warn-soft: #fff1dc;
  --bad: #b3261e; --bad-soft: #fde7e5; --focus: #1a5fd0;
  --chooser: #ffffff; --chooser-line: #d0d0d8; --chooser-pick: #d9e7ff;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101014; --card: #19191f; --fg: #ececf2; --muted: #a8a8b4; --line: #31313b;
    --accent: #ff5ca2; --accent-fg: #1a0a12; --accent-soft: #3a1828;
    --ok: #6fd58b; --ok-soft: #15301d; --warn: #ffb35c; --warn-soft: #33240f;
    --bad: #ff8a80; --bad-soft: #3a1714; --focus: #8ab4ff;
    --chooser: #2a2a30; --chooser-line: #45454f; --chooser-pick: #2f4466;
  }
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--fg); font: 17px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
main { max-width: 760px; margin: 0 auto; padding: 28px 20px 56px; }
h1 { font-size: 1.9rem; line-height: 1.2; margin: 0 0 10px; }
h2 { font-size: 1.15rem; margin: 0; }
p { margin: 0 0 10px; }
.lead { font-size: 1.08rem; }
.small { color: var(--muted); font-size: 0.92rem; }
b { font-weight: 650; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; margin: 16px 0; }
.notice { border-color: var(--warn); background: var(--warn-soft); }
.notice h2 { margin-bottom: 8px; }
ul.checks { margin: 8px 0 0; padding-left: 1.2em; }
ul.checks li { margin: 4px 0; }
.before h2 { margin-bottom: 4px; }

/* ------------------------------------------------ the step list */
ol.steps { list-style: none; margin: 18px 0; padding: 0; counter-reset: none; }
.step { background: var(--card); border: 1px solid var(--line); border-radius: 14px; margin: 10px 0; padding: 14px 20px; }
.step-head { display: flex; align-items: center; gap: 12px; }
.step-head h2 { flex: 1; }
.optional { color: var(--muted); font-weight: 400; font-size: 0.95rem; }
.badge { flex: none; width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.95rem; border: 2px solid var(--line); color: var(--muted); }
.state { font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.step .body { display: none; margin-top: 12px; }
.step .summary { display: none; margin: 6px 0 0 42px; color: var(--muted); font-size: 0.95rem; }
.step.is-current { border: 2px solid var(--accent); padding: 13px 19px; }
.step.is-current .badge { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.step.is-current .state { color: var(--accent); }
.step.is-current .body { display: block; }
.step.is-done .badge { background: var(--ok); border-color: var(--ok); color: var(--card); }
.step.is-done .state { color: var(--ok); }
.step.is-done .summary { display: block; }
.step.is-todo h2 { color: var(--muted); }
.step .body > p, .step .body .sub, .step .body .actions, .step .body .form, .step .body .saves { margin-left: 42px; }
.step .body .saves .actions, .step .body .working .actions, .step .body .problem .actions, .problem .actions { margin-left: 0; }
.step .body .actions[hidden] { display: none; }
@media (max-width: 520px) { .step .body > p, .step .body .sub, .step .body .actions, .step .body .form, .step .body .saves { margin-left: 0; } }

.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 14px; }
button { font: inherit; font-weight: 600; padding: 10px 20px; border-radius: 10px; border: 2px solid transparent; cursor: pointer; }
button.primary { background: var(--accent); color: var(--accent-fg); }
button.primary:hover { filter: brightness(1.07); }
button.secondary { background: transparent; color: var(--fg); border-color: var(--line); }
button.secondary:hover { border-color: var(--muted); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button[hidden] { display: none; }

/* step 1: the two devices */
.sub { border-left: 3px solid var(--line); padding: 6px 0 6px 14px; margin-top: 12px; }
.sub.sub-next { border-left-color: var(--accent); }
.sub.sub-done { border-left-color: var(--ok); opacity: 0.75; }
.sub.sub-done .chooser { display: none; }
.sub:not(.sub-next):not(.sub-done) .chooser { opacity: 0.55; }
.sub.sub-done .subtitle::after { content: "  Done"; color: var(--ok); font-weight: 700; }
.subnum { display: inline-block; font-weight: 700; color: var(--accent); margin-right: 4px; }
.sub.sub-done .subnum { color: var(--ok); }
.subtitle { margin-bottom: 8px; }

/* a small picture of Chrome's device list */
.chooser { width: min(380px, 100%); background: var(--chooser); border: 1px solid var(--chooser-line); border-radius: 10px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12); padding: 12px; margin: 6px 0 8px; font-size: 0.88rem; }
.chooser-title { font-weight: 600; margin-bottom: 8px; }
.chooser-row { padding: 7px 10px; border-radius: 6px; margin: 2px 0; }
.chooser-row.dim { color: var(--muted); }
.chooser-row.pick { background: var(--chooser-pick); font-weight: 600; outline: 2px solid var(--focus); outline-offset: -2px; }
.chooser-sub { font-weight: 400; color: var(--muted); }
.chooser-buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.cbtn { padding: 4px 12px; border-radius: 14px; border: 1px solid var(--chooser-line); }
.cbtn.blue { background: #1a73e8; color: #fff; border-color: #1a73e8; }

/* saving the backup */
.savelist { margin: 6px 0 0; padding-left: 1.4em; font-size: 0.9rem; word-break: break-all; }
.savelist li { margin: 3px 0; color: var(--muted); }
.savelist li.next { color: var(--fg); font-weight: 600; }
.savelist li.saved { color: var(--ok); }
.savelist li.saved::after { content: "  saved and checked"; font-weight: 600; }

/* Wi-Fi form */
.form { display: grid; grid-template-columns: max-content minmax(0, 320px); gap: 8px 12px; align-items: center; margin-top: 10px; }
.form .small { grid-column: 1 / -1; margin: 0; }
@media (max-width: 520px) { .form { grid-template-columns: 1fr; } }
label { font-size: 0.95rem; }
input { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); width: 100%; max-width: 100%; }
input[type=file] { padding: 6px; }

/* work in progress */
.working { margin: 14px 0 4px 42px; padding: 14px 16px; }
@media (max-width: 520px) { .working { margin-left: 0; } }
.work-title { font-weight: 700; margin-bottom: 8px; }
.bar { height: 14px; border-radius: 7px; background: var(--line); overflow: hidden; }
.fill { height: 100%; width: 0; background: var(--accent); transition: width 0.4s ease; }
.work-meta { margin: 8px 0 0; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; }
.stagelist { margin: 10px 0 0; padding-left: 1.3em; font-size: 0.92rem; color: var(--muted); }
.stagelist li.st-now { color: var(--fg); font-weight: 600; }
.stagelist li.st-done { color: var(--ok); }
.stagelist li.st-done::after { content: "  done"; }

/* problems */
.problem { margin: 14px 0 4px 42px; border: 2px solid var(--bad); background: var(--bad-soft); }
.problem.info { border-color: var(--warn); background: var(--warn-soft); }
.problem.critical { border-width: 3px; }
.problem h2 { margin-bottom: 6px; }
.problem ol { margin: 0; padding-left: 1.3em; }
@media (max-width: 520px) { .problem { margin-left: 0; } }
.hint { color: var(--bad); }

/* the banner while the Chromatic must stay connected */
.banner { position: sticky; top: 0; z-index: 10; background: var(--bad); color: #fff; padding: 10px 20px; text-align: center; font-size: 0.98rem; }
.banner.mild { background: var(--warn); }
@media (prefers-color-scheme: dark) { .banner { color: #16161b; } }
.banner strong { margin-right: 8px; }

/* done */
.done-title { font-weight: 700; font-size: 1.05rem; color: var(--ok); }
ol.next { margin: 6px 0 10px 42px; padding-left: 1.2em; }
ol.next li { margin: 6px 0; }
@media (max-width: 520px) { ol.next { margin-left: 0; } }

details.card summary { cursor: pointer; font-weight: 650; }
details.card[open] summary { margin-bottom: 10px; }
pre#log { max-height: 320px; overflow: auto; font-size: 0.8rem; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px; white-space: pre-wrap; word-break: break-word; }

dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--fg); max-width: min(540px, 92vw); padding: 22px; }
dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
dialog h2 { margin-bottom: 8px; }
dialog label { display: block; margin: 12px 0 6px; }
footer { margin-top: 28px; }
[hidden] { display: none !important; }
#restore-box .problem, #restore-box .working { margin-left: 0; }
#step-done.is-current { border-color: var(--ok); }
#step-done.is-current .badge { background: var(--ok); border-color: var(--ok); color: var(--card); }
#step-done.is-current .state { color: var(--ok); }
/* ------------------------------------------------ installerux2: back up / install choices */
.step .body .panel { margin-left: 42px; }
.panel.warn { border-left-color: var(--warn); background: var(--warn-soft); border-radius: 0 10px 10px 0; padding: 10px 14px; }
.panel .checks { margin: 6px 0 10px; padding-left: 1.2em; }
.panel label { display: block; margin: 8px 0 4px; font-weight: 600; }
.panel input { max-width: 360px; }
.exit-row { border-top: 1px solid var(--line); padding-top: 12px; }
.remembered { border-left: 3px solid var(--ok); padding-left: 10px; }
button.danger { color: var(--bad); border-color: var(--bad); }
.exit { border: 2px solid var(--ok); }
.exit h2 { color: var(--ok); margin-bottom: 6px; }
@media (max-width: 520px) { .step .body .panel { margin-left: 0; } }
.warn-line { color: var(--warn); font-weight: 600; }
.step .body .panel .actions { margin-left: 0; }
.step.is-done.is-skipped .badge { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.step.is-done.is-skipped .state, .step.is-done.is-skipped .summary { color: var(--warn); }
.reconnect-row { margin: 8px 0 0 42px; }
.reconnect-row button { padding: 6px 14px; font-size: 0.92rem; }
@media (max-width: 520px) { .reconnect-row { margin-left: 0; } }
/* in-progress words: cycling " . . ." (aria-hidden; still under reduced motion) */
.dots { display: inline-block; margin-left: 0.15em; letter-spacing: 0; }
.dots b { font-weight: inherit; margin-left: 0.25em; animation: dotcycle 1.4s infinite; opacity: 0.15; }
.dots b:nth-child(2) { animation-delay: 0.25s; }
.dots b:nth-child(3) { animation-delay: 0.5s; }
@keyframes dotcycle { 0%, 20% { opacity: 0.15; } 40%, 80% { opacity: 1; } 100% { opacity: 0.15; } }
@media (prefers-reduced-motion: reduce) { .dots b { animation: none; opacity: 1; } }
.status { margin: 10px 0 0 42px; }
.where { margin-top: 12px; border-left: 3px solid var(--ok); padding-left: 10px; }
@media (max-width: 520px) { .status { margin-left: 0; } }
.playonline { margin: 14px 0 6px; font-weight: 600; }
