/* ── Theme tokens ── */
:root {
  --bg:             #ffffff;
  --bg-icons:       #f97316;
  --card-bg:        #ffffff;
  --card-shadow:    0 8px 40px rgba(0,0,0,0.10);
  --text:           #111111;
  --label:          #374151;
  --muted:          #6b7280;
  --placeholder:    #9ca3af;
  --border:         #e5e7eb;
  --input-bg:       #fafafa;
  --input-focus:    #ffffff;
  --header-bg:      #ffffff;
  --header-border:  #e5e7eb;
  --header-text:    #111111;
  --switcher-bg:    #e5e7eb;
}

[data-theme="dark"] {
  --bg:             #0f172a;
  --bg-icons:       #fb923c;
  --card-bg:        #1e293b;
  --card-shadow:    0 8px 40px rgba(0,0,0,0.40);
  --text:           #f1f5f9;
  --label:          #cbd5e1;
  --muted:          #94a3b8;
  --placeholder:    #64748b;
  --border:         #334155;
  --input-bg:       #0f172a;
  --input-focus:    #1e293b;
  --header-bg:      #1e293b;
  --header-border:  #334155;
  --header-text:    #f1f5f9;
  --switcher-bg:    #334155;
}

/* ── Base reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', sans-serif;
  transition: background-color 0.3s, color 0.3s;
}

/* ── Floating background icons ── */
.bg-icons {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.bg-icons i {
  position: absolute;
  color: var(--bg-icons);
  opacity: 0.07;
  animation: floatUp linear infinite;
}

@keyframes floatUp {
  0%   { transform: translateY(110vh) rotate(0deg);  opacity: 0;    }
  10%  { opacity: 0.22; }
  90%  { opacity: 0.22; }
  100% { transform: translateY(-15vh) rotate(25deg); opacity: 0;    }
}

.bg-icons i:nth-child(1)  { left:  4%;  font-size: 28px; animation-duration: 9s;  animation-delay: 0s;   }
.bg-icons i:nth-child(2)  { left: 10%;  font-size: 36px; animation-duration: 11s; animation-delay: 1s;   }
.bg-icons i:nth-child(3)  { left: 18%;  font-size: 22px; animation-duration: 8s;  animation-delay: 2.5s; }
.bg-icons i:nth-child(4)  { left: 26%;  font-size: 40px; animation-duration: 13s; animation-delay: 0.5s; }
.bg-icons i:nth-child(5)  { left: 34%;  font-size: 26px; animation-duration: 10s; animation-delay: 3s;   }
.bg-icons i:nth-child(6)  { left: 42%;  font-size: 32px; animation-duration: 12s; animation-delay: 1.5s; }
.bg-icons i:nth-child(7)  { left: 50%;  font-size: 20px; animation-duration: 7s;  animation-delay: 4s;   }
.bg-icons i:nth-child(8)  { left: 58%;  font-size: 38px; animation-duration: 14s; animation-delay: 0.8s; }
.bg-icons i:nth-child(9)  { left: 66%;  font-size: 24px; animation-duration: 9s;  animation-delay: 2s;   }
.bg-icons i:nth-child(10) { left: 73%;  font-size: 34px; animation-duration: 11s; animation-delay: 3.5s; }
.bg-icons i:nth-child(11) { left: 80%;  font-size: 28px; animation-duration: 10s; animation-delay: 1.2s; }
.bg-icons i:nth-child(12) { left: 87%;  font-size: 42px; animation-duration: 13s; animation-delay: 5s;   }
.bg-icons i:nth-child(13) { left: 93%;  font-size: 22px; animation-duration: 8s;  animation-delay: 2.8s; }
.bg-icons i:nth-child(14) { left:  7%;  font-size: 30px; animation-duration: 15s; animation-delay: 6s;   }
.bg-icons i:nth-child(15) { left: 22%;  font-size: 26px; animation-duration: 9s;  animation-delay: 4.5s; }
.bg-icons i:nth-child(16) { left: 38%;  font-size: 36px; animation-duration: 12s; animation-delay: 7s;   }
.bg-icons i:nth-child(17) { left: 55%;  font-size: 20px; animation-duration: 8s;  animation-delay: 3.2s; }
.bg-icons i:nth-child(18) { left: 70%;  font-size: 44px; animation-duration: 16s; animation-delay: 0.3s; }
.bg-icons i:nth-child(19) { left: 83%;  font-size: 28px; animation-duration: 10s; animation-delay: 5.5s; }
.bg-icons i:nth-child(20) { left: 96%;  font-size: 32px; animation-duration: 11s; animation-delay: 1.8s; }

/* ── Header ── */
header {
  position: relative;
  z-index: 10;
  width: 100%;
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  padding: 0 clamp(16px, 4vw, 40px);
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.3s, border-color 0.3s;
}

.header-brand {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.header-brand .name {
  display: flex;
  flex-direction: column;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.header-brand .name .learn-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-brand .name .learn-row .learn {
  font-size: 13px;
  color: var(--header-text);
  transition: color 0.3s;
}

.header-brand .name .learn-row i {
  color: #f97316;
  font-size: 13px;
  line-height: 1;
}

.header-brand .name .next {
  font-size: 13px;
  color: #f97316;
  display: flex;
  align-items: center;
  gap: 5px;
}

.online-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(34,197,94,0.12);
  border: 1px solid rgba(34,197,94,0.35);
  border-radius: 999px;
  padding: 1px 6px 1px 4px;
  transition: background 0.3s, border-color 0.3s;
}

.online-badge.offline {
  background: rgba(239,68,68,0.12);
  border-color: rgba(239,68,68,0.35);
}

.online-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #22c55e;
  animation: blinkDot 1.6s ease-in-out infinite;
  flex-shrink: 0;
  transition: background 0.3s;
}

.online-badge.offline .online-dot {
  background: #ef4444;
  animation: blinkDotRed 1.6s ease-in-out infinite;
}

@keyframes blinkDot {
  0%, 100% { opacity: 1;   box-shadow: 0 0 4px 2px rgba(34,197,94,0.5); }
  50%       { opacity: 0.3; box-shadow: none; }
}

@keyframes blinkDotRed {
  0%, 100% { opacity: 1;   box-shadow: 0 0 4px 2px rgba(239,68,68,0.5); }
  50%       { opacity: 0.3; box-shadow: none; }
}

.online-text {
  font-size: 8px;
  font-weight: 700;
  color: #22c55e;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
  transition: color 0.3s;
}

.online-badge.offline .online-text {
  color: #ef4444;
}

/* ── Theme switcher ── */
.theme-switcher {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--switcher-bg);
  border-radius: 999px;
  padding: 4px;
  transition: background 0.3s;
}

.theme-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}

.theme-btn.active {
  background: var(--card-bg);
  color: #f97316;
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}

.theme-btn:hover:not(.active) { color: var(--text); }
