@font-face {
  font-family: 'Nunito';
  src: url('/fonts/nunito.ttf') format('truetype');
  font-weight: 400 900;
  font-display: swap;
}

@font-face {
  font-family: 'DM Sans';
  src: url('/fonts/dmsans.ttf') format('truetype');
  font-weight: 400 800;
  font-display: swap;
}

:root {
  --shell: #E5D6F5;
  --paper: #FAF4E4;
  --ink: #302641;
  --rim: #B69AC4;
  --key: #4958C7;
  --key-top: #6472D9;
  --key-edge: #303C92;
  --light-key: #E4D3F2;
  --light-key-top: #EEE1F5;
  --light-edge: #B6A2BC;
  --sage: #ACC79C;
  --ground: linear-gradient(155deg, #E9D9F4 0%, #E5D6F5 52%, #D9C3E8 100%);
  --font-head: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font-body);
  color: var(--ink);
  background: #ECE4F4;
  overflow: hidden;
  user-select: none;
}

button, input, label {
  font-family: inherit;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Desktop studio framing */
.studio-wrap {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
}

.reviewer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 390px;
  max-width: 100%;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(182, 154, 196, 0.45);
  border-radius: 14px;
  backdrop-filter: blur(8px);
}

.reviewer-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 12px;
  color: var(--ink);
}

.reviewer-brand .dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #2AB573;
}

.reviewer-pills {
  display: flex;
  gap: 5px;
}

.rev-pill {
  border: 1px solid var(--rim);
  background: #FFFDFB;
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  cursor: pointer;
}

.rev-pill.active {
  background: var(--key);
  border-color: var(--key);
  color: #fff;
}

.phone-shell {
  position: relative;
  width: 390px;
  height: min(844px, calc(100vh - 64px));
  background: var(--ground);
  border-radius: 36px;
  box-shadow: 0 24px 60px rgba(48, 38, 65, 0.22), 0 0 0 6px rgba(255, 255, 255, 0.6);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

@media (max-width: 520px) {
  .studio-wrap {
    padding: 0;
    gap: 0;
  }
  .reviewer-bar {
    display: none;
  }
  .phone-shell {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
    box-shadow: none;
  }
}

.screen {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--ground);
}

/* Header */
.hh-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  height: 48px;
  padding: 0 17px;
  flex-shrink: 0;
}

.wordmark {
  font-family: var(--font-head);
  font-size: 34px;
  font-weight: 900;
  letter-spacing: -2.15px;
  line-height: 1;
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.9), 0 2px 0 #B494B9;
}

.header-trailing {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Handheld Keys & Pills */
.hh-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 31px;
  padding: 0 10px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.90);
  border: 1px solid var(--rim);
  box-shadow: 0 1px 0 var(--rim);
  color: var(--ink);
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.hh-pill:active {
  transform: translateY(1px);
  box-shadow: 0 0 0 var(--rim);
}

.hh-pill.mini-pill {
  min-height: 28px;
  font-size: 12px;
  padding: 0 9px;
  border-radius: 12px;
}

.hh-pill.accent-pill {
  background: var(--paper);
  color: var(--key);
}

.hh-pill.highlight-ring {
  outline: 2.5px solid var(--key);
  outline-offset: 2px;
  animation: pulseRing 1.3s ease-in-out infinite;
}

.gift-pill.wiggle {
  animation: giftWiggle 2.2s ease-in-out infinite;
}

.closet-bump {
  transform: scale(1.16);
}

.hh-key {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 17px;
  font-family: var(--font-head);
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.hh-key.primary {
  width: 100%;
  min-height: 50px;
  font-size: 18px;
  color: #fff;
  background: linear-gradient(155deg, var(--key-top), var(--key));
  border: 1px solid #4551AF;
  box-shadow: 0 3px 0 var(--key-edge);
  text-decoration: none;
}

.hh-key.primary:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--key-edge);
}

