/* ---------- 2.4 Dressing Mirror (game/mirror-ui.js) ---------- */
#modal.modal-mirror { padding: 8px; }
.modal-mirror .modal-body { width: min(720px, calc(100vw - 16px)); }
.panel.mirror-panel {
  display: grid; gap: 10px; padding: 12px 16px 16px;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "head" "main" "parts" "choices" "foot";
  max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); overflow-y: auto; overflow-x: hidden;
}
.mirror-head { grid-area: head; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mirror-head h2 { font-family: var(--display); font-weight: 400; font-size: 28px; margin: 0; text-shadow: 0 3px 0 rgba(0,0,0,.4); }
.mirror-say { flex: none; width: 48px; height: 48px; border-radius: 50%; border: 3px solid var(--line); background: #2b3358; color: #fff; font-size: 22px; cursor: pointer; box-shadow: 0 4px 0 var(--line); }
.mirror-main { grid-area: main; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .82fr); gap: 12px; align-items: stretch; }

/* The face: 8×8 squares in a dark-plank frame, painted by tapping or dragging. */
.mirror-face {
  display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr);
  aspect-ratio: 1; width: 100%; max-width: 300px; justify-self: center; align-self: center;
  border: 6px solid #4a2f1c; border-radius: 10px; overflow: hidden; background: #000;
  box-shadow: 0 0 0 3px var(--line), 0 6px 0 rgba(0,0,0,.3); touch-action: none; cursor: crosshair;
}
.mirror-face.active { box-shadow: 0 0 0 3px var(--line), 0 0 0 7px var(--gold), 0 6px 0 rgba(0,0,0,.3); }
.mf-px { display: block; min-width: 0; min-height: 0; box-shadow: inset 0 0 0 .5px rgba(0,0,0,.2); }

/* The turning figure, in a mirror with the same sky shimmer as the one in Town. */
.mirror-stage {
  position: relative; min-height: 210px; border-radius: 18px 18px 10px 10px; overflow: hidden;
  border: 6px solid #4a2f1c; box-shadow: 0 0 0 3px var(--line), inset 0 0 0 2px rgba(255,255,255,.45);
  background: linear-gradient(180deg, #9fd8ff 0%, #e6f6ff 58%, #ffd6ea 100%);
}
.mirror-preview { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }

/* Picture tabs: face, shirt, trousers, shoes and hat, each with a dot of its colour. */
.mirror-parts { grid-area: parts; display: flex; gap: 8px; justify-content: center; }
.mirror-part {
  position: relative; width: 58px; height: 58px; padding: 0; font-size: 30px; line-height: 1; color: #fff;
  border-radius: 14px; border: 3px solid var(--line); background: #2b3358; box-shadow: 0 4px 0 var(--line); cursor: pointer;
}
.mirror-part.on { background: #4b5bb0; box-shadow: 0 0 0 4px var(--gold), 0 4px 0 var(--line); }
.mirror-part i { position: absolute; right: 3px; bottom: 3px; width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--line); }

/* 16 paint pots, or 8 hats. */
.mirror-choices { grid-area: choices; }
.mirror-pots, .mirror-hats { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; }
.mirror-pot {
  aspect-ratio: 1; width: 100%; padding: 0; cursor: pointer;
  border-radius: 46% 46% 38% 38%; border: 3px solid var(--line);
  background: radial-gradient(circle at 34% 28%, rgba(255,255,255,.6) 0 16%, transparent 18%), var(--pot);
  box-shadow: inset 0 -5px 0 rgba(0,0,0,.25), 0 3px 0 var(--line);
}
.mirror-pot.on { box-shadow: inset 0 -5px 0 rgba(0,0,0,.25), 0 0 0 4px var(--gold); transform: scale(1.08); }
.mirror-hat {
  aspect-ratio: 1; width: 100%; padding: 3px; display: grid; place-items: center; cursor: pointer;
  border-radius: 14px; border: 3px solid var(--line); background: #2b3358; box-shadow: 0 3px 0 var(--line);
}
.mirror-hat svg { width: 100%; height: 100%; }
.mirror-hat.on { background: #4b5bb0; box-shadow: 0 0 0 4px var(--gold); }

.mirror-foot { grid-area: foot; display: flex; gap: 12px; justify-content: center; margin-top: 4px; }
.mirror-foot .btn { font-size: 28px; min-width: 70px; padding: 8px 16px 10px; }
.mirror-foot .mirror-wear { min-width: 130px; font-size: 34px; }

/* The Locker's "My look" card. */
.item-card.mirror-card .ic-name { white-space: nowrap; }
.look-mirror { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.look-mirror .items-grid { flex: none; overflow: visible; grid-template-columns: minmax(124px, 160px); padding: 4px 0 2px; }

/* Phones on their side: face and figure on the left, the choices beside them. */
@media (max-height: 600px) and (min-aspect-ratio: 1/1) {
  .panel.mirror-panel { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "head head" "main parts" "main choices" "main foot"; align-items: start; gap: 8px 12px; padding: 10px 12px 12px; }
  .mirror-head h2 { font-size: 22px; }
  .mirror-say { width: 40px; height: 40px; font-size: 18px; }
  .mirror-main { grid-template-columns: auto auto; gap: 8px; }
  .mirror-face { width: min(46vh, 200px); }
  .mirror-stage { width: min(30vh, 128px); min-height: 0; height: min(46vh, 200px); }
  .mirror-part { width: 46px; height: 46px; font-size: 24px; }
  .mirror-pots, .mirror-hats { gap: 6px; }
  .mirror-foot .btn { font-size: 22px; min-width: 56px; padding: 6px 12px 8px; }
  .mirror-foot .mirror-wear { min-width: 96px; font-size: 26px; }
}
/* Narrow phones: smaller tabs and pots so all eight fit across. */
@media (max-width: 480px) {
  .panel.mirror-panel { padding: 10px 10px 14px; }
  .mirror-head h2 { font-size: 22px; }
  .mirror-main { gap: 8px; }
  .mirror-stage { min-height: 170px; }
  .mirror-parts { gap: 6px; }
  .mirror-part { width: 50px; height: 50px; font-size: 26px; }
  .mirror-pots, .mirror-hats { gap: 5px; }
  .mirror-hats { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 300px; margin: 0 auto; }
  .mirror-pot { border-width: 2px; }
  .mirror-foot .btn { font-size: 24px; min-width: 60px; }
}
