:root {
    --bg: #0d0f14;
    --panel: #161a22;
    --panel-2: #1c212c;
    --line: #2a3140;
    --text: #e8ebf1;
    --muted: #98a2b3;
    --accent: #7c8cff;
    --accent-ink: #0b0d18;
    --good: #3ecf8e;
    --warn: #f5b942;
    --bad: #ff6b6b;
    color-scheme: dark;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.masthead, main, footer {
    max-width: 780px;
    margin: 0 auto;
    padding: 0 20px;
}

.masthead { padding-top: 40px; padding-bottom: 8px; }
.masthead h1 { margin: 0 0 8px; font-size: 1.9rem; letter-spacing: -0.01em; }
.masthead p { margin: 0; color: var(--muted); max-width: 62ch; }

h2 { margin: 0; font-size: 1.15rem; }
h3 { margin: 0 0 6px; font-size: 1rem; }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.92em; }
a { color: var(--accent); }

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 20px;
    margin: 18px 0;
}

.card-head { display: flex; gap: 14px; align-items: flex-start; }
.card-head > div { flex: 1; min-width: 0; }
.sub { margin: 4px 0 0; color: var(--muted); font-size: 0.93rem; }

.step {
    flex: none;
    width: 30px; height: 30px;
    border-radius: 50%;
    background: var(--panel-2);
    border: 1px solid var(--line);
    display: grid; place-items: center;
    font-weight: 600; font-size: 0.9rem; color: var(--muted);
}

.dot {
    flex: none;
    width: 12px; height: 12px; margin-top: 9px;
    border-radius: 50%;
    background: #4a5263;
}
.dot.good { background: var(--good); box-shadow: 0 0 10px color-mix(in srgb, var(--good) 60%, transparent); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }
.dot.busy { background: var(--accent); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

.status { margin: 14px 0 0; }
.status:empty { display: none; }
.status.good { color: var(--good); }
.status.warn { color: var(--warn); }
.status.bad { color: var(--bad); }

.facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin: 14px 0 0;
}
.facts div { background: var(--panel-2); border-radius: 10px; padding: 9px 12px; }
.facts dt { color: var(--muted); font-size: 0.78rem; }
.facts dd { margin: 2px 0 0; font-weight: 600; font-size: 0.95rem; overflow-wrap: anywhere; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 16px; }

button {
    font: inherit; font-weight: 600; font-size: 0.93rem;
    color: var(--text);
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 8px 15px;
    cursor: pointer;
}
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover:not(:disabled) { filter: brightness(1.08); }
button.quiet { background: none; font-weight: 500; color: var(--muted); padding: 5px 10px; }

.check { display: inline-flex; gap: 7px; align-items: center; color: var(--muted); font-size: 0.88rem; }

.progress { height: 8px; margin-top: 14px; background: var(--panel-2); border-radius: 99px; overflow: hidden; }
.progress .bar { height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width 0.15s linear; }

.panel { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.panel .status { margin-top: 4px; }

.drop {
    display: grid; gap: 2px; justify-items: center; text-align: center;
    margin-top: 12px; padding: 22px 16px;
    border: 2px dashed var(--line); border-radius: 12px;
    color: var(--muted);
    cursor: pointer;
}
.drop strong { color: var(--text); }
.drop.over, .drop:hover, .drop:focus-within { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, transparent); }
.drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }

.fine { color: var(--muted); font-size: 0.86rem; margin: 12px 0 0; }
ol.fine { padding-left: 1.3em; }
ol.fine li { margin: 4px 0; }

.more { margin-top: 16px; }
.more summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; }
.more input[type=file] { color: var(--muted); font-size: 0.85rem; max-width: 100%; }

.session { margin-top: 16px; padding: 14px 16px; background: var(--panel-2); border-radius: 12px; border-left: 3px solid var(--accent); }
.session.good { border-left-color: var(--good); }
.session.warn { border-left-color: var(--warn); }
.headline { margin: 0; font-weight: 650; font-size: 1.05rem; }
.hint { margin: 4px 0 0; color: var(--muted); font-size: 0.9rem; }
.hint:empty { display: none; }

/* A card whose step is done: one line, nothing to press. */
.card.done { padding-top: 16px; padding-bottom: 14px; }
.card.done .sub { display: none; }
.card.done .status { margin-top: 8px; }
.card.done .more { margin-top: 8px; display: inline-block; margin-right: 18px; vertical-align: top; }
.card.done .more[open] { display: block; }
.actions:empty, .actions.empty { display: none; }

.steps { margin: 14px 0 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { counter-increment: step; position: relative; padding: 7px 0 7px 34px; color: var(--muted); }
.steps li::before {
    content: counter(step);
    position: absolute; left: 0; top: 6px;
    width: 22px; height: 22px; border-radius: 50%;
    display: grid; place-items: center;
    font-size: 0.78rem; font-weight: 600;
    border: 1px solid var(--line); background: var(--panel-2);
}
.steps li.current { color: var(--text); }
.steps li.current::before { border-color: var(--accent); color: var(--accent); }
.steps li.done::before { content: "✓"; background: var(--good); border-color: var(--good); color: var(--accent-ink); }
.steps li .actions, .steps li .progress { display: none; margin-top: 8px; }
.steps li.current .actions { display: flex; }
.steps li.current .progress { display: block; }

.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 14px; margin-top: 16px; }
.choice { border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.choice p { margin: 0; font-size: 0.93rem; }
.choice .fine { margin-top: 10px; }
.choice .status { margin-top: 10px; font-size: 0.9rem; min-height: 0; }
.choice .status:empty { display: none; }

.wires { border-collapse: collapse; margin-top: 12px; font-size: 0.93rem; }
.wires th { text-align: left; padding: 0 28px 5px 0; color: var(--muted); font-size: 0.78rem; font-weight: 500; }
.wires td { padding: 5px 28px 5px 0; font-weight: 600; border-top: 1px solid var(--line); }

#log-card summary { cursor: pointer; list-style-position: inside; }
#log-card summary h2 { display: inline; }
#log {
    margin: 12px 0 0; padding: 12px;
    max-height: 320px; overflow: auto;
    background: #0a0c10; border: 1px solid var(--line); border-radius: 10px;
    font: 12.5px/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    white-space: pre-wrap; overflow-wrap: anywhere;
}

.notice { border-radius: 12px; padding: 13px 16px; margin: 18px 0 0; border: 1px solid var(--line); }
.notice-error { border-color: color-mix(in srgb, var(--bad) 55%, transparent); background: color-mix(in srgb, var(--bad) 9%, transparent); }

footer { padding-top: 6px; padding-bottom: 44px; }
footer p { color: var(--muted); font-size: 0.82rem; }

[hidden] { display: none !important; }

@media (max-width: 520px) {
    .card { padding: 16px; }
    .masthead { padding-top: 26px; }
}

@media (max-width: 1000px) {
    body:has(#gblink-launcher-return) .masthead { padding-top: 56px; }
}
