:root { color-scheme: dark; font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif; color: #eaf0ed; background: #101715; font-synthesis: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; }
button, .button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
.header { height: 88px; max-width: 1264px; margin: auto; padding: 0 44px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #2a342e; }
.brand { display: flex; gap: 12px; align-items: center; font-size: 23px; font-weight: 750; letter-spacing: -.8px; }
.brand-mark { background: #bef477; color: #1b2716; width: 38px; height: 38px; text-align: center; border-radius: 10px; font-size: 29px; line-height: 35px; }
.header-actions { display: flex; align-items: center; gap: 24px; }
.tag, .eyebrow { font-size: 10px; letter-spacing: 1.7px; font-weight: 700; color: #a6b5aa; }
.tag { border: 1px solid #344139; padding: 7px 10px; border-radius: 5px; }
main { max-width: 1176px; padding: 48px 44px 24px; margin: auto; }
h1 { font-size: clamp(30px, 4vw, 42px); line-height: 1.2; font-weight: 600; letter-spacing: -1.7px; margin: 12px 0; }
h2 { font-size: 21px; letter-spacing: -.5px; margin: 0 0 6px; font-weight: 600; }
p { line-height: 1.6; }
.muted { color: #a5b1aa; font-size: 14px; margin: 0; }
.eyebrow { color: #bef477; margin: 0; }
.intro { margin-bottom: 30px; }
.tabs { display: flex; gap: 28px; margin-bottom: 8px; border-bottom: 1px solid #263029; }
.tab-link { background: transparent; border: none; border-bottom: 2px solid transparent; border-radius: 0; min-height: auto; padding: 12px 2px; margin-bottom: -1px; color: #95a69a; font-size: 13px; font-weight: 650; }
.tab-link:hover { color: #d2ddd6; }
.tab-link.active { color: #eaf0ed; border-bottom-color: #bef477; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.section-stack { display: grid; gap: 28px; }
.service-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; }
.card { background: #18211d; border: 1px solid #303c34; border-radius: 12px; padding: 32px; min-width: 0; }
.card-heading { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 24px; }
.service-mark { color: #e7c886; background: #3c3322; border: 1px solid #5a4c30; width: 44px; height: 44px; flex-shrink: 0; border-radius: 11px; display: grid; place-items: center; font-size: 22px; }
.service-mark.blue { background: #243847; color: #9dd2f4; border-color: #34516a; font-size: 19px; }
.service-mark.green { background: #24401f; color: #bef477; border-color: #3c5a30; }
.service-mark.purple { background: #2c2140; color: #c9a8f0; border-color: #46345f; }

label { display: block; font-size: 12px; font-weight: 600; margin: 22px 0 8px; color: #d2ddd6; }
.checkbox-row { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 400; color: #e6eee8; cursor: pointer; }
.checkbox-row input[type="checkbox"] { width: auto; min-height: auto; accent-color: #bef477; cursor: pointer; }
.checkbox-group { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 20px; margin: 16px 0 0; }
.checkbox-group-compact { grid-template-columns: repeat(4, 1fr); }
.checkbox-group .checkbox-row { margin: 0; }
input, select, textarea { width: 100%; min-height: 44px; background: #111a15; border: 1px solid #39473e; border-radius: 6px; color: #e6eee8; padding: 10px 12px; font-size: 13px; }
textarea { resize: vertical; font-family: inherit; line-height: 1.4; }
input::placeholder, textarea::placeholder { color: #7f9185; }
input:disabled, textarea:disabled, button:disabled { opacity: .55; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid #bef477; outline-offset: 3px; }
.help { color: #95a69a; font-size: 12px; margin: 8px 0 0; }
.secret-label { font-size: 11px; margin-top: 12px; }
.service { display: flex; flex-direction: column; }
.discovery-provider-list, .saved-search-list { display: grid; gap: 18px; }
.discovery-provider, .saved-search { border: 1px solid #344139; border-radius: 9px; padding: 22px; background: #141d18; }
.discovery-provider-heading, .saved-search-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.discovery-provider-heading h3, .saved-search-heading h3 { margin: 0 0 5px; font-size: 16px; }
.discovery-provider-heading .muted, .saved-search-heading .muted { max-width: 720px; }
.discovery-provider-heading button, .saved-search-heading button { flex-shrink: 0; }
.discovery-provider-fields, .saved-search-fields { display: grid; grid-template-columns: minmax(160px, .7fr) minmax(220px, 1.3fr); gap: 0 22px; }
.discovery-provider-fields .wide, .saved-search-fields .wide { grid-column: 1 / -1; }
.discovery-provider .test-row, .saved-search .test-row { margin-top: 0; }
.discovery-provider .connection-status, .saved-search .connection-status { min-height: 0; }
.saved-search-items { display: grid; gap: 8px; margin-top: 4px; }
.saved-search-item { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 8px 0; border-top: 1px solid #263029; font-size: 12px; }
.saved-search-item:first-child { border-top: none; }
.saved-search-item-title { color: #d2ddd6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-search-item-status { color: #95a69a; flex-shrink: 0; }
.saved-search-item-status.error { color: #e29a9a; }
.saved-search-item button { flex-shrink: 0; }
.test-row { display: flex; gap: 14px; align-items: center; margin-top: auto; padding-top: 25px; }
.test-label { font-size: 11px; color: #95a69a; }
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 18px; min-height: 42px; border-radius: 6px; font-size: 12px; font-weight: 650; padding: 10px 16px; border: 1px solid transparent; transition: background .15s; }
.primary { background: #bef477; color: #182511; }
.primary:hover { background: #d0ff93; }
.secondary { background: #222f26; border-color: #435548; color: #e0ebe3; }
.secondary:hover { background: #304235; }
.quiet { background: transparent; color: #adbeb1; padding: 0; }
button:disabled { opacity: .45; cursor: default; }
.connection-status { color: #95a69a; font-size: 12px; margin: 12px 0 0; min-height: 38px; }
.success { color: #bef477 !important; }
.error { color: #ffaaa0 !important; }
.experimental-warning { color: #e9d18a; max-width: 78ch; }
.save-bar { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 24px 0 0; }
.save-bar strong { font-size: 13px; font-weight: 500; }
.save-bar .help { margin-top: 4px; }
#feedback { min-height: 0; margin: 14px 0 28px; font-size: 13px; }

.downloads-toolbar { display: flex; justify-content: flex-end; margin-bottom: 4px; }
.download-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; border-top: 1px solid #263029; }
.download-row:first-of-type { border-top: none; }
.download-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.download-main strong { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.download-tags { font-size: 12px; color: #95a69a; }
.download-meta { font-size: 12px; color: #95a69a; flex-shrink: 0; }
.download-actions { display: flex; gap: 12px; flex-shrink: 0; }

.install h2 { margin-top: 10px; }
.install-url { display: flex; gap: 10px; }
.install-url input { flex: 1; min-width: 0; }
.install-url button, .install-url a { white-space: nowrap; }
footer { display: flex; justify-content: space-between; gap: 16px; margin-top: 30px; font-size: 10px; color: #8fa195; line-height: 1.7; }
.login { max-width: 470px; margin: 55px auto; padding: 38px; }
.login h1 { font-size: 34px; }
.login form { margin-top: 30px; }
.login .primary { width: 100%; }
#login-error { font-size: 13px; min-height: 20px; }
@media (max-width: 760px) {
  .header { height: 74px; padding: 0 20px; } main { padding: 30px 20px; }
  .service-grid { grid-template-columns: 1fr; }
  .card { padding: 22px; } .save-bar { align-items: flex-start; } .save-bar .primary { flex-shrink: 0; }
  .tabs { gap: 18px; }
  .install-url { flex-wrap: wrap; } .install-url input { flex-basis: 100%; } footer { flex-direction: column; }
  .tag { display: none; } .login { margin-top: 20px; } .brand { font-size: 21px; }
  .download-row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .download-actions { align-self: flex-end; }
  .checkbox-group { grid-template-columns: repeat(2, 1fr); }
  .checkbox-group-compact { grid-template-columns: repeat(2, 1fr); }
}

/* Shared spacing keeps new cards consistent across every tab. */
h3 { margin: 0; font-size: 14px; font-weight: 600; line-height: 1.5; color: #dbe5df; }
.card-heading > div { min-width: 0; }
.card > .card-heading + label { margin-top: 0; }
.card .muted { max-width: 70ch; }
.heading-with-action { align-items: center; flex-wrap: wrap; }
.heading-with-action > div { flex: 1; }
.heading-with-action > button { margin-left: auto; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 28px; }
.form-grid > div { min-width: 0; }
.form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.form-section { border-top: 1px solid #303c34; padding-top: 24px; margin-top: 28px; }
.action-description { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.action-description button { flex-shrink: 0; }
.form-details { border: 1px solid #344139; border-radius: 8px; padding: 16px 18px; margin-top: 24px; }
.form-details > summary { cursor: pointer; font-size: 13px; font-weight: 600; line-height: 1.6; }
.form-details > summary .muted { font-size: 12px; font-weight: 400; margin-left: 8px; }
.form-details[open] > summary { margin-bottom: 16px; }
.preference-group + .preference-group { border-top: 1px solid #303c34; padding-top: 24px; margin-top: 28px; }
.notice { border: 1px solid #4b653b; border-radius: 8px; padding: 20px; margin-top: 24px; background: #202d21; }
.notice > label:first-child { margin-top: 0; }
.notice input { font-family: ui-monospace, monospace; }
.token-list { margin-top: 12px; }
.token-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 0; }
.token-row + .token-row { border-top: 1px solid #303c34; }
.token-description { min-width: 0; }
.token-description strong { display: block; font-size: 14px; overflow-wrap: anywhere; }
.token-row button { flex-shrink: 0; }
.token-meta { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 8px; color: #95a69a; font-size: 12px; }
p[role="status"]:empty, p[role="alert"]:empty { display: none; }
#feedback:empty { display: block; margin: 0 0 28px; }
input[type="file"] { padding: 8px; }
input[type="file"]::file-selector-button { border: 0; border-radius: 4px; padding: 8px 12px; margin-right: 12px; color: #e0ebe3; background: #304235; cursor: pointer; }
@media (max-width: 760px) {
  .section-stack, .service-grid { gap: 22px; }
  .form-grid { grid-template-columns: 1fr; gap: 0; }
  .action-description { flex-direction: column; align-items: flex-start; gap: 16px; }
  .token-row { align-items: flex-start; flex-wrap: wrap; }
  .token-meta { flex-direction: column; gap: 6px; }
  .card-heading { gap: 12px; }
  /* A badge and an action button on one row squeeze the description down to a
     few characters wide, so the action drops to its own full-width row. */
  .card-heading > div { flex: 1 1 auto; min-width: 0; }
  .card-heading > button { flex: 1 0 100%; margin-left: 0; }
  .save-bar { flex-wrap: wrap; }
  .save-bar .primary { margin-left: auto; }
  .header-actions { gap: 12px; }
  .form-details { padding: 14px; }
  .discovery-provider-fields, .saved-search-fields { grid-template-columns: 1fr; gap: 0; }
  .discovery-provider-fields .wide, .saved-search-fields .wide { grid-column: auto; }
  .discovery-provider-heading, .saved-search-heading { flex-direction: column; }
  .saved-search-item { flex-direction: column; align-items: flex-start; gap: 4px; }
}

#workspace-intro { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.intro-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
#workspace > .section-stack, #workspace > .card { margin-bottom: 28px; }
#cache-torrent-card { padding: 20px 24px; }
.add-bar-row { display: flex; align-items: center; gap: 12px; }
.add-bar-row input[type="text"] { flex: 1; min-width: 0; }
.add-bar-row button { flex-shrink: 0; }
#cache-torrent-card .form-details { margin-top: 16px; }
#cache-feedback:not(:empty) { margin-top: 12px; }

dialog { border: 1px solid #303c34; border-radius: 12px; background: #18211d; color: #eaf0ed; padding: 0; width: min(1040px, 92vw); max-width: none; overflow: hidden; max-height: 88vh; max-height: 88dvh; }
dialog::backdrop { background: rgba(6, 10, 8, .72); backdrop-filter: blur(3px); }
dialog[open] { display: flex; flex-direction: column; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 28px; border-bottom: 1px solid #303c34; flex-shrink: 0; }
.dialog-header h2 { margin: 0; }
.dialog-close { font-size: 15px; line-height: 1; padding: 6px 8px; }
.dialog-body { padding: 24px 28px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
#settings-dialog > form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
#settings-dialog .tabs { padding: 0 28px; margin-bottom: 0; flex-shrink: 0; }
#settings-dialog .dialog-body { padding-top: 22px; }
#settings-dialog #feedback { margin: 0 0 20px; }

/* Settings is a long scroll, so the dialog canvas drops to the page tone and
   the header keeps the chrome tone: every card then sits a step above its
   background and reads as its own panel, instead of merging into one wall of
   equal-weight boxes. */
#settings-dialog { background: #101715; }
#settings-dialog .dialog-header { background: #141d18; }
#settings-dialog .card { box-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
#settings-dialog .section-stack { gap: 22px; }
#settings-dialog #feedback:empty { display: none; }

/* A card opens with a title band and a hairline, so its heading and its
   fields read as two zones rather than one slab of controls. */
#settings-dialog .card-heading { padding-bottom: 20px; border-bottom: 1px solid #263029; }
#settings-dialog .card.install > div:first-child { padding-bottom: 20px; border-bottom: 1px solid #263029; }
#settings-dialog #readiness-card > .help { padding-bottom: 20px; border-bottom: 1px solid #263029; margin-bottom: 0; }

/* Dividers inside a card stay quieter than the border framing the card. */
#settings-dialog .form-section { border-top-color: #263029; }
#settings-dialog .preference-group + .preference-group { border-top-color: #263029; }

/* Smaller badges stop the coloured marks from dominating the column. */
#settings-dialog .service-mark { width: 36px; height: 36px; font-size: 18px; border-radius: 9px; }
.dialog-footer { padding: 18px 28px; border-top: 1px solid #303c34; background: #141d18; flex-shrink: 0; }
#download-files-dialog .dialog-body > .help { margin-top: 0; }
#download-files-dialog .file-row:last-child { border-bottom: none; }
.setup { max-width: 800px; margin: 0 auto; }
.setup-progress { display: flex; gap: 10px; list-style: none; padding: 0; margin: 28px 0; }
.setup-progress li { flex: 1; border-top: 3px solid #344139; padding-top: 12px; color: #95a69a; font-size: 12px; }
.setup-progress li[aria-current="step"] { color: #bef477; border-color: #bef477; }
.setup-progress li.done { border-color: #779b57; color: #d2ddd6; }
#setup-preferences { margin-top: 24px; }
.setup-navigation { display: flex; justify-content: space-between; gap: 16px; border-top: 1px solid #303c34; padding-top: 24px; margin-top: 28px; }
.setup-navigation .primary { margin-left: auto; }
.setup-exit { display: flex; justify-content: space-between; gap: 20px; align-items: center; margin-top: 22px; }
.setup-exit button { flex-shrink: 0; }
.mode-options { display: grid; gap: 14px; margin-top: 24px; }
.mode-option { display: flex; gap: 14px; align-items: flex-start; padding: 20px; border: 1px solid #39473e; border-radius: 8px; margin: 0; cursor: pointer; }
.mode-option:has(input:checked) { border-color: #a4d769; background: #222f22; }
.mode-option input { width: 18px; min-height: 18px; margin: 3px 0 0; flex-shrink: 0; accent-color: #bef477; }
.mode-option strong { display: block; font-size: 15px; margin-bottom: 6px; }
.mode-option span span { display: block; font-size: 13px; font-weight: 400; color: #a5b1aa; line-height: 1.6; }
.setup-summary { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 16px 24px; font-size: 13px; line-height: 1.6; margin: 28px 0 0; }
.setup-summary dt { color: #95a69a; }
.setup-summary dd { margin: 0; overflow-wrap: anywhere; }
#setup-feedback:not(:empty) { margin-top: 24px; }
#setup-next-help { margin-top: 24px; }
@media (max-width: 760px) {
  #workspace-intro { align-items: flex-start; flex-direction: column; }
  .intro-actions { width: 100%; }
  .add-bar-row { flex-wrap: wrap; }
  .add-bar-row input[type="text"] { flex-basis: 100%; }
  .add-bar-row button { flex: 1; }
  dialog { width: 96vw; max-height: 94vh; max-height: 94dvh; }
  .dialog-header { padding: 18px 20px; }
  .dialog-body { padding: 20px; }
  #settings-dialog .tabs { padding: 0 20px; }
  .dialog-footer { padding: 16px 20px; }
  .setup-progress { gap: 8px; }
  .setup-progress li { font-size: 11px; }
  .setup-exit { flex-direction: column; align-items: flex-start; gap: 12px; }
  .setup-summary { grid-template-columns: 1fr; gap: 4px; }
  .setup-summary dd + dt { margin-top: 12px; }
}

#setup-check-playback { margin-top: 14px; }
#check-playback { margin-top: 12px; }
#setup-checks, #dashboard-checks { margin-top: 16px; font-size: 13px; line-height: 1.6; }
#download-files-close { margin-top: 20px; }
.diagnostic { padding: 14px 0; border-bottom: 1px solid #303c34; }
.diagnostic strong, .diagnostic span { display: block; }
.diagnostic span { margin-top: 6px; color: #b4c2b8; overflow-wrap: anywhere; }
.diagnostic.pass strong { color: #bef477; }
.diagnostic.fail strong { color: #ffb4a9; }
.diagnostic.warning strong { color: #e9d18a; }
.file-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid #303c34; }
.file-row p { overflow-wrap: anywhere; min-width: 0; }
.file-row-actions { display: flex; gap: 12px; flex-shrink: 0; }
@media (max-width: 600px) {
  .setup-progress { flex-wrap: wrap; }
  .setup-progress li { flex: 1 1 25%; }
  .file-row { align-items: flex-start; flex-direction: column; }
  .file-row-actions { align-self: flex-end; }
}
