/* Installer page. Fonts are served from assets/fonts/ (no third-party requests): Russo One for headings,
   Golos Text for text, both SIL OFL 1.1 (licenses next to the files). */
@font-face {
  font-family: "Russo One";
  src: url("assets/fonts/RussoOne-Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Golos Text";
  src: url("assets/fonts/GolosText-Variable.woff2") format("woff2");
  font-weight: 400 900; font-style: normal; font-display: swap;
}

:root {
  --bg: #04060c;
  --panel: rgba(10, 18, 32, .9);
  --panel-solid: #0a1220;
  --line: #1b2a3d;          /* panel borders, pending steps */
  --line-strong: #2a3d55;   /* outlined buttons, inputs */
  --text: #d6e4f0;          /* 15:1 on --bg */
  --bright: #ffffff;
  --muted: #8ea6bc;         /* 7.6:1 on --bg */
  --dim: #7189a0;           /* pending labels, 5.3:1 on --bg */
  --label: #7f97ad;
  --cyan: #4fb3e8;          /* done, progress, info */
  --cyan-text: #9fd2ef;
  --orange: #f0a24b;        /* active step, primary action, warnings */
  --on-orange: #140c03;
  --green: #5fd3a0;
  --red: #ff7b7b;
  --head: "Russo One", "Avenir Next Condensed", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --body: "Golos Text", "SF Pro Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
[hidden], .card[hidden] { display: none !important; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; overflow-x: hidden; color: var(--text); background: var(--bg); font: 16px/1.6 var(--body); }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 16px; top: -64px; z-index: 10; padding: 10px 16px;
  background: var(--orange); color: var(--on-orange); font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 12px; }

a { color: var(--cyan-text); text-underline-offset: 3px; }
a:hover { color: var(--bright); }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
strong { color: var(--bright); font-weight: 600; }
code {
  font-family: var(--mono); font-size: .86em; color: var(--cyan-text);
  background: rgba(79, 179, 232, .08); padding: 1px 5px; overflow-wrap: anywhere;
}
.muted { color: var(--muted); }

/* ---- hero: the banner is the visible title; the h1 is for screen readers and search engines ---------------- */
.hero { position: relative; }
.banner-wrap { position: relative; max-width: 1200px; margin: 0 auto; overflow: hidden; }
.banner { display: block; width: 100%; height: auto; }
.banner-wrap::after { /* fade into the page */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(4, 6, 12, 0) 45%, var(--bg) 100%),
    linear-gradient(90deg, var(--bg) 0, rgba(4, 6, 12, 0) 6%, rgba(4, 6, 12, 0) 94%, var(--bg) 100%);
}
.hero-row {
  max-width: 900px; margin: 0 auto; padding: 4px 16px 0;
  display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap;
}
.hero-description { margin: 0; color: var(--text); font-size: 1.02rem; flex: 1 1 320px; }
.hero-tools { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.hero-link { color: var(--orange); font-size: .82rem; letter-spacing: .14em; text-transform: uppercase; text-decoration: none; }
.hero-link:hover { color: var(--bright); text-decoration: underline; }
.lang-switch { display: inline-flex; border: 1px solid var(--line-strong); }
.lang-btn {
  min-width: 40px; min-height: 32px; padding: 0 10px; cursor: pointer;
  font: 600 .75rem/1 var(--body); letter-spacing: .12em; color: var(--muted);
  background: transparent; border: 0;
}
.lang-btn + .lang-btn { border-left: 1px solid var(--line-strong); }
.lang-btn:hover { color: var(--bright); }
.lang-btn.active { background: var(--cyan); color: #04111b; }

/* ---- layout -------------------------------------------------------------------------------------------------- */
main { max-width: 900px; margin: 0 auto; padding: 22px 16px 32px; }
.lead { margin: 18px 0; color: var(--muted); }
h2 {
  margin: 0 0 14px; display: flex; align-items: center; gap: 10px;
  font: 400 1.12rem/1.3 var(--head); letter-spacing: .05em; color: var(--bright);
}
.num {
  display: inline-grid; place-items: center; width: 26px; height: 26px; flex-shrink: 0;
  font: 400 .85rem/1 var(--head); color: var(--cyan); border: 1px solid var(--cyan);
}
.card { margin: 14px 0; padding: 22px; background: var(--panel); border: 1px solid var(--line); }
.card.plain { background: transparent; }
.card.plain h2 { font-size: 1rem; }
.hint { margin: 12px 0 0; color: var(--muted); font-size: .92rem; }
.status { margin: 12px 0 0; min-height: 1.4em; color: var(--muted); overflow-wrap: anywhere; }
.status.err { color: var(--red); }

/* ---- step indicator ------------------------------------------------------------------------------------------ */
.wizard { margin: 0 0 6px; }
.wizard-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.wstep {
  padding: 8px 8px 0; border-top: 2px solid var(--line); color: var(--dim);
  font-size: .75rem; line-height: 1.35; letter-spacing: .08em; text-transform: uppercase; overflow-wrap: anywhere;
  transition: border-color .2s, color .2s;
}
.wstep.done { border-top-color: var(--cyan); color: var(--cyan-text); }
.wstep.active { border-top-color: var(--orange); color: var(--bright); }
.wstep.error { border-top-color: var(--red); color: var(--red); }
.wstep.optional { border-top-style: dashed; border-top-color: var(--line-strong); color: var(--muted); }

/* ---- step 1 controls ----------------------------------------------------------------------------------------- */
.seg { display: inline-flex; flex-wrap: wrap; max-width: 100%; border: 1px solid var(--line-strong); }
.seg label { cursor: pointer; flex: 1 1 auto; }
.seg label + label { border-left: 1px solid var(--line-strong); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 9px 16px; color: var(--muted); text-align: center; }
.seg label:hover span { color: var(--bright); }
.seg input:checked + span { color: var(--bright); background: rgba(79, 179, 232, .14); box-shadow: inset 0 -2px 0 var(--cyan); }
.seg input:focus-visible + span { outline: 2px solid var(--orange); outline-offset: -2px; }
.seg input:disabled + span { opacity: .5; cursor: not-allowed; }

.drop {
  margin-top: 14px; padding: 26px 16px; display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap;
  border: 1px dashed var(--line-strong); background: rgba(4, 6, 12, .5); transition: border-color .15s, background-color .15s;
}
.drop.over { border-color: var(--orange); background: rgba(240, 162, 75, .07); }
.or { color: var(--muted); }

/* ---- buttons ------------------------------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 11px 20px;
  font: 600 .875rem/1.2 var(--body); letter-spacing: .04em; text-align: center; text-decoration: none; cursor: pointer;
  color: #b9cbdc; background: transparent; border: 1px solid var(--line-strong); border-radius: 0;
  transition: border-color .15s, color .15s, background-color .15s;
}
a.btn { color: #b9cbdc; }
.btn:hover:not(:disabled) { border-color: var(--cyan); color: var(--bright); }
.btn:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.btn.primary { color: var(--on-orange); background: var(--orange); border-color: var(--orange); }
.btn.primary:hover:not(:disabled) { background: #f6b46a; border-color: #f6b46a; color: var(--on-orange); }
.btn.primary:focus-visible { outline-color: var(--bright); }
.btn.small { min-height: 34px; padding: 6px 14px; font-size: .82rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ---- step 2: edition ----------------------------------------------------------------------------------------- */
.ed { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; margin: 0; }
.ed dt { color: var(--label); font-size: .75rem; line-height: 1.9; letter-spacing: .1em; text-transform: uppercase; }
.ed dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.ed dd code { word-break: break-all; }
.edition-picker-wrap { margin-top: 10px; }
.edition-picker-label { display: block; margin-bottom: 4px; color: var(--muted); font-size: .85rem; }
.edition-picker {
  display: block; max-width: 100%; min-height: 40px; padding: 6px 10px; cursor: pointer;
  font: inherit; font-size: .92rem; color: var(--text); background: var(--panel-solid);
  border: 1px solid var(--line-strong); border-radius: 0;
}
.edition-picker:hover { border-color: var(--cyan); }
.badge { display: inline-block; padding: 1px 8px; font-size: .72rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; border: 1px solid; vertical-align: 1px; }
.badge.ok { color: var(--green); border-color: rgba(95, 211, 160, .5); }
.badge.bad { color: var(--red); border-color: rgba(255, 123, 123, .5); }
.badge.warn { color: var(--orange); border-color: rgba(240, 162, 75, .5); }

/* ---- notices ------------------------------------------------------------------------------------------------- */
.notice { margin: 14px 0 0; padding: 12px 16px; color: var(--text); background: rgba(79, 179, 232, .06); border: 1px solid var(--line); border-left: 2px solid var(--cyan); }
.notice.warn { color: #fbe3c6; background: rgba(240, 162, 75, .08); border-color: rgba(240, 162, 75, .4); border-left-color: var(--orange); }
.notice.err { color: #ffd6d6; background: rgba(255, 123, 123, .08); border-color: rgba(255, 123, 123, .4); border-left-color: var(--red); }
.notice.ok { color: #d2f5e5; background: rgba(95, 211, 160, .07); border-color: rgba(95, 211, 160, .35); border-left-color: var(--green); }
.notice strong { color: inherit; }
.notice .muted { color: inherit; opacity: .85; }
.notice p { margin: 4px 0; overflow-wrap: anywhere; }
.notice ul { margin: 6px 0; padding-left: 22px; }

/* ---- step 4: info cards, progress ---------------------------------------------------------------------------- */
.info p { margin: 8px 0; color: var(--muted); }
.info-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 10px; margin: 4px 0 12px; }
.info-card { padding: 4px 12px; border-left: 2px solid var(--cyan); min-width: 0; }
.info-card span { display: block; color: var(--label); font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; }
.info-card b { display: block; color: var(--bright); font-weight: 600; overflow-wrap: anywhere; }

.progress-panel { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.stages { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.stage .top, .stage .bottom { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.stage .name { font: 400 .95rem/1.3 var(--head); letter-spacing: .04em; color: var(--bright); }
.stage .pct, .stage .eta { color: var(--muted); font-size: .82rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.stage .label { min-width: 0; color: var(--muted); font-size: .82rem; overflow-wrap: anywhere; }
.stage.pending { opacity: .55; }
.stage.pending .name { color: var(--text); }
.stage.active .name { color: var(--bright); }
.stage.active .pct { color: var(--bright); }
.stage.done .pct { color: var(--cyan-text); }
.stage.error .name, .stage.error .pct { color: var(--red); }
.stage.skipped { display: none; }
.bar { position: relative; height: 4px; margin: 7px 0 5px; overflow: hidden; background: #14202f; }
.bar > i { display: block; height: 100%; width: 0; background: var(--cyan); transition: width .25s linear; }
.stage.error .bar > i { background: var(--red); }
.bar.indeterminate > i { width: 35% !important; animation: bar-sweep 1.5s ease-in-out infinite; }
@keyframes bar-sweep { from { transform: translateX(-100%); } to { transform: translateX(290%); } }

.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 16px 0 6px; }
#elapsed { font-variant-numeric: tabular-nums; }
details { margin-top: 10px; }
summary { cursor: pointer; color: var(--muted); font-size: .85rem; letter-spacing: .08em; text-transform: uppercase; }
summary:hover { color: var(--bright); }
pre {
  margin: 10px 0 0; padding: 12px; overflow: auto; max-height: 280px;
  font: .8rem/1.45 var(--mono); color: #c3d3e2; background: #02040a; border: 1px solid var(--line);
}
pre.tree { max-height: none; }

/* ---- DLC list ------------------------------------------------------------------------------------------------ */
.dlc-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.dlc-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; border-left: 2px solid var(--cyan); background: rgba(79, 179, 232, .05); }
.dlc-list .meta { min-width: 0; }
.dlc-list .meta strong { display: block; }
.dlc-list .meta .muted { font-size: .84rem; overflow-wrap: anywhere; }
#dlc-status { white-space: pre-line; }
#nsp-status, #nsp-keys-status, #nsp-base-status, #nsp-full-info, #nsp-update-info { white-space: pre-line; }
.nsp-option { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.nsp-option > summary { cursor: pointer; color: var(--muted); }
.nsp-option[open] > summary { color: var(--bright); }
.nsp-option .seg { margin-top: 14px; }
.nsp-field { display: flex; align-items: center; gap: 4px 14px; flex-wrap: wrap; margin-top: 14px; }
.nsp-field .status { margin: 0; flex: 1 1 240px; }
.nsp-panel { margin-top: 6px; padding-left: 14px; border-left: 2px solid var(--line-strong); }
.nsp-panel .status:empty { display: none; }
.check { display: flex; align-items: flex-start; gap: 10px; margin-top: 14px; color: var(--text); font-size: .92rem; cursor: pointer; }
.check input { margin-top: 4px; width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--cyan); }
.number { display: flex; align-items: center; gap: 12px; margin-top: 14px; color: var(--label); font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; }
.number input {
  width: 7em; min-height: 40px; padding: 6px 10px; font: inherit; font-size: .95rem; letter-spacing: 0; color: var(--text);
  background: var(--panel-solid); border: 1px solid var(--line-strong); border-radius: 0;
}
.number input:focus-visible { outline: 2px solid var(--orange); outline-offset: 1px; }
.result-actions { margin-top: 10px; }

/* ---- secondary sections & footer ----------------------------------------------------------------------------- */
.credits-list { margin: 8px 0; padding-left: 20px; color: var(--muted); }
.credits-list li { margin-bottom: 8px; }
.credits-list em { font-size: .88em; }
footer { max-width: 900px; margin: 0 auto; padding: 18px 16px 40px; color: var(--muted); font-size: .86rem; border-top: 1px solid var(--line); }

/* ---- phones -------------------------------------------------------------------------------------------------- */
@media (max-width: 600px) {
  .hero-row { padding-top: 0; }
  .hero-description { font-size: .95rem; flex-basis: 100%; }
  .hero-tools { width: 100%; justify-content: space-between; }
  main { padding-top: 18px; }
  .card { padding: 18px 16px; }
  .wizard-steps { gap: 4px; }
  .wstep { padding: 6px 2px 0; font-size: .66rem; letter-spacing: .04em; }
  .seg { display: flex; flex-direction: column; width: 100%; }
  .seg label + label { border-left: 0; border-top: 1px solid var(--line-strong); }
  .drop { flex-direction: column; gap: 10px; }
  .btn { width: 100%; }
  .row .btn, .dlc-list .btn { width: auto; }
  .actions .btn { flex: 1 1 100%; }
  .ed { grid-template-columns: 1fr; gap: 0; }
  .ed dd { margin-bottom: 10px; }
  .info-cards { grid-template-columns: 1fr; }
  .stage .bottom { flex-direction: column; gap: 0; }
  .dlc-list li { flex-direction: column; align-items: stretch; }
  .nsp-panel { padding-left: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .bar.indeterminate > i { width: 100% !important; transform: none; opacity: .4; }
}
