/* workshop_case.css — выбор оправы, шкатулка, «В избранное» (релиз 1.0, волна B2;
   разметка строится в workshop_case.js). Окна — в общем стиле карточек
   (.ws-win.ws-modal: кремовая коробка в золотой оправе, розовая лента сверху),
   слов на виду — не больше трёх, остальное — в aria и строках ws-sr. */

/* ---------- выбор оправы: две карточки-кнопки ---------- */
.ws-choice .ws-win-box { width: min(100%, 340px); padding: 36px 14px 18px; }
.ws-choice-cards { width: 100%; display: flex; justify-content: center; gap: 14px; }
.ws-choice-card {
  position: relative; flex: 1 1 0; max-width: 138px; aspect-ratio: 139 / 192; padding: 0; border: 0;
  background: url(workshop_assets/ui_card.webp) center / 100% 100% no-repeat;
  filter: drop-shadow(0 4px 6px rgba(122, 52, 82, 0.3));
  transition: transform 0.12s ease;
  animation: wsChoiceIn 0.42s cubic-bezier(.2, 1.4, .5, 1) both;
}
.ws-choice-card + .ws-choice-card { animation-delay: 0.08s; }
.ws-choice-card:active { transform: scale(0.95); }
.ws-choice-art { position: absolute; left: 5%; top: 6%; width: 90%; height: 64%; display: block; }
.ws-choice-metal {   /* образец металла: кружок в белой и золотой каёмке */
  position: absolute; left: 50%; bottom: 9%; width: 36px; height: 36px; margin-left: -18px; border-radius: 50%;
  box-shadow: 0 0 0 3px #fff, 0 0 0 5px rgba(232, 182, 74, 0.95), 0 4px 7px rgba(122, 52, 82, 0.35);
}
@keyframes wsChoiceIn { 0% { transform: translateY(16px) scale(0.86); opacity: 0; } 100% { transform: none; opacity: 1; } }

/* ---------- главный камень: гнездо пульсирует, на заказчицах корона ---------- */
.ws-main-pulse {
  position: absolute; z-index: 2; pointer-events: none; border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 2px rgba(255, 246, 200, 0.95), 0 0 9px 3px rgba(255, 196, 70, 0.9);
  background: radial-gradient(circle, rgba(255, 246, 200, 0.55), rgba(255, 220, 120, 0) 70%);
  animation: wsMainPulse 1.1s ease-in-out infinite;
}
@keyframes wsMainPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(0.8); opacity: 0.5; }
  50% { transform: translate(-50%, -50%) scale(1.14); opacity: 1; }
}
.ws-crown {
  position: absolute; z-index: 3; left: calc(var(--face) / 2); top: -13px; width: 28px; height: 23px; margin-left: -14px;
  background: url(workshop_assets/ui_crown.webp) center / contain no-repeat; pointer-events: none;
  filter: drop-shadow(0 0 2px #fff) drop-shadow(0 2px 2px rgba(122, 52, 82, 0.35));
  animation: wsCrownIn 0.4s cubic-bezier(.2, 1.6, .5, 1) both;
}
@keyframes wsCrownIn { 0% { transform: translateY(-8px) scale(0.4); opacity: 0; } 100% { transform: none; opacity: 1; } }

/* ---------- карта: шкатулка слева от «Играть», любимое изделие — справа ---------- */
.ws-map-foot { --pw: min(64vw, 270px); --pph: 78px; }
#btn-case {
  --pic: url(workshop_assets/ui_casket.webp);
  position: absolute; left: max(6px, calc(50% - var(--pw) / 2 - 66px)); bottom: calc((var(--pph) - 58px) / 2);
  width: 58px; height: 58px; pointer-events: auto;
}
#btn-case.bump, #btn-win-case.bump { animation: wsBump 0.5s ease-out; }
.ws-map-fav {
  position: absolute; right: max(4px, calc(50% - var(--pw) / 2 - 70px)); bottom: -6px;
  width: 66px; height: 90px; padding: 0; border: 0; pointer-events: auto;
  /* тумба из лавки (--ws-pedestal, B3) — под любимым; без покупки — своя, бархатная */
  background: var(--ws-pedestal, url(workshop_assets/case_pedestal.webp)) 50% 100% / 100% auto no-repeat;
  filter: drop-shadow(0 4px 4px rgba(90, 30, 50, 0.3));
}
.ws-map-fav:active { transform: scale(0.95); }
.ws-map-fav-art { position: absolute; left: -4px; top: 6px; width: calc(100% + 8px); height: 54px; display: block; }

/* окно победы: кнопка шкатулки в левом верхнем углу, против счётчика монет */
#btn-win-case {
  --pic: url(workshop_assets/ui_casket.webp);
  position: fixed; z-index: 3; top: max(4px, calc(var(--bank-t, 10px) - 6px)); left: var(--bank-r, 10px); width: 56px; height: 56px;
}
.ws-win-jewel.is-flown { filter: opacity(0.2); transition: filter 0.25s ease; }

