* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: "Segoe UI", system-ui, sans-serif;
  touch-action: manipulation;
}

/* Skip Link for Accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #6cf;
  color: #000;
  padding: 8px 16px;
  z-index: 10000;
  font-weight: bold;
  text-decoration: none;
  border-radius: 0 0 8px 0;
}

.skip-link:focus {
  top: 0;
}

/* Background Layers */
#custom-bg,
#custom-video {
  position: fixed;
  top: 50%;
  left: 50%;
  min-width: 100%;
  min-height: 100%;
  width: auto;
  height: auto;
  transform: translate(-50%, -50%) scale(1.05);
  z-index: 0;
  object-fit: cover;
  transition: filter 0.3s ease;
  will-change: filter;
}

#custom-video {
  display: none;
}

#custom-bg.hidden,
#custom-video.hidden {
  display: none;
}

#custom-video.active {
  display: block;
}

/* Color Overlay */
#color-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  mix-blend-mode: overlay;
  opacity: 0;
  transition: opacity 0.3s ease, background-color 0.3s ease;
}

/* Raindrops Canvas */
#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  mix-blend-mode: screen;
  opacity: 0.9;
}

/* Loading Overlay */
#loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 15px;
}

#loading-overlay.active {
  display: flex;
}

.loader-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: #6cf;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loader-text {
  color: #fff;
  font-size: 14px;
  opacity: 0.8;
}

/* UI Buttons */
.ui-btn {
  position: fixed;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 50px;
  height: 50px;
  border-radius: 12px;
  font-size: 20px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-tap-highlight-color: transparent;
  right: 20px;
}

.ui-btn:hover,
.ui-btn:active {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

.ui-btn:focus {
  outline: 2px solid #6cf;
  outline-offset: 2px;
}

.ui-btn:focus:not(:focus-visible) {
  outline: none;
}

.ui-btn:focus-visible {
  outline: 2px solid #6cf;
  outline-offset: 2px;
}

.ui-btn.active {
  background: rgba(102, 204, 255, 0.3);
  border-color: #6cf;
}

/* Button specific positions */
#btn-settings {
  top: 20px;
}

#btn-sound {
  top: 80px;
}

#btn-fullscreen {
  bottom: 20px;
}

#btn-share {
  bottom: 80px;
}

/* Slide ALL buttons with the panel */
body.panel-active #btn-settings,
body.panel-active #btn-sound,
body.panel-active #btn-share,
body.panel-active #btn-fullscreen {
  right: 360px;
}

/* Settings Panel */
.panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 340px;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  padding: 20px;
  padding-top: 70px;
  z-index: 999;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  overflow-x: hidden;
}

.panel.open {
  transform: translateX(0);
}

.panel-close {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.panel-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.panel-close:focus {
  outline: 2px solid #6cf;
  outline-offset: 2px;
}

.panel-close:focus:not(:focus-visible) {
  outline: none;
}

.panel h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 15px;
  margin-top: 25px;
  color: #6cf;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 10px;
}

.panel h3:first-of-type {
  margin-top: 0;
}

/* Preset Grid */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 15px;
}

.preset-item {
  aspect-ratio: 16/10;
  background-size: cover;
  background-position: center;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid transparent;
  opacity: 0.6;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.preset-item:hover,
.preset-item:active {
  opacity: 0.85;
  transform: scale(1.02);
}

.preset-item:focus {
  outline: 2px solid #6cf;
  outline-offset: 2px;
  opacity: 0.85;
}

.preset-item:focus:not(:focus-visible) {
  outline: none;
}

.preset-item.active {
  border-color: #6cf;
  opacity: 1;
}

.preset-item::after {
  content: attr(data-label);
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 4px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
  color: white;
  font-size: 8px;
  text-align: center;
  border-radius: 0 0 6px 6px;
}

.preset-item.video::before {
  content: "▶";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 14px;
  color: white;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
  z-index: 1;
}

/* Controls */
.control-group {
  margin-bottom: 16px;
}

.control-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.8);
}

.control-value {
  color: #6cf;
  font-weight: 600;
  font-size: 11px;
}

input[type="range"] {
  width: 100%;
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.15);
  appearance: none;
  outline: none;
  cursor: pointer;
}

