/* ── Variables ──────────────────────────────────────────────────────────────── */
:root {
  --font-display: 'Bebas Neue', sans-serif;
  --font-ui: 'Inter', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --clr-bg: #060a12;
  --clr-text: #e8ecf2;
  --clr-muted: rgba(255,255,255,0.45);
  --clr-border: rgba(255,255,255,0.08);
  --clr-surface: rgba(255,255,255,0.04);
  --clr-orange: #ff7400;
  --clr-orange-glow: rgba(255,116,0,0.35);
  --clr-blue: #1a9fff;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --transition: 0.25s ease;
  --mx: 0;
  --my: 0;
}

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font-body);
  background: var(--clr-bg);
  color: var(--clr-text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Background scene ──────────────────────────────────────────────────────── */
/*
 * HORIZONTAL PAN only: background-size 220% so image is wider than viewport.
 * X position: 0%→100%→0% at 240s — imperceptibly slow left/right drift.
 * Y is locked at 50% (centre crop, never moves).
 */
.bg-scene {
  position: fixed; inset: 0; z-index: 0;
  background-image:
    radial-gradient(ellipse 80% 60% at 50% 100%, rgba(26,159,255,0.07) 0%, transparent 70%),
    radial-gradient(ellipse 60% 40% at 80% 20%, rgba(255,116,0,0.05) 0%, transparent 60%),
    url('../img/bg.webp');
  background-size: auto, auto, 220% auto;
  background-position: center, center, 0% 50%;
  background-repeat: no-repeat;
  background-attachment: scroll;
  filter: brightness(0.7);
  animation: bgPanH 240s linear infinite;
  will-change: background-position;
}

/* Gradient overlay */
.bg-scene::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(6,10,18,0.25) 0%,
    rgba(6,10,18,0.55) 55%,
    rgba(6,10,18,0.95) 100%
  );
  animation: overlayBreath 14s ease-in-out infinite;
  pointer-events: none;
}

/* Blue ambient orb — parallax */
.bg-scene::before {
  content: ''; position: absolute;
  width: 60vw; height: 60vw; left: -10vw; bottom: -10vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(26,159,255,0.10) 0%, transparent 70%);
  animation: flareBlue 22s ease-in-out infinite;
  transform: translate(calc(var(--mx) * -18px), calc(var(--my) * -12px));
  pointer-events: none;
  will-change: transform, opacity;
}

/* Orange flare — parallax opposite direction */
.bg-flare {
  position: fixed; width: 50vw; height: 50vw; right: -5vw; top: 10vh;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,116,0,0.07) 0%, transparent 65%);
  animation: flareOrange 30s ease-in-out infinite 4s;
  transform: translate(calc(var(--mx) * 22px), calc(var(--my) * 14px));
  pointer-events: none; z-index: 0;
  will-change: transform, opacity;
}

.bg-flare--alt {
  right: auto; left: 10vw; top: 50vh; width: 40vw; height: 40vw;
  background: radial-gradient(circle, rgba(26,159,255,0.05) 0%, transparent 60%);
  animation: flareBlue 28s ease-in-out infinite 10s;
  transform: translate(calc(var(--mx) * 12px), calc(var(--my) * 20px));
}

/* ── Pure horizontal pan — x goes 0% → 100% → 0%, y stays fixed at 40% ── */
@keyframes bgPanH {
  0%   { background-position: center, center, 0%   40%; }
  50%  { background-position: center, center, 100% 40%; }
  100% { background-position: center, center, 0%   40%; }
}

@keyframes overlayBreath {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.90; }
}

@keyframes flareBlue {
  0%, 100% { opacity: 0.04; }
  33%      { opacity: 0.14; }
  66%      { opacity: 0.07; }
}

@keyframes flareOrange {
  0%, 100% { opacity: 0.05; }
  40%      { opacity: 0.02; }
  70%      { opacity: 0.10; }
}

@media (prefers-reduced-motion: reduce) {
  .bg-scene, .bg-scene::before, .bg-scene::after, .bg-flare {
    animation: none !important;
    transform: none !important;
  }
}

/* ── Layout ────────────────────────────────────────────────────────────────── */
#app {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center;
  min-height: 100vh; padding: 30px 20px 60px;
}

/* ── Header ────────────────────────────────────────────────────────────────── */
.site-header { text-align: center; margin-bottom: 8px; }
.logo {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.6rem);
  letter-spacing: 0.06em;
  line-height: 1;
  background: linear-gradient(135deg, #fff 0%, var(--clr-orange) 60%, #ff3c00 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.tagline {
  font-family: var(--font-ui);
  font-size: clamp(0.7rem, 2vw, 0.85rem);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--clr-muted);
  margin-top: 4px;
}

