:root {
  --font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", 'Plus Jakarta Sans', "Helvetica Neue", sans-serif;
  
  /* Exact color sampled from user screenshot */
  --bg-gradient: #161b2e;
  --clock-text-color: rgba(94, 98, 126, 0.94);
  --clock-border-color: rgba(150, 160, 192, 0.4);
  --clock-glow: rgba(18, 24, 40, 0.5);
  --meta-text-color: #eceeff;
  --glass-bg: rgba(20, 26, 42, 0.45);
  --glass-border: rgba(255, 255, 255, 0.08);
  --cloud-opacity: 0.7;
  --transition-speed: 0.6s;
}

/* Day Mode Theme */
body.day {
  --bg-gradient: linear-gradient(180deg, #2f7fe0 0%, #5aa3ec 45%, #9ccdf5 80%, #c9e4f8 100%);
  --clock-text-color: rgba(255, 255, 255, 0.55);
  --clock-border-color: rgba(255, 255, 255, 0.7);
  --clock-glow: rgba(20, 70, 140, 0.25);
  --meta-text-color: #ffffff;
  --glass-bg: rgba(18, 60, 120, 0.28);
  --glass-border: rgba(255, 255, 255, 0.3);
  --cloud-opacity: 0.75;
}

/* Sunset / Golden Hour Theme */
body.sunset {
  /* Real dusk sky: deep blue overhead → violet → warm peach/orange at the horizon */
  --bg-gradient:
    radial-gradient(ellipse 70% 35% at 30% 100%, rgba(255, 170, 90, 0.75) 0%, rgba(255, 140, 90, 0) 70%),
    linear-gradient(180deg, #1c2b55 0%, #3b3f78 28%, #7a5a8f 50%, #c97c86 70%, #f2a072 86%, #ffc88a 100%);
  --clock-text-color: rgba(255, 255, 255, 0.42);
  --clock-border-color: rgba(255, 235, 225, 0.55);
  --clock-glow: rgba(40, 20, 60, 0.3);
  --meta-text-color: #fff6f0;
  --glass-bg: rgba(40, 30, 70, 0.35);
  --glass-border: rgba(255, 220, 200, 0.18);
  --cloud-opacity: 0.7;
}

/* Rainy Theme */
body.rain {
  --bg-gradient: radial-gradient(ellipse at 50% 15%, #232c38 0%, #141b24 60%, #0a0d12 100%);
  --clock-text-color: rgba(90, 102, 122, 0.85);
  --clock-border-color: rgba(170, 190, 215, 0.35);
  --clock-glow: rgba(5, 10, 18, 0.5);
  --meta-text-color: #e2e8f0;
  --glass-bg: rgba(15, 23, 35, 0.65);
  --glass-border: rgba(255, 255, 255, 0.08);
  --cloud-opacity: 0.9;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  font-family: var(--font-family);
  background-color: #121727;
  color: var(--meta-text-color);
}

body {
  background: var(--bg-gradient);
  transition: background var(--transition-speed) ease;
}

/* =========================================
   Sky Container & Background Visual Effects
   ========================================= */
.sky-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

/* Realistic Starry Sky Backdrop from User Reference */
body.night .sky-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url('sky_real.png') center center / cover no-repeat;
  opacity: 0.98;
  z-index: 1;
}

#stars-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  opacity: 0.85;
  transition: opacity 1s ease;
}

body.day #stars-canvas {
  opacity: 0.05;
}

