/* ============================================================
   Look Generator — styles
   ============================================================ */

:root {
  --bg-1: #ffe7f1;
  --bg-2: #ffd9c7;
  --bg-3: #e7d9ff;
  --bg-4: #d9f0ff;

  --ink: #2c2336;
  --ink-soft: #6b6275;
  --card: rgba(255, 255, 255, 0.72);
  --card-solid: #ffffff;
  --line: rgba(44, 35, 54, 0.10);

  --accent: #d6336c;
  --accent-2: #f97316;
  --accent-grad: linear-gradient(120deg, #ff6ba6 0%, #ff8c5a 55%, #ffb347 100%);

  --radius: 22px;
  --radius-sm: 13px;
  --shadow: 0 18px 50px -18px rgba(90, 40, 90, 0.45);
  --shadow-soft: 0 8px 24px -12px rgba(90, 40, 90, 0.35);

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: linear-gradient(135deg, var(--bg-1), var(--bg-2), var(--bg-3), var(--bg-4));
  background-size: 300% 300%;
  animation: drift 24s ease infinite;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 16px 8px;
  -webkit-font-smoothing: antialiased;
}

@keyframes drift {
  0%   { background-position: 0% 30%; }
  50%  { background-position: 100% 70%; }
  100% { background-position: 0% 30%; }
}

@media (prefers-reduced-motion: reduce) {
  body { animation: none; }
  * { animation-duration: 0.001ms !important; }
}

/* ---- decorative sparkles ---- */
.sparkle-field {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.sparkle-field .spark {
  position: absolute;
  font-size: var(--s, 16px);
  opacity: 0;
  animation: floatUp var(--dur, 9s) linear infinite;
  animation-delay: var(--delay, 0s);
  will-change: transform, opacity;
}
@keyframes floatUp {
  0%   { transform: translateY(20px) scale(0.6) rotate(0deg); opacity: 0; }
  15%  { opacity: 0.9; }
  85%  { opacity: 0.7; }
  100% { transform: translateY(-110vh) scale(1.1) rotate(220deg); opacity: 0; }
}

/* ---- app shell ---- */
.app {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 920px;
  background: var(--card);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 24px 30px;
}

/* keep the top controls tidy and centered even though the shell is now wide */
.app__header, .tabs, .chips, .actions, .brands, .ai { max-width: 560px; margin-left: auto; margin-right: auto; }

.app__header { text-align: center; margin-bottom: 18px; }
.app__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.1rem, 7vw, 3rem);
  line-height: 1.02;
  margin: 0;
  background: linear-gradient(115deg, #d6336c, #f9731c 70%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.01em;
}
.app__subtitle {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 0.98rem;
}

/* ---- tabs ---- */
.tabs {
  display: flex;
  gap: 6px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px;
  margin: 18px auto 18px;
}
.tab {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 9px 6px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.1s ease;
  white-space: nowrap;
}
.tab__icon { margin-right: 2px; }
.tab:hover { color: var(--ink); }
.tab:active { transform: scale(0.97); }
.tab.is-active {
  background: var(--card-solid);
  color: var(--accent);
  box-shadow: var(--shadow-soft);
}

/* ---- choice chips ---- */
.chips__prompt {
  text-align: center;
  margin: 0 0 12px;
  font-weight: 600;
  color: var(--ink);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 9px;
  margin-bottom: 22px;
}
.chip {
  border: 1.5px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  padding: 9px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.chip:hover { transform: translateY(-2px); border-color: rgba(214, 51, 108, 0.4); }
.chip:active { transform: translateY(0) scale(0.97); }
.chip.is-selected {
  background: var(--accent-grad);
  color: #fff;
  border-color: transparent;
  box-shadow: var(--shadow-soft);
}
.chip__swatch {
  width: 13px; height: 13px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.12);
  display: inline-block;
}

/* ---- actions ---- */
.actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.btn {
  font-family: inherit;
  font-weight: 600;
  border: 0;
  cursor: pointer;
  border-radius: 999px;
  transition: transform 0.12s ease, box-shadow 0.18s ease, background 0.18s ease, opacity 0.18s ease;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.btn:active { transform: scale(0.96); }
.btn--primary {
  background: var(--accent-grad);
  color: #fff;
  font-size: 1.06rem;
  padding: 14px 30px;
  box-shadow: 0 12px 26px -10px rgba(214, 51, 108, 0.7);
}
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 18px 34px -12px rgba(214, 51, 108, 0.75); }
.btn--primary.is-busy { pointer-events: none; opacity: 0.85; }
.btn__spark { display: inline-block; }
.btn--primary.is-busy .btn__spark { animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn--ghost {
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  border: 1.5px solid var(--line);
  padding: 13px 20px;
  font-size: 0.95rem;
}
.btn--ghost:hover { transform: translateY(-2px); border-color: rgba(214, 51, 108, 0.4); }

.btn--small {
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
  border: 1.5px solid var(--line);
  padding: 9px 15px;
  font-size: 0.86rem;
}
.btn--small:hover { border-color: rgba(214, 51, 108, 0.4); background: #fff; }

/* ---- result card ---- */
.result { margin-top: 26px; }
.result__card {
  background: var(--card-solid);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  padding: 24px 22px;
  position: relative;
  overflow: hidden;
}
.result__card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 6px;
  background: var(--accent-grad);
}
.result.reveal .result__card { animation: pop 0.5s cubic-bezier(.18,.89,.32,1.28); }
@keyframes pop {
  0%   { transform: scale(0.92) translateY(14px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.result__topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.result__context {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.result__vibe-tag {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(214, 51, 108, 0.1);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.result__name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.7rem, 6vw, 2.3rem);
  margin: 2px 0 16px;
  line-height: 1.05;
  color: var(--ink);
}

/* ---- palette ---- */
.palette {
  display: flex;
  gap: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  height: 46px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-soft);
}
.palette__swatch {
  flex: 1;
  position: relative;
  transition: flex 0.2s ease;
  cursor: default;
}
.palette__swatch:hover { flex: 1.6; }
.palette__swatch::after {
  content: attr(data-hex);
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.62rem;
  font-weight: 600;
  color: rgba(255,255,255,0.95);
  text-shadow: 0 1px 2px rgba(0,0,0,0.45);
  opacity: 0;
  transition: opacity 0.18s ease;
  white-space: nowrap;
  pointer-events: none;
}
.palette__swatch:hover::after { opacity: 1; }

/* ---- look breakdown ---- */
.look { list-style: none; margin: 0 0 16px; padding: 0; }
.look__row {
  display: grid;
  grid-template-columns: 26px 56px 1fr;
  align-items: baseline;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
}
.look__row:last-child { border-bottom: 0; }
.look__icon { font-size: 1.05rem; }
.look__label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.look__text { font-size: 0.96rem; line-height: 1.4; }

.look__tip {
  background: linear-gradient(120deg, rgba(255,179,71,0.16), rgba(255,107,166,0.14));
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin: 0 0 14px;
  font-size: 0.92rem;
  line-height: 1.45;
}
.look__tip::before { content: "💡 "; }
.look__vibe-line {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.08rem;
  text-align: center;
  color: var(--accent);
  margin: 4px 0 18px;
}

.result__actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---- saved ---- */
.saved { margin-top: 24px; }
.saved__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.saved__count {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  padding: 2px 9px;
  min-width: 22px;
  text-align: center;
}
.saved__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.saved__item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255,255,255,0.8);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  animation: pop 0.35s ease;
}
.saved__item .mini-palette {
  display: flex;
  border-radius: 6px;
  overflow: hidden;
  width: 56px;
  height: 22px;
  flex: 0 0 auto;
  box-shadow: var(--shadow-soft);
}
.saved__item .mini-palette span { flex: 1; }
.saved__item-body { flex: 1; min-width: 0; }
.saved__item-name { font-weight: 600; font-size: 0.95rem; }
.saved__item-meta { font-size: 0.78rem; color: var(--ink-soft); }
.saved__remove {
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 1rem;
  color: var(--ink-soft);
  padding: 4px;
  border-radius: 8px;
  flex: 0 0 auto;
}
.saved__remove:hover { color: var(--accent); background: rgba(214,51,108,0.1); }

/* ---- footer ---- */
.app__footer {
  position: relative;
  z-index: 1;
  margin-top: 18px;
  font-size: 0.78rem;
  color: var(--ink-soft);
  text-align: center;
  opacity: 0.85;
}

/* ---- toast ---- */
.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 50;
}
.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---- brand selector (shopping preferences) ---- */
.brands {
  margin-top: 16px;
  text-align: center;
}
.brands__summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ink);
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
  transition: border-color 0.18s ease;
}
.brands__summary::-webkit-details-marker { display: none; }
.brands__summary:hover { border-color: rgba(214, 51, 108, 0.4); }
.brands__hint { color: var(--ink-soft); font-weight: 500; font-size: 0.85rem; }
.brands__chips { margin-top: 14px; margin-bottom: 4px; }
.chip__tier {
  font-size: 0.7rem;
  font-weight: 700;
  opacity: 0.55;
  margin-left: 1px;
}
.chip.is-selected .chip__tier { opacity: 0.85; }