/* ── Viewport ──────────────────────────────────────────────────────────────── */
.viewport-wrap {
  position: relative; width: 100%; max-width: 720px;
  aspect-ratio: 16/9; margin: 24px auto 0;
  overflow: hidden;
  transition: all 0.5s cubic-bezier(0.4,0,0.2,1);
}
body.viewport-expanded .viewport-wrap {
  max-width: 90vw; height: 60vh; aspect-ratio: auto;
}
#canvas-3d { display: block; border-radius: var(--radius-lg); outline: none; }
.viewport-empty {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.4); border-radius: var(--radius-lg);
  opacity: 0; pointer-events: none; transition: opacity var(--transition);
}
.viewport-empty.visible { opacity: 1; }
.viewport-empty span {
  font-family: var(--font-ui); font-size: 0.8rem;
  color: var(--clr-muted); letter-spacing: 0.08em;
}
.loading-indicator {
  position: absolute; bottom: 12px; left: 12px; right: 12px;
  background: rgba(0,0,0,0.75); border-radius: var(--radius-sm);
  padding: 8px 14px; display: flex; align-items: center; gap: 10px;
  opacity: 0; pointer-events: none; transition: opacity var(--transition);
}
.loading-indicator.visible { opacity: 1; }
.progress-bar {
  height: 3px; background: var(--clr-orange); border-radius: 2px;
  width: 0; transition: width 0.3s;
  flex-shrink: 0; min-width: 0; max-width: 120px;
}
.progress-text {
  font-family: var(--font-mono); font-size: 0.7rem; color: var(--clr-muted);
  white-space: nowrap;
}

@media (max-width: 768px) {
  .viewport-wrap { aspect-ratio: 4/3; min-height: 260px; }
  body.viewport-expanded .viewport-wrap { max-width: 100%; height: 45vh; }
}

/* ── Controls ──────────────────────────────────────────────────────────────── */
.controls {
  display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
  margin: 18px 0 12px; width: 100%; max-width: 720px;
}
body.viewport-expanded .controls { max-width: 90vw; }

.ctrl-btn {
  font-family: var(--font-ui); font-size: 0.8rem; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  background: var(--clr-surface); color: var(--clr-text);
  border: 1px solid var(--clr-border); border-radius: var(--radius-md);
  padding: 10px 22px; cursor: pointer;
  transition: all var(--transition); display: flex; align-items: center; gap: 6px;
}
.ctrl-btn:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.15); }
.ctrl-btn.active { border-color: var(--clr-blue); color: var(--clr-blue); }
.ctrl-btn.accent { border-color: var(--clr-orange); color: var(--clr-orange); }
.ctrl-btn.accent:hover { background: rgba(255,116,0,0.1); }
.ctrl-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.ctrl-icon { font-size: 1rem; }

/* ── Spinner ───────────────────────────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px; border: 2px solid var(--clr-border);
  border-top-color: var(--clr-orange); border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Panels ────────────────────────────────────────────────────────────────── */
.panel {
  width: 100%; max-width: 720px;
  max-height: 0; overflow: hidden; opacity: 0;
  transition: max-height 0.4s ease, opacity 0.3s ease, margin 0.3s ease;
  margin: 0;
}
.panel.open { max-height: 800px; opacity: 1; margin: 12px 0; overflow-y: auto; }
body.viewport-expanded .panel { max-width: 90vw; }

.panel-inner {
  background: rgba(10,14,22,0.85); backdrop-filter: blur(20px);
  border: 1px solid var(--clr-border); border-radius: var(--radius-lg);
  padding: 24px;
}
.panel-title {
  font-family: var(--font-display); font-size: 1.4rem;
  letter-spacing: 0.05em; margin-bottom: 16px;
}

/* ── Select ────────────────────────────────────────────────────────────────── */
.select-group { display: flex; flex-direction: column; gap: 10px; }
.select-wrap { position: relative; }
.select-wrap::after {
  content: ''; position: absolute; right: 16px; top: 50%;
  width: 8px; height: 8px;
  border-right: 2px solid var(--clr-muted); border-bottom: 2px solid var(--clr-muted);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}
