/* ---------- GAME WRAPPER ---------- */
#game {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  background: transparent;
}

/* ---------- HEADER ---------- */
#game-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .5rem .8rem;
  background: linear-gradient(90deg, var(--main-3), var(--sec-b3));
  box-shadow: 0 2px 12px rgba(161, 72, 200, 0.3);
  flex-shrink: 0;
  min-width: 0;
}
.game-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 1rem; font-weight: 900;
  color: var(--white);
  text-shadow: 0 1px 4px rgba(0,0,0,.2);
  letter-spacing: .5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-buttons {
  display: flex;
  flex: 0 0 auto;
  gap: .35rem;
  flex-wrap: nowrap;
  margin-left: .35rem;
}

/* ---------- BUTTONS ---------- */
.btn {
  padding: .5rem .9rem;
  border-radius: 99px;
  font-size: .85rem; font-weight: 700;
  color: var(--white);
  transition: transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  white-space: nowrap;
}
.btn:active { transform: scale(.93); }
.btn-pink   { background: var(--pink); }
.btn-purple { background: var(--purple); }
.btn-teal   { background: var(--teal); }
.btn-yellow { background: var(--yellow); color: #7c4a00; position: relative; }

/* Красная точка уведомления на кнопке ачивок */
.btn-yellow .notif-dot {
  position: absolute;
  top: -4px; right: -4px;
  width: 11px; height: 11px;
  background: var(--sec-a1);
  border-radius: 50%;
  border: 2px solid var(--white);
  box-shadow: 0 0 6px rgba(243, 102, 174, .7);
  animation: dotPulse 1.4s ease-in-out infinite;
}
@keyframes dotPulse {
  0%, 100% { transform: scale(1);   box-shadow: 0 0 6px rgba(243, 102, 174, .7); }
  50%       { transform: scale(1.3); box-shadow: 0 0 12px rgba(243, 102, 174, .9); }
}
.btn-school { background: rgba(255,255,255,.25); backdrop-filter: blur(4px); }
.btn-school.school-active {
  background: var(--yellow); color: #7c4a00;
  box-shadow: 0 0 12px rgba(251,191,36,.6);
}

/* ---------- ASSIGNMENT BANNER ---------- */
#assignment-banner {
  background: linear-gradient(90deg, var(--purple), var(--pink));
  flex-shrink: 0;
}
#banner-inner {
  display: flex; align-items: center; gap: .5rem;
  font-size: .75rem; color: var(--white);
  flex-wrap: wrap;
}
#banner-lesson {
  background: rgba(255,255,255,.2);
  border-radius: 99px; padding: .1rem .5rem;
  font-weight: 700; white-space: nowrap;
}
#banner-task { font-weight: 700; flex: 1; }
#banner-tags { opacity: .85; font-size: .7rem; }

/* ---------- MAIN LAYOUT ---------- */
#main-layout {
  display: grid;
  grid-template-columns: 1fr 78px 0px;
  grid-template-rows: auto 1fr;
  flex: 1; overflow: hidden; gap: 0;
  position: relative;
}
#stage-wrap {
  grid-row: 1 / 3;
  grid-column: 1;
}
#panel-controls {
  grid-row: 1;
  grid-column: 2 / 4;
  background: linear-gradient(90deg, var(--sec-a1), var(--main-1)) !important;
  border-bottom: 3px solid rgba(168, 85, 247, 0.28) !important;
  box-shadow: 0 4px 12px rgba(168, 85, 247, 0.1) !important;
  z-index: 5 !important;
}
.items-sidebar {
  grid-row: 2;
  grid-column: 2 / span 2;
  min-width: 0;
  background: rgba(248, 240, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--main-4);
  box-shadow: 0 8px 32px rgba(139, 63, 199, 0.08);
  border-radius: 0;
  overflow: hidden;
  height: 100%;
}

.sidebar-split-layout {
  display: flex;
  flex-direction: row;
  height: 100%;
  width: 100%;
}

/* ---------- CATEGORY PANEL (left) ---------- */
#category-panel {
  width: 78px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 12px 8px;
  overflow-y: auto;
  scrollbar-width: none;
  border-right: 2.5px solid rgba(161, 72, 200, 0.2);
  background: linear-gradient(to bottom, #e4aefc00, var(--main-4));
  height: 100%;
}
#category-panel::-webkit-scrollbar { display: none; }

#category-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}


