:root {
  --bg: #ffffff;
  --txt: #0f172a;
  --muted: #6b7280;
  --glass: rgba(255, 255, 255, 0.60);
  --cyan: #22d3ee;
  --ring: #d9dde8;
  --primary: #364285;
  --secondary: #F3A63A;
  --accent: #CD7662;
}

/* base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: Poppins, system-ui, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--txt);
  line-height: 1.6;

  /* FUNDO CLARO – degradê puxando para #364285, #F3A63A, #CD7662 */
  background:
    radial-gradient(900px 580px at 15% 8%, rgba(54, 66, 133, 0.22), transparent 60%),
    radial-gradient(1000px 640px at 85% 85%, rgba(243, 166, 58, 0.28), transparent 55%),
    radial-gradient(950px 650px at 50% 105%, rgba(205, 118, 98, 0.24), transparent 55%),
    linear-gradient(180deg, #fff 0%, #fff9f2 40%, #fff3e6 100%);

  /* empurra o conteúdo para baixo do header fixo */
  padding-top: 72px;

  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 64 64"><circle cx="20" cy="36" r="10" fill="none" stroke="%236b7280" stroke-width="4"/><circle cx="44" cy="36" r="10" fill="none" stroke="%236b7280" stroke-width="4"/><path d="M6 36c2-10 8-15 26-15s24 5 26 15" fill="none" stroke="%2322d3ee" stroke-width="4" stroke-linecap="round"/></svg>') 8 8, auto;
}

a, button {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 64 64"><circle cx="20" cy="36" r="10" fill="none" stroke="%23364285" stroke-width="4"/><circle cx="44" cy="36" r="10" fill="none" stroke="%23364285" stroke-width="4"/><path d="M6 36c2-10 8-15 26-15s24 5 26 15" fill="none" stroke="%23F3A63A" stroke-width="4" stroke-linecap="round"/></svg>') 8 8, pointer;
  transition: all 0.2s ease;
}

/* header fixo */
.wrap {
  width: min(1200px, 94vw);
  margin: 0 auto;
  padding: 0 16px;
}

header {
  position: fixed;
  inset: 0 0 auto 0;
  height: 72px;
  z-index: 40;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.85));
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
}

.brand img {
  height: 38px;
  width: auto;
}

.menu {
  display: flex;
  gap: 8px;
}

.menu button {
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.75);
  color: var(--txt);
  font-weight: 600;
  font-size: 14px;
  transition: all 0.3s ease;
}

.menu button:hover {
  background: rgba(255, 255, 255, 0.9);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.menu button.active {
  outline: 2px solid rgba(54, 66, 133, 0.25);
  background: linear-gradient(135deg, rgba(54, 66, 133, 0.1), rgba(243, 166, 58, 0.1));
}

/* main */
main {
  position: relative;
  min-height: calc(100vh - 72px);
}

.screen {
  display: none;
  overflow: auto;
  animation: fadeIn 0.5s ease;
}

.screen.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* cartões e botões */
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.75));
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 20px;
  padding: 20px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
}

.card:hover {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.85));
  color: var(--txt);
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  transition: all 0.3s ease;
  cursor: pointer;
}

.btn:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0.9));
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.btn.primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  box-shadow: 0 4px 15px rgba(54, 66, 133, 0.3);
}

.btn.primary:hover {
  background: linear-gradient(135deg, var(--primary), #2a3568);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(54, 66, 133, 0.4);
}

.subtitle {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

/* grid util */
.grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(12, 1fr);
}

.col-12 { grid-column: span 12; }
.col-6 { grid-column: span 12; }
.col-4 { grid-column: span 12; }

@media (min-width: 768px) {
  .col-6 { grid-column: span 6; }
  .col-4 { grid-column: span 6; }
}

@media (min-width: 1024px) {
  .col-6 { grid-column: span 6; }
  .col-4 { grid-column: span 4; }
}

.hero {
  display: grid;
  place-items: center;
  min-height: 70vh;
  text-align: center;
  padding: 40px 20px;
}

.hero h1 {
  font-size: clamp(32px, 5vw, 64px);
  margin: 0 0 16px 0;
  font-weight: 800;
  line-height: 1.1;
}

.grad {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  display: inline-block;
}

.cta {
  margin-top: 24px;
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.pad {
  padding: 24px 16px;
}

.totals {
  font-size: 28px;
  font-weight: 800;
  color: var(--cyan);
  text-align: center;
}

.right {
  text-align: right;
}

.between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.flexgap {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

/* caixa do QR / preview */
.qrbox {
  width: 100%;
  max-width: 360px;
  height: 220px;
  display: grid;
  place-items: center;
  background: #ffffff;
  border: 2px dashed rgba(0, 0, 0, 0.1);
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  transition: all 0.3s ease;
}

.qrbox:hover {
  border-color: var(--primary);
}

#qr-area .preview-wrap {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 16px;
}

#qr-area .preview-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.2));
  border-radius: 8px;
}

#qr-area .caption {
  position: absolute;
  left: 8px;
  bottom: 6px;
  font-size: 11px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 4px 8px;
  border-radius: 6px;
  backdrop-filter: blur(10px);
}

