:root {
  color-scheme: light;
  --paper: #f1eee5;
  --surface: #fffdf7;
  --surface-muted: #e9e4d9;
  --ink: #202823;
  --muted: #687169;
  --line: #d5d1c6;
  --line-strong: #aaa99f;
  --accent: #c76049;
  --accent-dark: #9f4837;
  --link: #286276;
  --success: #4d775f;
  --warning: #f2e5b8;
  --warning-line: #d1ba69;
  --danger: #a94d47;
  --field-label: #414b44;
  --input: #fffefa;
  --placeholder: #9a9d98;
  --callout-text: #746633;
  --progress-muted: #8c918c;
  --success-bg: #e5eee7;
  --error-border: #d29a95;
  --error-bg: #f4dedb;
  --error-copy: #875c58;
  --card-shadow: rgba(50, 57, 52, 0.08);
  --on-accent: #fffdf7;
  --primary-bg: #202823;
  --primary-text: #fffdf7;
  --primary-hover: #9f4837;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #151714;
  --surface: #1d201c;
  --surface-muted: #282c26;
  --ink: #f0eee7;
  --muted: #a5aaa2;
  --line: #363a34;
  --line-strong: #555b52;
  --accent: #df765e;
  --accent-dark: #f08a72;
  --link: #78b4c7;
  --success: #7eaf91;
  --warning: #39331f;
  --warning-line: #746731;
  --danger: #e3847c;
  --field-label: #d9dcd5;
  --input: #181a17;
  --placeholder: #777c74;
  --callout-text: #d9c77c;
  --progress-muted: #797e77;
  --success-bg: #233128;
  --error-border: #7a4542;
  --error-bg: #352321;
  --error-copy: #dca5a0;
  --card-shadow: rgba(0, 0, 0, 0.28);
  --primary-bg: #df765e;
  --primary-text: #171916;
  --primary-hover: #f08a72;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  transition: background-color 160ms ease, color 160ms ease;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

button,
summary,
a {
  -webkit-tap-highlight-color: transparent;
}

.topbar {
  display: flex;
  width: min(1040px, calc(100% - 48px));
  margin: 0 auto;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  border: 1px solid var(--ink);
  border-radius: 5px;
  background: var(--accent);
  place-items: center;
}

.brand-mark svg {
  width: 23px;
  fill: none;
  stroke: var(--on-accent);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.brand > span:last-child {
  display: flex;
  align-items: center;
}

.brand strong {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 14px;
  letter-spacing: -0.02em;
}

.secure-note {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.secure-note svg {
  width: 16px;
  fill: none;
  stroke: var(--success);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.header-actions {
  display: flex;
  gap: 18px;
  align-items: center;
}

.theme-toggle,
.repo-button {
  display: inline-flex;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  cursor: pointer;
  color: var(--ink);
  background: var(--surface);
  gap: 7px;
  align-items: center;
  justify-content: center;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  text-decoration: none;
}

.theme-toggle {
  min-width: 76px;
}

.repo-button {
  min-width: 82px;
}

.theme-toggle:hover,
.repo-button:hover {
  border-color: var(--accent);
}

.theme-icon,
.repo-button svg {
  width: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

:root[data-theme="light"] .sun-icon,
:root[data-theme="dark"] .moon-icon {
  display: none;
}

.shell {
  display: block;
  width: min(900px, calc(100% - 48px));
  margin: 64px auto 92px;
}

.intro {
  margin-bottom: 46px;
}

.eyebrow,
.step-label {
  display: block;
  color: var(--accent-dark);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.intro h1 {
  max-width: 760px;
  margin: 18px 0 22px;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: clamp(52px, 7vw, 76px);
  font-weight: 600;
  letter-spacing: -0.065em;
  line-height: 0.98;
}

.intro > p {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.72;
}

.included-line {
  display: flex;
  max-width: 100%;
  margin-top: 34px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
}

.included-line strong {
  color: var(--ink);
  font-weight: 600;
}

.included-line i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--accent);
}

.setup-card {
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: 6px 7px 0 var(--card-shadow);
}

.card-heading {
  display: flex;
  padding: 31px 40px 27px;
  border-bottom: 1px solid var(--line);
  align-items: flex-start;
  justify-content: space-between;
}

.step-label {
  margin-bottom: 8px;
}

.card-heading h2,
.result-panel h2 {
  margin: 0;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 23px;
  letter-spacing: -0.035em;
}

form {
  padding: 36px 40px 40px;
}

.section-title {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  align-items: center;
}

.section-title > span {
  display: grid;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--accent-dark);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  font-weight: 700;
  place-items: center;
}

.section-title > div {
  display: flex;
  flex-direction: column;
}

.section-title strong {
  font-size: 14px;
}

.section-title small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.field {
  display: block;
  margin-bottom: 20px;
}

.field > span:first-child {
  display: flex;
  margin-bottom: 8px;
  align-items: center;
  justify-content: space-between;
  color: var(--field-label);
  font-size: 12px;
  font-weight: 650;
}

.field i {
  color: var(--muted);
  font-size: 9px;
  font-style: normal;
  font-weight: 500;
}

.input-wrap {
  display: flex;
  height: 52px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--input);
  transition: border-color 140ms ease, box-shadow 140ms ease;
  align-items: center;
}

.input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(199, 96, 73, 0.12);
}

.input-wrap > svg {
  width: 17px;
  margin-left: 13px;
  fill: none;
  stroke: #7d837e;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.input-wrap input {
  width: 100%;
  height: 100%;
  min-width: 0;
  padding: 0 12px;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 13px;
}

.input-wrap input::placeholder {
  color: var(--placeholder);
}

.input-wrap.compact input {
  padding-left: 13px;
}

.icon-button,
.text-button {
  flex: 0 0 auto;
  border: 0;
  cursor: pointer;
  background: transparent;
}

.icon-button {
  display: grid;
  width: 42px;
  height: 100%;
  color: var(--muted);
  place-items: center;
}

.icon-button:hover {
  color: var(--ink);
}

.icon-button svg {
  width: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.text-button {
  height: 28px;
  margin-right: 7px;
  padding: 0 8px;
  border-radius: 3px;
  color: var(--link);
  font-size: 9px;
  font-weight: 750;
  text-transform: uppercase;
}

.text-button:hover {
  background: var(--surface-muted);
}

.field-help {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.field-help a {
  color: var(--link);
}

.field-error {
  display: block;
  margin-top: 7px;
  color: var(--danger);
  font-size: 10px;
  font-weight: 650;
  line-height: 1.45;
}

.field-error[hidden] {
  display: none;
}

.field.has-error .input-wrap {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--danger) 14%, transparent);
}

.field.has-error > span:first-child {
  color: var(--danger);
}

.divider {
  height: 1px;
  margin: 27px 0;
  background: var(--line);
}

.torbox-callout {
  display: grid;
  margin-bottom: 20px;
  padding: 13px 14px;
  border: 1px solid var(--warning-line);
  border-radius: 4px;
  background: var(--warning);
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.torbox-callout > div {
  display: flex;
  flex-direction: column;
}

.torbox-callout strong {
  font-size: 11px;
}

.torbox-callout small {
  margin-top: 3px;
  color: var(--callout-text);
  font-size: 10px;
}

.torbox-callout a {
  display: inline-flex;
  gap: 3px;
  align-items: center;
  color: var(--callout-text);
  font-size: 9px;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-transform: uppercase;
}

.torbox-callout a svg {
  width: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.advanced {
  margin: 23px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.advanced summary {
  display: flex;
  padding: 13px 0;
  cursor: pointer;
  list-style: none;
  align-items: center;
  justify-content: space-between;
}

.advanced summary::-webkit-details-marker {
  display: none;
}

.advanced summary > span {
  display: flex;
  flex-direction: column;
}

.advanced summary strong {
  font-size: 11px;
}

.advanced summary small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.advanced summary svg {
  width: 17px;
  fill: none;
  stroke: var(--muted);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
  transition: transform 160ms ease;
}

.advanced[open] summary svg {
  transform: rotate(180deg);
}

.advanced-body {
  padding: 2px 0 15px;
  border-top: 1px solid var(--line);
}

.advanced-body > p {
  margin: 13px 0 15px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.6;
}

.advanced-body .field:last-child {
  margin-bottom: 0;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  min-height: 52px;
  border: 1px solid var(--ink);
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 750;
  text-decoration: none;
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
  align-items: center;
  justify-content: center;
}

form > .primary-button {
  width: 100%;
}

.primary-button {
  gap: 9px;
  color: var(--primary-text);
  background: var(--primary-bg);
}

.primary-button:hover {
  color: var(--primary-text);
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.primary-button:disabled {
  cursor: wait;
  color: var(--primary-text);
  background: var(--primary-bg);
  opacity: 0.68;
  transform: none;
}

.primary-button svg {
  width: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.secondary-button {
  color: var(--ink);
  background: transparent;
}

.secondary-button:hover {
  background: var(--surface-muted);
}

.privacy-copy {
  max-width: 390px;
  margin: 12px auto 0;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.55;
  text-align: center;
}

.progress-panel,
.result-panel {
  padding: 46px 40px;
}

.progress-heading {
  display: flex;
  gap: 14px;
  margin-bottom: 28px;
  align-items: center;
}

.progress-heading > div {
  display: flex;
  flex-direction: column;
}

.progress-heading strong {
  font-size: 15px;
}

.progress-heading small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 850ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.progress-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.progress-list li {
  position: relative;
  display: flex;
  gap: 12px;
  min-height: 39px;
  color: var(--progress-muted);
  font-size: 11px;
  align-items: flex-start;
}

.progress-list li:not(:last-child)::before {
  position: absolute;
  top: 18px;
  bottom: -2px;
  left: 6px;
  width: 1px;
  background: var(--line);
  content: "";
}

.progress-list li > span {
  position: relative;
  z-index: 1;
  width: 13px;
  height: 13px;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
}

.progress-list li.current {
  color: var(--ink);
}

.progress-list li.current > span {
  border-color: var(--accent);
  background: var(--warning);
}

.progress-list li.done {
  color: var(--muted);
}

.progress-list li.done > span {
  border-color: var(--success);
  background: var(--success);
}

.result-panel {
  text-align: center;
}

.success-mark {
  display: grid;
  width: 52px;
  height: 52px;
  margin: 0 auto 20px;
  border: 1px solid var(--success);
  border-radius: 50%;
  background: var(--success-bg);
  place-items: center;
}

.success-mark svg {
  width: 28px;
  fill: none;
  stroke: var(--success);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.3;
}

.result-panel > p {
  margin: 10px auto 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.result-addons {
  display: flex;
  margin: 24px 0;
  gap: 9px;
  justify-content: center;
}

.result-addons > span {
  display: inline-flex;
  gap: 7px;
  padding: 7px 10px 7px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  align-items: center;
}

.addon-icon {
  display: inline-grid;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border-radius: 3px;
  color: var(--surface);
  background: var(--accent);
  font-size: 9px;
  font-style: normal;
  font-weight: 800;
  place-items: center;
}

.cinema-icon {
  background: #596f6a;
}

.manifest-field {
  display: block;
  text-align: left;
}

.manifest-field > span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.manifest-field > div {
  display: flex;
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--input);
}

.manifest-field input {
  width: 100%;
  min-width: 0;
  padding: 0 12px;
  border: 0;
  outline: 0;
  color: var(--muted);
  background: transparent;
  font-size: 9px;
}

.manifest-field button {
  margin: 6px;
  padding: 0 10px;
  border: 0;
  border-radius: 3px;
  cursor: pointer;
  color: var(--on-accent);
  background: var(--link);
  font-size: 9px;
  font-weight: 800;
}

.result-actions {
  display: grid;
  margin-top: 16px;
  grid-template-columns: 1fr 0.55fr;
  gap: 9px;
}

.result-note {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-muted);
  text-align: left;
}

.error-panel {
  display: grid;
  margin: 24px 40px 0;
  padding: 16px;
  border: 1px solid var(--error-border);
  border-radius: 4px;
  outline: 0;
  background: var(--error-bg);
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.error-panel[hidden] {
  display: none;
}

.error-icon {
  display: grid;
  width: 29px;
  height: 29px;
  border: 1px solid var(--danger);
  border-radius: 50%;
  color: var(--danger);
  font-size: 13px;
  font-weight: 900;
  place-items: center;
}

.error-panel strong {
  font-size: 11px;
}

.error-panel p {
  margin: 3px 0 0;
  color: var(--error-copy);
  font-size: 10px;
  line-height: 1.5;
}

.error-panel button {
  padding: 7px 9px;
  border: 1px solid var(--danger);
  border-radius: 3px;
  cursor: pointer;
  color: var(--danger);
  background: transparent;
  font-size: 9px;
  font-weight: 800;
}

[hidden] {
  display: none !important;
}

footer {
  display: flex;
  width: min(900px, calc(100% - 48px));
  margin: 0 auto;
  padding: 22px 0 30px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 9px;
  justify-content: space-between;
}

footer a {
  color: var(--link);
  text-underline-offset: 3px;
}

@media (max-width: 560px) {
  .topbar,
  .shell,
  footer {
    width: min(100% - 28px, 520px);
  }

  .topbar {
    padding: 17px 0;
  }

  .secure-note {
    display: none;
  }

  .header-actions {
    gap: 8px;
  }

  .repo-button {
    min-width: 38px;
    padding: 0 9px;
  }

  .repo-button svg {
    width: 16px;
  }

  .repo-button {
    font-size: 0;
  }

  .shell {
    margin-top: 38px;
    margin-bottom: 54px;
  }

  .intro h1 {
    font-size: 46px;
  }

  .included-line {
    flex-wrap: wrap;
  }

  .setup-card {
    box-shadow: 4px 5px 0 var(--card-shadow);
  }

  .card-heading,
  form,
  .progress-panel,
  .result-panel {
    padding-right: 20px;
    padding-left: 20px;
  }

  .torbox-callout {
    grid-template-columns: 1fr;
  }

  .error-panel {
    margin-top: 20px;
    margin-right: 20px;
    margin-left: 20px;
    grid-template-columns: auto minmax(0, 1fr);
  }

  .error-panel button {
    grid-column: 2;
    justify-self: start;
  }

  .result-actions {
    grid-template-columns: 1fr;
  }

  footer {
    gap: 7px;
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
