:root {
  --cream: #f7ecd6;
  --cream-dark: #ecdcbd;
  --red: #b02a24;
  --navy: #1a2a4a;
  --wood: #8a5a2b;
  --wood-dark: #5c3a18;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Bricolage Grotesque', sans-serif;
  background:
    radial-gradient(circle at 20% 0%, rgba(176,42,36,0.06), transparent 40%),
    radial-gradient(circle at 80% 100%, rgba(26,42,74,0.06), transparent 40%),
    var(--cream);
  color: var(--navy);
  -webkit-font-smoothing: antialiased;
}

/* Header */
.site-header {
  background: linear-gradient(180deg, var(--wood) 0%, var(--wood-dark) 100%);
  box-shadow: 0 4px 18px rgba(0,0,0,0.25);
  position: relative;
}
.pole-strip {
  height: 10px;
  background: repeating-linear-gradient(
    45deg,
    var(--red) 0 12px,
    #fff 12px 24px,
    var(--navy) 24px 36px,
    #fff 36px 48px
  );
  background-size: 68px 68px;
  animation: barberScroll 3s linear infinite;
}
@keyframes barberScroll {
  0% { background-position: 0 0; }
  100% { background-position: 68px 0; }
}
.app-title {
  font-size: clamp(2rem, 6vw, 3.4rem);
  font-weight: 800;
  color: var(--cream);
  letter-spacing: -0.02em;
  margin: 0;
  text-shadow: 2px 2px 0 var(--red), 4px 4px 0 rgba(0,0,0,0.25);
}
.tagline {
  color: var(--cream-dark);
  font-weight: 300;
  font-size: clamp(0.85rem, 2.5vw, 1.05rem);
  margin: 0.5rem 0 0;
}
.now-serving {
  display: inline-block;
  margin-top: 0.8rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  background: var(--red);
  color: #fff;
  padding: 3px 10px;
  border-radius: 4px;
  border: 1px dashed rgba(255,255,255,0.5);
}

/* Drop zone */
.drop-zone {
  border: 3px dashed var(--wood);
  border-radius: 20px;
  background: rgba(255,255,255,0.55);
  padding: 3rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  max-width: 520px;
  margin: 2rem auto;
  box-shadow: inset 0 0 0 8px rgba(138,90,43,0.12);
}
.drop-zone:hover, .drop-zone-active {
  border-color: var(--red);
  background: rgba(255,255,255,0.85);
  transform: scale(1.01);
}
.demo-btn {
  background: var(--navy);
  color: var(--cream);
  padding: 0.6rem 1.3rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
}
.demo-btn:hover { background: var(--red); transform: translateY(-2px); }

/* Mirror frames */
.mirror-frame {
  position: relative;
  aspect-ratio: 1;
  border-radius: 14px;
  overflow: hidden;
  background: #2b2b2b;
  border: 8px solid var(--wood-dark);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3), inset 0 0 30px rgba(0,0,0,0.4);
}
.result-frame { border-color: var(--red); }
.panel-badge {
  position: absolute;
  top: 8px; left: 8px;
  z-index: 5;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  background: var(--navy);
  color: #fff;
  padding: 3px 9px;
  border-radius: 4px;
}
.panel-badge-red { background: var(--red); }

.loading-box, .empty-result {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: var(--cream);
}

/* Barber pole spinner */
.barber-pole {
  border-radius: 999px;
  overflow: hidden;
  border: 3px solid var(--wood-dark);
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.barber-pole-stripes {
  width: 100%; height: 200%;
  background: repeating-linear-gradient(
    60deg,
    var(--red) 0 14px,
    #fff 14px 28px,
    var(--navy) 28px 42px,
    #fff 42px 56px
  );
  animation: poleSpin 1.1s linear infinite;
}
@keyframes poleSpin {
  0% { transform: translateY(-25%); }
  100% { transform: translateY(0%); }
}

/* Section labels */
.section-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--wood-dark);
  margin: 0 0 0.5rem;
  font-weight: 600;
}

/* Style grid */
.style-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
}
@media (max-width: 640px) {
  .style-grid { grid-template-columns: repeat(3, 1fr); }
}
.style-card {
  background: #fff;
  border: 2px solid var(--cream-dark);
  border-radius: 12px;
  padding: 0.8rem 0.4rem;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 5px rgba(0,0,0,0.08);
  color: var(--navy);
}
.style-card:hover:not(:disabled) {
  transform: translateY(-3px);
  border-color: var(--red);
  box-shadow: 0 6px 14px rgba(176,42,36,0.2);
}
.style-card:disabled { opacity: 0.5; cursor: wait; }
.style-card-active {
  border-color: var(--red);
  background: #fff4ec;
  box-shadow: 0 0 0 3px rgba(176,42,36,0.25);
}

/* Before / After slider */
.ba-wrap {
  position: relative;
  aspect-ratio: 1;
  max-width: 420px;
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
  border: 6px solid var(--wood-dark);
  cursor: ew-resize;
  user-select: none;
  touch-action: none;
}
.ba-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ba-after { position: absolute; inset: 0; overflow: hidden; }
.ba-img-clip { max-width: none; }
.ba-wrap .ba-after .ba-img-clip {
  width: 420px; height: 100%;
}
.ba-line {
  position: absolute; top: 0; bottom: 0;
  width: 3px; background: #fff;
  box-shadow: 0 0 6px rgba(0,0,0,0.5);
  transform: translateX(-50%);
}
.ba-handle {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  background: var(--red); color: #fff;
  font-size: 0.6rem; letter-spacing: -1px;
  width: 34px; height: 34px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
}
.ba-label {
  position: absolute; bottom: 8px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.6rem; letter-spacing: 0.1em;
  background: rgba(0,0,0,0.6); color: #fff;
  padding: 2px 7px; border-radius: 4px;
}
.ba-label-l { left: 8px; }
.ba-label-r { right: 8px; }

/* Quip bubble */
.quip-bubble {
  background: #fff;
  border: 2px solid var(--cream-dark);
  border-radius: 14px;
  padding: 0.7rem 1rem;
  font-style: italic;
  font-size: 0.95rem;
  color: var(--wood-dark);
  margin-bottom: 1rem;
  position: relative;
  max-width: 480px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

/* Action buttons */
.act-btn {
  flex: 1 1 auto;
  min-width: 140px;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: transform 0.15s, filter 0.15s;
  color: #fff;
}
.act-btn:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.08); }
.act-btn:disabled { opacity: 0.6; cursor: wait; }
.act-save  { background: var(--navy); }
.act-share { background: var(--wood); }
.act-rate  { background: var(--red); }

/* Verdict */
.verdict-box {
  background: #fff8ec;
  border-left: 5px solid var(--red);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  font-size: 0.95rem;
  margin-bottom: 1.2rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

/* Lookbook */
.lookbook-toggle {
  width: 100%;
  background: var(--wood-dark);
  color: var(--cream);
  padding: 0.8rem;
  border-radius: 12px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}
.lookbook-toggle:hover { background: var(--navy); }
.lookbook-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.7rem;
}
.look-card {
  background: #fff;
  border: 2px solid var(--cream-dark);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

/* Footer */
.site-footer {
  background: var(--wood-dark);
  color: var(--cream-dark);
  text-align: center;
  padding: 1.4rem 1rem;
  font-size: 0.85rem;
  margin-top: 2rem;
}
.footer-link {
  color: var(--cream);
  font-weight: 700;
  text-decoration: underline;
}
.footer-link:hover { color: #fff; }

.hidden { display: none; }