.hh-key.primary:disabled {
  opacity: 0.56;
  cursor: wait;
}

.hh-key.primary.gleam::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 17px;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,0.22) 50%, transparent 70%);
  background-size: 220% 100%;
  animation: keyGleam 2.4s ease-in-out infinite;
  pointer-events: none;
}

.action-wrap {
  padding: 0 28px;
  width: 100%;
}

/* Screen 1: Sealed Charm */
.screen-charm {
  padding-bottom: 12px;
  gap: 10px;
}

.charm-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  margin: 0 16px;
  border-radius: 25px;
  border: 3px solid var(--rim);
  background: #1E1929;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stage-halo {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transition: background 0.52s ease-out;
}

.charm-stage.sealed .stage-halo {
  background: radial-gradient(ellipse 88% 66% at 50% 46%, rgba(91, 75, 122, 0.38) 8%, rgba(47, 39, 66, 0.44) 44%, transparent 72%);
}

.charm-stage.released .stage-halo {
  background: radial-gradient(ellipse 92% 72% at 50% 44%, rgba(252, 224, 184, 0.62) 10%, rgba(126, 95, 160, 0.56) 50%, transparent 78%);
}

.charm-stage.awake .stage-halo {
  background: radial-gradient(ellipse 96% 78% at 50% 44%, rgba(255, 232, 200, 0.78) 12%, rgba(156, 117, 186, 0.62) 52%, transparent 84%);
}

.stage-bloom {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 50% 52%, rgba(255, 247, 226, 0.78), rgba(223, 196, 245, 0.45) 40%, transparent 72%);
}

.stage-bloom.active {
  animation: bloomFlash 0.68s ease-out forwards;
}

.charm-title {
  position: relative;
  z-index: 3;
  margin: 22px 16px 0;
  text-align: center;
  font-family: var(--font-head);
  font-size: 23px;
  font-weight: 900;
  line-height: 1.18;
  letter-spacing: -0.7px;
  color: #fff;
  pointer-events: none;
}

.charm-iframe {
  position: relative;
  z-index: 2;
  flex: 1;
  width: 100%;
  border: 0;
  margin-top: -8px;
  background: transparent;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.charm-iframe.ready {
  opacity: 1;
}

.charm-loading, .room-loading {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.charm-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.92;
  padding-top: 44px;
}

.loading-spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}

.loading-spinner.dark {
  border-color: rgba(73, 88, 199, 0.2);
  border-top-color: var(--key);
}

/* Screen 2: First Look */
.screen-firstlook {
  padding-bottom: 12px;
  gap: 8px;
  align-items: center;
}

.firstlook-heading {
  text-align: center;
  padding: 0 20px;
}

.firstlook-heading h1 {
  margin: 0;
  font-family: var(--font-head);
  font-size: 25px;
  font-weight: 900;
  letter-spacing: -0.7px;
}

.firstlook-heading p {
  margin: 3px 0 0;
  font-size: 14px;
  color: rgba(48, 38, 65, 0.68);
}

.firstlook-spacer {
  flex: 1;
  min-height: 4px;
}

.firstlook-card {
  width: calc(100% - 44px);
  max-width: 340px;
  padding: 18px 20px;
  background: var(--paper);
  border: 1.5px solid rgba(182, 154, 196, 0.75);
  border-radius: 22px;
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.polaroid-duo {
  position: relative;
  height: 225px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sample-polaroid {
  position: relative;
  width: 152px;
  height: 215px;
  padding: 5px;
  background: #fff;
  border-radius: 12px;
  transform: translateX(-26px) rotate(-2.5deg);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.16);
  overflow: hidden;
}

.sample-polaroid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}

.boxie-sticker {
  position: absolute;
  left: calc(50% + 28px);
  bottom: 0;
  height: 132px;
  width: auto;
  transform: rotate(4deg);
  transform-origin: bottom center;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.18));
  pointer-events: none;
  z-index: 2;
}

