:root {
  --ink: #12212b;
  --paper: #e7edf0;
  --line: #b6c4cc;
  --hi: #0f6f8c;
  --hi-hover: #0c576e;
  --card-bg: rgba(255, 255, 255, 0.90);
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--paper);
  font-family: ui-sans-serif, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
}
#app { position: fixed; inset: 0; }
canvas { display: block; touch-action: none; }

/* Viršutinis informacinis skydelis */
#meta {
  position: fixed;
  left: 14px;
  top: 12px;
  z-index: 5;
  pointer-events: auto;
  background: var(--card-bg);
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 18px rgba(18,33,43,0.08);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#meta h1 {
  margin: 0;
  font-size: 13px;
  letter-spacing: .16em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--hi);
}
#meta p {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: #4a5b66;
  font-variant-numeric: tabular-nums;
}

.lang-switch-top {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.lang-btn {
  background: #f1f5f8;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  cursor: pointer;
  color: var(--ink);
  transition: all 0.15s ease;
}

.lang-btn:hover {
  background: #e2eaf0;
  border-color: var(--hi);
}

.lang-btn.active {
  background: var(--hi);
  color: #fff;
  border-color: var(--hi);
}

/* Navigacijos pultelis ant viršutinės juostos */
.nav-control-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(18, 33, 43, 0.05);
  padding: 3px 5px;
  border-radius: 10px;
  border: 1px solid rgba(182, 196, 204, 0.5);
}

.nav-dpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 22px);
  grid-template-rows: repeat(3, 20px);
  gap: 2px;
}

.nav-zoom-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
  border-left: 1px solid rgba(182, 196, 204, 0.6);
  padding-left: 5px;
}

.nav-btn {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--ink);
  font-size: 10px;
  font-weight: 700;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all 0.12s ease;
  user-select: none;
  box-shadow: 0 1px 2px rgba(18, 33, 43, 0.06);
}

.nav-btn:hover {
  background: var(--hi);
  color: #ffffff;
  border-color: var(--hi);
  transform: translateY(-1px);
}

.nav-btn:active {
  transform: translateY(1px);
  box-shadow: none;
}

.nav-btn.nav-corner {
  font-size: 9px;
  color: #64748b;
  background: #f1f5f9;
}

.nav-btn.nav-corner:hover {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
}

.nav-btn.nav-zoom {
  font-size: 13px;
  font-weight: 900;
  height: 31px;
  width: 24px;
}

.nav-btn.nav-center {
  font-size: 12px;
  background: #f8fafc;
  color: #475569;
}

/* Šoninis valdymo skydelis dešinėje (šalia antraštės ir navigacijos) */
#sidebar {
  position: fixed;
  right: 14px;
  top: 12px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 12px 14px;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 26px rgba(18,33,43,.14);
  width: 200px;
  max-height: calc(100vh - 130px);
  overflow-y: auto;
}

.side-section {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.side-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  color: #637785;
  margin-bottom: 2px;
}

/* Stilingas Checkbox / Toggle elementas */
.check-item {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  color: var(--ink);
  padding: 4px 6px;
  border-radius: 6px;
  transition: background 0.12s;
}
.check-item:hover {
  background: rgba(15, 111, 140, 0.08);
}
.check-item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 17px;
  height: 17px;
  border: 1.5px solid var(--line);
  border-radius: 4px;
  outline: none;
  background: #fff;
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease;
  margin: 0;
}
.check-item input[type="checkbox"]:checked {
  background: var(--hi);
  border-color: var(--hi);
}
.check-item input[type="checkbox"]:checked::after {
  content: "✓";
  position: absolute;
  color: #fff;
  font-size: 12px;
  font-weight: bold;
  left: 3px;
  top: -1px;
}

.btn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}
.btn-full {
  width: 100%;
  margin-top: 2px;
}

