#night-drive {
  position:relative; isolation:isolate; width:100%; min-width:0; margin:34px 0 0;
  color:#f4f7ff; color-scheme:dark; text-align:left; scroll-margin-top:90px;
}
.nd-view { position:relative; overflow:hidden; aspect-ratio:3/2; background:#101727; border-radius:12px; }
.nd-road,.nd-haze,.nd-wipe,.nd-heading { position:absolute; inset:0; }
.nd-road { display:block; width:100%; height:100%; }
.nd-haze { opacity:0; pointer-events:none; }
/* Weaker forward illumination and near-field scatter. The sky and self-lit taillights stay consistent. */
.nd-haze::before {
  content:""; position:absolute; inset:0;
  background:
    radial-gradient(ellipse 61% 25% at 48% 109%,#dbbc786b,transparent),
    linear-gradient(to bottom,transparent 27%,#06091019 39%,#06080ccf 49%,#05070bdb 60%,#0b0d10cd 74%,#17191aa9);
  --lamps:radial-gradient(ellipse 2.5% 1.15% at 50.7% 54.3%,transparent 54%,#000 100%),
          radial-gradient(ellipse 2.5% 1.15% at 62.4% 54.2%,transparent 54%,#000 100%);
  -webkit-mask-image:var(--lamps); mask-image:var(--lamps);
  -webkit-mask-composite:source-in; mask-composite:intersect;
}
.nd-wipe {
  pointer-events:none; opacity:0; border-right:2px solid #ffe600;
  background:linear-gradient(to left,#ffe60014,transparent 4%);
}
.nd-heading { bottom:auto; padding:clamp(16px,3vw,26px); background:linear-gradient(#050a1660,transparent); }
#night-drive .nd-title { margin:0; color:#fff!important; text-align:left; font:700 clamp(25px,3.4vw,43px)/1.06 Manrope,sans-serif; letter-spacing:-.045em; }
.nd-state {
  position:absolute; bottom:12px; left:clamp(16px,3vw,26px); display:grid;
  padding:4px 9px; border-radius:4px; background:#071020e6; color:#f4f7ff;
  font:700 .8rem/1.4 Manrope,sans-serif;
}
.nd-state span {grid-area:1/1;}
.nd-cloudy-label {opacity:0;}
#night-drive .nd-caption {padding:8px 0 0;text-align:left;}
.nd-bar {display:flex;gap:16px;align-items:center;justify-content:space-between;border-bottom:1px solid #9cb9ef40;}
.nd-choices {display:flex;gap:18px;}
#night-drive .nd-bar button {
  min-width:44px; min-height:44px; padding:4px 2px; background:transparent !important; border:0 !important; border-radius:0 !important;
  box-shadow:none !important; color:inherit; font:600 .95rem/1.3 Manrope,sans-serif; cursor:pointer;
}
#night-drive .nd-bar button::before, #night-drive .nd-bar button::after {content:none !important;}
#night-drive .nd-choices button[aria-pressed="true"] {box-shadow:inset 0 -2px #ffdf00 !important;}
#night-drive .nd-control {text-decoration:underline;text-underline-offset:.25em;}
#night-drive [hidden] {display:none;}
#night-drive .nd-message {max-width:52ch;margin:12px 0 4px;color:inherit;text-align:left;font:400 1rem/1.55 Manrope,sans-serif;}
.nd-source {display:inline-flex;align-items:center;min-height:40px;color:inherit;font:400 .8rem/1.4 Manrope,sans-serif;text-decoration:underline;text-underline-offset:.25em;}
#night-drive :is(a,button):focus-visible { outline:2px solid currentColor; outline-offset:2px; }
body[data-theme="light"] #night-drive {color:#173859;}
#night-drive[data-frame="cloudy"] :is(.nd-haze,.nd-cloudy-label),
#night-drive[data-frame="running"] .nd-haze {opacity:1;}
#night-drive[data-frame="cloudy"] .nd-restored-label {opacity:0;}
#night-drive[data-frame="running"] .nd-haze {animation:nd-clear 6s ease-in-out both;}
#night-drive[data-frame="running"] .nd-wipe {animation:nd-line 6s ease-in-out both;}
#night-drive[data-frame="running"] .nd-cloudy-label {animation:nd-before-label 6s step-end both;}
#night-drive[data-frame="running"] .nd-restored-label {animation:nd-after-label 6s step-end both;}
#night-drive[data-frame="running"][data-paused] :is(.nd-haze,.nd-wipe,.nd-state span) {animation-play-state:paused;}
@keyframes nd-clear {0%,30% {clip-path:inset(0);} 76%,100% {clip-path:inset(0 0 0 100%);}}
@keyframes nd-line {
  0%,29.9% {opacity:0;transform:translateX(-100%);} 30% {opacity:1;transform:translateX(-100%);}
  76% {opacity:1;transform:translateX(0);} 76.1%,100% {opacity:0;transform:translateX(0);}
}
@keyframes nd-before-label {0% {opacity:1;} 55%,100% {opacity:0;}}
@keyframes nd-after-label {0% {opacity:0;} 55%,100% {opacity:1;}}