.scan-overlay {
  position: absolute;
  inset: 5px;
  border-radius: 8px;
  background: rgba(48, 38, 65, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.scan-beam {
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, transparent, #FFF4B8, #fff, #FFF4B8, transparent);
  box-shadow: 0 0 12px #E5D6F5;
  animation: scanSweep 1.15s ease-in-out infinite alternate;
}

.scan-label {
  position: relative;
  z-index: 2;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 800;
}

.firstlook-card-note {
  margin: 0;
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 800;
  color: rgba(48, 38, 65, 0.75);
  text-align: center;
}

.firstlook-error {
  margin: 0;
  padding: 0 28px;
  font-size: 12px;
  font-weight: 700;
  color: var(--key);
  text-align: center;
}

.privacy-note {
  margin: 0;
  padding: 0 28px;
  font-size: 12px;
  color: rgba(48, 38, 65, 0.66);
  text-align: center;
}

.text-link-btn {
  border: 0;
  background: none;
  color: var(--key);
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 800;
  min-height: 36px;
  cursor: pointer;
}

/* Screen 3: Console */
.screen-console {
  gap: 5px;
}

.tab-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sunroom-stage {
  position: relative;
  flex: 1;
  min-height: 220px;
  margin: 0 11px;
  border-radius: 25px;
  border: 3px solid var(--rim);
  box-shadow: 0 2px 0 rgba(255, 255, 255, 0.72);
  overflow: hidden;
}

.sunroom-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.sunroom-motes {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 24%, rgba(255, 252, 238, 0.25), transparent 45%);
  pointer-events: none;
}

.room-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.room-iframe.ready {
  opacity: 1;
}

.room-loading {
  transition: opacity 0.35s ease;
}

.room-loading.faded {
  opacity: 0;
}

.room-standin {
  position: absolute;
  left: 50%;
  bottom: 6%;
  height: 84%;
  width: auto;
  max-width: 70%;
  object-fit: contain;
  transform: translateX(-50%);
  filter: drop-shadow(0 8px 12px rgba(48, 38, 65, 0.22));
}

.room-spinner {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 18px;
  height: 18px;
  border-width: 2.5px;
}

.stage-gesture {
  position: absolute;
  inset: 0;
  z-index: 3;
  cursor: grab;
  touch-action: none;
}

.stage-gesture:active {
  cursor: grabbing;
}

.stage-corners {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  z-index: 4;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.stage-top-left, .stage-top-right {
  display: flex;
  gap: 6px;
  pointer-events: auto;
}

.shutter-flash {
  position: absolute;
  inset: 0;
  background: #fff;
  z-index: 5;
  pointer-events: none;
  animation: shutter 0.35s ease-out forwards;
}

/* Share Tip Card */
.share-tip {
  margin: 0 14px;
  padding: 9px 12px 9px 15px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(182, 154, 196, 0.65);
  cursor: pointer;
}

.share-tip-top {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 800;
}

.share-tip-title {
  flex: 1;
}

.share-tip-close {
  border: 0;
  background: rgba(182, 154, 196, 0.25);
  color: var(--ink);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-weight: 800;
  cursor: pointer;
}

.share-tip-steps {
  margin-top: 7px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: rgba(48, 38, 65, 0.85);
}

.status-tip-line {
  text-align: center;
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 800;
  color: rgba(48, 38, 65, 0.8);
  padding: 1px 0;
}

/* Handheld Deck */
.handheld-deck {
  margin: 0 11px;
  padding: 9px 12px 7px;
  background: var(--paper);
  border-radius: 19px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  flex-shrink: 0;
}

.deck-main-row {
  display: flex;
  gap: 9px;
  height: 146px;
}

.deck-main-row.tour-compact {
  height: 61px;
}

.save-fit-key {
  flex: 0 0 45.5%;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  gap: 2px;
}

.deck-main-row.tour-compact .save-fit-key {
  flex: 1;
  flex-direction: row;
  gap: 6px;
}

.save-fit-key .plus-glyph {
  font-size: 36px;
  line-height: 0.9;
  font-weight: 900;
}

.deck-main-row.tour-compact .plus-glyph {
  font-size: 24px;
}

.save-fit-key .save-label {
  font-size: 19px;
  font-weight: 900;
}

.wardrobe-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.deck-main-row.tour-compact .wardrobe-grid {
  grid-template-columns: 1fr;
}

.garment-key {
  flex-direction: column;
  gap: 1px;
  padding: 3px;
  border-radius: 14px;
  background: linear-gradient(155deg, var(--light-key-top), var(--light-key));
  border: 1px solid #C7B3CF;
  box-shadow: 0 3px 0 var(--light-edge);
  color: var(--ink);
  font-size: 13px;
}

.garment-key:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--light-edge);
}