button {
  font: inherit;
  font-size: 12px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
  transition: all 0.15s ease;
}
button:hover { background: #dde6ec; border-color: #9cb2bf; }
button.primary-btn {
  background: var(--hi);
  color: #fff;
  border-color: var(--hi);
  font-weight: 600;
}
button.primary-btn:hover {
  background: var(--hi-hover);
}

button.moto-btn {
  background: linear-gradient(135deg, #e65100, #bf360c);
  color: #fff;
  font-weight: 700;
  border: 1px solid #ff7043;
  box-shadow: 0 3px 10px rgba(230, 81, 0, 0.35);
}
button.moto-btn:hover {
  background: linear-gradient(135deg, #f57c00, #d84315);
  box-shadow: 0 4px 14px rgba(230, 81, 0, 0.5);
}

/* Apatinė Interaktyvi Auto / Moto Lofto Galerijos Juosta */
#bottomGalleryBar {
  position: fixed;
  bottom: 0;
  left: 310px; /* Šalia sidebar */
  right: 0;
  z-index: 40;
  background: rgba(15, 23, 30, 0.92);
  backdrop-filter: blur(14px);
  border-top: 1px solid rgba(255, 112, 67, 0.35);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.4);
  padding: 8px 16px 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

#bottomGalleryHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#bottomGalleryTitle {
  font-size: 11.5px;
  font-weight: 800;
  color: #ff9e80;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#bottomGalleryThemeTag {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(255, 112, 67, 0.15);
  color: #ffccbc;
  border: 1px solid rgba(255, 112, 67, 0.3);
}

#bottomGalleryControls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

#bottomGalleryControls button {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

#bottomGalleryControls button:hover {
  background: #ff7043;
  border-color: #ff7043;
  color: #ffffff;
}

#bottomGalleryCounter {
  font-size: 11px;
  font-weight: 700;
  color: #67c8ff;
  min-width: 42px;
  text-align: center;
}

.bottom-gallery-track {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
  scroll-behavior: smooth;
}
.bottom-gallery-track::-webkit-scrollbar {
  height: 4px;
}
.bottom-gallery-track::-webkit-scrollbar-thumb {
  background: rgba(255, 112, 67, 0.4);
  border-radius: 4px;
}

.bg-card {
  flex: 0 0 175px;
  height: 95px;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.12);
  transition: all 0.22s ease;
  background: #090e14;
}

.bg-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.bg-card:hover {
  border-color: #ff7043;
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(255, 112, 67, 0.35);
}
.bg-card:hover img {
  transform: scale(1.06);
}

.bg-card.active {
  border-color: #ff9e80;
  box-shadow: 0 0 0 2px #ff7043, 0 6px 16px rgba(255, 112, 67, 0.45);
}

.bg-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(5, 10, 15, 0.92) 0%, rgba(5, 10, 15, 0.2) 60%, transparent 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 6px 8px;
  pointer-events: none;
}

.bg-card-title {
  font-size: 10px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.bg-card-badge {
  font-size: 8.5px;
  font-weight: 600;
  color: #ffccbc;
  text-transform: uppercase;
}

/* Prisitaikymas mažiems ekranams */
@media (max-width: 768px) {
  #bottomGalleryBar {
    left: 0;
    padding: 6px 10px 8px 10px;
  }
  .bg-card {
    flex: 0 0 140px;
    height: 80px;
  }
}

/* Auto / Moto Concept Modal – Interactive Gallery Slider */
#conceptModal {
  position: fixed;
  inset: 0;
  z-index: 99;
  background: rgba(8, 14, 20, 0.92);
  backdrop-filter: blur(12px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 12px;
}
#conceptModal.show { display: flex; }

#conceptCard {
  background: #0f1923;
  border: 1px solid rgba(255, 112, 67, 0.4);
  border-radius: 16px;
  width: 100%;
  max-width: 1060px;
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0,0,0,0.7);
  overflow: hidden;
}

#conceptHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255, 112, 67, 0.25);
  background: rgba(230, 81, 0, 0.12);
}
#conceptTitle {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #ff9e80;
  text-transform: uppercase;
}
#conceptCounter {
  font-size: 12px;
  color: #67c8ff;
  font-weight: 700;
  margin-left: auto;
  margin-right: 12px;
}
#conceptClose {
  background: rgba(255, 100, 100, 0.2);
  border: 1px solid rgba(255, 100, 100, 0.4);
  color: #ffb8b8;
  border-radius: 6px;
  padding: 5px 12px;
  font-weight: 700;
  cursor: pointer;
}
#conceptClose:hover { background: rgba(255, 100, 100, 0.4); }

#conceptViewer {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.gallery-stage {
  position: relative;
  flex: 1;
  min-height: 340px;
  max-height: 58vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #090e14;
  overflow: hidden;
}
#galleryMainImg {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  user-select: none;
  transition: opacity 0.2s ease;
}

.gallery-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(15, 25, 35, 0.8) !important;
  color: #ff9e80 !important;
  border: 1px solid rgba(255, 112, 67, 0.5) !important;
  border-radius: 50% !important;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s;
}
.gallery-nav-btn:hover {
  background: #e65100 !important;
  color: #fff !important;
  transform: translateY(-50%) scale(1.1);
}
#galleryPrev { left: 12px; }
#galleryNext { right: 12px; }

.gallery-info {
  padding: 12px 18px;
  background: #14202c;
  border-top: 1px solid rgba(207,230,255,0.12);
  border-bottom: 1px solid rgba(207,230,255,0.12);
}
#galleryTitle {
  margin: 0 0 4px 0;
  font-size: 15px;
  color: #67c8ff;
  font-weight: 700;
}
#galleryDesc {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: #cfe6ff;
}

.gallery-thumbs {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  background: #0b1219;
  overflow-x: auto;
  scrollbar-width: thin;
}
.thumb-item {
  flex: 0 0 72px;
  height: 48px;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid transparent;
  opacity: 0.6;
  cursor: pointer;
  transition: all 0.2s;
}
.thumb-item:hover { opacity: 0.9; }
.thumb-item.active {
  border-color: #ff7043;
  opacity: 1;
  transform: scale(1.05);
}
.thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#hint {
  position: fixed;
  right: 14px;
  top: 12px;
  z-index: 5;
  font-size: 11.5px;
  color: #5c6d78;
  text-align: right;
  line-height: 1.6;
  pointer-events: none;
  background: var(--card-bg);
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
@media (max-width: 768px){ #hint { display: none; } }

/* 2D Brėžinio modalas su sluoksnių valdymo skydeliu */
#plan {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: #0c1e33;
  display: none;
  flex-direction: column;
}
#plan.show { display: flex; }
#planHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 14px;
  color: #cfe6ff;
  font-size: 12.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(207,230,255,.22);
}

#planZoomControls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.plan-zoom-btn {
  background: rgba(207,230,255,0.12) !important;
  color: #cfe6ff !important;
  border: 1px solid rgba(207,230,255,0.3) !important;
  border-radius: 6px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.15s;
}
.plan-zoom-btn:hover {
  background: rgba(15, 111, 140, 0.5) !important;
  border-color: #67c8ff !important;
}

.plan-print-btn {
  background: rgba(103, 200, 255, 0.22) !important;
  border: 1px solid rgba(103, 200, 255, 0.55) !important;
  color: #ffffff !important;
  padding: 5px 12px;
}
.plan-print-btn:hover {
  background: #0f6f8c !important;
  border-color: #67c8ff !important;
  box-shadow: 0 0 10px rgba(103, 200, 255, 0.4);
}

