:root {
  color-scheme: light;
  --bg-1: #f5ead7;
  --bg-2: #d98f53;
  --panel: rgba(255, 248, 239, 0.82);
  --panel-strong: rgba(255, 251, 245, 0.94);
  --line: rgba(102, 60, 28, 0.16);
  --text: #3f2616;
  --muted: #7d5a45;
  --accent: #b74c2a;
  --accent-2: #1b8d8a;
  --gold: #c99b33;
  --shadow: 0 24px 70px rgba(88, 42, 16, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Outfit", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 247, 223, 0.95), transparent 28%),
    radial-gradient(circle at 85% 18%, rgba(255, 209, 132, 0.45), transparent 20%),
    linear-gradient(135deg, var(--bg-1), var(--bg-2));
}

button {
  font: inherit;
}

.page-shell {
  width: min(1260px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 40px;
}

.hero {
  margin-bottom: 24px;
}

.eyebrow,
.panel-label {
  margin: 0 0 8px;
  color: var(--accent);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.76rem;
  font-weight: 700;
}

.hero h1,
.stage-topbar h2,
.wardrobe-header h2 {
  margin: 0;
  font-family: "Noto Serif SC", serif;
}

.hero h1 {
  font-size: clamp(2.4rem, 4vw, 4.6rem);
  line-height: 1.08;
}

.hero-copy,
.wardrobe-copy {
  max-width: 720px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

.studio-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1.05fr) minmax(280px, 0.95fr);
  gap: 24px;
}

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

.stage-card {
  padding: 24px;
}

.wardrobe-card {
  padding: 24px 20px;
}

.stage-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.reset-button {
  padding: 12px 16px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #9f3b21, #db7a3d);
  color: #fff7ef;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(159, 59, 33, 0.24);
}

.stage-area {
  position: relative;
  overflow: hidden;
  min-height: 640px;
  margin-top: 18px;
  border-radius: 28px;
  background:
    radial-gradient(circle at 50% 15%, rgba(255, 230, 139, 0.75), transparent 18%),
    linear-gradient(180deg, rgba(255, 250, 240, 0.94), rgba(255, 238, 208, 0.92));
  border: 1px solid rgba(163, 103, 45, 0.12);
}

.sun-glow {
  position: absolute;
  top: 20px;
  right: 28px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 221, 121, 0.92), rgba(255, 221, 121, 0));
}

.sheep-frame {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 640px;
  padding: 24px;
}

.stage-status {
  position: absolute;
  top: 20px;
  left: 20px;
  right: 124px;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.turn-controls {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 3;
  display: inline-flex;
  gap: 8px;
}

.turn-button {
  min-width: 44px;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid rgba(96, 57, 27, 0.12);
  border-radius: 999px;
  background: rgba(255, 252, 247, 0.9);
  color: var(--text);
  cursor: pointer;
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 20px rgba(88, 42, 16, 0.1);
  transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.turn-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 22px rgba(88, 42, 16, 0.14);
}

.turn-button:active {
  transform: translateY(0);
}

.facing-badge,
.drag-hint {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 252, 247, 0.82);
  border: 1px solid rgba(96, 57, 27, 0.12);
  backdrop-filter: blur(10px);
  font-size: 0.88rem;
}

.facing-badge {
  font-weight: 700;
}

.sheep-compositor {
  position: relative;
  width: min(100%, 430px);
  aspect-ratio: 1;
  margin-top: 100px;
}

