.bg-grad {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  background:
    radial-gradient(900px 520px at 10% 10%, rgba(255, 122, 182, 0.44), transparent 60%),
    radial-gradient(1000px 620px at 90% 8%, rgba(61, 169, 255, 0.56), transparent 60%),
    radial-gradient(900px 620px at 50% 100%, rgba(255, 220, 92, 0.42), transparent 58%),
    radial-gradient(720px 520px at 20% 86%, rgba(123, 242, 171, 0.28), transparent 58%),
    linear-gradient(180deg, #99deff 0%, #c0eeff 24%, #d8f3ff 46%, #ffe7a8 72%, #ffd7ef 100%);
}

.bg-grad::before,
.bg-grad::after {
  content: "";
  position: absolute;
  inset: -8%;
  pointer-events: none;
}

.bg-grad::before {
  background:
    radial-gradient(circle at 14% 20%, rgba(255, 255, 255, 0.95) 0 8px, transparent 9px),
    radial-gradient(circle at 30% 12%, rgba(255, 255, 255, 0.7) 0 5px, transparent 6px),
    radial-gradient(circle at 54% 18%, rgba(255, 255, 255, 0.8) 0 7px, transparent 8px),
    radial-gradient(circle at 84% 22%, rgba(255, 255, 255, 0.85) 0 6px, transparent 7px),
    radial-gradient(circle at 76% 72%, rgba(255, 255, 255, 0.8) 0 8px, transparent 9px),
    radial-gradient(circle at 18% 70%, rgba(255, 255, 255, 0.72) 0 6px, transparent 7px);
  animation: float-clouds 18s ease-in-out infinite;
  opacity: 0.65;
}

.bg-grad::after {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, 0.18) 60%, rgba(255, 255, 255, 0) 100%);
  mix-blend-mode: screen;
  opacity: 0.6;
  animation: rainbow-shift 12s linear infinite;
}

.celebration-layer {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.firework,
.sparkle {
  position: absolute;
  display: block;
}

.firework {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  opacity: 0;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.98) 0 4%, transparent 5%),
    repeating-conic-gradient(
      from 0deg,
      rgba(255, 99, 146, 0.92) 0deg 10deg,
      transparent 10deg 20deg,
      rgba(56, 189, 248, 0.92) 20deg 30deg,
      transparent 30deg 40deg,
      rgba(255, 214, 74, 0.92) 40deg 50deg,
      transparent 50deg 60deg,
      rgba(74, 222, 128, 0.92) 60deg 70deg,
      transparent 70deg 80deg,
      rgba(168, 85, 247, 0.92) 80deg 90deg,
      transparent 90deg 100deg
    );
  filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.45));
  animation: firework-pop 6s ease-out infinite;
}

.firework-a {
  top: 7%;
  left: 4%;
  animation-delay: 0s;
}

.firework-b {
  top: 10%;
  right: 6%;
  animation-delay: 1.9s;
}

.firework-c {
  top: 2%;
  left: 42%;
  animation-delay: 3.8s;
}

.sparkle {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 1) 0 35%, rgba(255, 255, 255, 0.25) 36% 60%, transparent 61%);
  box-shadow: 0 0 24px rgba(255, 255, 255, 0.5);
  animation: confetti-float 8s ease-in-out infinite;
}

.sparkle::before,
.sparkle::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  background: currentColor;
  border-radius: 999px;
}

.sparkle::before {
  width: 3px;
  height: 18px;
}

.sparkle::after {
  width: 18px;
  height: 3px;
}