input[type="range"]:focus {
  outline: 2px solid #6cf;
  outline-offset: 4px;
}

input[type="range"]:focus:not(:focus-visible) {
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  background: #6cf;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: #6cf;
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

/* Color Picker */
.color-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.color-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.color-btn:hover,
.color-btn.active {
  transform: scale(1.15);
  border-color: white;
}

.color-btn:focus {
  outline: 2px solid #6cf;
  outline-offset: 2px;
}

.color-btn:focus:not(:focus-visible) {
  outline: none;
}

.color-btn.none {
  background: linear-gradient(135deg, #333 45%, #fff 45%, #fff 55%, #333 55%);
}

/* Inputs */
.input-group {
  margin-top: 12px;
}

.input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.text-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12px;
  outline: none;
  min-width: 0;
}

.text-input:focus {
  border-color: #6cf;
  outline: none;
}

.text-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.btn {
  background: #6cf;
  border: none;
  color: #000;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.btn:hover,
.btn:active {
  filter: brightness(1.1);
}

.btn:focus {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.btn:focus:not(:focus-visible) {
  outline: none;
}

.btn-file {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  color: white;
  border: 1px dashed rgba(255, 255, 255, 0.3);
}

.btn-file:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Audio Control */
.sound-control {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  margin-bottom: 15px;
}

.sound-icon {
  font-size: 20px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px;
  border-radius: 4px;
}

.sound-icon:focus {
  outline: 2px solid #6cf;
  outline-offset: 2px;
}

.sound-icon:focus:not(:focus-visible) {
  outline: none;
}

.sound-control input[type="range"] {
  flex: 1;
}

/* Reset Button */
.btn-reset {
  width: 100%;
  background: rgba(255, 100, 100, 0.2);
  color: #ff6b6b;
  border: 1px solid rgba(255, 100, 100, 0.3);
  margin-top: 10px;
}

.btn-reset:hover {
  background: rgba(255, 100, 100, 0.3);
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 14px 24px;
  border-radius: 30px;
  font-size: 13px;
  z-index: 2000;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.error {
  border-color: rgba(255, 100, 100, 0.5);
  background: rgba(50, 0, 0, 0.9);
}

.toast.success {
  border-color: rgba(100, 255, 150, 0.5);
}

/* Swipe Indicator */
.swipe-indicator {
  position: fixed;
  top: 50%;
  right: 0;
  width: 20px;
  height: 60px;
  background: linear-gradient(to left, rgba(102, 204, 255, 0.3), transparent);
  border-radius: 10px 0 0 10px;
  z-index: 998;
  transform: translateY(-50%);
  opacity: 0.5;
  transition: opacity 0.3s;
  pointer-events: none;
}

.panel.open ~ .swipe-indicator {
  opacity: 0;
}

/* Scrollbar */
.panel::-webkit-scrollbar {
  width: 4px;
}

.panel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
}

/* Screen Reader Only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* PWA Install Button */
#btn-install {
  display: none;
  bottom: 140px;
}

#btn-install.show {
  display: flex;
}

/* Responsive */
@media (max-width: 480px) {
  .panel {
    width: 100%;
    padding: 15px;
    padding-top: 60px;
  }

  body.panel-active #btn-settings,
  body.panel-active #btn-sound,
  body.panel-active #btn-share,
  body.panel-active #btn-fullscreen,
  body.panel-active #btn-install {
    right: auto;
    left: 15px;
  }

  .preset-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .ui-btn {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }

  #btn-settings {
    top: 15px;
    right: 15px;
  }

  #btn-sound {
    top: 70px;
    right: 15px;
  }

  #btn-fullscreen {
    bottom: 15px;
    right: 15px;
  }

  #btn-share {
    bottom: 70px;
    right: 15px;
  }

  #btn-install {
    bottom: 125px;
    right: 15px;
  }

  .control-label {
    font-size: 11px;
  }

  .text-input {
    padding: 8px 10px;
    font-size: 11px;
  }

  .btn {
    padding: 8px 12px;
    font-size: 10px;
  }
}

@media (max-width: 360px) {
  .preset-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Hidden audio element */
#rain-audio {
  display: none;
}

/* =========================================================
   WIDGETS - Premium Glassmorphism Edition
   Atmospheric, animated, immersive
   ========================================================= */