.garment-key.highlight-ring {
  outline: 2.5px solid var(--key);
  outline-offset: 1px;
}

.garment-key {
  min-width: 0;
  overflow: hidden;
}

.garment-key img {
  height: 32px;
  width: auto;
  object-fit: contain;
  pointer-events: none;
}

.garment-key .key-title {
  line-height: 1.05;
}

.garment-key .key-worn {
  max-width: 100%;
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.1;
  color: rgba(48, 38, 65, 0.90);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.garment-key .key-worn:empty,
.deck-main-row.tour-compact .garment-key .key-worn {
  display: none;
}

.deck-main-row.tour-compact .garment-key {
  flex-direction: row;
  gap: 8px;
}

.milestone-pill {
  position: relative;
  height: 25px;
  width: 100%;
  border-radius: 999px;
  border: 1.5px solid transparent;
  background: rgba(172, 199, 156, 0.36);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.milestone-pill.ready {
  background: var(--light-key);
  border-color: var(--key);
}

.milestone-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: var(--sage);
  transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.milestone-pill.ready .milestone-fill {
  width: 100% !important;
  background: rgba(73, 88, 199, 0.24);
}

.milestone-label {
  position: relative;
  z-index: 2;
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
}

.milestone-pill.ready .milestone-label {
  color: var(--key);
}

/* Bottom Navigation */
.bottom-nav {
  display: flex;
  background: var(--paper);
  border-top: 1px solid rgba(182, 154, 196, 0.45);
  height: 52px;
  flex-shrink: 0;
}

.nav-btn {
  flex: 1;
  border: 0;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: rgba(48, 38, 65, 0.65);
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.nav-btn.active {
  color: var(--key);
}

/* Tab: Packs */
.packs-list-view {
  flex: 1;
  overflow-y: auto;
  padding: 6px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.packs-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.packs-heading-row h2 {
  margin: 0;
  font-family: var(--font-head);
  font-size: 23px;
  font-weight: 900;
}

.packs-ready-tag {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--rim);
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 800;
  color: var(--key);
}

.packs-sub {
  margin: 0;
  font-size: 13px;
  color: rgba(48, 38, 65, 0.72);
}

.milestones-bar {
  display: flex;
  gap: 6px;
}

.m-chip {
  flex: 1;
  text-align: center;
  padding: 4px 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--rim);
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 800;
}

.m-chip.done {
  background: var(--sage);
  color: var(--ink);
  border-color: #84A671;
}

.packs-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pack-card {
  display: flex;
  gap: 12px;
  padding: 10px;
  background: var(--paper);
  border-radius: 18px;
  border: 1.5px solid var(--rim);
  box-shadow: 0 3px 0 rgba(182, 154, 196, 0.65);
  align-items: center;
}

.pack-thumb {
  width: 68px;
  height: 92px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 4px 10px rgba(0,0,0,0.18);
}

.pack-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pack-info h3 {
  margin: 0;
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 900;
}

.pack-info p {
  margin: 0;
  font-size: 12px;
  color: rgba(48, 38, 65, 0.72);
}

.pack-open-btn {
  padding: 7px 14px;
  border-radius: 12px;
  border: 1px solid #4551AF;
  background: linear-gradient(155deg, var(--key-top), var(--key));
  box-shadow: 0 2px 0 var(--key-edge);
  color: #fff;
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.pack-open-btn:disabled {
  background: var(--light-key);
  color: rgba(48, 38, 65, 0.55);
  border-color: var(--rim);
  box-shadow: none;
  cursor: default;
}

/* Foil Rip Screen */
.packs-rip-view {
  position: relative;
  flex: 1;
  min-height: 0;
  margin: 0 11px 6px;
  border-radius: 25px;
  overflow: hidden;
  border: 3px solid var(--rim);
  display: flex;
  flex-direction: column;
  padding: 14px;
}

.orbit-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.rip-topbar {
  position: relative;
  z-index: 4;
  display: flex;
  justify-content: space-between;
}

.rip-contents-popover {
  position: relative;
  z-index: 5;
  align-self: flex-end;
  margin-top: 6px;
  padding: 10px 12px;
  background: var(--paper);
  border-radius: 13px;
  border: 1px solid var(--rim);
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 800;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.foil-stage {
  position: relative;
  z-index: 3;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.foil-wrapper {
  position: relative;
  width: 210px;
  height: 410px;
  cursor: grab;
  touch-action: none;
  transform: rotate(-3deg);
  filter: drop-shadow(0 9px 18px rgba(0, 0, 0, 0.42));
}

.foil-half {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 14px;
  transition: transform 0.34s ease-in, opacity 0.34s ease-in;
}

.foil-half img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.foil-top {
  clip-path: polygon(0% 0%, 100% 0%, 100% 11.5%, 88% 10.3%, 75% 11.5%, 62% 10.3%, 50% 11.5%, 38% 10.3%, 25% 11.5%, 12% 10.3%, 0% 11.5%);
  transform-origin: right center;
}

.foil-bottom {
  clip-path: polygon(0% 11.5%, 12% 10.3%, 25% 11.5%, 38% 10.3%, 50% 11.5%, 62% 10.3%, 75% 11.5%, 88% 10.3%, 100% 11.5%, 100% 100%, 0% 100%);
}

.foil-wrapper.torn .foil-top {
  transform: translate(150px, -45px) rotate(13deg);
  opacity: 0;
}

.foil-wrapper.torn .foil-bottom {
  transform: translateY(220px) rotate(-11deg);
  opacity: 0;
}

.foil-overlay-copy {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 26px;
  gap: 24px;
  pointer-events: none;
}

.foil-overlay-copy h3 {
  margin: 0;
  font-family: var(--font-head);
  font-size: 24px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.85);
}

.foil-slide-pill {
  pointer-events: auto;
  padding: 9px 14px;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.foil-locked-note {
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--paper);
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 800;
}

.rip-reveal-stage {
  position: relative;
  z-index: 4;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(233, 217, 244, 0.94);
  margin: -14px;
  padding: 20px;
}

.reveal-card {
  position: relative;
  width: 240px;
  height: 290px;
  border-radius: 22px;
  border: 2.5px solid var(--rim);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 28px rgba(48, 38, 65, 0.22);
}

.reveal-sunroom {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reveal-swatch {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.22);
}

.reveal-piece-img {
  position: relative;
  z-index: 2;
  width: 155px;
  height: 155px;
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(48, 38, 65, 0.22));
}

.reveal-new-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 3;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--key);
  color: #fff;
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 900;
}

.reveal-counter {
  position: absolute;
  bottom: 10px;
  right: 12px;
  z-index: 3;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--paper);
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 800;
}