/* inputs */
.input {
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.9);
  color: var(--txt);
  font-size: 14px;
  transition: all 0.3s ease;
  width: 100%;
}

.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(54, 66, 133, 0.1);
  background: rgba(255, 255, 255, 1);
}

.w220 {
  width: 220px;
}

/* spacing utilities */
.mt6 { margin-top: 6px; }
.mt8 { margin-top: 8px; }
.mt10 { margin-top: 10px; }
.mt12 { margin-top: 12px; }
.mt16 { margin-top: 16px; }
.mb12 { margin-bottom: 12px; }

.grid4 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (min-width: 640px) {
  .grid4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

.scrollY32 {
  max-height: 32vh;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

.scrollY48 {
  max-height: 48vh;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

.scrollY32::-webkit-scrollbar,
.scrollY48::-webkit-scrollbar {
  width: 6px;
}

.scrollY32::-webkit-scrollbar-track,
.scrollY48::-webkit-scrollbar-track {
  background: transparent;
}

.scrollY32::-webkit-scrollbar-thumb,
.scrollY48::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

/* Provador de Óculos */
.tryon-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  height: 100%;
  min-height: 80vh;
}

@media (min-width: 1024px) {
  .tryon-container {
    grid-template-columns: 380px 1fr;
  }
}

.sidebar {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.8));
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 20px;
  padding: 20px;
  overflow: auto;
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  max-height: 80vh;
}

.main {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 16px;
  min-height: 600px;
}

.stage {
  position: relative;
  background: #0b1220;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 20px;
  overflow: hidden;
  min-height: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  display: none;
  border-radius: 20px;
}

#canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 20px;
}

.toolbar, .footer {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.toolbar {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.8));
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 16px;
  padding: 16px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.footer {
  justify-content: space-between;
  padding: 12px 0;
}

h1 {
  font-size: 20px;
  margin: 0 0 8px 0;
  letter-spacing: 0.3px;
  font-weight: 700;
  color: var(--txt);
}

h2 {
  font-size: 15px;
  margin: 16px 0 10px 0;
  color: #475569;
  font-weight: 600;
}

.row.mini {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 20px;
  font-size: 12px;
  color: #64748b;
  background: rgba(255, 255, 255, 0.8);
  font-weight: 500;
}

.help {
  font-size: 12px;
  color: #64748b;
  line-height: 1.4;
}

.hint {
  position: absolute;
  left: 16px;
  top: 16px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  backdrop-filter: blur(10px);
  color: #fff;
  z-index: 10;
  max-width: 300px;
}

/* Catálogo do provador */
.catalog {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.thumb {
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  overflow: hidden;
  padding: 8px;
  transition: all 0.3s ease;
  cursor: pointer;
}

.thumb:hover {
  border-color: var(--primary);
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.thumb.active {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(54, 66, 133, 0.1), rgba(243, 166, 58, 0.1));
}

.thumb img {
  height: 60px !important;
  width: 100%;
  object-fit: contain;
  transition: transform 0.3s ease;
}

.thumb:hover img {
  transform: scale(1.1);
}

/* Catálogo de produtos */
.product-card {
  display: grid;
  gap: 12px;
  transition: all 0.3s ease;
}

.product-card:hover {
  transform: translateY(-4px);
}

.product-card .img {
  height: 240px;
  background: #ffffff;
  border-radius: 16px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.08);
  padding: 20px;
  transition: all 0.3s ease;
}

.product-card:hover .img {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.product-card .img img {
  max-height: 180px;
  max-width: 90%;
  object-fit: contain;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.15));
  transition: all 0.3s ease;
}

.product-card:hover .img img {
  transform: scale(1.05);
  filter: drop-shadow(0 12px 25px rgba(0, 0, 0, 0.2));
}

.product-card .meta {
  padding: 8px 4px;
}

.product-card .meta strong {
  display: block;
  margin-bottom: 4px;
  font-size: 15px;
  color: var(--txt);
}

.product-card .meta small {
  color: #64748b;
  font-size: 13px;
  line-height: 1.4;
}

/* Drawer do carrinho */
.drawer {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
}

.panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.9));
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 20px;
  padding: 20px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fab {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.fab:hover {
  transform: scale(1.1) translateY(-2px);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.3);
}

/* Status da câmera */
#status {
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  backdrop-filter: blur(10px);
}

/* Sliders e controles */
input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.1);
  outline: none;
  -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Responsividade melhorada */
@media (max-width: 768px) {
  .nav {
    flex-direction: column;
    height: auto;
    padding: 12px 0;
  }
  
  .menu {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }
  
  .menu button {
    flex: 1;
    min-width: 120px;
    text-align: center;
  }
  
  .hero {
    min-height: 50vh;
    padding: 20px;
  }
  
  .cta {
    flex-direction: column;
    align-items: center;
  }
  
  .cta .btn {
    width: 200px;
  }
  
  .tryon-container {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .sidebar {
    max-height: 400px;
  }
}

/* Animações suaves */
.fade-in {
  animation: fadeIn 0.5s ease;
}

.slide-in {
  animation: slideIn 0.5s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Estados de loading */
.loading {
  opacity: 0.7;
  pointer-events: none;
  position: relative;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(54, 66, 133, 0.3);
  border-top: 2px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}