/* ---- result two-column grid ---- */
.result__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
  margin-bottom: 18px;
}
@media (min-width: 720px) {
  .result__grid { grid-template-columns: minmax(0, 1.04fr) minmax(0, 0.96fr); align-items: start; }
}
.result__left, .result__right { min-width: 0; }

/* ---- face preview ("the look on a face") ---- */
.face {
  margin: 0 0 16px;
  background: linear-gradient(160deg, #fff6fb, #f3ecff);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 14px 12px;
  text-align: center;
}
.face__preview { width: 100%; max-width: 210px; margin: 0 auto; }
.face__preview svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 8px 18px rgba(90, 40, 90, 0.18)); }
.face__tones { margin: 12px 0 0; }
.face__tones-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 7px;
}
.tones { display: flex; gap: 8px; justify-content: center; }
.tone {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 1px var(--line);
  cursor: pointer;
  padding: 0;
  transition: transform 0.12s ease, box-shadow 0.15s ease;
}
.tone:hover { transform: scale(1.12); }
.tone.is-selected { box-shadow: 0 0 0 2px var(--accent); transform: scale(1.1); }

/* ---- tutorial card ---- */
.tutorial {
  display: flex;
  gap: 12px;
  align-items: center;
  text-decoration: none;
  color: inherit;
  background: var(--card-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-soft);
  transition: transform 0.14s ease, box-shadow 0.18s ease;
}
.tutorial:hover { transform: translateY(-2px); box-shadow: 0 14px 28px -14px rgba(90, 40, 90, 0.4); }
.tutorial__thumb {
  flex: 0 0 auto;
  width: 74px; height: 56px;
  border-radius: 10px;
  background: linear-gradient(135deg, #ff6ba6, #ff8c5a 70%);
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.tutorial__play {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem;
  padding-left: 2px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.18);
}
.tutorial__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tutorial__label { font-weight: 700; font-size: 0.95rem; }
.tutorial__query {
  font-size: 0.85rem; color: var(--ink-soft);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tutorial__cta { font-size: 0.78rem; font-weight: 600; color: var(--accent); }

/* ---- shopping kit ---- */
.kit__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  margin: 0 0 10px;
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
}
.kit__brandnote { font-family: var(--font-body); font-size: 0.76rem; color: var(--ink-soft); font-weight: 500; }
.kit__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.kit__item {
  display: flex;
  gap: 11px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
}
.kit__icon { font-size: 1.1rem; line-height: 1.4; flex: 0 0 auto; }
.kit__body { min-width: 0; flex: 1; }
.kit__product { font-size: 0.95rem; }
.kit__product strong { font-weight: 600; }
.kit__area {
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--accent); background: rgba(214, 51, 108, 0.1);
  padding: 2px 7px; border-radius: 999px; margin-left: 4px; vertical-align: 1px;
}
.kit__shade { font-size: 0.82rem; color: var(--ink-soft); margin-top: 2px; }
.kit__shops { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.kit__shop {
  font-size: 0.78rem; font-weight: 600;
  text-decoration: none;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 4px 11px;
  transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
  white-space: nowrap;
}
.kit__shop:hover { border-color: var(--accent); color: var(--accent); background: rgba(214, 51, 108, 0.06); }
.kit__shop--all { background: var(--accent-grad); color: #fff; border-color: transparent; }
.kit__shop--all:hover { color: #fff; opacity: 0.92; }

/* ---- clickable saved rows ---- */
.saved__open {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  border: 0;
  background: transparent;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  padding: 2px;
  border-radius: 10px;
  transition: background 0.15s ease;
}
.saved__open:hover { background: rgba(214, 51, 108, 0.07); }
.saved__open:active { transform: scale(0.99); }

/* ---- AI stylist panel ---- */
.ai { margin-top: 12px; text-align: center; }
.ai__summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ink);
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: linear-gradient(120deg, rgba(255,107,166,0.10), rgba(255,179,71,0.10));
  transition: border-color 0.18s ease;
}
.ai__summary::-webkit-details-marker { display: none; }
.ai__summary:hover { border-color: rgba(214, 51, 108, 0.4); }
.ai__hint { color: var(--ink-soft); font-weight: 500; font-size: 0.85rem; }
.ai__body {
  margin-top: 14px;
  text-align: left;
  background: var(--card-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
  box-shadow: var(--shadow-soft);
}
.ai__label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 6px;
}
.ai__input {
  width: 100%;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.ai__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(214, 51, 108, 0.12);
}
.ai__textarea { resize: vertical; min-height: 64px; line-height: 1.4; }
.ai__note {
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin: -4px 0 14px;
  line-height: 1.45;
}
.ai__note a { color: var(--accent); font-weight: 600; }
.ai__actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ai__status { font-size: 0.85rem; font-weight: 500; color: var(--ink-soft); }
.ai__status.is-error { color: #c0392b; }
.ai__status.is-ok { color: #1e7d4f; }
.ai__status.is-loading { color: var(--accent); }

@media (max-width: 480px) {
  .app { padding: 22px 16px 26px; }
  .look__row { grid-template-columns: 24px 1fr; }
  .look__label { grid-column: 2; }
  .look__text { grid-column: 1 / -1; padding-left: 34px; }
  .btn--primary { width: 100%; justify-content: center; }
  .ai__actions .btn--primary { width: 100%; }
}
