:root {
  color-scheme: dark;
  --ink: #f6f8fb;
  --muted: #9da7b7;
  --line: rgba(173, 226, 255, 0.18);
  --line-strong: rgba(73, 224, 255, 0.42);
  --paper: #07090d;
  --panel: rgba(15, 19, 28, 0.82);
  --accent: #49e0ff;
  --accent-2: #ff4fad;
  --accent-3: #f7c95f;
  --accent-ink: #061016;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(73, 224, 255, 0.13), transparent 28%),
    linear-gradient(225deg, rgba(255, 79, 173, 0.11), transparent 32%),
    linear-gradient(180deg, #10131a 0%, #07090d 52%, #050608 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.78), transparent 88%);
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.studio {
  min-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 2px 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 900px;
  margin-bottom: 0;
  font-size: clamp(2.4rem, 5.7vw, 5.9rem);
  line-height: 0.88;
  letter-spacing: 0;
  text-transform: uppercase;
  text-wrap: balance;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.tagline {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  letter-spacing: 0.015em;
}

.status-pill {
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 10px 16px;
  color: #c7f7ff;
  background: rgba(5, 13, 18, 0.78);
  box-shadow: 0 0 28px rgba(73, 224, 255, 0.16), inset 0 0 18px rgba(73, 224, 255, 0.06);
  font-size: 0.88rem;
}

.workspace {
  display: block;
  flex: 1;
  min-height: 0;
}

.app-page[hidden] {
  display: none;
}

.app-page {
  min-height: 0;
}

.profile-page {
  display: grid;
  align-items: start;
  justify-items: center;
}

.profile-panel {
  width: min(980px, 100%);
  min-height: 420px;
}

.scan-page {
  display: grid;
  min-height: calc(100vh - 210px);
}

.results-page {
  display: grid;
}

.capture-panel,
.insights-panel {
  position: relative;
  background: linear-gradient(180deg, rgba(20, 25, 36, 0.9), rgba(9, 12, 18, 0.9));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.capture-panel::before,
.insights-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(120deg, rgba(73, 224, 255, 0.16), transparent 22%, transparent 74%, rgba(255, 79, 173, 0.12));
  opacity: 0.75;
}

.capture-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
  min-height: calc(100vh - 220px);
}

.capture-panel.locked .media-frame {
  filter: grayscale(0.35);
}

.capture-panel.locked .capture-actions,
.capture-panel.locked .tone-strip {
  opacity: 0.42;
  pointer-events: none;
}

.panel-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 34px;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.panel-head strong {
  color: var(--ink);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
}

.media-frame {
  position: relative;
  z-index: 1;
  min-height: 0;
  flex: 1;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(circle at 50% 38%, rgba(73, 224, 255, 0.22), transparent 28%),
    linear-gradient(145deg, #121824, #06080d 62%);
  aspect-ratio: 4 / 3;
}

.media-frame video,
.media-frame img {
  width: 100%;
  height: 100%;
  min-height: 455px;
  display: block;
}

.media-frame video {
  object-fit: cover;
  transform: scaleX(-1);
  filter: none;
  background: #05070b;
}

.media-frame img {
  object-fit: cover;
  filter: saturate(1.02) contrast(1.02);
}

#preview[src=""] {
  display: none;
}

.scan-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(73, 224, 255, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(73, 224, 255, 0.09) 1px, transparent 1px),
    linear-gradient(transparent 0 46%, rgba(73, 224, 255, 0.2) 48%, transparent 52%);
  background-size: 36px 36px, 36px 36px, 100% 180px;
  mix-blend-mode: screen;
  opacity: 0.24;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--ink);
  font-size: 1.2rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.quality-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(1, 5, 10, 0.72);
  backdrop-filter: blur(14px);
}

.quality-modal[hidden] {
  display: none;
}

.location-gate {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(1, 5, 10, 0.92);
  backdrop-filter: blur(18px);
}

.location-gate[hidden] {
  display: none;
}

.location-card {
  width: min(480px, 100%);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 32px 28px;
  background:
    linear-gradient(135deg, rgba(247, 201, 95, 0.1), transparent 46%),
    rgba(12, 16, 24, 0.98);
  box-shadow: var(--shadow), 0 0 60px rgba(247, 201, 95, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
}

.location-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 1px solid rgba(247, 201, 95, 0.5);
  background: radial-gradient(circle at 50% 40%, rgba(247, 201, 95, 0.18), transparent 70%);
  box-shadow: 0 0 36px rgba(247, 201, 95, 0.2);
  position: relative;
  flex-shrink: 0;
}

