/* ── Appliance Workshop (Xưởng Đồ Điện) ─────────────────── */

/* Home chooser with a third world card: three rows in portrait, three columns in landscape. */
.worlds.worlds-3 { grid-template-rows: repeat(3, minmax(0, 1fr)); }
.world-workshop { background: #EDE9FE; box-shadow: inset 0 0 0 6px var(--purple), 0 6px 0 rgba(0, 0, 0, .08); }

/* Picker: five big machine cards, two stars each (level 1 and level 2). */
.ws-picker {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: var(--touch-gap);
}
.ws-card {
  position: relative;
  min-width: 96px;
  min-height: 96px;
  display: grid;
  place-items: center;
  border-radius: 28px;
  box-shadow: 0 6px 0 rgba(0, 0, 0, .08);
  overflow: hidden;
}
.ws-card:active { transform: translateY(3px); box-shadow: 0 3px 0 rgba(0, 0, 0, .08); }
.ws-card-tv { background: #DBEAFE; }
.ws-card-fridge { background: #DCFCE7; }
.ws-card-washer { background: #FEF3C7; }
.ws-card-fan { background: #FFE4E6; }
.ws-card-cooker { background: #FFEDD5; grid-column: 1 / -1; }
.ws-art { width: min(64%, 220px); max-height: 70%; height: auto; }
.ws-art-spin { transform-box: view-box; transform-origin: 60px 42px; animation: ws-spin 2.4s linear infinite; }
.ws-stars { position: absolute; bottom: 10px; display: flex; gap: 6px; }
.ws-star { display: block; width: 28px; height: 28px; }
.ws-star svg { display: block; width: 100%; height: 100%; fill: rgba(31, 41, 55, .16); }
.ws-star.is-done svg { fill: var(--yellow); filter: drop-shadow(0 2px 0 rgba(146, 64, 14, .35)); }
.ws-card.is-locked { box-shadow: inset 0 0 0 4px rgba(146, 64, 14, .18), 0 6px 0 rgba(0, 0, 0, .06); }
.ws-card.is-locked .ws-art { opacity: .45; filter: saturate(.35) sepia(.25); }
.ws-card.is-locked .ws-art * { animation: none; }

/* Stage: the 3D canvas fills the room; big kid buttons float over it. */
.room-workshop[data-screen="stage"] .bar { gap: 16px; }
.ws-level { display: inline-flex; gap: 8px; }
.ws-level i { width: 22px; height: 22px; border-radius: 7px; background: rgba(31, 41, 55, .14); }
.ws-level i.is-on { background: var(--purple); box-shadow: inset 0 4px 0 rgba(255, 255, 255, .35); }
.ws-view {
  position: relative;
  flex: 1;
  min-height: 0;
  border-radius: 32px;
  background: #F5F3FF;
  box-shadow: inset 0 0 0 6px #EDE9FE;
  overflow: hidden;
}
.ws-canvas { display: block; width: 100%; height: 100%; touch-action: none; user-select: none; -webkit-user-select: none; }
.ws-open {
  position: absolute;
  right: var(--touch-gap);
  bottom: var(--touch-gap);
  width: 112px;
  height: 112px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--paper);
  box-shadow: 0 8px 0 rgba(0, 0, 0, .1), inset 0 0 0 6px var(--purple);
  animation: pulse 1.6s ease-in-out infinite;
}
.ws-open svg { width: 64px; height: 64px; }
.ws-open:active { transform: translateY(3px); }
.ws-next {
  position: absolute;
  right: var(--touch-gap);
  bottom: var(--touch-gap);
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--green);
  color: var(--paper);
  box-shadow: 0 6px 0 rgba(21, 128, 61, .3);
}
.ws-next svg { width: 48px; height: 48px; }
.ws-sticker {
  position: absolute;
  top: var(--touch-gap);
  left: 50%;
  width: 120px;
  height: 120px;
  margin-left: -60px;
  pointer-events: none;
  animation: ws-sticker .7s cubic-bezier(.3, 1.6, .5, 1) both;
}
.ws-sticker svg { width: 100%; height: 100%; fill: var(--yellow); filter: drop-shadow(0 5px 0 rgba(146, 64, 14, .3)); }
.ws-hint {
  position: absolute;
  left: 50%;
  bottom: 14%;
  width: 180px;
  margin-left: -90px;
  pointer-events: none;
}
.ws-hint-finger { animation: ws-swipe 1.6s ease-in-out infinite; }
.ws-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  pointer-events: none;
}
.ws-loading i { width: 22px; height: 22px; border-radius: 7px; background: var(--purple); animation: bob 1s ease-in-out infinite; }
.ws-loading i:nth-child(2) { background: var(--blue); animation-delay: -.33s; }
.ws-loading i:nth-child(3) { background: var(--green); animation-delay: -.66s; }

@keyframes ws-spin { to { transform: rotate(360deg); } }
@keyframes ws-swipe { 0%, 100% { transform: translateX(-34px); } 50% { transform: translateX(34px); } }
@keyframes ws-sticker { from { transform: scale(.2) rotate(-30deg); opacity: 0; } to { transform: scale(1) rotate(0); opacity: 1; } }

@media (orientation: landscape) {
  .worlds.worlds-3 {
    grid-template-columns: repeat(3, minmax(0, 440px));
    grid-template-rows: minmax(0, 440px);
  }
  .ws-picker { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); }
  .ws-card-cooker { grid-column: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .ws-art-spin, .ws-hint-finger, .ws-loading i, .ws-open, .ws-sticker { animation: none; }
}