/*   KEYFRAME ANIMATIONS */

/* Widget entrance animation */
@keyframes widgetSlideIn {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    filter: blur(10px);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

/* Pulse for the second */
@keyframes secondsPulse {
  0%,
  100% {
    opacity: 0.5;
  }

  50% {
    opacity: 0.9;
  }
}

/* Light float effect */
@keyframes subtleFloat {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-3px);
  }
}

/* Rain animation for weather icon */
@keyframes rainSway {
  0%,
  100% {
    transform: rotate(-2deg) translateX(0);
  }

  25% {
    transform: rotate(1deg) translateX(1px);
  }

  75% {
    transform: rotate(-1deg) translateX(-1px);
  }
}

/*Pulse effect */
@keyframes celestialGlow {
  0%,
  100% {
    filter: drop-shadow(0 0 8px rgba(255, 200, 100, 0.3));
    transform: scale(1);
  }

  50% {
    filter: drop-shadow(0 0 15px rgba(255, 200, 100, 0.5));
    transform: scale(1.05);
  }
}

/* Drift for the cloud */
@keyframes cloudDrift {
  0%,
  100% {
    transform: translateX(0);
  }

  50% {
    transform: translateX(3px);
  }
}

/* Badge pulse for the Now */
@keyframes nowPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(102, 204, 255, 0.4),
      inset 0 0 15px rgba(102, 204, 255, 0.1);
  }

  50% {
    box-shadow: 0 0 0 8px rgba(102, 204, 255, 0),
      inset 0 0 20px rgba(102, 204, 255, 0.2);
  }
}

/* Shimmer effect */
@keyframes shimmer {
  0% {
    background-position: -200% center;
  }

  100% {
    background-position: 200% center;
  }
}

/* Glow breathe */
@keyframes glowBreathe {
  0%,
  100% {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3),
      0 0 0 1px rgba(255, 255, 255, 0.05),
      inset 0 1px 0 rgba(255, 255, 255, 0.1), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
  }

  50% {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4),
      0 0 0 1px rgba(255, 255, 255, 0.08),
      inset 0 1px 0 rgba(255, 255, 255, 0.15), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
  }
}

/* ============================================
   CONTAINER
   ============================================ */
.widgets-container {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 20px;
  pointer-events: none;
  perspective: 1000px;
}

.widgets-container > * {
  pointer-events: auto;
}

.widgets-container.widgets-hidden {
  opacity: 0;
  visibility: hidden;
}

.widgets-container.widgets-visible {
  opacity: 1;
  visibility: visible;
}

.widgets-container.widgets-visible .datetime-widget {
  animation: widgetSlideIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.widgets-container.widgets-visible .weather-widget {
  animation: widgetSlideIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.15s forwards;
  opacity: 0;
}

/* ============================================
   SHARED WIDGET STYLES - Premium Glass
   ============================================ */
.datetime-widget,
.weather-widget {
  position: relative;
  width: min(92vw, 380px);
  border-radius: 24px;
  color: #fff;

  /* Multi-layer glass effect */
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.12) 0%,
    rgba(255, 255, 255, 0.05) 50%,
    rgba(255, 255, 255, 0.08) 100%
  );

  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);

  /* Sophisticated border - light refraction effect */
  border: 1px solid transparent;
  background-clip: padding-box;

  /* Complex shadow for depth */
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.15), inset 0 -1px 0 rgba(0, 0, 0, 0.1);

  /* Subtle animation */
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);

  /* 3D effect base */
  transform-style: preserve-3d;
}

/* Gradient border overlay */
.datetime-widget::before,
.weather-widget::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 24px;
  padding: 1px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.3) 0%,
    rgba(255, 255, 255, 0.05) 50%,
    rgba(255, 255, 255, 0.1) 100%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* Top light reflection */
.datetime-widget::after,
.weather-widget::after {
  content: "";
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.5) 50%,
    transparent 100%
  );
  pointer-events: none;
}

/* Hover state - lift and glow */
.datetime-widget:hover,
.weather-widget:hover {
  transform: translateY(-4px) scale(1.01);

  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.18) 0%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0.12) 100%
  );

  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.2), inset 0 -1px 0 rgba(0, 0, 0, 0.1),
    0 0 40px rgba(102, 180, 255, 0.1);
}