.sheep-compositor.is-draggable {
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.sheep-compositor.is-dragging {
  cursor: grabbing;
}

.sheep-photo,
.accessory-layer {
  position: absolute;
  inset: 0;
  width: 100%;
}

.sheep-photo {
  display: block;
  height: 100%;
  z-index: 1;
  filter: drop-shadow(0 20px 30px rgba(108, 56, 19, 0.2));
}

.accessory-layer {
  height: 100%;
  display: block;
  z-index: 2;
  overflow: visible;
  transition: opacity 140ms ease;
  pointer-events: none;
}

.stage-accessory {
  position: absolute;
  display: block;
  width: 100%;
  height: auto;
  left: 50%;
  transform: translateX(-50%);
  object-fit: contain;
  filter: drop-shadow(0 10px 12px rgba(82, 42, 14, 0.14));
}

.stage-accessory--crown {
  top: 4%;
  width: 42.3%;
}

.stage-accessory--forehead {
  top: 15%;
  width: 36%;
}

.stage-accessory--necklace {
  top: 37%;
  width: 44%;
}

.stage-accessory--chest-chain {
  top: 39%;
  width: 32.76%;
  clip-path: inset(27% 0 0 0);
  transform-origin: center 20%;
  transition: top 140ms ease, left 140ms ease, width 140ms ease, transform 140ms ease;
}

.stage-accessory--chest-chain[data-facing="正面"] {
  top: 39%;
  left: 50%;
  width: 32.76%;
  transform: translateX(-50%) rotate(0deg);
}

.stage-accessory--chest-chain[data-facing="左前方"] {
  top: 39.5%;
  left: 46.8%;
  width: 30.8%;
  transform: translateX(-50%) rotate(-10deg);
}

.stage-accessory--chest-chain[data-facing="左侧"] {
  top: 40.4%;
  left: 42.6%;
  width: 24.2%;
  transform: translateX(-50%) rotate(-22deg);
}

.stage-accessory--chest-chain[data-facing="左后方"] {
  top: 39.8%;
  left: 45.2%;
  width: 26.4%;
  transform: translateX(-50%) rotate(-34deg);
}

.stage-accessory--chest-chain[data-facing="背面"] {
  top: 39.2%;
  left: 50%;
  width: 27.2%;
  transform: translateX(-50%) rotate(180deg);
}

.stage-accessory--chest-chain[data-facing="右后方"] {
  top: 39.8%;
  left: 54.8%;
  width: 26.4%;
  transform: translateX(-50%) rotate(34deg);
}

.stage-accessory--chest-chain[data-facing="右侧"] {
  top: 40.4%;
  left: 57.4%;
  width: 24.2%;
  transform: translateX(-50%) rotate(22deg);
}

.stage-accessory--chest-chain[data-facing="右前方"] {
  top: 39.5%;
  left: 53.2%;
  width: 30.8%;
  transform: translateX(-50%) rotate(10deg);
}

.stage-accessory--earrings {
  top: 18%;
  width: 32%;
}

.stage-accessory--leg-gem {
  top: 72%;
  left: 42%;
  width: 8%;
  transform: none;
}

.stage-leg-gem-pair {
  position: absolute;
  inset: 0;
  z-index: 3;
}

.stage-leg-gem {
  position: absolute;
  top: 76%;
  width: 7.4%;
  height: auto;
  z-index: 4;
  filter: drop-shadow(0 6px 8px rgba(82, 42, 14, 0.14));
}

.stage-leg-gem--left {
  left: 34%;
}

.stage-leg-gem--right {
  right: 34%;
}

.stage-earring-pair {
  position: absolute;
  inset: 0;
  z-index: 3;
}

.stage-earring {
  position: absolute;
  top: 31%;
  width: 10.08%;
  height: 22%;
  z-index: 4;
  overflow: hidden;
  filter: drop-shadow(0 8px 10px rgba(82, 42, 14, 0.16));
}

.stage-earring--left {
  left: 18%;
}

.stage-earring--right {
  right: 18%;
}

.stage-earring-image {
  position: absolute;
  top: -26%;
  width: 240%;
  height: 132%;
  object-fit: contain;
}

.stage-earring-image--left,
.stage-earring-image--right {
  top: 0;
  height: 100%;
}

.stage-earring-image--left {
  left: 0;
}

.stage-earring-image--right {
  right: 0;
}

.selected-strip {
  margin-top: 18px;
}

.selected-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.selected-item {
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--panel-strong);
  border: 1px solid rgba(106, 70, 44, 0.14);
  font-size: 0.92rem;
}

.accessory-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.accessory-card {
  display: grid;
  gap: 8px;
  text-align: left;
  padding: 16px;
  border-radius: 24px;
  border: 1px solid rgba(96, 57, 27, 0.12);
  background: rgba(255, 252, 247, 0.9);
  color: inherit;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.card-preview {
  display: grid;
  place-items: center;
  min-height: 180px;
  padding: 0;
  overflow: hidden;
}

.card-preview-image {
  width: auto;
  height: 160px;
  max-width: 100%;
  object-fit: contain;
}

.card-preview[data-preview-id="uploaded-chest-chain"] {
  min-height: 220px;
}

.card-preview[data-preview-id="uploaded-chest-chain"] .card-preview-image {
  height: 210px;
}

.accessory-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 24px rgba(103, 59, 24, 0.12);
}

.accessory-card.active {
  border-color: rgba(183, 76, 42, 0.44);
  box-shadow: 0 18px 24px rgba(183, 76, 42, 0.18);
}

.chip {
  display: inline-flex;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(201, 155, 51, 0.16);
  color: #7d5915;
  font-size: 0.8rem;
  font-weight: 700;
}

.card-title {
  font-size: 1.02rem;
  font-weight: 700;
}

.card-meta,
.card-desc {
  display: none;
}

@media (max-width: 980px) {
  .studio-layout {
    grid-template-columns: 1fr;
  }

  .stage-area,
  .sheep-frame {
    min-height: 560px;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 20px, 1260px);
    padding-top: 20px;
  }

  .stage-card,
  .wardrobe-card {
    border-radius: 24px;
  }

  .stage-card {
    padding: 18px;
  }

  .wardrobe-card {
    padding: 18px;
  }

  .stage-topbar {
    flex-direction: column;
  }

  .stage-status {
    top: 14px;
    left: 14px;
    right: 14px;
    flex-direction: column;
    align-items: flex-start;
  }

  .turn-controls {
    top: auto;
    right: 14px;
    bottom: 14px;
  }

  .accessory-grid {
    grid-template-columns: 1fr;
  }

  .stage-area,
  .sheep-frame {
    min-height: 500px;
  }
}