/* Category item wrapper */
.category-item-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Category item label (displays text on hover/active under the icon) */
.category-item-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  text-shadow: 0px 1px 2px rgba(255, 255, 255, 0.5);
  text-align: center;
  max-width: 74px;
  white-space: normal;
  word-wrap: break-word;
  line-height: 1.1;
  opacity: 0;
  transform: translateY(-4px);
  max-height: 0;

  transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), 
              transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), 
              max-height 0.2s cubic-bezier(0.4, 0, 0.2, 1), 
              margin-top 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  margin-top: 0;
}

.category-item-wrapper.active .category-item-label {
  opacity: 1;
  transform: translateY(0);
  max-height: 24px;
  margin-top: 4px;
}

/* Category Button Style (Squircle with 3D button effect) */
.category-item, .cat-btn {
  background: #ffffff;
  border: 2px solid var(--main-4);
  color: var(--purple);
  width: 56px;
  height: 56px;
  border-radius: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0px 4px 0px var(--main-4), 0px 6px 10px rgba(161, 72, 200, 0.1);
  transform: translateY(0);
}

.category-item:hover, .cat-btn:hover {
  border-color: var(--main-1);
  box-shadow: 0px 6px 0px var(--main-1), 0px 8px 15px rgba(161, 72, 200, 0.2);
  transform: translateY(-2px);
}

.category-item:active, .cat-btn:active {
  transform: translateY(-1px) scale(0.96);
  box-shadow: 0px 3px 0px var(--main-4), 0px 4px 8px rgba(161, 72, 200, 0.1);
}

.category-item.active, .cat-btn.active {
  background: #ffffff !important;
  border: 1.5px solid var(--purple) !important;
  color: var(--purple) !important;
  box-shadow: 0px 4px 0px var(--main-2) !important;
  transform: translateY(-4px) scale(1.05);
}


.category-icon, .cat-icon {
  font-size: 20px;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.category-item.active .category-icon, .cat-btn.active .cat-icon {
  transform: scale(1.15);
}

.category-icon img, .cat-icon img {
  width: clamp(24px, 4.5vw, 36px);
  height: clamp(24px, 4.5vw, 36px);
  object-fit: contain;
  mix-blend-mode: multiply;
  filter: contrast(1.05) saturate(1.05);
  transition: var(--transition);
}

.category-item:hover .category-icon img, .cat-btn:hover .cat-icon img {
  transform: scale(1.1);
}

.category-item.active .category-icon img, .cat-btn.active .cat-icon img {
  transform: scale(1.15);
}


/* ---------- STAGE (center) ---------- */
#stage-wrap {
  display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end;
  background: transparent;
  position: relative; overflow: hidden;
  padding-bottom: 2%;
}
#stage-wrap::before {
  content: '';
  position: absolute; inset: 0; z-index: 0;
  background-image: var(--page-bg, url('../Background/photoshoot.jpg'));
  background-size: cover;
  background-position: center center;
  filter: blur(var(--bg-blur, 1px)) saturate(0.85) brightness(var(--bg-brightness, 0.95));
  transform: translateY(var(--bg-y, 0px)) scale(calc(1.06 * var(--bg-scale, 1)));
  transition: transform 0.1s ease-out, filter 0.1s ease-out;
}
#stage {
  position: relative;
  aspect-ratio: 768 / 1376;
  height: 85%; width: auto;
  max-width: 100%;
  max-height: calc(100vw * 1376 / 768);
  flex-shrink: 1;
  z-index: 1;
}

#character-breath-wrapper {
  position: absolute;
  inset: 0;
  z-index: 1;
  transform-origin: bottom center;
}
#stage #character-breath-wrapper {
  animation: stageCharBreath 4s ease-in-out infinite;
}
#stage #character-breath-wrapper.no-breath {
  animation: none !important;
}
@keyframes stageCharBreath {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.001, 1.004);
  }
}