/* ============================================
   DATETIME WIDGET
   ============================================ */
.datetime-widget {
  padding: 24px 28px;
  text-align: center;
  overflow: hidden;
}

/* Time display */
.datetime-widget .time {
  font-size: 56px;
  font-weight: 200;
  letter-spacing: 2px;
  line-height: 1;
  margin-bottom: 8px;

  /* Subtle text glow */
  text-shadow: 0 0 40px rgba(255, 255, 255, 0.15), 0 2px 10px rgba(0, 0, 0, 0.3);

  /* Smooth number transitions */
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.datetime-widget .time-seconds {
  font-size: 20px;
  font-weight: 300;
  opacity: 0.6;
  vertical-align: top;
  margin-left: 4px;
  display: inline-block;
  min-width: 28px;

  /* Pulse animation */
  animation: secondsPulse 1s ease-in-out infinite;
}

.datetime-widget .date {
  font-size: 14px;
  font-weight: 400;
  opacity: 0.85;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.datetime-widget .day-name {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.6;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.datetime-widget .day-phase {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 14px;
  padding: 6px 14px;

  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.5px;

  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.12) 0%,
    rgba(255, 255, 255, 0.05) 100%
  );

  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);

  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 2px 8px rgba(0, 0, 0, 0.15);
}

.datetime-widget .day-phase span:first-child {
  font-size: 14px;
}

/* ============================================
   WEATHER WIDGET
   ============================================ */
.weather-widget {
  padding: 20px 24px;
  overflow: hidden;
}

/* Loading state */
.weather-widget.loading {
  min-height: 160px;
}

.weather-widget.loading #weather-content {
  display: none;
}

.weather-widget.loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.08) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
  border-radius: 24px;
}

/* Error state */
.weather-widget.error .weather-error {
  display: flex;
}

.weather-widget.error #weather-content {
  display: none;
}

.weather-error {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px;
  text-align: center;
}

.weather-error-icon {
  font-size: 32px;
  opacity: 0.7;
  animation: subtleFloat 3s ease-in-out infinite;
}

.weather-error-text {
  font-size: 13px;
  opacity: 0.8;
  max-width: 200px;
}

.weather-retry-btn {
  padding: 10px 24px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;

  color: #fff;
  background: linear-gradient(
    135deg,
    rgba(102, 204, 255, 0.3) 0%,
    rgba(102, 204, 255, 0.15) 100%
  );

  border: 1px solid rgba(102, 204, 255, 0.3);
  border-radius: 12px;
  cursor: pointer;

  transition: all 0.3s ease;

  box-shadow: 0 4px 15px rgba(102, 204, 255, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.weather-retry-btn:hover {
  background: linear-gradient(
    135deg,
    rgba(102, 204, 255, 0.5) 0%,
    rgba(102, 204, 255, 0.25) 100%
  );
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 204, 255, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.weather-retry-btn:active {
  transform: translateY(0);
}

/* Weather Header */
.weather-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.weather-location {
  display: inline-flex;
  align-items: center;
  gap: 8px;

  padding: 8px 12px;
  margin: -8px -12px;

  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.3px;

  border-radius: 12px;
  cursor: pointer;

  transition: all 0.3s ease;
}

.weather-location:hover {
  background: rgba(255, 255, 255, 0.1);
}

.weather-location:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(102, 204, 255, 0.5);
}

.weather-location-icon {
  font-size: 14px;
}

.weather-location-text {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.weather-location-edit {
  font-size: 11px;
  opacity: 0.5;
  transition: opacity 0.2s;
}

.weather-location:hover .weather-location-edit {
  opacity: 1;
}

.weather-update-time {
  font-size: 10px;
  opacity: 0.5;
  white-space: nowrap;
  padding-top: 4px;
}

/* Weather Current */
.weather-current {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.weather-icon {
  font-size: 52px;
  line-height: 1;

  /* Dynamic animation based on weather - applied via JS class */
  transition: all 0.3s ease;
}

/* Weather icon animations */
.weather-icon.rain {
  animation: rainSway 2s ease-in-out infinite;
}

.weather-icon.sun,
.weather-icon.moon {
  animation: celestialGlow 4s ease-in-out infinite;
}

.weather-icon.cloud {
  animation: cloudDrift 4s ease-in-out infinite;
}

.weather-icon.snow {
  animation: subtleFloat 3s ease-in-out infinite;
}

.weather-info {
  flex: 1;
}

.weather-temp {
  font-size: 42px;
  font-weight: 200;
  line-height: 1;
  letter-spacing: -1px;

  text-shadow: 0 0 30px rgba(255, 255, 255, 0.1), 0 2px 10px rgba(0, 0, 0, 0.2);

  font-variant-numeric: tabular-nums;
}

.weather-temp-unit {
  font-size: 18px;
  font-weight: 300;
  opacity: 0.6;
  vertical-align: top;
  margin-left: 2px;
}

.weather-desc {
  font-size: 14px;
  font-weight: 400;
  opacity: 0.85;
  margin-top: 4px;
  letter-spacing: 0.3px;
}

/* Weather Details */
.weather-details {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  padding-bottom: 16px;

  /* Gradient divider */
  border-bottom: 1px solid transparent;
  background-image: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.15) 50%,
    transparent 100%
  );
  background-size: 100% 1px;
  background-repeat: no-repeat;
  background-position: bottom;
}

.weather-detail-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;

  padding: 10px 8px;

  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);

  transition: all 0.3s ease;
}