.location-icon::before {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -60%);
  width: 22px; height: 28px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  border: 2px solid #f7c95f;
  box-shadow: 0 0 12px rgba(247, 201, 95, 0.5);
}

.location-icon::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, 4px);
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #f7c95f;
  box-shadow: 0 0 8px rgba(247, 201, 95, 0.8);
}

.location-card .eyebrow {
  color: var(--accent-3);
}

.location-card h2 {
  margin: 0;
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  text-transform: uppercase;
  letter-spacing: 0;
  line-height: 1.1;
}

.location-card p:not(.eyebrow) {
  margin: 0;
  color: #c9d0da;
  line-height: 1.6;
  font-size: 0.95rem;
}

.location-card .button.primary {
  width: 100%;
  min-height: 52px;
  font-size: 0.95rem;
  background: linear-gradient(135deg, var(--accent-3), #ffe87a);
  border-color: rgba(247, 201, 95, 0.9);
  color: #1a1200;
  box-shadow: 0 0 30px rgba(247, 201, 95, 0.22);
}

.location-skip {
  background: none;
  border: none;
  color: #4a5260;
  font-size: 0.76rem;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: #2a303a;
  padding: 4px;
  line-height: 1.4;
}

.location-skip:hover {
  color: #6a7380;
}

.quality-card {
  width: min(520px, 100%);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 22px;
  background:
    linear-gradient(135deg, rgba(73, 224, 255, 0.12), transparent 46%),
    rgba(12, 16, 24, 0.96);
  box-shadow: var(--shadow), 0 0 40px rgba(73, 224, 255, 0.16);
}

.quality-card h2 {
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.quality-card p:not(.eyebrow) {
  color: #c9d0da;
  line-height: 1.55;
}

.lens-icon {
  width: 92px;
  height: 92px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  position: relative;
  box-shadow: 0 0 36px rgba(73, 224, 255, 0.22), inset 0 0 30px rgba(73, 224, 255, 0.12);
}

.lens-icon::before,
.lens-icon::after {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(255, 79, 173, 0.75);
  border-radius: 50%;
}

.lens-icon::after {
  inset: 42px -18px auto auto;
  width: 40px;
  height: 1px;
  border: 0;
  transform: rotate(45deg);
  background: var(--accent-2);
  box-shadow: 0 0 14px rgba(255, 79, 173, 0.7);
}

.face-box {
  position: absolute;
  border: 1px solid #ffffff;
  outline: 2px solid var(--accent);
  border-radius: 6px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.36), 0 0 28px rgba(73, 224, 255, 0.55);
  pointer-events: none;
}

.capture-actions {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 0.7fr 1fr 1fr 52px;
  gap: 10px;
}

.button,
.icon-button {
  border: 1px solid var(--line);
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.button:hover,
.icon-button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: rgba(73, 224, 255, 0.09);
}

.button.primary {
  background: linear-gradient(135deg, var(--accent), #a8f3ff);
  border-color: rgba(168, 243, 255, 0.9);
  color: var(--accent-ink);
  box-shadow: 0 0 30px rgba(73, 224, 255, 0.22);
}

.icon-button {
  color: var(--accent);
  font-size: 1.55rem;
}

.icon-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.tone-strip {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  min-height: 42px;
}

.tone-chip {
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  min-height: 42px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
}

.insights-panel {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
}

.analysis-grid,
.occasion-row,
.recommendation,
.flow-panel,
.palette-section,
.outfit-section,
.internet-section,
.accessory-section {
  position: relative;
  z-index: 1;
}

.analysis-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.045);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.metric span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metric strong {
  display: block;
  color: #ffffff;
  font-size: clamp(1.08rem, 2.4vw, 1.55rem);
  line-height: 1.05;
}

.metric-depth    { border-top: 2px solid var(--accent-3); }
.metric-undertone { border-top: 2px solid var(--accent); }
.metric-contrast  { border-top: 2px solid var(--accent-2); }

.profile-intro {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.65;
  padding-bottom: 6px;
}

.flow-panel {
  display: grid;
  gap: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 18px;
  background: rgba(0, 0, 0, 0.22);
}

@keyframes page-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.app-page:not([hidden]) {
  animation: page-in 220ms ease both;
}

.flow-step {
  display: grid;
  gap: 10px;
}

.flow-step.locked {
  opacity: 0.5;
  pointer-events: none;
}

.step-label {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.step-label span {
  display: inline-grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--accent);
}

.step-label strong {
  color: #ffffff;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.choice-grid.two {
  grid-template-columns: repeat(2, 1fr);
}

.choice-card {
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.045);
  color: #ffffff;
  cursor: pointer;
  text-align: left;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.choice-card span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.45;
  text-transform: none;
  letter-spacing: 0;
}