/* Celestial Orb (Moon / Sun) */
.sun-moon-element {
  position: absolute;
  top: 13%;
  right: 5%;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffffff 0%, #e2e8f5 65%, #bacae0 100%);
  box-shadow: 0 0 50px rgba(210, 230, 255, 0.35), 0 0 100px rgba(180, 210, 255, 0.2);
  opacity: 0.85;
  filter: blur(1px);
  z-index: 3;
  transition: all 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body.day .sun-moon-element {
  background: radial-gradient(circle at 40% 40%, #fff7b3 0%, #ffc837 70%, #ff8008 100%);
  box-shadow: 0 0 70px rgba(255, 200, 50, 0.6), 0 0 140px rgba(255, 170, 0, 0.35);
  top: 13%;
  right: 5%;
  width: 80px;
  height: 80px;
  filter: none;
  opacity: 1;
}

/* Rain: no moon/sun, dim stars */
body.rain .sun-moon-element { opacity: 0; }
body.rain #stars-canvas { opacity: 0.15; }

/* Day: hide night clouds tint, lighter glass */
body.day .clouds-layer { opacity: 0.9; filter: brightness(1.6) blur(18px); }

body.sunset .sun-moon-element {
  /* Low sun sitting near the horizon, half hidden */
  background: radial-gradient(circle at 50% 50%, #fffbe8 0%, #ffe0a0 45%, #ffb36b 100%);
  box-shadow: 0 0 60px 20px rgba(255, 190, 110, 0.55), 0 0 200px 80px rgba(255, 150, 80, 0.3);
  top: auto;
  bottom: -40px;
  right: auto;
  left: 18%;
  width: 120px;
  height: 120px;
  filter: blur(0.5px);
  opacity: 1;
}

/* Only the first few stars appear at dusk */
body.sunset #stars-canvas { opacity: 0.18; }
body.sunset .clouds-layer { filter: sepia(0.6) saturate(2) hue-rotate(-20deg) brightness(1.3) blur(16px); }

/* Moving Organic Cloud Layers */
.clouds-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 300%;
  height: 100%;
  background-repeat: repeat-x;
  pointer-events: none;
  opacity: var(--cloud-opacity);
  will-change: transform;
}

/* CSS Procedural Cloud Gradients to ensure rich cloudy feel without broken asset URLs */
.layer-back {
  background-image: 
    radial-gradient(circle at 15% 20%, rgba(200, 215, 240, 0.08) 0%, transparent 60%),
    radial-gradient(circle at 45% 15%, rgba(180, 200, 230, 0.12) 0%, transparent 55%),
    radial-gradient(circle at 75% 25%, rgba(190, 210, 240, 0.09) 0%, transparent 60%);
  background-size: 1600px 100%;
  animation: driftClouds 140s linear infinite;
  z-index: 4;
}

.layer-mid {
  background-image: 
    radial-gradient(ellipse at 25% 18%, rgba(220, 230, 250, 0.14) 0%, rgba(160, 180, 220, 0.05) 50%, transparent 70%),
    radial-gradient(ellipse at 65% 22%, rgba(210, 225, 245, 0.12) 0%, rgba(150, 175, 215, 0.04) 50%, transparent 70%),
    radial-gradient(ellipse at 88% 12%, rgba(230, 240, 255, 0.1) 0%, transparent 65%);
  background-size: 1900px 100%;
  animation: driftClouds 90s linear infinite;
  z-index: 5;
  filter: blur(14px);
}

.layer-front {
  background-image: 
    radial-gradient(ellipse at 30% 8%, rgba(240, 245, 255, 0.15) 0%, rgba(180, 200, 235, 0.04) 40%, transparent 65%),
    radial-gradient(ellipse at 80% 14%, rgba(230, 240, 255, 0.12) 0%, rgba(170, 195, 230, 0.03) 45%, transparent 60%);
  background-size: 2400px 100%;
  animation: driftClouds 65s linear infinite;
  z-index: 6;
  filter: blur(24px);
}

@keyframes driftClouds {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-50%, 0, 0); }
}