.weather-detail-item:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.1);
}

.weather-detail-icon {
  font-size: 16px;
  opacity: 0.8;
}

.weather-detail-item span:last-child {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.3px;
}

/* Hourly Forecast */
.weather-hourly {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.weather-hour {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 10px;

  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.08) 0%,
    rgba(255, 255, 255, 0.03) 100%
  );

  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.06);

  transition: all 0.3s ease;
}

.weather-hour:hover {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.12) 0%,
    rgba(255, 255, 255, 0.05) 100%
  );
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

/* "Now" hour - special styling */
.weather-hour.is-now {
  background: linear-gradient(
    180deg,
    rgba(102, 204, 255, 0.2) 0%,
    rgba(102, 204, 255, 0.08) 100%
  );

  border-color: rgba(102, 204, 255, 0.3);

  animation: nowPulse 3s ease-in-out infinite;
}

/* Live indicator dot */
.weather-hour.is-now::before {
  content: "";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 6px;
  height: 6px;

  background: #6cf;
  border-radius: 50%;

  box-shadow: 0 0 8px rgba(102, 204, 255, 0.8);

  animation: secondsPulse 1.5s ease-in-out infinite;
}

.weather-hour-time {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.7;
  letter-spacing: 0.3px;
}

.weather-hour.is-now .weather-hour-time {
  opacity: 1;
  color: #6cf;
  font-weight: 600;
}

.weather-hour-icon {
  font-size: 22px;
  line-height: 1;
}

.weather-hour-temp {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

/* ============================================
   LOCATION MODAL - Premium Glass
   ============================================ */
.location-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;

  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;

  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);

  opacity: 0;
  transition: opacity 0.3s ease;
}

.location-modal.open {
  display: flex;
  opacity: 1;
}

.location-modal-content {
  position: relative;
  width: min(92vw, 420px);
  max-height: 80vh;
  overflow-y: auto;
  overflow-x: hidden;

  padding: 28px;

  background: linear-gradient(
    135deg,
    rgba(30, 35, 45, 0.95) 0%,
    rgba(20, 25, 35, 0.98) 100%
  );

  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.1);

  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.1);

  color: #fff;

  animation: widgetSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Scrollbar styling */
.location-modal-content::-webkit-scrollbar {
  width: 6px;
}

.location-modal-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

.location-modal-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.location-modal-content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.location-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.location-modal-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.location-modal-close {
  width: 40px;
  height: 40px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  font-size: 18px;
  color: #fff;

  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;

  cursor: pointer;
  transition: all 0.3s ease;
}

.location-modal-close:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

.location-modal-close:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(102, 204, 255, 0.5);
}

/* Location Options */
.location-option {
  display: flex;
  align-items: center;
  gap: 14px;

  padding: 16px 18px;
  margin-bottom: 12px;

  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.06) 0%,
    rgba(255, 255, 255, 0.02) 100%
  );

  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;

  cursor: pointer;
  transition: all 0.3s ease;
}

.location-option:hover {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(255, 255, 255, 0.04) 100%
  );
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateX(4px);
}