.select-wrap select {
  width: 100%; appearance: none;
  background: var(--clr-surface); color: var(--clr-text);
  border: 1px solid var(--clr-border); border-radius: var(--radius-sm);
  padding: 12px 40px 12px 14px;
  font-family: var(--font-ui); font-size: 0.85rem;
  cursor: pointer; transition: border-color var(--transition);
}
.select-wrap select:hover { border-color: rgba(255,255,255,0.15); }
.select-wrap select:disabled { opacity: 0.4; cursor: not-allowed; }
.select-wrap select option { background: #0d1117; }

/* ── Request block ─────────────────────────────────────────────────────────── */
.request-block { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--clr-border); }
.request-block textarea, .request-block input {
  width: 100%; background: var(--clr-surface); color: var(--clr-text);
  border: 1px solid var(--clr-border); border-radius: var(--radius-sm);
  padding: 10px 14px; font-family: var(--font-body); font-size: 0.85rem;
  margin-top: 8px; resize: vertical;
}
.chk-label {
  display: flex; align-items: center; gap: 8px; margin-top: 10px;
  font-family: var(--font-ui); font-size: 0.8rem; color: var(--clr-muted); cursor: pointer;
}
.hidden { display: none !important; }
.text-muted { color: var(--clr-muted); font-size: 0.8rem; font-family: var(--font-ui); }

.btn-secondary {
  margin-top: 12px; padding: 10px 20px;
  background: var(--clr-surface); color: var(--clr-text);
  border: 1px solid var(--clr-border); border-radius: var(--radius-sm);
  font-family: var(--font-ui); font-size: 0.8rem; font-weight: 600;
  cursor: pointer; transition: all var(--transition);
}
.btn-secondary:hover { background: rgba(255,255,255,0.08); }
.btn-secondary:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Skins grid ────────────────────────────────────────────────────────────── */
.skins-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
}
.skin-card {
  position: relative; aspect-ratio: 1;
  border-radius: var(--radius-sm); overflow: hidden;
  cursor: pointer; border: 2px solid transparent;
  transition: all var(--transition);
}
.skin-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.skin-card .skin-name {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 6px 8px; background: rgba(0,0,0,0.85); backdrop-filter: blur(4px);
  font-family: var(--font-ui); font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.06em; text-align: center; text-transform: uppercase;
  color: rgba(255,255,255,0.9); transition: all var(--transition);
}
.skin-card:hover { border-color: rgba(26,159,255,0.5); transform: scale(1.04); }
.skin-card:hover .skin-name { background: rgba(26,159,255,0.2); color: #fff; }
.skin-card.selected { border-color: var(--clr-orange); box-shadow: 0 0 14px var(--clr-orange-glow); }
.skin-card.selected::after {
  content: '✓'; position: absolute; top: 6px; right: 6px;
  width: 20px; height: 20px; background: var(--clr-orange);
  border-radius: 50%; font-size: 0.65rem;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700;
}

/* ── Order form ────────────────────────────────────────────────────────────── */
.order-form { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-family: var(--font-ui); font-size: 0.75rem;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--clr-muted);
}
.field label .req { color: var(--clr-orange); margin-left: 2px; }
.field input, .field textarea {
  background: rgba(255,255,255,0.04); border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm); padding: 10px 14px;
  color: var(--clr-text); font-family: var(--font-body); font-size: 0.9rem;
  transition: border-color var(--transition); resize: vertical;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--clr-blue); }
