.settings-page {
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, .78), var(--bg) 42%),
    url("https://images.unsplash.com/photo-1489599849927-2ee91cede3ba?auto=format&fit=crop&w=1800&q=80");
  background-attachment: fixed;
  background-position: center;
  background-size: cover;
}

.settings-main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 112px 0 56px;
}

.settings-hero {
  display: grid;
  gap: 12px;
  max-width: 760px;
  margin-bottom: 28px;
}

.settings-eyebrow {
  color: var(--red);
  font-size: .76rem;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.settings-title {
  font-size: clamp(2rem, 6vw, 4.4rem);
  line-height: .98;
  font-weight: 900;
}

.settings-subtitle {
  color: var(--text2);
  max-width: 640px;
  line-height: 1.6;
  font-size: clamp(.96rem, 2vw, 1.08rem);
}

.settings-status {
  width: max-content;
  max-width: 100%;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(0, 0, 0, .72);
  color: #d1fae5;
  padding: 8px 12px;
  font-size: .84rem;
}

.settings-status[data-tone="warn"] {
  color: #fde68a;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.settings-panel {
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(16, 16, 16, .94);
  box-shadow: 0 24px 60px -36px rgba(0, 0, 0, .95);
  padding: 18px;
}

.settings-panel-featured {
  background:
    radial-gradient(circle at top left, rgba(229, 9, 20, .16), transparent 34%),
    rgba(16, 16, 16, .94);
}

.settings-panel-wide {
  grid-column: 1 / -1;
}

.settings-panel.danger-panel {
  border-color: rgba(229, 9, 20, .3);
}

.settings-panel-head {
  margin-bottom: 14px;
}

.settings-panel-head h2 {
  font-size: 1.05rem;
  margin-bottom: 4px;
}

.settings-panel-head p,
.settings-help,
.storage-sub {
  color: var(--text3);
  font-size: .84rem;
  line-height: 1.45;
}

.settings-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 220px);
  gap: 14px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid rgba(255, 255, 255, .08);
}

.settings-field:first-of-type {
  border-top: 0;
}

.settings-label {
  display: grid;
  gap: 3px;
}

.settings-label strong {
  font-size: .9rem;
}

.settings-label span {
  color: var(--text3);
  font-size: .78rem;
  line-height: 1.35;
}

.settings-control,
.settings-number {
  width: 100%;
  min-height: 40px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(0, 0, 0, .48);
  color: var(--text);
  padding: 8px 10px;
  font: inherit;
}

.settings-control:focus,
.settings-number:focus {
  outline: 2px solid rgba(229, 9, 20, .45);
  outline-offset: 2px;
}

.toggle-switch {
  justify-self: end;
  position: relative;
  display: inline-flex;
  width: 54px;
  height: 30px;
}

.toggle-switch input {
  position: absolute;
  opacity: 0;
}

.toggle-track {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .18);
  transition: background var(--anim), border-color var(--anim);
}

.toggle-track::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  left: 4px;
  top: 4px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .38);
  transition: transform var(--anim);
}

.toggle-switch input:checked + .toggle-track {
  background: var(--red);
  border-color: var(--red);
}

.toggle-switch input:checked + .toggle-track::after {
  transform: translateX(24px);
}

.storage-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-top: 1px solid rgba(255, 255, 255, .08);
  padding: 14px 0;
}

.catalog-index-card {
  display: grid;
  gap: 12px;
  border-top: 1px solid rgba(255, 255, 255, .08);
  padding: 14px 0 4px;
}

.catalog-index-meter {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, .11);
  border: 1px solid rgba(255, 255, 255, .1);
}

.catalog-index-meter span {
  display: block;
  width: var(--catalog-index-progress, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #e50914, #ffb703);
  transition: width .28s ease;
}

.catalog-index-status-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.catalog-index-status {
  margin: 0 0 4px;
  font-weight: 850;
}

.catalog-index-percent {
  color: #fff;
  font-size: 1.35rem;
  line-height: 1;
}

.catalog-index-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.catalog-index-stats span {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .06);
  color: var(--text2);
  padding: 6px 9px;
  font-size: .78rem;
  font-weight: 800;
}