.location-option:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(102, 204, 255, 0.5);
}

.location-option.active {
  background: linear-gradient(
    135deg,
    rgba(102, 204, 255, 0.2) 0%,
    rgba(102, 204, 255, 0.08) 100%
  );
  border-color: rgba(102, 204, 255, 0.4);
}

.location-option.active::before {
  content: "✓";
  position: absolute;
  right: 18px;
  font-size: 14px;
  color: #6cf;
}

.location-option {
  position: relative;
}

.location-option-icon {
  font-size: 24px;
  width: 40px;
  text-align: center;
}

.location-option-info {
  flex: 1;
}

.location-option-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 3px;
  letter-spacing: 0.2px;
}

.location-option-desc {
  font-size: 12px;
  opacity: 0.6;
}

/* Location Search */
.location-search {
  margin-top: 20px;
}

.location-search-input {
  width: 100%;
  padding: 14px 18px;

  font-size: 14px;
  color: #fff;

  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;

  outline: none;
  transition: all 0.3s ease;
}

.location-search-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.location-search-input:focus {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(102, 204, 255, 0.5);
  box-shadow: 0 0 0 4px rgba(102, 204, 255, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.location-search-results {
  margin-top: 12px;
  max-height: 200px;
  overflow-y: auto;
}

.location-search-result {
  padding: 12px 16px;
  margin-bottom: 8px;

  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  border: 1px solid transparent;

  cursor: pointer;
  transition: all 0.3s ease;
}

.location-search-result:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateX(4px);
}

.location-search-result:focus {
  outline: none;
  border-color: rgba(102, 204, 255, 0.5);
}

.location-search-result-name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.location-search-result-country {
  font-size: 12px;
  opacity: 0.6;
}

.location-search-loading,
.location-search-empty {
  padding: 24px;
  text-align: center;
  font-size: 13px;
  opacity: 0.6;
}

/* Popular Cities */
.location-popular {
  margin-top: 24px;
}

.location-popular-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  opacity: 0.5;
  margin-bottom: 14px;
}

.location-popular-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.location-popular-item {
  padding: 12px 16px;

  font-size: 13px;
  font-weight: 500;
  text-align: center;

  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;

  cursor: pointer;
  transition: all 0.3s ease;
}

.location-popular-item:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.location-popular-item:focus {
  outline: none;
  border-color: rgba(102, 204, 255, 0.5);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 480px) {
  .widgets-container {
    gap: 16px;
    padding: 16px;
  }

  .datetime-widget,
  .weather-widget {
    width: min(94vw, 360px);
    border-radius: 20px;
  }

  .datetime-widget::before,
  .weather-widget::before,
  .datetime-widget::after,
  .weather-widget::after {
    border-radius: 20px;
  }

  .datetime-widget {
    padding: 20px 22px;
  }

  .datetime-widget .time {
    font-size: 44px;
  }

  .datetime-widget .time-seconds {
    font-size: 16px;
  }

  .weather-widget {
    padding: 18px 20px;
  }

  .weather-icon {
    font-size: 44px;
  }

  .weather-temp {
    font-size: 36px;
  }

  .weather-hour {
    padding: 12px 8px;
  }

  .weather-hour-icon {
    font-size: 20px;
  }

  .location-modal-content {
    padding: 24px;
    border-radius: 24px;
  }
}

@media (max-width: 360px) {
  .datetime-widget .time {
    font-size: 38px;
    letter-spacing: 1px;
  }

  .weather-temp {
    font-size: 32px;
  }

  .weather-details {
    gap: 6px;
  }

  .weather-detail-item {
    padding: 8px 6px;
  }

  .weather-hourly {
    gap: 8px;
  }
}

/* ============================================
   REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .widgets-container.widgets-visible .datetime-widget,
  .widgets-container.widgets-visible .weather-widget {
    animation: none;
    opacity: 1;
  }
}

/* ============================================
   DARK MODE ENHANCEMENTS (if OS prefers)
   ============================================ */
@media (prefers-color-scheme: dark) {
  .datetime-widget,
  .weather-widget {
    background: linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.1) 0%,
      rgba(255, 255, 255, 0.04) 50%,
      rgba(255, 255, 255, 0.07) 100%
    );
  }
}