:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #596274;
  --line: #d8dee8;
  --paper: #ffffff;
  --surface: #ffffff;
  --soft: #f4f7fb;
  --panel-soft: #fbfcfe;
  --select-bg: linear-gradient(180deg, #ffffff, #f7f9fc);
  --select-hover-border: #86b8cb;
  --select-hover-shadow: 0 10px 28px rgba(23, 32, 51, 0.08);
  --header-bg: rgba(255, 255, 255, 0.94);
  --header-line: rgba(216, 222, 232, 0.9);
  --page-hero-bg: linear-gradient(180deg, #f8fafc, #fff);
  --auth-bg: linear-gradient(180deg, #f8fafc, #eef4f8);
  --disabled-bg: #edf1f6;
  --focus-ring: rgba(18, 107, 143, 0.18);
  --primary: #126b8f;
  --primary-dark: #0c4a66;
  --accent: #e1a028;
  --success: #1d7a55;
  --danger: #b42318;
  --shadow: 0 24px 70px rgba(23, 32, 51, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ink: #edf4ff;
    --muted: #b3bfd0;
    --line: #334157;
    --paper: #0f1624;
    --surface: #161f31;
    --soft: #121b2c;
    --panel-soft: #1a2638;
    --select-bg: linear-gradient(180deg, #1a2638, #151f30);
    --select-hover-border: #4ba5cd;
    --select-hover-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
    --header-bg: rgba(15, 22, 36, 0.94);
    --header-line: rgba(51, 65, 87, 0.86);
    --page-hero-bg: linear-gradient(180deg, #121b2c, #0f1624);
    --auth-bg: linear-gradient(180deg, #121b2c, #0b1020);
    --disabled-bg: #273244;
    --focus-ring: rgba(75, 165, 205, 0.24);
    --primary: #4ba5cd;
    --primary-dark: #8bd5f3;
    --accent: #f0bc4d;
    --success: #48b885;
    --danger: #ff8a80;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #edf4ff;
  --muted: #b3bfd0;
  --line: #334157;
  --paper: #0f1624;
  --surface: #161f31;
  --soft: #121b2c;
  --panel-soft: #1a2638;
  --select-bg: linear-gradient(180deg, #1a2638, #151f30);
  --select-hover-border: #4ba5cd;
  --select-hover-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
  --header-bg: rgba(15, 22, 36, 0.94);
  --header-line: rgba(51, 65, 87, 0.86);
  --page-hero-bg: linear-gradient(180deg, #121b2c, #0f1624);
  --auth-bg: linear-gradient(180deg, #121b2c, #0b1020);
  --disabled-bg: #273244;
  --focus-ring: rgba(75, 165, 205, 0.24);
  --primary: #4ba5cd;
  --primary-dark: #8bd5f3;
  --accent: #f0bc4d;
  --success: #48b885;
  --danger: #ff8a80;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}

a {
  color: var(--primary);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--header-line);
  background: var(--header-bg);
  backdrop-filter: blur(16px);
}

.site-header__inner,
.site-footer__inner,
.wrap {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.site-footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-header__inner {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

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

.brand__mark {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 0.82rem;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.site-nav a {
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a.is-active {
  color: var(--primary);
}

.theme-switcher {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.theme-switcher__label {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.select-field {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: 132px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--select-bg);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.select-field::after {
  content: "";
  position: absolute;
  right: 13px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--primary);
  border-bottom: 2px solid var(--primary);
  pointer-events: none;
  transform: translateY(-2px) rotate(45deg);
}

.select-field:hover {
  border-color: var(--select-hover-border);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.18) inset,
    var(--select-hover-shadow);
}

.select-field:focus-within {
  border-color: var(--primary);
  box-shadow:
    0 0 0 3px var(--focus-ring),
    0 1px 0 rgba(255, 255, 255, 0.18) inset;
}

.select-field__control {
  width: 100%;
  min-height: 40px;
  appearance: none;
  border: 0;
  border-radius: 8px;
  padding: 8px 38px 8px 12px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 760;
}

.select-field__control:focus {
  outline: none;
}

.select-field__control option {
  color: var(--ink);
  background: var(--surface);
}

.theme-switcher__field {
  min-width: 128px;
}

.theme-switcher__select {
  font-size: 0.95rem;
}

.theme-switcher__select:focus {
  outline: none;
}

.hero {
  min-height: 590px;
  display: flex;
  align-items: center;
  background:
    linear-gradient(115deg, rgba(18, 107, 143, 0.94), rgba(23, 32, 51, 0.86)),
    url("/assets/hero-c4atube.svg") center / cover no-repeat;
  color: #fff;
}

.hero__content {
  width: min(800px, 100%);
  padding: 88px 0;
}

.hero__kicker {
  margin: 0 0 14px;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}

.hero h1 {
  font-size: clamp(2.4rem, 5.5vw, 4.8rem);
  line-height: 1;
  margin: 0 0 22px;
  letter-spacing: 0;
}

.hero p:not(.hero__kicker) {
  max-width: 690px;
  margin: 0 0 32px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.24rem;
}

.actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: var(--accent);
  color: #172033;
  font-weight: 850;
  text-decoration: none;
  cursor: pointer;
}

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

.hero .button.secondary {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
}

.hero .button.secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #fff;
}

.button--secondary:hover {
  background: var(--soft);
  border-color: var(--muted);
}

.button--success {
  background: var(--success) !important;
  color: #fff !important;
  border-color: var(--success) !important;
}

.download-item__actions {
  display: flex;
  gap: 8px;
}

.button--small {
  min-height: 38px;
  padding: 8px 14px;
  font-size: 0.92rem;
  white-space: nowrap;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.button--disabled {
  background: var(--disabled-bg);
  color: var(--muted);
  cursor: default;
}

.section {
  padding: 72px 0;
}

.section--soft {
  background: var(--soft);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--primary-dark);
  font-weight: 850;
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}

.section h2,
.page-hero h1,
.auth-panel h1 {
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 1.08;
  margin: 0 0 18px;
  letter-spacing: 0;
}

.lead {
  max-width: 780px;
  color: var(--muted);
  font-size: 1.1rem;
}

#os-detection {
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--muted);
}

#os-detection::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

.grid {
  display: grid;
  gap: 20px;
}

.grid--features {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 36px;
}

.feature,
.download-panel,
.auth-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.feature {
  padding: 24px;
}

.feature__icon {
  display: inline-flex;
  margin-bottom: 24px;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 900;
}

.feature h3 {
  margin: 0 0 10px;
  font-size: 1.1rem;
}

.feature p {
  margin: 0;
  color: var(--muted);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}

.page-main {
  min-height: calc(100vh - 147px);
}

.page-hero {
  padding: 58px 0 34px;
  background: var(--page-hero-bg);
}

.secure-downloads {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  align-items: start;
}

.download-panel {
  overflow: hidden;
  box-shadow: var(--shadow);
}

.download-panel__header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 24px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.download-panel__header h2 {
  margin: 0 0 6px;
  font-size: 1.35rem;
}

.download-panel__header p,
.empty-state {
  margin: 0;
  color: var(--muted);
}

.download-panel__header .download-count {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: rgba(18, 107, 143, 0.1);
  color: var(--primary-dark);
  font-weight: 900;
}

.download-list {
  list-style: none;
  padding: 0 24px;
  margin: 0;
}

.download-list--nested {
  padding: 0;
}

.download-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.download-item:first-child {
  border-top: 0;
}

.download-item h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.download-item h4 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.download-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.tool-groups {
  padding: 10px 24px 20px;
}

.tool-group {
  padding-top: 24px;
}

.tool-group + .tool-group {
  margin-top: 12px;
  border-top: 1px solid var(--line);
}

.tool-group > h3 {
  margin: 0 0 8px;
  color: var(--primary-dark);
  font-size: 1.1rem;
  font-weight: 800;
}

.empty-state {
  padding: 24px;
}

.auth-main {
  display: grid;
  place-items: center;
  padding: 58px 16px;
  background: var(--auth-bg);
}

.auth-panel {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 34px;
  padding: 32px;
  box-shadow: var(--shadow);
}

.login-form {
  display: grid;
  gap: 16px;
}

.login-form label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-weight: 750;
}

.login-form input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--paper);
  font: inherit;
}

.login-form input:focus {
  outline: 3px solid var(--focus-ring);
  border-color: var(--primary);
}

.form-error {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid rgba(180, 35, 24, 0.3);
  border-radius: 7px;
  background: rgba(180, 35, 24, 0.08);
  color: var(--danger);
  font-weight: 750;
}

.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrapper input {
  padding-right: 44px;
}

.toggle-password {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.toggle-password:hover {
  color: var(--primary);
}

.icon-eye {
  width: 20px;
  height: 20px;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 28px 0;
  color: var(--muted);
  background: var(--surface);
}

@media (max-width: 820px) {
  .site-header__inner,
  .site-footer__inner,
  .site-nav,
  .theme-switcher,
  .actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-header__inner {
    padding: 16px 0;
  }

  .hero {
    min-height: 530px;
  }

  .grid--features,
  .secure-downloads,
  .split,
  .auth-panel {
    grid-template-columns: 1fr;
  }

  .auth-panel {
    padding: 24px;
  }
}

@media (max-width: 560px) {
  .download-item {
    grid-template-columns: 1fr;
  }
}

.download-controls {
  display: flex;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
  flex-wrap: wrap;
}

.download-search {
  flex: 1;
  min-width: 200px;
}

.download-search__input {
  width: 100%;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
}

.download-search__input:focus {
  outline: 3px solid var(--focus-ring);
  border-color: var(--primary);
}

.download-search__input::placeholder {
  color: var(--muted);
}

.download-sort {
  display: flex;
  align-items: center;
  gap: 8px;
}

.download-sort label {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--muted);
  white-space: nowrap;
}

.download-sort__field {
  min-width: 184px;
}

.download-sort__select {
  min-height: 42px;
}

.download-sort__select:focus {
  outline: none;
}

.download-item.hidden {
  display: none;
}

.tool-group.hidden {
  display: none;
}

.no-results-message {
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 560px) {
  .download-controls {
    flex-direction: column;
  }

  .download-sort {
    width: 100%;
  }

  .download-sort__select {
    flex: 1;
  }

  .download-sort__field {
    flex: 1;
    width: 100%;
  }
}
