/* VESPER Garage (M1) */
.vgar { margin-top: 8px; }
.vgar__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-top: 12px; }
.vgar--crew .vgar__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.vgar__card { background: #111215; border: 1px solid rgba(237,235,230,.08); border-radius: 14px; overflow: hidden; content-visibility: auto; contain-intrinsic-size: auto 320px; }
.vgar__thumb { display:block; aspect-ratio: 16/10; background: #0c0d0f; }
.vgar__thumb img { width:100%; height:100%; object-fit:cover; display:block; }
.vgar__thumb-fb { display:flex; align-items:center; justify-content:center; width:100%; height:100%; color:#555; }
.vgar__body { padding: 12px; text-align: center; }
.vgar__title { margin:0 0 4px; font-family: Oswald, sans-serif; font-size: 18px; line-height:1.2; }
.vgar__title a { color:#EDEBE6; text-decoration:none; }
.vgar__meta, .vgar__owner, .vgar__hint { margin: 0 0 6px; color: #b8b4ad; font-size: 13px; }
.vgar__acts { display:flex; gap:8px; flex-wrap:wrap; justify-content:center; margin-top:8px; }
.vgar__btn { appearance:none; border:1px solid rgba(237,235,230,.16); background:#16181c; color:#EDEBE6; border-radius:8px; padding:7px 12px; cursor:pointer; font: inherit; text-decoration:none; display:inline-block; }
.vgar__btn:hover { border-color:#F10000; color:#fff; }
.vgar__btn.is-primary { background:#F10000; border-color:#F10000; color:#fff; }
.vgar__btn.is-danger { border-color:#5a1a1a; color:#ffb3b3; }
.vgar__headacts { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:8px; min-width:0; max-width:100%; }
.vgar__headacts .vgar__btn { max-width:100%; min-height:40px; white-space:normal; text-align:center; box-sizing:border-box; }
.vgar--crew > .vgp__blockhead { min-width:0; }
.vgar--crew > .vgp__blockhead h2 { min-width:0; overflow-wrap:anywhere; }

.vgar__editor { margin: 12px 0 18px; padding: 14px; border:1px solid rgba(237,235,230,.08); border-radius:12px; background:#101114; box-sizing:border-box; max-width:100%; min-width:0; }
.vgar__editor[hidden],
.vgar__editor.hidden { display:none !important; }
.vgar__fields { display:grid; grid-template-columns:minmax(0,1fr); gap:12px; min-width:0; }
.vgar__row { display:grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap:10px; min-width:0; }
.vgar__field { display:flex; flex-direction:column; align-items:stretch; gap:6px; min-width:0; font-size:14px; }
.vgar__field > span { display:block; min-width:0; color:#c9c5be; font-weight:600; overflow-wrap:anywhere; }
.vgar__editor .vgar__field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.vgar__editor .vgar__field select,
.vgar__editor .vgar__field textarea { width:100%; max-width:100%; min-width:0; box-sizing:border-box; background:#0c0d0f; color:#EDEBE6; border:1px solid rgba(237,235,230,.14); border-radius:8px; padding:8px 10px; font:inherit; }
.vgar__editor .vgar__field textarea { min-height:120px; resize:vertical; line-height:1.45; }
.vgar__editor .vgar__field input[type="file"] { display:block; width:100%; max-width:100%; min-width:0; box-sizing:border-box; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; padding:7px 8px; background:#16181c; color:#EDEBE6; border:1px solid rgba(237,235,230,.16); border-radius:8px; font:inherit; font-size:12px; line-height:1.4; cursor:pointer; }
.vgar__editor .vgar__field input[type="file"]::file-selector-button,
.vgar__editor .vgar__field input[type="file"]::-webkit-file-upload-button { appearance:none; -webkit-appearance:none; border:1px solid #F10000; border-radius:6px; background:#F10000; color:#fff; padding:6px 10px; margin-right:10px; font:inherit; font-size:12px; line-height:1; cursor:pointer; }
.vgar__editor .vgar__field input[type="file"]::file-selector-button:hover,
.vgar__editor .vgar__field input[type="file"]::-webkit-file-upload-button:hover { background:#c90000; border-color:#c90000; }
.vgar__editor .vgar__field--wide,
.vgar__editor .vgar__field--cover { grid-column:1 / -1; }
.vgar__editor .vgar__btn { appearance:none; -webkit-appearance:none; box-sizing:border-box; min-height:40px; padding:9px 14px; border:1px solid rgba(237,235,230,.16); border-radius:8px; background:#16181c; color:#EDEBE6; font:inherit; font-size:14px; line-height:1.2; text-align:center; text-decoration:none; cursor:pointer; }
.vgar__editor .vgar__btn:hover { border-color:#F10000; color:#fff; }
.vgar__editor .vgar__btn.is-primary { background:#F10000; border-color:#F10000; color:#fff; }
.vgar__checks { display:grid; gap:6px; min-width:0; }
.vgar__checks label { min-width:0; overflow-wrap:anywhere; }
.vgar__formacts { display:flex; gap:10px; align-items:center; flex-wrap:wrap; min-width:0; margin-top:12px; }
.vgar__status { flex:1 1 140px; min-width:0; font-size:13px; color:#b8b4ad; }
.vgar__status.is-error { color:#ffb3b3; }
.vgar__status.is-ok { color:#7ee2a8; }
.vgar__share-panel { margin:12px 0; padding:12px; border:1px solid rgba(237,235,230,.08); border-radius:12px; background:#101114; box-sizing:border-box; max-width:100%; }
.vgar__share-panel[hidden] { display:none !important; }
.vgar__detail { display:grid; gap:14px; }
/* Top row: Edit vehicle at the left, directly opposite the sheet's × close. */
.vgar__detail-top { display:flex; align-items:center; justify-content:space-between; min-height:36px; }
.vgar__dhead { text-align:center; }
.vgar__dtitle { margin:0; font-family: Oswald, sans-serif; font-size: 28px; text-align:center; }
.vgar__specs { background:#101114; border:1px solid rgba(237,235,230,.08); border-radius:12px; padding:12px; }
.vgar__media-list { display:grid; gap:12px; }
.vgar__media img, .vgar__media video { width:100%; border-radius:12px; display:block; background:#000; }
.vgar__caption { margin:6px 0 0; color:#b8b4ad; font-size:13px; }
@media (max-width: 720px) {
  .vgar__row { grid-template-columns: 1fr; }
  .vgar__grid { grid-template-columns: 1fr 1fr; }
  .vgar--crew > .vgp__blockhead { flex-wrap: wrap; }
}
@media (max-width: 480px) {
  .vgar__grid { grid-template-columns: 1fr; }
  .vgar__editor { padding: 12px; }
  .vgar__editor .vgar__formacts { display:grid; grid-template-columns:1fr; align-items:stretch; }
  .vgar__editor .vgar__btn { width:100%; min-height:44px; }
  .vgar__headacts,
  .vgar__headacts .vgar__btn { width:100%; max-width:100%; }
  .vgar__headacts { justify-content:flex-start; }
}

/* VESPER Garage 3D viewer (Three.js) */
.vgar__viewer { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 12px; margin: 12px 0; background: #0f1012; border: 1px solid rgba(237,235,230,.08); border-radius: 12px; overflow: hidden; }
.vgar__viewer-main { display: flex; flex-direction: column; min-width: 0; }
.vgar__viewer-stage { position: relative; aspect-ratio: 16 / 10; min-height: 320px; background: #0c0d0f; }
.vgar__viewer-canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.vgar__viewer-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #b8b4ad; font-size: 13px; background: rgba(12,13,15,.7); text-align: center; padding: 16px; }
.vgar__viewer-overlay[hidden] { display: none !important; }
.vgar__viewer-error { color: #ffb3b3; }
.vgar__viewer-toolbar { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; padding: 8px; background: #101114; border-top: 1px solid rgba(237,235,230,.08); }
.vgar__vbtn { appearance: none; border: 1px solid rgba(237,235,230,.16); background: #16181c; color: #EDEBE6; border-radius: 6px; padding: 5px 9px; cursor: pointer; font: inherit; font-size: 12px; line-height: 1; }
.vgar__vbtn:hover, .vgar__vbtn.is-active { border-color: #F10000; color: #fff; background: rgba(241,0,0,.18); }
.vgar__viewer-inspector { padding: 10px; background: #101114; border-left: 1px solid rgba(237,235,230,.08); display: grid; gap: 12px; align-content: start; overflow-y: auto; max-height: 520px; }
.vgar__insp-block { display: grid; gap: 6px; }
.vgar__insp-label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #b8b4ad; font-weight: 700; }
.vgar__insp-select { width: 100%; background: #0c0d0f; color: #EDEBE6; border: 1px solid rgba(237,235,230,.14); border-radius: 6px; padding: 6px 8px; font: inherit; font-size: 13px; }
.vgar__insp-row { display: flex; flex-wrap: wrap; gap: 6px; }
.vgar__ichip { appearance: none; border: 1px solid rgba(237,235,230,.16); background: #16181c; color: #EDEBE6; border-radius: 999px; padding: 5px 10px; cursor: pointer; font: inherit; font-size: 12px; text-decoration: none; display: inline-block; }
.vgar__ichip.is-active { background: #F10000; border-color: #F10000; color: #fff; }
.vgar__insp-checks { display: grid; gap: 4px; font-size: 13px; color: #c9c5be; }
.vgar__insp-checks label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.vgar__badge-3d { display: inline-block; padding: 2px 6px; border-radius: 4px; background: #F10000; color: #fff; font-size: 10px; font-weight: 700; letter-spacing: .08em; }
.vgar__model-badge { display: flex; align-items: center; justify-content: center; gap: 6px; }
@media (max-width: 820px) { .vgar__viewer { grid-template-columns: 1fr; } .vgar__viewer-inspector { max-height: none; border-left: 0; border-top: 1px solid rgba(237,235,230,.08); } }

/* Advanced viewer additions */
.vgar__viewer-poster { background: #0c0d0f; }
.vgar__annotation-pin { box-shadow: 0 0 0 2px rgba(255,255,255,.35); }
.vgar__measure-label { pointer-events: none; transform: translate(-50%, -100%); white-space: nowrap; }
.vgar__annotations-layer { overflow: hidden; }

/* R5 additions */
.vgar__thumb{position:relative;}
.vgar__thumb-badge{position:absolute;top:8px;left:8px;padding:3px 7px;border-radius:999px;background:#F10000;color:#fff;font:700 10px/1 Oswald,Arial Narrow,sans-serif;letter-spacing:.08em;text-transform:uppercase;z-index:2}
.vgar__viewer-empty{display:flex;align-items:center;justify-content:center;min-height:280px;aspect-ratio:16/10;border:1px dashed rgba(237,235,230,.22);border-radius:12px;background:#0f1012;margin:12px 0}
.vgar__viewer-empty-in{text-align:center;padding:24px;color:#b8b4ad}
.vgar__viewer-empty-ico{display:inline-flex;color:#F10000;margin-bottom:8px}
.vgar__viewer-empty-txt{margin:0 0 4px;font:600 18px/1.2 Oswald,Arial Narrow,sans-serif;color:#EDEBE6;text-transform:uppercase;letter-spacing:.06em}
.vgar__sheet{position:fixed;inset:0;z-index:100000;display:flex;align-items:stretch;justify-content:stretch;padding:0}
.vgar__sheet-backdrop{position:absolute;inset:0;background:rgba(0,0,0,.72)}
/* Full-screen vehicle viewport: the sheet fills the viewport instead of
   floating as a 1100px card, so the 3D viewer gets the whole width. */
.vgar__sheet-panel{position:relative;width:100%;max-width:none;max-height:100vh;height:100vh;overflow:auto;background:#0C0D0F;border:0;border-radius:0;padding:18px;box-shadow:none;box-sizing:border-box}
.vgar__sheet-close{position:sticky;top:0;float:right;z-index:3;width:36px;height:36px;border:0;border-radius:8px;background:#16181c;color:#EDEBE6;font-size:24px;line-height:1;cursor:pointer}
.vgar__sheet-close:hover{background:#F10000;color:#fff}
/* Edit vehicle shares the × close button's horizontal line: the × floats out
   of flow on the body's first line, so pull the detail-top row up onto that
   same line (left) and keep clear of the × on the right. */
.vgar__sheet .vgar__detail-top{margin-top:-36px;padding-right:52px;position:relative;z-index:4}
body.vgar-sheet-open{overflow:hidden}
.vgar__sheet .vgar__detail{margin:0;max-width:none;width:100%}
.vgar__sheet .vgar__detail .vgar__viewer{max-width:none;width:100%}
@media (max-width:720px){.vgar__sheet{padding:0}.vgar__sheet-panel{width:100%;max-height:100vh;height:100vh;border-radius:0;padding:12px}}

/* ---- vehicle editor toggle ----
   "Edit vehicle" is a button; the editor stays hidden until it is pressed. */
.vgar__detail-edit{display:flex;flex-direction:column;gap:12px;margin-top:6px}
.vgar__btn--edit{display:inline-flex;align-items:center;gap:8px;align-self:flex-start}
.vgar__btn--edit svg{flex:0 0 auto;color:#F10000}
.vgar__btn--edit.is-open{border-color:#F10000;color:#fff;background:rgba(241,0,0,.14)}
.vgar__detail-panel[hidden]{display:none !important}
.vgar__detail-panel{margin-top:2px}

/* The vehicle viewport's own Vesper header. */
.vgar__sheet-head{position:sticky;top:0;z-index:4;margin:0 -18px 12px;padding:6px 18px 0;background:#0C0D0F;border-bottom:1px solid rgba(237,235,230,.12)}
@media (max-width:720px){.vgar__sheet-head{margin:0 -12px 12px;padding:6px 12px 0}}
