@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=DM+Sans:wght@300;400;500&family=Share+Tech+Mono&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #080a0e;
  --surface: rgba(255,255,255,0.03);
  --border: rgba(255,255,255,0.07);
  --accent: #e8c97a;
  --accent2: #c0392b;
  --text: #f0ece4;
  --muted: rgba(240,236,228,0.4);
  --panel-w: 220px;
}

html, body {
  width: 100%; height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  overflow: hidden;
}

/* ── TOP BAR ── */
#topbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: 56px; z-index: 20;
  display: flex; align-items: center;
  padding: 0 28px;
  background: #ffffff;
  border-bottom: 1px solid rgba(232,201,122,0.15);
  box-shadow: 0 2px 12px rgba(0,0,0,0.35);
}

.topbar-logo {
  height: 38px;
  width: auto;
  display: block;
  border-radius: 4px;
  padding: 3px 8px;
  background: #ffffff;
}

/* ── CANVAS ── */
#canvas-wrap {
  position: fixed; inset: 0;
  z-index: 0;
}
canvas { display: block; width: 100% !important; height: 100% !important; }

/* ── VIGNETTE ── */
#vignette { display: none; }

/* ── FLOOR REFLECTION LINE ── */
#floor-line {
  position: fixed; bottom: 0; left: 0; right: 0; height: 1px; z-index: 2;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.25;
}

/* ── LEFT PANEL ── */
#left-panel {
  position: fixed; top: 56px; left: 0; bottom: 0;
  width: var(--panel-w); z-index: 10;
  padding: 20px 16px;
  display: flex; flex-direction: column; gap: 18px;
  border-right: 1px solid rgba(0,0,0,0.08);
  background: linear-gradient(90deg, rgba(240,240,240,0.85) 0%, rgba(240,240,240,0.0) 100%);
  backdrop-filter: blur(12px);
  box-shadow: 4px 0 18px rgba(0,0,0,0.18);
}

.panel-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  letter-spacing: 3px;
  color: rgba(0,0,0,0.45);
  text-transform: uppercase;
  margin-bottom: 12px;
}
#right-panel .panel-label { color: var(--accent); }
#paint-label-right { color: var(--accent); }

/* ── SIDEBAR NAV MENU ITEMS ── */
.nav-menu-item {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%;
  padding: 9px 10px 9px 12px;
  background: rgba(0,0,0,0.04);
  border: none;
  border-left: 3px solid transparent;
  border-radius: 0 6px 6px 0;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 1.5px;
  color: #1a1a2e;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
  text-align: left;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  box-shadow: none;
}
.nav-menu-item::after {
  content: '›';
  font-size: 16px;
  font-weight: 300;
  color: #c0392b;
  line-height: 1;
  transition: transform 0.18s;
}
.nav-menu-item:hover {
  background: rgba(192,57,43,0.08);
  border-left-color: #c0392b;
  color: #c0392b;
}
.nav-menu-item:hover::after {
  transform: translateX(3px);
}
.nav-menu-item.active {
  background: rgba(192,57,43,0.10);
  border-left-color: #c0392b;
  color: #c0392b;
}
.nav-menu-item.active::after {
  transform: translateX(3px);
}

/* COLOR SWITCHER */
.color-grid {
  display: grid;
  grid-template-columns: repeat(4, 36px);
  gap: 8px;
}
.color-swatch {
  width: 36px; height: 36px;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  position: relative;
}
.color-swatch:hover { transform: scale(1.12); }
.color-swatch.active {
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(232,201,122,0.4);
}
.color-swatch::after {
  content: '';
  position: absolute; inset: 3px;
  border-radius: 3px;
  background: inherit;
  filter: brightness(1.2);
}

/* ALLOY SUB-COLOURS */
.alloy-colors {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 8px;
  width: 100%;
}
.alloy-swatch {
  width: 22px; height: 22px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.2);
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.alloy-swatch:hover { transform: scale(1.15); }
.alloy-swatch.active { border-color: var(--accent); box-shadow: 0 0 6px rgba(232,201,122,0.6); }

/* WHEEL COLOR SECTION — inline inside wheel list */
#wheel-color-section {
  width: 100%;
  padding: 12px 4px 4px;
}