/* Weather / scene picker (moon button) */
.scene-picker {
  position: fixed;
  top: 76px;
  right: 24px;
  z-index: 60;
  width: min(380px, calc(100vw - 32px));
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  padding: 14px;
  border-radius: 22px;
  background: rgba(14, 18, 30, 0.72);
  backdrop-filter: blur(26px);
  -webkit-backdrop-filter: blur(26px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
  color: #fff;
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  scrollbar-width: thin;
}

.scene-picker.open {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.sp-title {
  margin: 12px 4px 6px;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.55;
}

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

.sp-moons {
  grid-template-columns: repeat(4, 1fr);
}

.scene-picker button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 4px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  font-family: inherit;
  font-size: 0.74rem;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.scene-picker button span {
  font-size: 1.35rem;
  line-height: 1;
}

.scene-picker button:hover {
  background: rgba(255, 255, 255, 0.14);
}

.scene-picker button.active {
  background: rgba(96, 165, 250, 0.28);
  border-color: rgba(96, 165, 250, 0.7);
}

.scene-picker .sp-live {
  flex-direction: row;
  justify-content: center;
  width: 100%;
  padding: 11px;
  font-size: 0.9rem;
  font-weight: 600;
}

.scene-picker .sp-live small {
  font-weight: 400;
  opacity: 0.6;
}

.rainbow-layer {
  position: absolute;
  left: 50%;
  top: 38%;
  width: 150vmax;
  height: 150vmax;
  transform: translateX(-50%);
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  z-index: 3;
  transition: opacity 2s ease;
  filter: blur(6px);
  -webkit-mask-image: radial-gradient(circle, transparent 62%, #000 62.5%, #000 70%, transparent 70.5%);
          mask-image: radial-gradient(circle, transparent 62%, #000 62.5%, #000 70%, transparent 70.5%);
  background: radial-gradient(circle,
    transparent 62%,
    rgba(255, 70, 70, 0.9) 63%, rgba(255, 160, 60, 0.9) 64.2%, rgba(255, 230, 80, 0.9) 65.4%,
    rgba(90, 210, 110, 0.9) 66.6%, rgba(70, 150, 255, 0.9) 67.8%, rgba(150, 90, 230, 0.9) 69%,
    transparent 70%);
}

/* City search suggestions */
.city-suggestions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 10px;
  max-height: 260px;
  overflow-y: auto;
}

.city-suggestions:empty {
  display: none;
}

.suggestion {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.suggestion:hover,
.suggestion:focus-visible {
  background: rgba(255, 255, 255, 0.14);
  outline: none;
}

.s-name {
  font-size: 0.98rem;
  font-weight: 600;
}

.s-sub {
  font-size: 0.8rem;
  opacity: 0.65;
}

.s-loading {
  padding: 10px 14px;
  font-size: 0.85rem;
  opacity: 0.6;
}

/* =========================================
   Scene engine extras (scenes.js)
   ========================================= */
/* Scene classes drive everything through inline vars; neutralise old per-theme orb rules */
body.scene .sun-moon-element {
  transition: left 1.4s ease, top 1.4s ease, width 1.4s ease, height 1.4s ease,
              opacity 1.2s ease, background 1.2s ease, box-shadow 1.2s ease, filter 1.2s ease;
}

body.scene.night .sky-container::before {
  opacity: var(--night-photo-opacity, 1);
}

.cloud-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4; /* above sun/moon (3) so clouds pass in front of them */
}

.moon-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: none;
}

.fog-layer {
  position: absolute;
  inset: -10%;
  pointer-events: none;
  z-index: 8;
  opacity: 0;
  transition: opacity 1.5s ease;
  background:
    radial-gradient(ellipse 60% 25% at 20% 70%, rgba(220, 225, 232, 0.55), transparent 70%),
    radial-gradient(ellipse 70% 30% at 75% 55%, rgba(215, 220, 228, 0.5), transparent 70%),
    radial-gradient(ellipse 80% 35% at 45% 85%, rgba(225, 230, 236, 0.6), transparent 70%),
    linear-gradient(180deg, rgba(200, 206, 214, 0.15), rgba(210, 215, 222, 0.45));
  filter: blur(20px);
  animation: fogDrift 40s ease-in-out infinite alternate;
}

body.sky-light .rain-drop {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.9));
}

body.sky-dark .fog-layer {
  filter: blur(20px) brightness(0.35);
}

@keyframes fogDrift {
  from { transform: translate3d(-4%, 0, 0); }
  to   { transform: translate3d(4%, -2%, 0); }
}

.snow-flake {
  position: absolute;
  top: -12px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff 0%, rgba(255, 255, 255, 0.6) 60%, transparent 100%);
  animation-name: snowFall;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  will-change: transform;
  pointer-events: none;
}

@keyframes snowFall {
  0%   { transform: translate3d(0, 0, 0); }
  25%  { transform: translate3d(calc(var(--drift) * 0.5), 27vh, 0); }
  50%  { transform: translate3d(calc(var(--drift) * -0.3), 54vh, 0); }
  75%  { transform: translate3d(var(--drift), 81vh, 0); }
  100% { transform: translate3d(calc(var(--drift) * 0.2), 108vh, 0); }
}