/* следующая цель: награда ближайшей неоткрытой шкатулки — над ней на карте */
.ws-goal {
  position: absolute; z-index: 3; left: 50%; top: -34px; width: 36px; height: 36px; margin-left: -18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; pointer-events: none;
  background: radial-gradient(circle at 40% 30%, #ffffff, #fdf0f4 60%, #f6d6e0);
  box-shadow: 0 0 0 2.5px rgba(232, 182, 74, 0.9), 0 3px 6px rgba(122, 52, 82, 0.35);
  opacity: 0.88;
}
.ws-goal::after {   /* хвостик к шкатулке */
  content: ''; position: absolute; left: 50%; bottom: -7px; margin-left: -6px;
  border-style: solid; border-width: 7px 6px 0; border-color: #f2c96a transparent transparent;
}
.ws-goal i { display: block; width: 26px; height: 26px; border-radius: 50%; filter: saturate(0.55); opacity: 0.8; }
.ws-goal .ws-goal-pic { border-radius: 0; background: center / contain no-repeat; }
.ws-goal .ws-goal-sw { box-shadow: inset 0 -3px 5px rgba(0, 0, 0, 0.3), inset 0 2px 3px rgba(255, 255, 255, 0.4); }
.ws-goal .ws-coin-ico { width: 26px; height: 26px; }
/* под лентой «Глава 2» — сбоку от шкатулки, хвостик к ней */
.ws-goal.is-side { top: 50%; margin: -18px 0 0; }
.ws-goal.is-left { left: auto; right: calc(100% + 8px); }
.ws-goal.is-right { left: calc(100% + 8px); }
.ws-goal.is-side::after { bottom: auto; top: 50%; margin: -6px 0 0; }
.ws-goal.is-left::after { left: 100%; border-width: 6px 0 6px 7px; border-color: transparent transparent transparent #f2c96a; }
.ws-goal.is-right::after { left: auto; right: 100%; border-width: 6px 7px 6px 0; border-color: transparent #f2c96a transparent transparent; }
.ws-goal.is-ready { opacity: 1; box-shadow: 0 0 0 2.5px #e8b64a, 0 0 12px rgba(255, 200, 70, 0.95); }
.ws-goal.is-ready i { filter: none; opacity: 1; }

/* ---------- шкатулка: 12 коллекций по 5 изделий ---------- */
.ws-case {
  background: linear-gradient(180deg, rgba(96, 34, 70, 0.5), rgba(70, 20, 50, 0.62)),
    #eab9c6 url(workshop_assets/bg_map.webp) 50% 50% / cover no-repeat;
}
.ws-case .ws-win-box { width: min(100%, 384px); padding: 32px 8px 10px; gap: 6px; }
.ws-case-list {
  width: 100%; max-height: calc(100vh - 124px); max-height: calc(100dvh - 124px);
  overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; scrollbar-width: thin;
  display: flex; flex-direction: column; gap: 6px; padding: 4px 3px;
}
.ws-case-row {
  flex: none; display: flex; align-items: center; gap: 6px; padding: 5px 6px 5px 4px; border-radius: 16px;
  background: rgba(255, 255, 255, 0.55); box-shadow: inset 0 0 0 1.5px rgba(232, 182, 74, 0.45);
}
.ws-case-box {
  flex: none; width: 36px; height: 40px;
  background: url(workshop_assets/case_closed.webp) 50% 70% / contain no-repeat;
  filter: drop-shadow(0 2px 2px rgba(90, 30, 50, 0.3));
}
.ws-case-box.is-open { background-image: url(workshop_assets/case_open.webp); background-position: 50% 50%; }
.ws-case-tiles { flex: 1 1 auto; min-width: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.ws-case-tile {
  position: relative; width: 100%; aspect-ratio: 194 / 182; padding: 0; border: 0;
  background: url(workshop_assets/case_tile_pink.webp) center / 100% 100% no-repeat;
  filter: drop-shadow(0 2px 2px rgba(122, 52, 82, 0.25));
  transition: transform 0.1s ease;
}
.ws-case-tile.t-lilac { background-image: url(workshop_assets/case_tile_lilac.webp); }
.ws-case-tile:active { transform: scale(0.94); }
.ws-case-tile canvas { position: absolute; left: 5%; top: 6%; width: 90%; height: 86%; display: block; pointer-events: none; }
.ws-case-tile.is-empty { cursor: default; }
.ws-case-tile.is-fav::after {
  content: ''; position: absolute; right: -4px; top: -5px; width: 19px; height: 17px;
  background: url(workshop_assets/ui_heart.webp) center / contain no-repeat;
  filter: drop-shadow(0 1px 1px rgba(122, 52, 82, 0.4));
}
.ws-case-tile.is-new { animation: wsTileNew 1.3s ease-in-out 3; }
@keyframes wsTileNew {
  0%, 100% { filter: drop-shadow(0 2px 2px rgba(122, 52, 82, 0.25)); }
  50% { filter: drop-shadow(0 0 4px #fff6c8) drop-shadow(0 0 10px rgba(255, 200, 70, 0.95)); }
}

/* крупный показ: изделие на мраморном пьедестале, блик, сердце «любимое» */
.ws-view { z-index: 23; }
.ws-view .ws-win-box { width: min(100%, 340px); padding: 36px 12px 16px; gap: 4px; }
.ws-view-stage {
  position: relative; width: 100%; height: 232px;
  background: var(--ws-pedestal, url(workshop_assets/case_pedestal.webp)) 50% 100% / 76% auto no-repeat;   /* тумба из лавки (B3) */
}
.ws-view-stage::before {   /* мягкое сияние за изделием */
  content: ''; position: absolute; left: 50%; top: 42%; width: 88%; aspect-ratio: 1.4; transform: translate(-50%, -50%);
  background: radial-gradient(ellipse, rgba(255, 246, 214, 0.95), rgba(255, 230, 200, 0) 68%); pointer-events: none;
}
.ws-view-art { position: absolute; left: 0; top: 0; width: 100%; height: 180px; display: block; }
.ws-fav {
  flex: none; width: 74px; height: 66px; padding: 0; border: 0;
  background: url(workshop_assets/ui_heart_off.webp) center / contain no-repeat;
  filter: drop-shadow(0 3px 3px rgba(122, 52, 82, 0.35));
  transition: transform 0.1s ease;
}
.ws-fav[aria-pressed="true"] { background-image: url(workshop_assets/ui_heart.webp); filter: drop-shadow(0 0 10px rgba(255, 130, 180, 0.85)); }
.ws-fav:active { transform: scale(0.92); }
.ws-fav.bump { animation: wsBump 0.45s ease-out; }

/* ---------- «В избранное»: один раз после 3-й победы ---------- */
.ws-favask { z-index: 24; }
.ws-favask .ws-win-box { padding-top: 36px; }
.ws-favask-pic {
  width: 116px; height: 104px; background: url(workshop_assets/ui_heart.webp) center / contain no-repeat;
  filter: drop-shadow(0 0 12px rgba(255, 140, 180, 0.8));
  animation: wsFavBeat 1.5s ease-in-out infinite;
}
@keyframes wsFavBeat { 0%, 60%, 100% { transform: scale(1); } 30% { transform: scale(1.1); } }
.ws-favask-ok { --ph: 62px; width: 150px; margin-top: 4px; }
.ws-favask-ok > svg { width: 38px; height: 38px; }

/* ---------- низкий телефон, лёжа, большой экран ---------- */
/* узкий телефон (360): «Играть» чуть уже, пьедестал ниже — по краям хватает места обоим */
@media (max-width: 380px) and (orientation: portrait) {
  .ws-map-foot { --pw: calc(100vw - 140px); }
  .ws-map-foot .ws-map-play { width: var(--pw); }
  .ws-map-fav { width: 58px; height: 80px; }
  .ws-map-fav-art { height: 48px; }
}
@media (max-height: 700px) and (orientation: portrait) {
  .ws-view-stage { height: 200px; }
  .ws-view-art { height: 156px; }
}
@container ws-game (max-height: 600px) and (max-width: 600px) and (orientation: portrait) {
  .ws-crown { width: 24px; height: 20px; margin-left: -12px; top: -11px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .ws-map-foot { --pw: 220px; --pph: 62px; }
  #btn-case { width: 52px; height: 52px; bottom: calc((var(--pph) - 52px) / 2); }
  .ws-map-fav { width: 58px; height: 78px; bottom: -4px; }
  .ws-map-fav-art { height: 46px; }
  #btn-win-case { width: 50px; height: 50px; }
  .ws-choice .ws-win-box { padding: 30px 12px 12px; }
  .ws-choice-card { max-width: 122px; }
  .ws-case .ws-win-box { width: min(100%, 520px); }
  .ws-view .ws-win-box { padding-top: 30px; }
  .ws-view-stage { height: 150px; background-size: auto 66%; }
  .ws-view-art { height: 112px; }
  .ws-fav { width: 60px; height: 54px; }
  .ws-favask-pic { width: 84px; height: 74px; }
}
@media (prefers-reduced-motion: reduce) {
  .ws-main-pulse, .ws-favask-pic, .ws-case-tile.is-new, .ws-choice-card, .ws-crown { animation: none !important; }
  .ws-main-pulse { opacity: 0.9; }
}