/* SHARED LIST */
.hotspot-list { display: flex; flex-direction: column; gap: 8px; }
.hs-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  background: rgba(255,255,255,0.05);
}
.hs-item:hover {
  background: rgba(255,255,255,0.10);
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(232,201,122,0.25);
  transform: translateX(3px);
}
.hs-item.active {
  background: rgba(232,201,122,0.12);
  border-color: var(--accent);
  box-shadow: 0 0 14px rgba(232,201,122,0.35);
}
.hs-thumb {
  width: 48px; height: 48px;
  border-radius: 6px;
  object-fit: contain;
  background: rgba(255,255,255,0.08);
  flex-shrink: 0;
  filter: brightness(1.1) contrast(1.05);
}
.hs-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.hs-label { font-size: 13px; font-weight: 400; color: rgba(255,255,255,0.9); }
.hs-desc { font-size: 11px; color: rgba(255,255,255,0.4); margin-top: 1px; }
.hs-buy {
  display: none;
  margin-top: 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  letter-spacing: 0.5px;
  color: #0a0a0a;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 4px 10px;
  text-decoration: none;
  font-weight: 800;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
  align-self: flex-start;
  box-shadow: 0 0 10px rgba(232,201,122,0.4);
}
.hs-item.active .hs-buy {
  display: inline-block;
}
.hs-buy:hover {
  background: #fff;
  border-color: #fff;
  color: #0a0a0a;
  box-shadow: 0 0 16px rgba(232,201,122,0.7);
}

/* ── RIGHT PANEL ── */
#right-panel {
  position: fixed; top: 56px; right: -280px; bottom: 0;
  width: 280px; z-index: 10;
  padding: 32px 24px;
  display: flex; flex-direction: column; gap: 28px;
  border-left: 1px solid rgba(255,255,255,0.08);
  background: linear-gradient(160deg, rgba(30,30,30,0.82) 0%, rgba(15,15,15,0.92) 100%);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  box-shadow: -6px 0 32px rgba(0,0,0,0.35);
  transition: right 0.3s ease;
  overflow: visible;
}
#right-panel.open { right: 0; }

.panel-scroll {
  display: flex;
  flex-direction: column;
  gap: 28px;
  overflow-y: auto;
  overflow-x: visible;
  flex: 1;
  max-height: calc(100vh - 116px);
  padding-right: 2px;
}
.panel-scroll::-webkit-scrollbar { width: 3px; }
.panel-scroll::-webkit-scrollbar-track { background: transparent; }
.panel-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

/* ── PANEL TITLE ── */
#right-panel-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 13px;
  letter-spacing: 3px;
  color: var(--accent);
  margin-bottom: 4px;
}

/* ── EMPTY STATE ── */
.panel-empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px;
  padding: 40px 16px;
  color: rgba(255,255,255,0.25);
  text-align: center;
}
.panel-empty-icon { font-size: 48px; opacity: 0.5; }
.panel-empty-text {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 22px;
  letter-spacing: 3px;
  line-height: 1.6;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
}

.panel-divider {
  height: 1px;
  background: rgba(255,255,255,0.1);
  flex-shrink: 0;
}

/* Tab — visible when panel is hidden */
#wheel-tab {
  position: absolute;
  left: -38px; top: 50%;
  width: 38px;
  padding: 20px 0;
  background: linear-gradient(180deg, #3a3a3a 0%, #2a2a2a 100%);
  border: 1px solid rgba(255,255,255,0.1);
  border-right: none;
  border-radius: 10px 0 0 10px;
  cursor: pointer;
  text-align: center;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2.5px;
  color: #e8c97a;
  writing-mode: vertical-rl;
  transform: translateY(-50%) rotate(180deg);
  backdrop-filter: blur(12px);
  z-index: 13;
  line-height: 1.4;
  box-shadow: -4px 0 16px rgba(0,0,0,0.25);
  transition: background 0.25s, box-shadow 0.25s, color 0.25s;
}
#wheel-tab:hover {
  background: linear-gradient(180deg, #4a4a4a 0%, #3a3a3a 100%);
  color: #fff;
  box-shadow: -4px 0 20px rgba(0,0,0,0.35);
}
#right-panel.open #wheel-tab { display: none; }


.stat-block { display: flex; flex-direction: column; gap: 6px; }
.stat-value {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 36px;
  line-height: 1;
  color: var(--text);
}
.stat-value span { font-size: 16px; color: var(--muted); margin-left: 4px; }
.stat-name { font-size: 11px; color: var(--muted); letter-spacing: 1px; }

.divider {
  height: 1px; background: var(--border); flex-shrink: 0;
}

/* ── CONTROLS HINT ── */
#controls-hint {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  z-index: 10;
  display: flex; gap: 20px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 2px;
  pointer-events: none;
}
.hint-item { display: flex; align-items: center; gap: 6px; }
.hint-key {
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 2px 6px;
  font-size: 9px;
  color: rgba(255,255,255,0.3);
}