.scene-toast {
  position: fixed;
  left: 50%;
  top: 14%;
  transform: translate(-50%, -8px);
  z-index: 50;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(10, 14, 24, 0.45);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 0.9rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.scene-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Lightning (rain theme) — sits behind clouds/rain, in front of the sky */
.lightning-canvas,
.lightning-flash {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
}

.lightning-flash {
  opacity: 0;
  background: radial-gradient(ellipse at 50% 20%, rgba(200, 215, 255, 0.9) 0%, rgba(150, 170, 220, 0.4) 50%, rgba(80, 100, 150, 0.15) 100%);
  transition: opacity 60ms linear;
}

/* Rain / Weather Particles */
.rain-snow-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 7;
}

.rain-drop {
  position: absolute;
  top: -60px;
  width: 1px;
  height: 46px;
  border-radius: 1px;
  background: linear-gradient(180deg, rgba(200, 225, 255, 0), rgba(200, 225, 255, 0.55));
  animation-name: rainFall;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  will-change: transform;
  pointer-events: none;
}

@keyframes rainFall {
  from { transform: translate3d(0, 0, 0) rotate(8deg); }
  to   { transform: translate3d(-14vh, 112vh, 0) rotate(8deg); }
}

/* =========================================
   Lock Screen Viewport & Layout
   ========================================= */
.lockscreen-viewport {
  position: relative;
  z-index: 10;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 2rem 1rem;
}

/* Top Meta Bar (Clean Lockscreen Status matching user image) */
.top-meta-bar {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  padding-top: 6px;
}

.date-location-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  background: transparent;
  border: none;
  font-size: clamp(1.05rem, 1.8vw, 1.35rem);
  font-weight: 400;
  letter-spacing: -0.01em;
  color: #eceeff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.date-location-chip:hover {
  opacity: 0.85;
}

.meta-date {
  font-weight: 400;
  color: #f0f2ff;
}

.meta-weather {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #f0f2ff;
}

.cloud-status-icon {
  width: 1.15em;
  height: 1.15em;
  display: inline-block;
  vertical-align: middle;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}

/* Quick Action Control Buttons - Subtle Transparent Glass */
.quick-actions {
  position: absolute;
  right: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #f1f5f9;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  transform: scale(1.08);
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.35);
}

.svg-icon {
  width: 18px;
  height: 18px;
}

/* =========================================
   Giant Lockscreen Digital Clock
   Matching exact proportion, slender outlines, and soft fill
   ========================================= */
.clock-display-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  transform: translateY(-5vh);
}

.giant-clock-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.giant-clock {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  font-family: "Barlow Condensed", "SF Pro Display", sans-serif;
  font-size: min(28vw, 44vh, 28rem);
  font-weight: 500;
  line-height: 0.8;
  letter-spacing: 0.01em;
  color: var(--clock-text-color);
  /* Sleek translucent stroke and inner fill */
  -webkit-text-stroke: 1.5px var(--clock-border-color);
  text-shadow:
    0 2px 20px var(--clock-glow),
    0 0 1px rgba(255, 255, 255, 0.2);
  transition: color 0.5s ease;
}

.digit {
  display: inline-block;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: center;
}

/* Colon matching iPad / Lockscreen solid circular dots */
.colon-wrapper {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.28em;
  height: 100%;
  padding: 0 0.04em;
  font-size: inherit;
  align-self: center;
}

.colon-dot {
  width: 0.075em;
  height: 0.075em;
  border-radius: 50%;
  background: var(--clock-text-color);
  border: 1.5px solid var(--clock-border-color);
  box-shadow: 0 2px 10px var(--clock-glow);
  transition: background 0.5s ease;
}

.clock-subtitle {
  margin-top: 1.6rem;
  font-size: clamp(0.95rem, 1.4vw, 1.25rem);
  font-weight: 400;
  color: rgba(210, 225, 250, 0.8);
  letter-spacing: 0.5px;
  text-align: center;
  padding: 6px 20px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(10px);
}

/* =========================================
   Bottom Sheet & Weather Forecast Drawer
   ========================================= */
.bottom-sheet {
  width: 100%;
  max-width: 920px;
  background: var(--glass-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  padding: 8px 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.28);
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), background 0.3s;
  touch-action: pan-x;
  will-change: transform;
}

/* Swiped down: only the handle peeks out */
.bottom-sheet.sheet-hidden {
  transform: translateY(calc(100% - 34px));
}

.bottom-sheet.dragging {
  transition: none;
}

