
:root {
  --black: #0C0C0A;
  --white: #FFFFFF;
  --lime: #C8FF00;
  --red: #E5484D;

  --bg: #F5F5F3;
  --surface: #FFFFFF;
  --surface-alt: #FAFAF9;
  --surface-hover: #ECECEA;
  --border: rgba(12, 12, 10, 0.1);
  --text: #0C0C0A;
  --text-muted: rgba(12, 12, 10, 0.58);
  --shadow: rgba(12, 12, 10, 0.07);

  --gray: var(--text-muted);
  --line: var(--border);
  --bg-page: var(--bg);
  --bg-card: var(--surface);
  --red-bg: rgba(229, 72, 77, .1);

  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #111113;
  --surface: #1C1C1F;
  --surface-alt: #242429;
  --surface-hover: #303037;
  --border: rgba(255,255,255,.12);
  --text: #F2F2F0;
  --text-muted: rgba(242,242,240,.66);
  --shadow: rgba(0,0,0,.42);

  --gray: var(--text-muted);
  --line: var(--border);
  --bg-page: var(--bg);
  --bg-card: var(--surface);
  --red-bg: rgba(229,72,77,.16);

  color-scheme: dark;
}


html,
body {
  background: var(--bg);
  color: var(--text);
  transition:
          background .2s ease,
          color .2s ease;
}


.theme-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mobile-top .theme-actions {
  display: flex;
  align-items: center;
  margin-left: auto;
  margin-right: 12px;
}

.btn-theme,
.btn-theme-toggle,
.theme-toggle {
  font-family: "Poppins", sans-serif;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  cursor: pointer;
  transition:
          background .15s ease,
          color .15s ease,
          border-color .15s ease,
          transform .15s ease,
          box-shadow .15s ease;
}

.btn-theme:active,
.btn-theme-toggle:active {
  transform: scale(.96);
}

.btn-theme,
.btn-theme-toggle,
.theme-toggle {
  -webkit-tap-highlight-color: transparent;
}

.btn-theme:hover,
.btn-theme-toggle:hover,
.theme-toggle:hover {

  box-shadow: 0 2px 10px var(--shadow);
}

.btn-theme,
.btn-theme-toggle {
  display: inline-grid;
  place-items: center;

  width: 40px;
  height: 40px;

  border-radius: 10px;
  font-size: 1rem;
  line-height: 1;

  flex: 0 0 auto;
}


.btn-theme:focus-visible,
.btn-theme-toggle:focus-visible,
.theme-toggle:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 2px;
}

html[data-theme="dark"] .btn-theme,
html[data-theme="dark"] .btn-theme-toggle {
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.14);
  color: var(--text);
}


.theme-toggle {
  display: flex;
  align-items: center;
  gap: 10px;

  width: 100%;
  min-height: 44px;

  padding: 9px 12px;
  margin-top: 4px;

  border-radius: 10px;

  text-align: left;
  font-size: .78rem;
  font-weight: 500;
}

.theme-toggle .nav-icon {
  width: 20px;
  text-align: center;
  font-size: 1rem;
}

.theme-toggle .tt-label {
  flex: 1;
}

.theme-toggle .tt-icon-dark {
  display: none;
}

html[data-theme="dark"] .theme-toggle .tt-icon-light {
  display: none;
}

html[data-theme="dark"] .theme-toggle .tt-icon-dark {
  display: inline;
}

.sidebar .theme-toggle {
  background: rgba(255,255,255,.04);
  border-color: rgba(255,255,255,.08);
  color: rgba(255,255,255,.72);
}

.sidebar .theme-toggle:hover {
  background: rgba(255,255,255,.08);
  color: #FFF;
}

.sidebar .theme-toggle.dark {
  color: #FFF;
}


html[data-theme="dark"] nav {
  background: #0c0c0a;
  border-bottom-color: var(--border);
}

html[data-theme="dark"] .nav-logo,
html[data-theme="dark"] .nav-back,
html[data-theme="dark"] .title,
html[data-theme="dark"] .detail code,
html[data-theme="dark"] .err-field {
  color: var(--text);
}

html[data-theme="dark"] .nav-back:hover,
html[data-theme="dark"] .btn-s:hover {
  color: var(--text);
  border-color: var(--text);
}

html[data-theme="dark"] .nav-mark {
  background: var(--lime);
  color: var(--black);
}

html[data-theme="dark"] .card {
  background: rgba(28,28,31,.82);
  border-color: var(--border);
  box-shadow:
          0 24px 64px rgba(0,0,0,.28),
          0 0 0 1px rgba(255,255,255,.05) inset;
}

html[data-theme="dark"] .code-bg {
  -webkit-text-stroke-color: rgba(242,242,240,.09);
}

html[data-theme="dark"] .desc,
html[data-theme="dark"] .detail,
html[data-theme="dark"] .err-msg {
  color: var(--text-muted);
}

html[data-theme="dark"] .detail,
html[data-theme="dark"] .field-err,
html[data-theme="dark"] .btn-s {
  background: rgba(255,255,255,.04);
  border-color: var(--border);
}

html[data-theme="dark"] .btn-p {
  background: var(--lime);
  color: var(--black);
}

html[data-theme="dark"] .toast {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}


@media (max-width: 520px) {
  .theme-actions {
    gap: 8px;
  }
  .mobile-top .theme-actions {
    margin-right: 8px;
  }
  .btn-theme {
    width: 36px;
    height: 36px;
  }
}