.reveal-piece-name {
  margin: 0;
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 900;
}

.reveal-boxie-bonus {
  margin: 0;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--rim);
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 800;
  color: var(--key);
}

/* Tab: Explore */
#tab-explore {
  padding: 4px 13px 10px;
}

.explore-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.explore-header h2 {
  margin: 0 auto;
  font-family: var(--font-head);
  font-size: 23px;
  font-weight: 900;
}

.explore-tag {
  position: absolute;
  right: 14px;
  font-size: 11px;
  font-weight: 700;
  color: rgba(48, 38, 65, 0.55);
}

.explore-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding-bottom: 12px;
}

.explore-card {
  position: relative;
  aspect-ratio: 0.75;
  border-radius: 14px;
  overflow: hidden;
  border: 1.5px solid rgba(182, 154, 196, 0.7);
  cursor: pointer;
  background: var(--paper);
}

.explore-card-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.explore-swatches {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 10px 36px;
}

.explore-piece-thumbs {
  display: flex;
  justify-content: center;
  align-items: center;
}

.explore-piece-thumbs img {
  width: 50px;
  height: 50px;
  object-fit: contain;
  margin: 0 -4px;
  filter: drop-shadow(0 3px 6px rgba(48, 38, 65, 0.18));
}

.explore-color-dots {
  display: flex;
  gap: 5px;
}