.sheet-drag-handle {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 0 12px;
  cursor: grab;
  touch-action: none;
}

.handle-bar {
  width: 44px;
  height: 4.5px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
  transition: background 0.2s;
}

.sheet-drag-handle:hover .handle-bar {
  background: rgba(255, 255, 255, 0.6);
}

.weather-preview-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  text-align: center;
}

.stat-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 0.8rem;
  color: rgba(200, 215, 240, 0.65);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.stat-val {
  font-size: 1.25rem;
  font-weight: 600;
  color: #ffffff;
}

/* Hourly Scroll */
.hourly-forecast-container {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 6px 2px 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
  cursor: grab;
  touch-action: pan-x;
}

.hourly-forecast-container.dragging {
  cursor: grabbing;
}

.hour-card {
  cursor: pointer;
}

.hourly-forecast-container::-webkit-scrollbar {
  height: 4px;
}

.hourly-forecast-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.hour-card {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
  min-width: 68px;
  transition: transform 0.2s, background 0.2s;
}

.hour-card.active, .hour-card:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}

.hour-time {
  font-size: 0.82rem;
  color: rgba(220, 235, 255, 0.75);
}

.hour-icon {
  font-size: 1.3rem;
}

.hour-temp {
  font-size: 0.95rem;
  font-weight: 600;
  color: #ffffff;
}

/* =========================================
   Modal for City Search
   ========================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 15, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.search-dialog {
  background: rgba(20, 27, 44, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 24px;
  width: 90%;
  max-width: 480px;
  padding: 24px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.open .search-dialog {
  transform: scale(1);
}

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

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
}

.close-modal-btn {
  background: transparent;
  border: none;
  color: #cbd5e1;
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
}

.search-input-box {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.search-input-box input {
  flex: 1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 12px 16px;
  border-radius: 12px;
  color: #fff;
  font-size: 1rem;
  outline: none;
  font-family: inherit;
}

.search-input-box input:focus {
  border-color: rgba(147, 197, 253, 0.6);
  box-shadow: 0 0 12px rgba(147, 197, 253, 0.2);
}

.search-input-box button {
  background: #3b82f6;
  color: white;
  border: none;
  padding: 0 18px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.search-input-box button:hover {
  background: #2563eb;
}

.quick-cities {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.tag {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.tag:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.geo-btn {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #e2e8f0;
  padding: 10px;
  border-radius: 12px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
}

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

/* =========================================
   Soundscape Mixer Modal & Cards Grid
   ========================================= */
.sound-dialog {
  background: rgba(18, 24, 38, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 28px;
  width: 92%;
  max-width: 680px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6);
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.modal-overlay.open .sound-dialog {
  transform: scale(1);
}

.header-title-box h3 {
  font-size: 1.35rem;
  font-weight: 600;
  color: #fff;
}

.header-title-box .subtitle {
  font-size: 0.85rem;
  color: rgba(200, 220, 245, 0.7);
  margin-top: 3px;
}

.mixer-global-bar {
  display: flex;
  gap: 12px;
  margin: 16px 0 20px;
}

.mixer-global-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mixer-global-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  transform: translateY(-1px);
}

.mixer-global-btn.pause-all {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.mixer-global-btn.pause-all:hover {
  background: rgba(239, 68, 68, 0.32);
}

.sound-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.sound-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.sound-card:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.sound-card.playing {
  background: rgba(59, 130, 246, 0.18);
  border-color: rgba(96, 165, 250, 0.6);
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.25);
}

.sound-card-icon {
  font-size: 2.2rem;
  margin-bottom: 8px;
  transition: transform 0.2s ease;
}

.sound-card.playing .sound-card-icon {
  transform: scale(1.15);
  animation: soundPulse 1.8s ease-in-out infinite alternate;
}

@keyframes soundPulse {
  0% { transform: scale(1.1); }
  100% { transform: scale(1.22); }
}

.sound-card-title {
  font-size: 1rem;
  font-weight: 600;
  color: #ffffff;
}

.sound-card-status {
  font-size: 0.78rem;
  color: rgba(200, 220, 245, 0.6);
  margin-top: 2px;
  margin-bottom: 12px;
}

.sound-card.playing .sound-card-status {
  color: #93c5fd;
  font-weight: 500;
}