.storage-value {
  font-size: 1.55rem;
  font-weight: 900;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, .08);
}

.settings-apk-download-btn {
  font-weight: 850;
}

body.native-app-runtime .settings-apk-download-btn {
  display: none !important;
}

.btn.danger {
  border-color: rgba(229, 9, 20, .5);
  background: rgba(229, 9, 20, .18);
  color: #ffc9ce;
}

.proxy-status {
  margin-top: 12px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .05);
  padding: 10px 12px;
  color: var(--text2);
  font-size: .84rem;
}

.proxy-status[data-tone="ok"] {
  color: #a7f3d0;
  border-color: rgba(16, 185, 129, .28);
}

.proxy-status[data-tone="warn"] {
  color: #fde68a;
  border-color: rgba(252, 211, 77, .28);
}

.settings-footer-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

body[data-theme="light"].settings-page {
  background:
    linear-gradient(180deg, rgba(255, 250, 244, .94), rgba(246, 241, 234, .98) 46%),
    url("https://images.unsplash.com/photo-1489599849927-2ee91cede3ba?auto=format&fit=crop&w=1800&q=80");
  color: #171717;
}

body[data-theme="light"] .settings-eyebrow {
  color: #b0060f;
}

body[data-theme="light"] .settings-title,
body[data-theme="light"] .settings-panel-head h2,
body[data-theme="light"] .settings-label strong,
body[data-theme="light"] .storage-value {
  color: #171717;
}

body[data-theme="light"] .settings-subtitle,
body[data-theme="light"] .settings-panel-head p,
body[data-theme="light"] .settings-help,
body[data-theme="light"] .settings-label span,
body[data-theme="light"] .storage-sub {
  color: #5f5f64;
}

body[data-theme="light"] .settings-panel {
  border-color: rgba(23, 23, 23, .1);
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 22px 60px -42px rgba(64, 45, 32, .55);
}

body[data-theme="light"] .settings-panel-featured {
  background:
    radial-gradient(circle at top left, rgba(229, 9, 20, .1), transparent 34%),
    rgba(255, 255, 255, .94);
}

body[data-theme="light"] .settings-field,
body[data-theme="light"] .storage-card,
body[data-theme="light"] .catalog-index-card,
body[data-theme="light"] .settings-actions {
  border-color: rgba(23, 23, 23, .09);
}

body[data-theme="light"] .catalog-index-meter {
  background: rgba(23, 23, 23, .08);
  border-color: rgba(23, 23, 23, .08);
}

body[data-theme="light"] .catalog-index-percent,
body[data-theme="light"] .catalog-index-status {
  color: #171717;
}

body[data-theme="light"] .catalog-index-stats span {
  border-color: rgba(23, 23, 23, .1);
  background: rgba(23, 23, 23, .04);
  color: #4b5563;
}

body[data-theme="light"] .settings-control,
body[data-theme="light"] .settings-number {
  border-color: rgba(23, 23, 23, .16);
  background: rgba(255, 255, 255, .96);
  color: #171717;
}

body[data-theme="light"] .settings-status {
  border-color: rgba(22, 163, 74, .22);
  background: rgba(240, 253, 244, .94);
  color: #166534;
}

body[data-theme="light"] .toggle-track {
  background: rgba(23, 23, 23, .12);
  border-color: rgba(23, 23, 23, .14);
}

body[data-theme="light"] .btn.danger {
  background: rgba(229, 9, 20, .1);
  color: #9f1239;
}

@media (max-width: 860px) {
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .settings-main {
    padding-top: 98px;
  }
}

@media (max-width: 560px) {
  .settings-main {
    width: min(100% - 20px, 1180px);
  }

  .settings-field,
  .storage-card {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .toggle-switch {
    justify-self: start;
  }

  .settings-actions,
  .settings-footer-actions {
    justify-content: stretch;
  }

  .settings-actions .btn,
  .settings-footer-actions .btn {
    width: 100%;
  }
}