.explore-color-dots span {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.explore-title-pill {
  position: absolute;
  left: 6px;
  bottom: 6px;
  right: 40px;
  z-index: 3;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--paper);
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.explore-like-btn {
  position: absolute;
  right: 6px;
  bottom: 6px;
  z-index: 4;
  width: 28px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid var(--rim);
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.explore-like-btn.liked {
  color: #B94876;
}

/* Polaroid Flight */
.polaroid-flight {
  position: absolute;
  left: 50%;
  top: 44%;
  z-index: 50;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(1);
}

.polaroid-frame {
  width: 132px;
  padding: 8px 8px 10px;
  border-radius: 12px;
  background: #FFFDF9;
  border: 1px solid rgba(182, 154, 196, 0.65);
  box-shadow: 0 14px 28px rgba(48, 38, 65, 0.25);
  text-align: center;
}

.polaroid-well {
  position: relative;
  width: 100%;
  height: 142px;
  border-radius: 8px;
  overflow: hidden;
}

.polaroid-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.polaroid-doll {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
}

.polaroid-caption {
  margin-top: 6px;
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 900;
}

/* Modal Sheets */
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(30, 25, 41, 0.42);
  z-index: 60;
}

.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 88%;
  background: var(--paper);
  border-top-left-radius: 26px;
  border-top-right-radius: 26px;
  z-index: 70;
  display: flex;
  flex-direction: column;
  padding: 10px 0 18px;
  box-shadow: 0 -10px 30px rgba(30, 25, 41, 0.22);
}

.sheet-grabber {
  width: 38px;
  height: 4px;
  border-radius: 999px;
  background: rgba(182, 154, 196, 0.6);
  margin: 0 auto 8px;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 18px 12px;
}

.sheet-header h2 {
  margin: 0;
  font-family: var(--font-head);
  font-size: 24px;
  font-weight: 900;
}

/* Closet Grid */
.closet-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 4px 12px 12px;
}

.closet-pocket {
  position: relative;
  aspect-ratio: 0.68;
  border-radius: 11px;
  overflow: hidden;
  border: 1.5px solid var(--rim);
  background: var(--paper);
  cursor: pointer;
}

.closet-pocket img.pocket-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.closet-pocket img.pocket-doll {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px 6px 20px;
}

.closet-pocket .pocket-num {
  position: absolute;
  left: 5px;
  bottom: 5px;
  z-index: 3;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--paper);
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 900;
}

.closet-add-card, .closet-empty-slot {
  aspect-ratio: 0.68;
  border-radius: 11px;
  border: 1.5px dashed var(--rim);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  background: none;
  cursor: pointer;
  text-align: center;
  padding: 6px;
}

.closet-empty-slot {
  border-color: rgba(182, 154, 196, 0.55);
  color: var(--rim);
  cursor: default;
}