.volume-slider-wrapper {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  opacity: 0.5;
  transition: opacity 0.2s ease;
}

.sound-card.playing .volume-slider-wrapper {
  opacity: 1;
}

.vol-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.2);
  outline: none;
  cursor: pointer;
}

.vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #60a5fa;
  cursor: pointer;
  box-shadow: 0 0 6px rgba(96, 165, 250, 0.6);
}

/* =========================================
   Responsive Design for Mobile & Tablets
   ========================================= */
@media (max-width: 768px) {
  .lockscreen-viewport {
    padding: 1.5rem 1.2rem 1.2rem;
  }
  
  .top-meta-bar {
    justify-content: flex-start;
  }

  .date-location-chip {
    font-size: 0.98rem;
    padding: 6px 14px;
  }

  .weather-preview-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .giant-clock {
    font-size: min(34vw, 40vh);
  }

  .clock-extras {
    position: static;
    flex-direction: row;
    margin-top: 10px;
    align-items: center;
  }

  .giant-clock-container {
    flex-direction: column;
  }

  .sound-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}


/* =========================================
   Mobile / PWA polish
   ========================================= */
/* Notches, rounded corners and the home indicator */
.lockscreen-viewport {
  padding-top: max(1.2rem, env(safe-area-inset-top));
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
  padding-left: max(2rem, env(safe-area-inset-left));
  padding-right: max(2rem, env(safe-area-inset-right));
}

.scene-picker {
  top: calc(76px + env(safe-area-inset-top));
}

@media (max-width: 768px) {
  .lockscreen-viewport {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }
}

/* Phones, portrait */
@media (max-width: 600px) {
  /* date chip on top, round buttons in a row beneath it */
  .top-meta-bar {
    flex-direction: column;
    justify-content: center;
    gap: 12px;
  }

  .quick-actions {
    position: static;
    gap: 14px;
  }

  .icon-btn {
    width: 44px;
    height: 44px;
  }

  /* iOS-style stacked clock: hours over minutes */
  .giant-clock {
    flex-direction: column;
    font-size: min(60vw, 25vh);
    line-height: 0.82;
    letter-spacing: 0;
  }

  .colon-wrapper {
    display: none;
  }

  .clock-display-wrapper {
    transform: none;
  }

  /* compact weather sheet */
  .bottom-sheet {
    padding: 0 12px 12px;
    border-radius: 24px;
    gap: 8px;
  }

  .weather-preview-row {
    gap: 8px;
  }

  .stat-box {
    padding: 8px 6px;
    border-radius: 14px;
  }

  .stat-label {
    font-size: 0.66rem;
  }

  .stat-val {
    font-size: 1.05rem;
  }

  .hourly-forecast-container {
    gap: 8px;
  }

  .hour-card {
    min-width: 58px;
    padding: 8px 10px;
  }

  /* weather picker becomes a bottom sheet */
  .scene-picker {
    top: auto;
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    width: auto;
    max-height: 72dvh;
    border-radius: 24px;
    transform: translateY(24px);
  }

  .scene-picker.open {
    transform: none;
  }

  .scene-toast {
    top: calc(env(safe-area-inset-top) + 64px);
  }

  /* dialogs: keep clear of the on-screen keyboard */
  #search-modal {
    align-items: flex-start;
    padding-top: max(env(safe-area-inset-top), 8vh);
  }

  .search-dialog,
  .sound-dialog {
    width: calc(100% - 24px);
    padding: 18px;
    border-radius: 22px;
  }

  .sound-dialog {
    max-height: 88dvh;
  }

  #city-input {
    font-size: 16px; /* stops iOS from zooming the page on focus */
  }
}

/* Phones, landscape / very short screens */
@media (max-height: 480px) {
  .lockscreen-viewport {
    padding-top: max(0.6rem, env(safe-area-inset-top));
    padding-bottom: max(0.4rem, env(safe-area-inset-bottom));
  }

  .giant-clock {
    font-size: min(28vw, 34vh);
  }

  .scene-picker {
    top: 56px;
    right: max(12px, env(safe-area-inset-right));
    bottom: auto;
    left: auto;
    width: min(360px, 60vw);
    max-height: calc(100dvh - 68px);
  }
}

/* Installed app: no browser bar, so use the real viewport */
@media (display-mode: standalone) {
  body {
    user-select: none;
  }
}