.choice-card.selected {
  border-color: var(--accent);
  background: rgba(73, 224, 255, 0.13);
  box-shadow: 0 0 24px rgba(73, 224, 255, 0.14);
}

.occasion-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.24);
}

.segment {
  border: 1px solid transparent;
  border-radius: 6px;
  min-height: 42px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.segment.active {
  color: #080b10;
  border-color: rgba(247, 201, 95, 0.9);
  background: linear-gradient(135deg, var(--accent-3), #fff0a8);
  box-shadow: 0 0 24px rgba(247, 201, 95, 0.16);
}

.recommendation {
  border: 1px solid rgba(73, 224, 255, 0.28);
  border-radius: 8px;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(73, 224, 255, 0.12), transparent 48%),
    linear-gradient(225deg, rgba(255, 79, 173, 0.1), transparent 54%),
    rgba(3, 8, 13, 0.78);
  color: #fff;
}

.recommendation .eyebrow {
  color: var(--accent-3);
}

.recommendation h2 {
  margin-bottom: 8px;
  font-size: clamp(1.38rem, 3vw, 2.1rem);
  letter-spacing: 0;
  text-transform: uppercase;
}

.recommendation p:last-child {
  margin-bottom: 0;
  color: #c9d0da;
  line-height: 1.58;
}

.palette-section,
.outfit-section,
.internet-section,
.accessory-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.section-head h2 {
  margin: 0;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.section-head span {
  color: var(--muted);
  font-size: 0.88rem;
}

.palette-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.palette-card {
  min-height: 148px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: inherit;
  cursor: pointer;
  padding: 0;
  text-align: left;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.palette-card:hover,
.palette-card.selected {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 0 28px rgba(73, 224, 255, 0.15);
}

.swatches {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  min-height: 92px;
}

.palette-card strong {
  display: block;
  padding: 11px 12px 2px;
  color: #ffffff;
  font-size: 0.96rem;
}

.palette-card span {
  display: block;
  padding: 0 12px 11px;
  color: var(--muted);
  font-size: 0.82rem;
}

.outfit-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.outfit-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  padding: 14px;
  display: grid;
  gap: 10px;
  min-height: 150px;
  color: inherit;
  text-align: left;
}

button.outfit-card {
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

button.outfit-card:hover,
.outfit-card.selected {
  transform: translateY(-2px);
  border-color: var(--accent-3);
  box-shadow: 0 0 26px rgba(247, 201, 95, 0.14);
}

.muted-card {
  min-height: 96px;
  opacity: 0.76;
}

.outfit-card h3 {
  margin: 0;
  color: #ffffff;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.outfit-card p {
  margin-bottom: 0;
  color: #aeb7c5;
  line-height: 1.45;
}

.fabric-row {
  display: flex;
  gap: 6px;
}

.fabric-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.24);
  box-shadow: 0 0 14px rgba(0, 0, 0, 0.26);
}

.internet-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.accessory-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.face-shape-grid {
  grid-template-columns: repeat(5, 1fr);
}

.internet-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.internet-card > div,
.placeholder-card {
  display: grid;
  gap: 8px;
  padding: 16px;
}

.exact-color-row {
  display: flex;
  gap: 6px;
  padding: 0;
}

.internet-card strong {
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.internet-card span {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.outfit-formula,
.fit-guidance {
  margin: 2px 0 0;
  color: #ffffff;
  font-size: 0.88rem;
  line-height: 1.42;
}

.fit-guidance {
  color: #aeb7c5;
}

.internet-card a {
  width: fit-content;
  margin-top: 4px;
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 800;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}


@media (max-width: 980px) {
  .capture-panel {
    min-height: auto;
  }

  .media-frame video,
  .media-frame img {
    min-height: 390px;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 14px;
  }

  .studio {
    min-height: calc(100vh - 28px);
    gap: 14px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .status-pill {
    width: 100%;
    text-align: center;
  }

  .analysis-grid,
  .palette-grid,
  .internet-grid,
  .accessory-grid {
    grid-template-columns: 1fr;
  }

  .outfit-list {
    grid-template-columns: 1fr;
  }

  .occasion-row,
  .choice-grid,
  .choice-grid.two,
  .face-shape-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .capture-actions {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
  }

  .capture-actions #backToProfile {
    grid-column: 1;
  }

  .capture-actions #cameraButton {
    grid-column: 2;
    grid-row: 1;
  }

  .capture-actions label[for="photoInput"] {
    grid-column: 1;
    grid-row: 2;
  }

  .capture-actions #snapButton {
    grid-column: 2;
    grid-row: 2;
  }
}