.radio-group { display: flex; gap: 16px; }
.radio-group label {
  font-size: 0.85rem; text-transform: none; letter-spacing: 0;
  display: flex; align-items: center; gap: 6px; cursor: pointer;
}
.btn-primary {
  padding: 14px 28px; background: var(--clr-orange); color: #fff;
  border: none; border-radius: var(--radius-sm);
  font-family: var(--font-ui); font-size: 0.9rem; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  cursor: pointer; transition: all var(--transition);
}
.btn-primary:hover { background: #ff8a2a; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Order status banner ───────────────────────────────────────────────────── */
.order-status-banner {
  width: 100%; max-width: 720px; margin-top: 24px;
  background: rgba(10,14,22,0.85); backdrop-filter: blur(20px);
  border: 1px solid var(--clr-border); border-radius: var(--radius-lg);
  padding: 24px; text-align: center;
}
.order-status-banner h3 { font-family: var(--font-display); font-size: 1.3rem; margin-bottom: 8px; }
.order-status-banner .status strong { color: var(--clr-orange); }
.order-status-banner code {
  font-family: var(--font-mono); background: var(--clr-surface);
  padding: 2px 8px; border-radius: 4px;
}

/* ── Toasts ────────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 20px; right: 20px; z-index: 9999;
  display: flex; flex-direction: column-reverse; gap: 8px;
}
.toast {
  padding: 12px 20px; border-radius: var(--radius-sm);
  font-family: var(--font-ui); font-size: 0.82rem; font-weight: 500;
  color: #fff; backdrop-filter: blur(10px);
  animation: toastIn 0.3s ease forwards;
}
.toast.success { background: rgba(34,197,94,0.85); }
.toast.error   { background: rgba(239,68,68,0.85); }
.toast.info    { background: rgba(59,130,246,0.85); }
.toast.out     { animation: toastOut 0.3s ease forwards; }
@keyframes toastIn  { from { opacity:0; transform: translateY(16px); } to { opacity:1; transform: translateY(0); } }
@keyframes toastOut { from { opacity:1; transform: translateY(0); }    to { opacity:0; transform: translateY(16px); } }

/* ── YouTube banner ────────────────────────────────────────────────────────── */
/*
 * Full width across all 3 control buttons, same height as ctrl-btn (42px).
 * Uses the same border-radius and font as controls for visual consistency.
 */
.yt-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 720px;
  height: 42px;               /* matches ctrl-btn height */
  margin: 0 auto 12px;
  padding: 0 20px;
  background: rgba(255, 0, 0, 0.10);
  border: 1px solid rgba(255, 60, 0, 0.30);
  border-radius: var(--radius-md);
  color: #ff4444;
  text-decoration: none;
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: all var(--transition);
  cursor: pointer;
}
.yt-banner:hover {
  background: rgba(255, 0, 0, 0.18);
  border-color: rgba(255, 60, 0, 0.55);
  color: #ff6666;
}
.yt-icon {
  width: 22px; height: 22px;
  flex-shrink: 0;
  color: #ff2020;
}
body.viewport-expanded .yt-banner { max-width: 90vw; }

/* ── Gallery trigger button (inside viewport) ──────────────────────────────── */
.gallery-trigger {
  position: absolute;
  bottom: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(10, 14, 22, 0.82);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  color: var(--clr-text);
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition);
  z-index: 10;
}
.gallery-trigger:hover {
  background: rgba(255, 116, 0, 0.25);
  border-color: var(--clr-orange);
  color: var(--clr-orange);
}
.gallery-trigger svg { flex-shrink: 0; }

/* ── Gallery Lightbox ──────────────────────────────────────────────────────── */
.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(4, 6, 12, 0.95);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: galleryIn 0.2s ease;
}
.gallery-lightbox.hidden { display: none; }

@keyframes galleryIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Stage: 90vw × 90vh, image fills it with object-fit */
.gallery-stage {
  width: 90vw;
  height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.gallery-stage img {
  max-width: 90vw;
  max-height: 90vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-md);
  user-select: none;
  -webkit-user-drag: none;
  transition: opacity 0.18s ease;
}
.gallery-stage img.fading { opacity: 0; }

/* Navigation arrows */
.gallery-prev,
.gallery-next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 50%;
  color: #fff;
  width: 52px; height: 52px;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  transition: all var(--transition);
  display: flex; align-items: center; justify-content: center;
  z-index: 9010;
}
.gallery-prev { left: 16px; }
.gallery-next { right: 16px; }
.gallery-prev:hover,
.gallery-next:hover {
  background: rgba(255, 116, 0, 0.25);
  border-color: var(--clr-orange);
}
.gallery-prev:disabled,
.gallery-next:disabled { opacity: 0.2; cursor: default; }

/* Close button */
.gallery-close {
  position: fixed;
  top: 16px; right: 20px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 50%;
  color: #fff;
  width: 44px; height: 44px;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all var(--transition);
  display: flex; align-items: center; justify-content: center;
  z-index: 9010;
}
.gallery-close:hover { background: rgba(239, 68, 68, 0.3); border-color: #ef4444; }

/* Counter */
.gallery-counter {
  position: fixed;
  bottom: 24px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,0.6);
  border-radius: 20px;
  padding: 6px 18px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.1em;
  z-index: 9010;
  pointer-events: none;
}

@media (max-width: 600px) {
  .gallery-prev { left: 6px; width: 44px; height: 44px; font-size: 1.5rem; }
  .gallery-next { right: 6px; width: 44px; height: 44px; font-size: 1.5rem; }
  .gallery-close { top: 10px; right: 10px; }
}