/* Boxies Shelf */
.boxies-shelf-scroll {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 8px 20px 14px;
}

.boxie-card {
  flex: 0 0 156px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  border: 0;
  background: none;
  cursor: pointer;
  padding: 0;
}

.boxie-card:disabled {
  cursor: default;
}

.boxie-portrait-frame {
  position: relative;
  width: 156px;
  height: 156px;
  border-radius: 20px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.09);
  overflow: hidden;
}

.boxie-portrait-frame.current {
  border: 3px solid var(--key);
}

.boxie-portrait-frame.locked {
  background: linear-gradient(180deg, rgba(244, 111, 168, 0.5), #4958C7);
}

.boxie-portrait-frame img {
  width: 88%;
  height: 88%;
  object-fit: contain;
}

.boxie-portrait-frame.locked img {
  filter: brightness(0.15) opacity(0.85);
}

.boxie-lock-num {
  position: absolute;
  bottom: 10px;
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 900;
  color: #fff;
}

.boxie-card-name {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
}

.boxies-footer {
  padding: 8px 20px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.boxies-goal-text {
  margin: 0;
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.boxies-actions-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.boxies-notice {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--key);
}

/* Menu Sheet */
.menu-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 18px;
}

.menu-item {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--rim);
  background: #fff;
  color: var(--ink);
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.menu-item.danger {
  color: #A63356;
}

/* Paywall Sheet */
.paywall-sheet {
  background: #F6F2EA;
  max-height: 94%;
  padding: 14px 22px 18px;
}

.paywall-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.paywall-wordmark {
  font-family: var(--font-head);
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -1.4px;
}

.paywall-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid #D9D3C7;
  background: #fff;
  font-size: 18px;
  cursor: pointer;
}

.paywall-hero {
  display: flex;
  justify-content: center;
  margin: 10px 0 8px;
}

.paywall-blister-card {
  width: 146px;
  height: 170px;
  border-radius: 22px;
  background: #EFEAE0;
  border: 2px solid #D9D3C7;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 2px 10px rgba(255,255,255,0.9), 0 8px 18px rgba(48, 38, 65, 0.12);
}

.paywall-blister-card img {
  height: 82%;
  width: auto;
  object-fit: contain;
}

.paywall-title {
  margin: 4px 0 10px;
  font-family: var(--font-head);
  font-size: 29px;
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.9px;
}

.paywall-perks {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
}

.paywall-plans {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.plan-card {
  width: 100%;
  padding: 12px 14px;
  border-radius: 16px;
  border: 2px solid #D9D3C7;
  background: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-head);
  font-size: 14px;
  cursor: pointer;
}

.plan-card.selected {
  border-color: var(--key);
  background: #F4F5FD;
}

.plan-badge {
  margin-left: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--key);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.paywall-footer {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.paywall-cta {
  width: 100%;
  height: 50px;
  border-radius: 999px;
  border: 0;
  background: var(--ink);
  color: #fff;
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.paywall-web-note {
  margin: 0;
  text-align: center;
  font-size: 11px;
  color: rgba(48, 38, 65, 0.65);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes keyGleam {
  0%, 100% { background-position: 180% 0; }
  50% { background-position: -80% 0; }
}

@keyframes pulseRing {
  0%, 100% { outline-color: var(--key); }
  50% { outline-color: rgba(73, 88, 199, 0.35); }
}

@keyframes giftWiggle {
  0%, 82%, 100% { transform: rotate(0deg); }
  86% { transform: rotate(-6deg); }
  90% { transform: rotate(6deg); }
  94% { transform: rotate(-4deg); }
}

@keyframes bloomFlash {
  0% { opacity: 0.9; transform: scale(0.45); }
  100% { opacity: 0; transform: scale(1.65); }
}

@keyframes scanSweep {
  from { top: 8%; }
  to { top: 88%; }
}

@keyframes shutter {
  0% { opacity: 0.72; }
  100% { opacity: 0; }
}
