body:has(.ad-lab) { background: #081521; color: #f7f4ed; }
body:has(.ad-lab) > header { background: #081521; border-bottom: 1px solid #ffffff12; }
body:has(.ad-lab) > footer { margin-top: 48px; background: #07111c; }
.ad-lab { max-width: 1680px; padding: 52px clamp(20px, 4vw, 68px) 16px; margin: auto; }
.ad-heading { display: flex; align-items: end; justify-content: space-between; gap: 32px; margin-bottom: 32px; }
.ad-heading h1 { font-size: clamp(42px, 5.1vw, 76px); letter-spacing: -.06em; line-height: 1.01; }
.ad-heading p { max-width: 26ch; font-size: 17px; color: #aebfcd; padding-bottom: 6px; }
.ad-heading em { color: #ffa12b; }
.ad-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: stretch; }
.ad-stage { position: relative; isolation: isolate; min-width: 0; min-height: 510px; overflow: hidden; border-radius: 24px; border: 1px solid #90b3d01c; background: radial-gradient(ellipse at 60% 46%, #29485c 0, #132a3a 38%, #091622 78%); box-shadow: 0 28px 70px -35px #000b; }
.ad-stage::after { content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(circle 200px at var(--ad-light-x, 50%) var(--ad-light-y, 54%), #ffad4620, transparent 80%); opacity: 0; transition: opacity .3s; }
.ad-stage.has-pointer::after { opacity: 1; }
.ad-horizon { position: absolute; inset: 0; pointer-events: none; opacity: .38; background: linear-gradient(transparent 0 58%, #b5c8d212 58%, transparent 58.3%); }
.ad-road { position: absolute; top: 60%; left: -15%; right: -15%; height: 50%; background: radial-gradient(ellipse at 53% 0, #ffb04e28, transparent 50%), linear-gradient(#0a142066, #07101a); transform: perspective(500px) rotateX(40deg); transform-origin: 50% 0; }
.ad-camera { position: absolute; inset: 0; display: grid; place-items: center; transform-origin: 0 0; }
.ad-vehicle { width: 92%; max-width: 1140px; aspect-ratio: 3; position: relative; margin-top: 16px; filter: drop-shadow(0 18px 14px #0008); transition: opacity .3s; }
.ad-vehicle::after { content: ''; position: absolute; z-index: -1; inset: 88% 7% auto; height: 5%; background: #000a; border-radius: 50%; filter: blur(7px); }
.ad-coach { width: 100%; height: 100%; object-fit: contain; }
.ad-screen { position: absolute; left: 41.8%; top: 20.4%; width: 32.2%; height: 32.8%; display: grid; place-items: center; background: #09111c; overflow: hidden; box-shadow: 0 0 0 1px #05090f, 0 0 18px #ffb6430b; }
.ad-screen::after { content: ''; pointer-events: none; position: absolute; inset: 0; background: linear-gradient(135deg, #d4e9ff0c, transparent 55%, #00000014); }
.ad-screen img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.ad-screen-brand { color: #e2e8ec; font-size: clamp(5px, .85vw, 13px); font-weight: 800; letter-spacing: .12em; }
.ad-stage.has-image .ad-screen-brand { display: none; }
.ad-stage.is-returning .ad-vehicle { opacity: 0; }
.ad-stage-tools { position: absolute; z-index: 2; left: 24px; right: 24px; bottom: 22px; display: flex; gap: 10px; }
.ad-stage-tools button { color: #e3ebef; border: 1px solid #a3bec738; background: #07121cc9; border-radius: 999px; min-height: 44px; padding: 10px 18px; font-size: 12px; backdrop-filter: blur(12px); }
.ad-stage-tools button:hover:not(:disabled) { background: #294051; border-color: #ffb34b80; }
.ad-stage-tools button:disabled { opacity: .35; cursor: default; }
.ad-controls { padding: 26px; border: 1px solid #b4c7d723; border-radius: 24px; background: linear-gradient(160deg, #192c3d, #101e2b); display: flex; flex-direction: column; align-items: stretch; }
.ad-dropzone { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; justify-content: center; gap: 12px; padding: 30px 12px; min-height: 200px; border: 1px dashed #d4dfe45e; border-radius: 15px; cursor: pointer; transition: background .2s, border-color .2s; }
.ad-dropzone:hover, .ad-dropzone.is-dragging { background: #ffab3610; border-color: #ffab36; }
.ad-dropzone:focus-within { outline: 2px solid #ffb54a; outline-offset: 5px; }
.ad-dropzone input { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); }
.ad-dropzone strong { font-size: 16px; font-weight: 800; }
.ad-dropzone > span { color: #aebdca; font-size: 11px; }
.ad-file-icon { width: 40px; height: 40px; fill: none; stroke: #ffc071; stroke-width: 1.4; }
.ad-dropzone:has(#ad-thumbnail:not([hidden])) .ad-file-icon { display: none; }
#ad-thumbnail { width: 112px; height: 76px; object-fit: contain; background: #081521; border-radius: 5px; }
.ad-file-name { color: #c3d0da; font-size: 12px; overflow-wrap: anywhere; margin: 12px 0 0; }
.ad-error { color: #ffd0ad; font-size: 13px; line-height: 1.5; margin: 12px 0 0; }
.ad-fit { border: 0; padding: 0; margin: 22px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ad-fit legend { font-size: 12px; padding: 0; margin-bottom: 9px; color: #b5c4cf; }
.ad-fit label { position: relative; cursor: pointer; }
.ad-fit input { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); }
.ad-fit span { display: flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 10px; border: 1px solid #9bb2c533; color: #acbfcc; font-size: 12px; }
.ad-fit input:checked + span { background: #f8f3e9; color: #111f30; border-color: #f8f3e9; }
.ad-fit input:focus-visible + span { outline: 2px solid #ffb54a; outline-offset: 3px; }
.ad-fit:disabled { opacity: .4; }
.ad-fit:disabled label { cursor: default; }
.ad-run { justify-content: center; min-height: 52px; background: #ff9b1c; color: #0b1725; font-size: 15px; box-shadow: 0 7px 22px #0002; }
.ad-run:disabled { cursor: default; opacity: .4; transform: none; box-shadow: none; }
.ad-run:hover:not(:disabled) { background: #ffb341; }
.ad-status { font-size: 12px; color: #afc0ce; line-height: 1.55; margin-top: 14px; min-height: 36px; }
.ad-secondary { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 4px; }
.ad-secondary button, .ad-secondary a { border: 0; background: none; color: #d4e0e8; font-size: 12px; padding: 10px 0; min-height: 44px; text-decoration: underline; text-underline-offset: 4px; }
.ad-secondary button:hover, .ad-secondary a:hover { color: #ffbd6a; }
.ad-private { font-size: 11px; color: #95aabb; margin-top: auto; padding-top: 18px; line-height: 1.5; }
.ad-caption { color: #8da4b7; font-size: 11px; margin-top: 18px; }
.ad-lab :focus-visible { outline-color: #ffb54a; }
@media (max-width: 1050px) {
  .ad-workspace { grid-template-columns: minmax(0, 1fr) 290px; gap: 18px; }
  .ad-controls { padding: 20px; }
  .ad-stage { min-height: 470px; }
}
@media (min-width: 761px) and (max-width: 1100px) {
  .ad-workspace { grid-template-columns: 1fr; }
  .ad-stage { min-height: min(340px, 70svh); height: min(43vw, 70svh); max-height: 440px; }
  .ad-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; align-items: start; }
  .ad-dropzone { grid-column: 1; grid-row: 1 / span 4; align-self: stretch; }
  .ad-file-name { grid-column: 1; grid-row: 5; }
  .ad-fit { grid-column: 2; grid-row: 1; margin: 0 0 18px; }
  .ad-run { grid-column: 2; grid-row: 2; }
  .ad-status { grid-column: 2; grid-row: 3; }
  .ad-secondary { grid-column: 2; grid-row: 4; }
  .ad-private { grid-column: 2; grid-row: 5; }
  .ad-error { grid-column: 1 / -1; grid-row: 6; }
}
@media (max-width: 760px) {
  .ad-lab { padding-top: 30px; }
  .ad-heading { display: block; margin-bottom: 24px; }
  .ad-heading h1 { font-size: clamp(42px, 9.5vw, 60px); }
  .ad-heading p { font-size: 15px; margin-top: 16px; padding: 0; max-width: none; }
  .ad-workspace { grid-template-columns: 1fr; gap: 16px; }
  .ad-stage { min-height: 260px; height: 34svh; max-height: 320px; border-radius: 18px; }
  .ad-stage-tools { left: 16px; bottom: 15px; gap: 8px; }
  .ad-stage-tools button { font-size: 11px; padding-inline: 14px; }
  .ad-controls { padding: 20px; border-radius: 18px; }
  .ad-dropzone { min-height: 142px; padding: 20px 12px; gap: 8px; }
  .ad-file-icon { width: 32px; height: 32px; }
  .ad-fit { margin: 18px 0; }
  .ad-stage::after { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .ad-lab *, .ad-stage::after { transition: none !important; }
}

.ad-controls fieldset { border: 0; }
.ad-controls legend { border: 0; font-weight: 400; padding-bottom: 0; }
.ad-controls input[type=radio]:focus-visible { outline: none; }
@media (max-width: 760px) {
  .ad-controls:has(#ad-thumbnail:not([hidden])) .ad-dropzone {
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr);
    text-align: left;
    align-content: center;
    min-height: 100px;
    padding: 16px;
    gap: 4px 12px;
  }
  .ad-controls:has(#ad-thumbnail:not([hidden])) #ad-thumbnail { grid-row: span 2; width: 80px; height: 56px; }
  .ad-controls:has(#ad-thumbnail:not([hidden])) .ad-dropzone strong { font-size: 14px; }
}