/* ── PANEL TOGGLE BUTTONS ── */
.panel-toggle-btn {
  position: fixed;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(232,201,122,0.15);
  color: var(--accent);
  font-size: 20px;
  cursor: pointer;
  z-index: 12;
  border: 1px solid var(--accent);
  transition: all 0.3s ease;
  display: none;
}
.panel-toggle-btn:active {
  background: rgba(232,201,122,0.3);
  transform: scale(0.95);
}
#toggle-left {
  top: 68px;
  left: 16px;
}
#toggle-right {
  top: 68px;
  right: 16px;
  width: auto;
  height: auto;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 11px;
  font-family: 'Share Tech Mono', monospace;
  letter-spacing: 2px;
  font-weight: 600;
}

/* ── LOADING ── */
#loader {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px;
  transition: opacity 0.8s, visibility 0.8s;
}
#loader.fade { opacity: 0; visibility: hidden; }
/* ── LOADER ANIMATION — GOLF CART ── */
.loader-anim {
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 8px;
  animation: cart-bounce 0.6s ease-in-out infinite alternate;
}
.golf-cart-svg {
  width: clamp(160px, 40vw, 220px);
  height: auto;
  filter: drop-shadow(0 6px 18px rgba(0,0,0,0.5));
}
.motion-lines {
  animation: motion-fade 0.6s ease-in-out infinite alternate;
}
@keyframes cart-bounce {
  from { transform: translateY(0px); }
  to   { transform: translateY(-5px); }
}
@keyframes motion-fade {
  from { opacity: 1;   transform: translateX(0); }
  to   { opacity: 0.3; transform: translateX(-6px); }
}
.loader-bar-wrap {
  width: 240px; height: 2px;
  background: var(--border); border-radius: 2px;
  overflow: hidden;
}
.loader-bar {
  height: 100%; width: 0%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease;
  box-shadow: 0 0 10px rgba(232,201,122,0.6);
}
.loader-text {
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--muted);
}

/* ── TABLET LAYOUT (768px - 1024px) ── */
@media (max-width: 1024px) {
  :root { --panel-w: 160px; }

  #topbar {
    padding: 16px 20px;
  }
  .brand {
    font-size: 24px;
    letter-spacing: 2px;
  }
  .status-bar {
    font-size: 9px;
    gap: 12px;
    letter-spacing: 1px;
  }

  /* Left panel — slim sidebar on tablet */
  #left-panel {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    width: 160px;
    height: auto;
    overflow-y: auto;
    padding: 14px 10px;
    gap: 12px;
    border-right: 1px solid rgba(0,0,0,0.08);
    border-bottom: none;
    border-radius: 0;
    transition: none;
  }

  .nav-menu-item {
    font-size: 12px;
    padding: 8px 8px 8px 10px;
    letter-spacing: 1px;
  }
  .nav-menu-item::after {
    font-size: 14px;
  }

  .panel-label {
    font-size: 8px;
    letter-spacing: 2px;
    margin-bottom: 8px;
  }

  .color-grid {
    grid-template-columns: repeat(3, 28px);
    gap: 6px;
  }
  .color-swatch {
    width: 28px;
    height: 28px;
  }
  #right-panel {
    position: fixed;
    top: 56px;
    right: -100%;
    width: 280px;
    height: auto;
    max-height: 72vh;
    overflow: visible;
    padding: 24px 18px;
    gap: 20px;
    border-left: none;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    border-radius: 0 0 0 12px;
    background: linear-gradient(160deg, rgba(30,30,30,0.88) 0%, rgba(15,15,15,0.95) 100%);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    box-shadow: -4px 4px 24px rgba(0,0,0,0.4);
    transition: right 0.3s ease;
  }
  #right-panel.open {
    right: 0;
  }

  /* Show only the right toggle button on tablet */
  #toggle-right {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  #toggle-left {
    display: none;
  }

  .stat-value {
    font-size: 28px;
  }
  .stat-name {
    font-size: 10px;
  }

  .hs-thumb {
    width: 40px;
    height: 40px;
  }
  .hs-label {
    font-size: 12px;
  }
  .hs-desc {
    font-size: 10px;
  }
}

