:root {
  color-scheme: light;
  --ink: #2f2a3d;
  --muted: #776f84;
  --panel: rgba(255, 255, 255, 0.84);
  --line: rgba(92, 71, 105, 0.16);
  --pink: #ff7fa8;
  --mint: #70cfb8;
  --sky: #72aef8;
  --lemon: #ffe28b;
  --shadow: 0 24px 70px rgba(71, 49, 86, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 12%, rgba(255, 226, 139, 0.55), transparent 28%),
    radial-gradient(circle at 90% 18%, rgba(112, 207, 184, 0.45), transparent 24%),
    linear-gradient(135deg, #fff4f9 0%, #eef9ff 48%, #fff9dc 100%);
}

button {
  font: inherit;
}

button:focus-visible {
  outline: 3px solid #7d63e8;
  outline-offset: 3px;
}

.app-shell {
  width: min(1240px, calc(100vw - 32px));
  min-height: calc(100vh - 32px);
  margin: 16px auto;
  display: grid;
  grid-template-columns: minmax(430px, 1fr) 430px;
  gap: 18px;
  align-items: stretch;
}

.stage-panel,
.wardrobe-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.stage-panel {
  min-height: 660px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.brand-row {
  min-height: 86px;
  padding: 22px 28px 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow,
.section-kicker {
  margin: 0;
  color: var(--pink);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 4px 0 0;
  font-size: clamp(32px, 4vw, 52px);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin: 3px 0 0;
  font-size: 21px;
  line-height: 1.15;
}

.look-name {
  flex: 0 0 auto;
  margin-top: 8px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 127, 168, 0.28);
  border-radius: 999px;
  background: #fff;
  color: #b84f73;
  font-size: 14px;
  font-weight: 800;
}

.stage-wrap {
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 0 24px 24px;
}

.avatar-svg {
  width: min(100%, 590px);
  height: min(74vh, 700px);
  min-height: 520px;
  display: block;
}

.wardrobe-panel {
  padding: 18px;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  gap: 14px;
}

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

.mini-actions {
  grid-template-columns: 1fr 1fr;
}

.tool-button,
.tab-button,
.item-card,
.small-button,
.favorite-chip {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.tool-button,
.tab-button,
.small-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 900;
}

.tool-button.primary {
  border-color: rgba(255, 127, 168, 0.4);
  background: #ffeff5;
  color: #9f365e;
}

.tool-button:hover,
.tab-button:hover,
.item-card:hover,
.small-button:hover,
.favorite-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(77, 54, 88, 0.12);
}

.challenge-panel,
.favorites-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.64);
  padding: 12px;
}

.challenge-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.challenge-copy,
.mini-actions,
.action-status,
.score-meter {
  grid-column: 1 / -1;
}

.challenge-copy {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.score-badge {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff3c7;
  color: #8b5a00;
  font-size: 22px;
  font-weight: 1000;
  border: 1px solid rgba(255, 193, 71, 0.48);
}

.score-meter {
  height: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: #f1e7bd;
}

.score-meter div {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff9dbb, #ffcf67, #70cfb8);
  transition: width 220ms ease;
}

.action-status {
  min-height: 18px;
  margin: 0;
  color: #9f365e;
  font-size: 12px;
  font-weight: 800;
}

.small-button {
  min-height: 38px;
  color: #625a70;
}

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

.tab-button {
  min-height: 40px;
  color: var(--muted);
}

.tab-button.active {
  border-color: rgba(114, 174, 248, 0.55);
  background: #edf6ff;
  color: #2c67a9;
}

.item-grid {
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 2px 2px 8px;
}

.item-card {
  min-height: 118px;
  padding: 10px;
  display: grid;
  grid-template-rows: 72px auto;
  gap: 8px;
  text-align: left;
}

.item-card.active {
  border-color: rgba(255, 127, 168, 0.7);
  background: #fff4f8;
  box-shadow: inset 0 0 0 2px rgba(255, 127, 168, 0.16);
}

.item-card[aria-pressed="true"] .item-name::after {
  content: "  ✓";
  color: #d44979;
}

.swatch-preview {
  border-radius: 8px;
  border: 1px solid rgba(73, 54, 86, 0.1);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.74), rgba(255, 255, 255, 0.28)),
    var(--preview);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.mini-shape {
  width: 44px;
  height: 44px;
  border-radius: var(--shape-radius, 14px);
  background: var(--accent);
  box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.08);
}

.item-name {
  min-width: 0;
  font-size: 14px;
  font-weight: 900;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.favorites-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.favorite-list {
  min-height: 38px;
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.favorite-chip {
  min-height: 34px;
  padding: 0 10px;
  color: #624b73;
  font-size: 13px;
  font-weight: 900;
}

.empty-favorites {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 940px) {
  .app-shell {
    width: min(100vw - 20px, 660px);
    margin: 10px auto;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(520px, 58vh) auto;
  }

  .stage-panel {
    min-height: 520px;
  }

  .brand-row {
    min-height: 76px;
    padding: 18px 18px 8px;
  }

  .stage-wrap {
    padding: 0 10px 12px;
  }

  .avatar-svg {
    height: 100%;
    min-height: 420px;
  }

  .wardrobe-panel {
    padding: 12px;
  }

  .category-tabs {
    grid-template-columns: repeat(7, minmax(56px, 1fr));
    overflow-x: auto;
  }

  .tab-button {
    min-width: 58px;
    padding: 0 8px;
  }

  .item-grid {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    grid-auto-flow: column;
    grid-auto-columns: minmax(120px, 1fr);
    overflow-x: auto;
    overflow-y: hidden;
  }
}

@media (max-width: 520px) {
  .app-shell {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    gap: 0;
  }

  .stage-panel,
  .wardrobe-panel {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .look-name {
    display: none;
  }

  h1 {
    font-size: 32px;
  }

  .toolbar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .tool-button {
    min-height: 42px;
  }

  .challenge-panel {
    padding: 11px;
  }

  .tool-button span:last-child,
  .tab-button span:last-child {
    font-size: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