.plan-print-all-btn {
  background: rgba(255, 184, 77, 0.22) !important;
  border: 1px solid rgba(255, 184, 77, 0.65) !important;
  color: #fff3db !important;
  padding: 5px 12px;
}
.plan-print-all-btn:hover {
  background: #d97706 !important;
  border-color: #f59e0b !important;
  color: #ffffff !important;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

#planClose {
  background: rgba(255, 100, 100, 0.2) !important;
  border: 1px solid rgba(255, 100, 100, 0.4) !important;
  color: #ffb8b8 !important;
  border-radius: 6px;
  padding: 5px 12px;
  font-weight: 700;
  cursor: pointer;
}
#planClose:hover {
  background: rgba(255, 100, 100, 0.4) !important;
}

#planBody {
  flex: 1;
  display: flex;
  overflow: hidden;
}

#planSidebar {
  width: 220px;
  background: rgba(10, 24, 41, 0.95);
  border-right: 1px solid rgba(207,230,255,.18);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.plan-preset-btn {
  width: 100%;
  padding: 8px 12px;
  font-size: 12.5px;
  background: rgba(207,230,255,0.08);
  border: 1px solid rgba(207,230,255,0.22);
  color: #dff0ff;
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
  touch-action: manipulation;
}
.plan-preset-btn:hover {
  background: rgba(103,200,255,0.20);
  border-color: #67c8ff;
}
.plan-preset-btn.active {
  background: #0f6f8c;
  color: #fff;
  border-color: #67c8ff;
  font-weight: 600;
}

.plan-check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #cfe6ff;
  cursor: pointer;
  user-select: none;
  padding: 5px 0;
  touch-action: manipulation;
}
.plan-check input {
  cursor: pointer;
  accent-color: #0f6f8c;
  width: 18px;
  height: 18px;
}

#planInner {
  flex: 1;
  overflow: auto;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-overflow-scrolling: touch;
}
#planInner svg {
  width: 100%;
  min-width: 650px;
  max-width: 1200px;
  height: auto;
}

/* =========================================================================
   MOBILUSIS ADAPTYVUMAS (TELEFONAMS IR PLANŠETĖMS)
   ========================================================================= */
#mobileBackdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(3px);
  z-index: 90;
  transition: opacity 0.25s ease;
}

@media (max-width: 768px) {
  #meta {
    left: 10px;
    right: 10px;
    top: 10px;
    padding: 10px 14px;
    max-width: none;
    width: calc(100% - 20px);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  }
  #meta h1 { font-size: 13px; }
  #meta p { font-size: 11.5px; }

  #mobileMenuBtn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: var(--hi);
    color: #fff;
    border: none;
    border-radius: 8px;
    width: 34px;
    height: 34px;
    font-size: 17px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(15, 111, 140, 0.35);
  }

  #hint {
    display: none; /* Paslepiam pelės instrukcijas telefone */
  }

  /* Šoninis valdymo skydelis telefone veikia kaip išvažiuojantis meniu (Drawer) */
  #sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 260px;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0 16px 16px 0;
    z-index: 100;
    transform: translateX(-105%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 10px 0 30px rgba(0,0,0,0.3);
    padding: 18px 16px;
  }

  #sidebar.mobile-open {
    transform: translateX(0);
  }

  #mobileBackdrop.active {
    display: block;
  }

  /* Brėžinio modalas telefone */
  #planModal {
    padding: 0;
  }
  #planCard {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-width: none;
    max-height: none;
    border-radius: 0;
    border: none;
  }
  #planBody {
    flex-direction: column;
  }
  #planSidebar {
    width: 100%;
    max-height: 190px;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    border-right: none;
    border-bottom: 1px solid rgba(207,230,255,.18);
  }
  #planSidebar > div {
    flex: 1 1 45%;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .plan-preset-btn {
    padding: 7px 9px;
    font-size: 11.5px;
  }
  .plan-check {
    font-size: 12px;
    padding: 3px 0;
  }
  #planInner {
    padding: 8px;
    align-items: flex-start;
  }
}