/* ── MOBILE LAYOUT (< 768px) ── */
@media (max-width: 768px) {
  :root { --panel-w: 100%; }

  #topbar {
    padding: 12px 16px;
    height: auto;
  }
  .brand {
    font-size: 20px;
    letter-spacing: 1px;
  }
  .status-bar {
    font-size: 7px;
    gap: 8px;
    letter-spacing: 0.5px;
  }

  /* Left panel — compact horizontal strip on mobile */
  #left-panel {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: auto;
    width: 100%;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: rgba(8,10,14,0.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    border-radius: 0;
    overflow-x: auto;
    overflow-y: visible;
    z-index: 11;
    scrollbar-width: none;
  }
  #left-panel::-webkit-scrollbar { display: none; }

  /* Show nav buttons as compact pills on mobile */
  .nav-menu-item {
    display: flex;
    flex-shrink: 0;
    padding: 5px 10px;
    font-size: 10px;
    letter-spacing: 1px;
    border-radius: 20px;
    border-left: none;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.06);
    color: rgba(240,236,228,0.85);
    white-space: nowrap;
  }
  .nav-menu-item::after { display: none; }
  .nav-menu-item:hover {
    background: rgba(192,57,43,0.18);
    border-color: #c0392b;
    color: #c0392b;
  }
  .nav-menu-item.active {
    background: rgba(192,57,43,0.22);
    border-color: #c0392b;
    color: #c0392b;
  }

  #left-panel .panel-label {
    display: none;
  }
  #left-panel .color-grid {
    grid-template-columns: repeat(9, 26px);
    gap: 5px;
    flex-shrink: 0;
  }
  #left-panel .color-swatch {
    width: 26px;
    height: 26px;
    border-radius: 5px;
  }

  /* Bottom sheet */
  #right-panel {
    position: fixed;
    top: auto;
    bottom: -100vh;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 58vh;
    border-left: none;
    border-bottom: none;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding: 0 16px 20px;
    gap: 0;
    border-radius: 18px 18px 0 0;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(28,28,28,0.96) 0%, rgba(12,12,12,0.98) 100%);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    box-shadow: 0 -8px 40px rgba(0,0,0,0.55);
    transition: bottom 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    z-index: 11;
  }
  #right-panel.open {
    bottom: 0;
    right: 0;
  }

  /* Hide the side tab on mobile — toggle button opens the sheet */
  #wheel-tab {
    display: none !important;
  }


  /* Scrollable panel content */
  .panel-scroll {
    max-height: calc(58vh - 48px);
    overflow-y: auto;
    padding-right: 0;
    gap: 18px;
  }

  /* Color grid: all 9 swatches in one row */
  .color-grid {
    grid-template-columns: repeat(9, 1fr);
    gap: 6px;
  }
  .color-swatch {
    width: 100%;
    height: 30px;
    border-radius: 5px;
  }

  /* Wheel list: horizontal scroll */
  #wheel-list {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: visible;
    gap: 8px;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  #wheel-list::-webkit-scrollbar { display: none; }
  #wheel-list .hs-item {
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    width: 72px;
    padding: 8px 6px;
    text-align: center;
    gap: 4px;
    transform: none !important;
  }
  #wheel-list .hs-thumb {
    width: 44px;
    height: 44px;
    min-width: 44px;
    margin: 0 auto;
  }
  #wheel-list .hs-label {
    font-size: 9px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 68px;
  }
  #wheel-list .hs-desc {
    display: none;
  }

  /* Wheel color section breaks out of horizontal scroll row */
  #wheel-list {
    flex-wrap: wrap;
  }
  #wheel-color-section {
    flex-shrink: 0;
    width: 100%;
    padding: 10px 4px 2px;
    order: 99;
  }

  #toggle-left {
    display: none;
  }
  #toggle-right {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Move open button to bottom-right, above the sheet */
  #toggle-right {
    top: auto;
    bottom: 24px;
    right: 16px;
    font-size: 10px;
    padding: 7px 12px;
    letter-spacing: 1.5px;
  }

  /* Hide controls hint on mobile — not needed */
  #controls-hint {
    display: none;
  }

  .stat-value {
    font-size: 24px;
  }
  .stat-name {
    font-size: 9px;
  }

  .panel-label {
    font-size: 8px;
  }

}

/* ── SMALL PHONE (< 480px) ── */
@media (max-width: 480px) {
  #topbar {
    padding: 10px 12px;
  }
  .brand {
    font-size: 16px;
    letter-spacing: 1px;
  }
  .status-bar {
    display: none;
  }

  /* Tighter strip on small phones */
  #left-panel {
    gap: 4px;
    padding: 5px 8px;
  }
  .nav-menu-item {
    font-size: 9px;
    padding: 4px 8px;
    letter-spacing: 0.8px;
  }
  #left-panel .color-grid {
    grid-template-columns: repeat(9, 22px);
    gap: 3px;
  }
  #left-panel .color-swatch {
    width: 22px;
    height: 22px;
  }
  /* Keep full-width bottom sheet on small phones */
  #right-panel {
    width: 100%;
    max-width: 100%;
    max-height: 62vh;
    padding: 0 12px 16px;
  }
  .panel-scroll {
    max-height: calc(62vh - 48px);
  }

  .panel-toggle-btn {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }

  .stat-value {
    font-size: 20px;
  }

  /* Tighter swatch on very small screens */
  .color-grid {
    gap: 4px;
  }
  .color-swatch {
    height: 28px;
  }

  .loader-bar-wrap {
    width: 160px;
  }
}