.sparkle-a { left: 10%; top: 42%; color: #ff5ca8; animation-delay: 0.3s; }
.sparkle-b { left: 84%; top: 34%; color: #39c5ff; animation-delay: 1.8s; }
.sparkle-c { left: 68%; top: 70%; color: #ffd84d; animation-delay: 3.2s; }
.sparkle-d { left: 22%; top: 76%; color: #4ade80; animation-delay: 4.6s; }

html,
body {
  min-height: 100vh;
}

body {
  color: #24324f;
  font-weight: 500;
  background-color: #dff3ff;
}

.brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #3d8dff, #ff6fae, #ffd84d);
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.45), 0 0 18px rgba(61, 141, 255, 0.35);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.navbar {
  background: linear-gradient(90deg, rgba(78, 145, 255, 0.76), rgba(110, 126, 255, 0.74), rgba(72, 206, 255, 0.76));
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: 0 10px 25px rgba(86, 88, 174, 0.16);
}

.navbar .navbar-brand,
.navbar .badge,
.navbar .btn,
.navbar a {
  position: relative;
  z-index: 1;
  color: #163154 !important;
}

.navbar .btn:hover,
.navbar .btn:focus-visible,
.navbar a:hover,
.navbar a:focus-visible {
  color: #102845 !important;
}

.kids-name-badge {
  font-family: "Baloo 2", "Comic Sans MS", "Trebuchet MS", cursive;
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 0.48rem 0.9rem;
  color: #fff6cf !important;
  background: linear-gradient(135deg, #1f3d67, #2b4f86) !important;
  border-color: rgba(255, 255, 255, 0.42) !important;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.18);
  box-shadow: 0 10px 22px rgba(28, 59, 104, 0.28);
}

.battery-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.battery-icon {
  position: relative;
  width: 20px;
  height: 11px;
  border: 2px solid currentColor;
  border-radius: 3px;
  display: inline-block;
}

.battery-icon::after {
  content: "";
  position: absolute;
  right: -5px;
  top: 2px;
  width: 3px;
  height: 5px;
  border-radius: 0 2px 2px 0;
  background: currentColor;
}

.battery-fill {
  position: absolute;
  left: 2px;
  top: 2px;
  bottom: 2px;
  width: 0;
  border-radius: 1px;
  background: currentColor;
}

.card {
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-radius: 1.25rem;
  background: rgba(255, 255, 255, 0.68);
  backdrop-filter: blur(16px);
  box-shadow: 0 18px 38px rgba(129, 96, 196, 0.16);
}

.card .card-body,
.card label,
.card .form-check-label,
.card .fw-semibold,
.card .small,
.card p,
.card div {
  color: inherit;
}

.card-title,
h4,
h5 {
  color: #1f4676;
}

.form-label,
.form-check-label {
  color: #234064;
  font-weight: 700;
}

.text-muted {
  color: #4f678f !important;
}

.nav-tabs {
  border-bottom: 0;
  gap: 0.5rem;
}

.nav-tabs .nav-link {
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  color: #24456f;
  background: rgba(255, 255, 255, 0.52);
  font-weight: 700;
  box-shadow: 0 10px 22px rgba(110, 109, 194, 0.08);
}

.nav-tabs .nav-link:hover,
.nav-tabs .nav-link:focus-visible {
  border-color: rgba(61, 141, 255, 0.4);
  background: rgba(255, 255, 255, 0.72);
  color: #173a63;
}

.nav-tabs .nav-link.active {
  border-color: rgba(61, 141, 255, 0.56);
  color: #163a67;
  background: linear-gradient(135deg, rgba(167, 219, 255, 0.92), rgba(255, 210, 232, 0.92));
  box-shadow: 0 14px 28px rgba(82, 125, 214, 0.18);
}

.tab-content > .tab-pane {
  animation: fade-in-up 180ms ease;
}

.home-card {
  cursor: pointer;
  border-radius: 1.4rem;
  overflow: hidden;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background 180ms ease;
}

.home-card .display-6 {
  color: #1e5fd1;
  font-size: 3rem;
  font-weight: 900;
  text-shadow: 0 10px 24px rgba(30, 95, 209, 0.22);
  filter: saturate(1.3);
}

.home-card:nth-of-type(5n + 1) {
  background: linear-gradient(135deg, rgba(255, 175, 208, 0.98), rgba(255, 227, 108, 0.94));
}

.home-card:nth-of-type(5n + 2) {
  background: linear-gradient(135deg, rgba(146, 214, 255, 0.99), rgba(149, 236, 255, 0.95));
}

.home-card:nth-of-type(5n + 3) {
  background: linear-gradient(135deg, rgba(181, 202, 255, 0.98), rgba(228, 198, 255, 0.95));
}

.home-card:nth-of-type(5n + 4) {
  background: linear-gradient(135deg, rgba(255, 223, 122, 0.96), rgba(255, 177, 217, 0.94));
}

.home-card:nth-of-type(5n + 5) {
  background: linear-gradient(135deg, rgba(167, 255, 237, 0.96), rgba(168, 206, 255, 0.95));
}

.home-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 24px 42px rgba(130, 103, 194, 0.22);
}

.home-card.active,
.home-card:focus-visible {
  outline: 0;
  border-color: #3d8dff;
  box-shadow: 0 0 0 6px rgba(61, 141, 255, 0.24), 0 24px 42px rgba(81, 124, 214, 0.24);
}

.playlist {
  max-height: 420px;
  overflow: auto;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.56);
}

.playlist .list-group-item {
  border: 0;
  border-bottom: 1px solid rgba(133, 120, 196, 0.14);
  background: transparent;
  color: #263c5f;
}

.playlist .list-group-item:last-child {
  border-bottom: 0;
}

.playlist .list-group-item.active {
  background: linear-gradient(135deg, rgba(152, 206, 255, 0.36), rgba(255, 194, 227, 0.28));
  color: #203857;
}

.btn-primary {
  background: linear-gradient(135deg, #3d8dff, #6a7cff);
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow: 0 10px 24px rgba(78, 123, 214, 0.24);
  font-weight: 700;
  color: #ffffff;
}

.btn-primary:hover,
.btn-primary:focus {
  background: linear-gradient(135deg, #55a0ff, #7e8cff);
  border-color: rgba(255, 255, 255, 0.6);
}

.btn-outline-light,
.btn-outline-secondary,
.btn-outline-primary,
.btn-outline-success,
.btn-outline-warning {
  background: rgba(255, 255, 255, 0.5);
  border-color: rgba(255, 255, 255, 0.6);
  color: #234064;
}

.btn-outline-light:hover,
.btn-outline-secondary:hover,
.btn-outline-primary:hover,
.btn-outline-success:hover,
.btn-outline-warning:hover,
.btn-outline-light:focus-visible,
.btn-outline-secondary:focus-visible,
.btn-outline-primary:focus-visible,
.btn-outline-success:focus-visible,
.btn-outline-warning:focus-visible {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(61, 141, 255, 0.45);
  color: #173a63;
}

.btn-success {
  background: linear-gradient(135deg, #32c788, #25a76e);
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow: 0 10px 24px rgba(37, 167, 110, 0.2);
  color: #ffffff;
  font-weight: 700;
}

.btn-warning {
  background: linear-gradient(135deg, #ffd765, #ffb347);
  border-color: rgba(255, 255, 255, 0.55);
  box-shadow: 0 10px 24px rgba(255, 179, 71, 0.2);
  color: #533200;
  font-weight: 800;
}

.btn-danger {
  background: linear-gradient(135deg, #ff6f7f, #ef476f);
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 10px 24px rgba(239, 71, 111, 0.24);
  color: #ffffff;
  font-weight: 700;
}

.btn-dark {
  background: linear-gradient(135deg, #28456b, #182b45);
  border-color: rgba(255, 255, 255, 0.4);
}

.btn {
  border-radius: 0.9rem;
}

.btn:focus-visible,
.form-control:focus,
.form-select:focus,
.form-check-input:focus,
.form-range:focus {
  box-shadow: 0 0 0 0.25rem rgba(61, 141, 255, 0.22) !important;
}

.input-group-text,
.form-control,
.form-select {
  border-color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.78);
  color: #233a5d;
}

.form-control,
.form-select {
  border-radius: 0.9rem;
}

.form-check-input {
  border-color: rgba(61, 141, 255, 0.4);
  background-color: rgba(255, 255, 255, 0.82);
}

.form-check-input:checked {
  background-color: #3d8dff;
  border-color: #3d8dff;
}

.form-range::-webkit-slider-runnable-track {
  height: 0.55rem;
  background: linear-gradient(90deg, rgba(61, 141, 255, 0.32), rgba(255, 166, 200, 0.4));
  border-radius: 999px;
}

.form-range::-webkit-slider-thumb {
  margin-top: -0.3rem;
  width: 1.15rem;
  height: 1.15rem;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #3d8dff, #7a7cff);
  box-shadow: 0 6px 14px rgba(61, 141, 255, 0.28);
}

.form-range::-moz-range-track {
  height: 0.55rem;
  background: linear-gradient(90deg, rgba(61, 141, 255, 0.32), rgba(255, 166, 200, 0.4));
  border-radius: 999px;
}

.form-range::-moz-range-thumb {
  width: 1.15rem;
  height: 1.15rem;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #3d8dff, #7a7cff);
  box-shadow: 0 6px 14px rgba(61, 141, 255, 0.28);
}

.input-group-text {
  font-weight: 700;
  color: #2757a6;
}

.form-control::placeholder {
  color: #7890b6;
}

#gifQuery {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(253, 247, 255, 0.9));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.badge {
  box-shadow: 0 10px 20px rgba(124, 96, 188, 0.16);
  color: #1d3557;
}

.badge.text-bg-secondary,
.badge.text-bg-success,
.badge.text-bg-danger,
.badge.text-bg-dark {
  color: #ffffff !important;
}

#localStatus.text-bg-secondary {
  background: linear-gradient(135deg, #64748b, #475569) !important;
}

#localStatus.text-bg-success {
  background: linear-gradient(135deg, #22c55e, #15803d) !important;
}

#localStatus.text-bg-danger {
  background: linear-gradient(135deg, #ef476f, #c81e4d) !important;
}

.modal-content {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(250, 245, 255, 0.88));
  border: 2px solid rgba(255, 255, 255, 0.72);
}

.modal-header,
.modal-footer {
  border-color: rgba(123, 143, 194, 0.18);
}

pre.mono {
  background: rgba(255, 255, 255, 0.62);
  border-radius: 0.8rem;
  padding: 0.8rem;
  color: #203857;
  border: 1px solid rgba(123, 143, 194, 0.18);
  white-space: pre-wrap;
  word-break: break-word;
}

.list-group-item-action:hover,
.list-group-item-action:focus-visible {
  background: rgba(61, 141, 255, 0.1);
  color: #183a62;
}

#batteryList .border {
  border-color: rgba(61, 141, 255, 0.18) !important;
  background: rgba(255, 255, 255, 0.5);
  color: #203857;
}

[data-bs-theme="dark"] body {
  color: #e8f2ff;
  background-color: #0d1730;
}

[data-bs-theme="dark"] .card {
  background: rgba(16, 29, 53, 0.76);
  border-color: rgba(157, 194, 255, 0.14);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] .card-title,
[data-bs-theme="dark"] h4,
[data-bs-theme="dark"] h5,
[data-bs-theme="dark"] .form-label,
[data-bs-theme="dark"] .form-check-label,
[data-bs-theme="dark"] .fw-semibold,
[data-bs-theme="dark"] .small,
[data-bs-theme="dark"] .card div,
[data-bs-theme="dark"] .card p {
  color: #e8f2ff;
}

[data-bs-theme="dark"] .text-muted {
  color: #b4c8ec !important;
}

[data-bs-theme="dark"] .input-group-text,
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] pre.mono,
[data-bs-theme="dark"] .playlist {
  background: rgba(12, 23, 45, 0.86);
  border-color: rgba(157, 194, 255, 0.18);
  color: #e8f2ff;
}

[data-bs-theme="dark"] .form-control::placeholder {
  color: #8fa8ce;
}

[data-bs-theme="dark"] .playlist .list-group-item {
  color: #e8f2ff;
  border-bottom-color: rgba(157, 194, 255, 0.12);
}

[data-bs-theme="dark"] .playlist .list-group-item.active,
[data-bs-theme="dark"] .list-group-item-action:hover,
[data-bs-theme="dark"] .list-group-item-action:focus-visible {
  background: rgba(61, 141, 255, 0.22);
  color: #ffffff;
}

[data-bs-theme="dark"] .nav-tabs .nav-link {
  background: rgba(13, 25, 48, 0.78);
  border-color: rgba(157, 194, 255, 0.16);
  color: #dce9ff;
}

[data-bs-theme="dark"] .nav-tabs .nav-link:hover,
[data-bs-theme="dark"] .nav-tabs .nav-link:focus-visible {
  background: rgba(26, 46, 84, 0.9);
  color: #ffffff;
}

[data-bs-theme="dark"] .nav-tabs .nav-link.active {
  background: linear-gradient(135deg, rgba(43, 86, 169, 0.95), rgba(106, 124, 255, 0.95));
  color: #ffffff;
  border-color: rgba(130, 170, 255, 0.38);
}

[data-bs-theme="dark"] .btn-outline-light,
[data-bs-theme="dark"] .btn-outline-secondary,
[data-bs-theme="dark"] .btn-outline-primary,
[data-bs-theme="dark"] .btn-outline-success,
[data-bs-theme="dark"] .btn-outline-warning {
  background: rgba(20, 37, 68, 0.78);
  border-color: rgba(157, 194, 255, 0.18);
  color: #eaf2ff;
}

[data-bs-theme="dark"] .btn-outline-light:hover,
[data-bs-theme="dark"] .btn-outline-secondary:hover,
[data-bs-theme="dark"] .btn-outline-primary:hover,
[data-bs-theme="dark"] .btn-outline-success:hover,
[data-bs-theme="dark"] .btn-outline-warning:hover,
[data-bs-theme="dark"] .btn-outline-light:focus-visible,
[data-bs-theme="dark"] .btn-outline-secondary:focus-visible,
[data-bs-theme="dark"] .btn-outline-primary:focus-visible,
[data-bs-theme="dark"] .btn-outline-success:focus-visible,
[data-bs-theme="dark"] .btn-outline-warning:focus-visible {
  background: rgba(36, 61, 109, 0.94);
  color: #ffffff;
}

[data-bs-theme="dark"] #batteryList .border {
  background: rgba(12, 23, 45, 0.7);
  color: #e8f2ff;
  border-color: rgba(157, 194, 255, 0.16) !important;
}

@keyframes fade-in-up {
  0% {
    opacity: 0;
    transform: translateY(6px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes firework-pop {
  0% {
    opacity: 0;
    transform: scale(0.08);
  }
  8% {
    opacity: 1;
  }
  24% {
    opacity: 1;
    transform: scale(1);
  }
  42%,
  100% {
    opacity: 0;
    transform: scale(1.55);
  }
}

@keyframes confetti-float {
  0%, 100% {
    transform: translate3d(0, 0, 0) scale(0.85) rotate(0deg);
    opacity: 0.55;
  }
  50% {
    transform: translate3d(8px, -20px, 0) scale(1.25) rotate(25deg);
    opacity: 1;
  }
}

@keyframes float-clouds {
  0%, 100% {
    transform: translateY(0) translateX(0);
  }
  50% {
    transform: translateY(-14px) translateX(10px);
  }
}

@keyframes rainbow-shift {
  0% {
    transform: translateX(-3%);
  }
  50% {
    transform: translateX(3%);
  }
  100% {
    transform: translateX(-3%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .bg-grad::before,
  .bg-grad::after,
  .firework,
  .sparkle,
  .home-card {
    animation: none !important;
    transition: none !important;
  }
}