#character-layers {
  position: absolute; inset: 0; z-index: 1;
  transform: translateY(var(--char-y, 0px)) scale(var(--char-scale, 1));
  transform-origin: bottom center;
  transition: transform 0.1s ease-out;
}
#layer-body { position: absolute; inset: 0; }
#layer-body img {
  width: 100%; height: 100%;
  object-fit: fill; display: block; pointer-events: none;
}
.body-blink-overlay {
  position: absolute !important;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.05s ease-in-out;
  z-index: 1;
}
.body-blink-overlay.blink-active {
  opacity: 1 !important;
}
.char-layer { position: absolute; inset: 0; overflow: visible; }
.character-aura {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 95%;
  height: 85%;
  background: var(--char-aura-gradient, radial-gradient(
    ellipse at center,
    rgba(255, 253, 240, 0.6) 0%,
    rgba(255, 240, 210, 0.35) 45%,
    rgba(255, 240, 210, 0.1) 70%,
    transparent 85%
  ));
  filter: blur(20px);
  z-index: -2;
  pointer-events: none;
  border-radius: 50%;
  opacity: var(--char-aura-opacity, 0.4);
  transition: opacity 0.2s ease, background 0.2s ease;
}
.character-shadow {
  position: absolute;
  bottom: 5%;
  left: 52%;
  transform: translateX(-50%);
  width: 60%;
  height: 4.5%;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.45) 0%, rgba(0, 0, 0, 0.15) 84%, transparent 70%);
  filter: blur(5px);
  z-index: -1;
  pointer-events: none;
}


/* Cloth-change animations */
@keyframes popIn {
  0%   { transform: scale(.75) translateY(6px); opacity: 0; }
  60%  { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
@keyframes fadeIn {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}
@keyframes softPopIn {
  0%   { transform: scale(.9) translateY(3px); opacity: 0; }
  60%  { transform: scale(1.025); opacity: 1; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
@keyframes smoothPopIn {
  0%   { transform: scale(.88) translateY(4px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.layer-animate-popIn { animation: popIn .3s cubic-bezier(.34,1.56,.64,1) both; }
.layer-animate-softPopIn { animation: softPopIn .35s cubic-bezier(.34,1.3,0.64,1) both; }
.layer-animate-smoothPopIn { animation: smoothPopIn .38s cubic-bezier(.16,1,0.3,1) both; }
.layer-animate-fadeIn { animation: fadeIn .35s ease-out both; }

/* Keep active for fallback or backward compatibility */
.layer-animate { animation: popIn .3s cubic-bezier(.34,1.56,.64,1) both; }

/* Sparkles */
#sparkles { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.sparkle {
  position: absolute; font-size: 1.1rem; pointer-events: none;
  animation: sparkleFly .7s ease-out forwards;
}
@keyframes sparkleFly {
  0%   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(.4); }
}

/* Stage Background Particles (Dust) */
#stage-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.stage-particle {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 20%, transparent 80%);
  pointer-events: none;
  opacity: 0;
  transform: translateY(0) rotate(0deg);
}

#outfit-name-display { display: none; }

/* ---------- BOTTOMS SUB-TABS ---------- */
.sub-tabs {
  display: flex; gap: .35rem;
  padding: 0 0 .4rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.sub-tab-btn {
  flex: 1;
  padding: .3rem .4rem;
  border-radius: 99px;
  font-size: .7rem; font-weight: 700;
  background: var(--white); color: var(--text-muted);
  border: 2px solid var(--main-4);
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  transition: background var(--transition), color var(--transition), border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(161, 72, 200, 0.05);
}
.sub-tab-btn svg, .sub-tab-btn img {
  width: 18px; height: 18px;
  display: block;
}
.sub-tab-btn img {
  object-fit: contain;
  mix-blend-mode: multiply;
  filter: contrast(1.05) saturate(1.05);
}
.sub-tab-btn:hover {
  transform: translateY(-1px);
  border-color: var(--main-1);
  color: var(--purple);
  box-shadow: 0 4px 10px rgba(161, 72, 200, 0.1);
}
.sub-tab-btn.active {
  background: var(--white);
  color: var(--purple);
  border-color: var(--purple);
  box-shadow: 0 4px 12px rgba(161, 72, 200, 0.15);
}
.sub-tab-btn:active { transform: scale(.95); }

/* Drag & Drop Stage Hover Overlay */
#stage-wrap.drag-hover::after {
  content: '';
  position: absolute;
  inset: 12px;
  border: 3px dashed var(--purple);
  border-radius: 24px;
  z-index: 1000;
  background: rgba(124, 58, 237, 0.12);
  pointer-events: none;
  animation: pulse-border 1.5s infinite ease-in-out;
}

@keyframes pulse-border {
  0% { opacity: 0.6; transform: scale(0.99); }
  50% { opacity: 1; transform: scale(1); }
  100% { opacity: 0.6; transform: scale(0.99); }
}


