:root {
  --paper: #f4f1ec;
  --ink: #161616;
  --muted: #77736c;
  --hair: #d8d3ca;
  --hatch: #c9c3b8;
  --card: #fbfaf7;
  --serif: "Cormorant Garamond", "Iowan Old Style", "Palatino", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f0f0f;
    --ink: #ece8e1;
    --muted: #8d8981;
    --hair: #2c2b29;
    --hatch: #3a3936;
    --card: #1d1d1c;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { background: var(--paper); }

body {
  -webkit-tap-highlight-color: transparent;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  padding: env(safe-area-inset-top) 20px env(safe-area-inset-bottom);
}

.masthead, main { max-width: 560px; margin: 0 auto; }

button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }

.eyebrow,
.label {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}

/* Masthead */
.masthead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding-block: 28px 18px;
  border-bottom: 1px solid var(--ink);
}
h1 {
  font: 600 2.1rem/1 var(--serif);
  letter-spacing: -0.01em;
  margin: 6px 0 0;
}
.text-btn {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 8px 0;
  border-bottom: 1px solid currentColor;
}

/* The look: color-block composition + list of pieces */
.look {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 22px;
  padding-block: 24px;
  border-bottom: 1px solid var(--hair);
}
.look-art { width: 100%; display: block; }
.block { cursor: pointer; transition: fill 0.35s ease; }
.block.empty { fill: url(#hatch); }
.hatch-line { stroke: var(--hatch); stroke-width: 1.2; }
.blk-jacket.empty { fill: transparent; }

.pieces { list-style: none; margin: 0; padding: 0; }
.piece-row {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--hair);
  text-align: left;
}
.pieces li:last-child .piece-row { border-bottom: 0; }
.piece-name {
  display: flex;
  align-items: center;
  gap: 9px;
  font: 500 1.25rem/1.2 var(--serif);
  margin-top: 2px;
}
.piece-name.placeholder { color: var(--muted); font-style: italic; }
.tile-sm { width: 12px; height: 12px; flex-shrink: 0; box-shadow: inset 0 0 0 1px rgba(128,128,128,.35); }
.piece-action {
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.piece-row.active .label { color: var(--ink); }
.piece-row.active .piece-action { color: var(--ink); border-bottom: 1px solid var(--ink); }

/* Panel */
.panel { padding-block: 28px 190px; scroll-margin-top: 8px; }

/* Floating mini preview */
.mini-look {
  position: fixed;
  right: calc(16px + env(safe-area-inset-right, 0px));
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  width: 104px;
  padding: 12px 14px 9px;
  border-radius: 22px;
  background: var(--card);
  box-shadow: 0 0 0 1px var(--hair), 0 8px 24px rgba(0, 0, 0, 0.22);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.mini-look.shown { opacity: 1; transform: none; pointer-events: auto; }
.mini-look svg { display: block; width: 100%; overflow: visible; }
.mini-look .block { cursor: inherit; }

/* The little outfit, used at the top and in the floating preview */
.outfit { overflow: visible; }
.outfit .block {
  stroke: rgba(128, 128, 128, 0.35);
  stroke-width: 1.5;
  stroke-linejoin: round;
}
.outfit .blk-jacket.empty { stroke: none; }
.outfit .hanger {
  fill: none;
  stroke: var(--muted);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.mini-cap {
  display: block;
  margin-top: 6px;
  font-size: 0.54rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  white-space: nowrap;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
}
/* Whenever a color is picked the outfit swings on its hanger and a sparkle twinkles */
.outfit .swing { transform-box: view-box; transform-origin: 60px -14px; }
.pop .swing { animation: mini-swing 0.9s ease-out; }
@keyframes mini-swing {
  0% { transform: rotate(0); }
  20% { transform: rotate(-9deg); }
  45% { transform: rotate(6deg); }
  70% { transform: rotate(-3deg); }
  88% { transform: rotate(1deg); }
  100% { transform: rotate(0); }
}
.sparkle {
  position: absolute;
  top: 6px;
  right: 9px;
  font-size: 0.9rem;
  line-height: 1;
  color: #d0a23a;
  opacity: 0;
  pointer-events: none;
}
.mini-look.pop .sparkle { animation: sparkle 0.9s ease-out; }
@keyframes sparkle {
  0% { opacity: 0; transform: scale(0.3) rotate(0); }
  30% { opacity: 1; transform: scale(1.2) rotate(30deg); }
  100% { opacity: 0; transform: scale(0.6) rotate(90deg); }
}
.panel h2 {
  font: 500 1.75rem/1.15 var(--serif);
  margin: 8px 0 6px;
  letter-spacing: -0.005em;
}
.panel h2 em { font-style: italic; }
.lede { color: var(--muted); margin: 0 0 24px; }

.start-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.start-list button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 18px 2px;
  border-bottom: 1px solid var(--hair);
  font: 500 1.5rem/1 var(--serif);
}
.start-list button span { font: 400 1rem var(--sans); color: var(--muted); transition: transform 0.2s; }
.start-list button:hover span { transform: translateX(4px); color: var(--ink); }

.group-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 26px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--hair);
}
.group-head:first-of-type { margin-top: 22px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 18px 12px;
}
.swatch {
  display: flex;
  flex-direction: column;
  gap: 7px;
  text-align: left;
}
.tile {
  width: 100%;
  aspect-ratio: 1;
  box-shadow: inset 0 0 0 1px rgba(128,128,128,.25);
  background-image: linear-gradient(135deg, rgba(255,255,255,.08), rgba(0,0,0,.05));
  transition: transform 0.15s ease;
}
.swatch:active .tile { transform: scale(0.96); }
.swatch.current .tile { outline: 1px solid var(--ink); outline-offset: 3px; }
.swatch .name { font-size: 0.8rem; line-height: 1.2; }

/* Verdict */
.verdict { padding-top: 2px; }
.verdict p.tip {
  font: italic 500 1.35rem/1.35 var(--serif);
  margin: 10px 0 0;
}
.combo { display: flex; margin: 22px 0 6px; height: 64px; }
.combo div { flex: 1; box-shadow: inset 0 0 0 1px rgba(128,128,128,.2); }
.combo-names { display: flex; }
.combo-names span { flex: 1; font-size: 0.75rem; color: var(--muted); padding-top: 6px; }

.empty-note { font: italic 500 1.2rem var(--serif); color: var(--muted); }

.btn {
  display: block;
  width: 100%;
  margin-top: 28px;
  padding: 16px;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.btn.ghost { background: none; color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
