/* The Muse wardrobe: the dressing UI, shared by /muse (its own page) and /you (at the top of
   your record, so dressing is not a trip to another page).

   EVERY rule is scoped under `.wr` because both pages own their own look, and the host page's
   `.btn`, `.status` and `.empty` already mean something else on /you. Scoping is cheaper than
   being careful: a wardrobe rule can then never reach a page it was not meant for.

   The variables are wardrobe-LOCAL (--wr-r, --wr-r-sm, --wr-ok) on purpose. /you sets --r:14px
   and --ok to the accent blue, /muse sets --r:16px and --ok to green, and borrowing either
   name would restyle the whole host page or turn the worn-piece tick blue.

   SIZING. A person reads this board, so it lives in a CONTAINER (.wr-wrap, 1040px) instead of
   stretching to whatever the monitor is. Measured before this pass, on a 1440px screen: the
   board was 1325px wide, inventory slots were 133px, and a 933px preview box held a 184px
   picture. Everything below is sized so the pieces are the small squares a wardrobe inventory
   is made of, and the leftover width is USED (what is worn gets its own column) rather than
   left as gutters. */

:root{
  /* stone panels and dark slots: the palette a block game uses */
  --stone:#a2a2a2; --stone-hi:#d3d3d3; --stone-lo:#6b6b6b; --stone-dk:#4a4a4a;
  --slot:#262626; --slot-bd:#151515; --slot-hi:#3d3d3d;
  --tip:#170020; --tip-bd:#3a0d52; --tip-name:#d9a3ff; --tip-id:#6f5a7a;
  --wr-r:16px; --wr-r-sm:10px; --wr-ok:#15803d;
}

/* ---- the container: this board is read by a human, not stretched to the monitor ---- */
.wr-wrap{max-width:1040px;margin:0 auto}

/* ---- the selector: one stone board ---- */
.wr .board{margin:18px 0 40px;border-radius:var(--wr-r);
  background:var(--stone);
  border-top:4px solid var(--stone-hi);border-left:4px solid var(--stone-hi);
  border-right:4px solid var(--stone-dk);border-bottom:4px solid var(--stone-dk);
  padding:clamp(12px,1.5vw,20px);box-shadow:0 18px 44px rgba(12,18,34,.16)}
.wr .board-grid{display:grid;grid-template-columns:minmax(0,1fr) 290px 250px;
  gap:14px;align-items:start}
.wr .plate{border-radius:var(--wr-r-sm);background:#b9b9b9;padding:12px;
  border-top:3px solid #e0e0e0;border-left:3px solid #e0e0e0;
  border-right:3px solid #767676;border-bottom:3px solid #767676}
.wr .plate h2{font-size:12px;margin:0 0 10px;font-family:var(--mono);font-weight:700;
  letter-spacing:.06em;text-transform:uppercase;color:#1f1f1f;
  display:flex;align-items:center;justify-content:space-between;gap:8px}
.wr .plate h2 span{color:#4d4d4d;font-weight:600;letter-spacing:0;text-transform:none;font-size:11px}

/* the base picker: ten mascot tiles in one strip, like a character-select row */
.wr .base-strip{display:grid;grid-template-columns:repeat(10,minmax(0,1fr));gap:8px}
.wr .base-tile{cursor:pointer;background:var(--slot);border:2px solid var(--slot-bd);border-radius:8px;
  padding:5px;color:#e8e8e8;text-align:center;display:flex;flex-direction:column;gap:3px;align-items:center}
.wr .base-tile img{width:100%;aspect-ratio:1/1;border-radius:6px;object-fit:cover;display:block;background:#0f0f0f}
.wr .base-tile b{font-size:10.5px;color:#fff;line-height:1.15}
.wr .base-tile small{font-size:9px;color:#a9a9a9;line-height:1.15}
.wr .base-tile[aria-pressed="true"]{border-color:var(--tip-name);box-shadow:0 0 0 2px rgba(217,163,255,.35) inset}

/* centre: the character preview, bounded so the picture is the subject rather than the box */
.wr .stage{background:radial-gradient(120% 90% at 50% 12%,#2a2a2a 0%,#161616 70%);
  border:2px solid var(--slot-bd);border-radius:var(--wr-r-sm);padding:14px;
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px}
.wr .stage-frame{width:220px;height:220px;max-width:100%;border-radius:50%;overflow:hidden;flex:none;
  border:3px solid rgba(217,163,255,.5);background:#0f0f0f;position:relative}
.wr .stage-frame img{width:100%;height:100%;object-fit:cover;display:block}
.wr .stage-frame img.off{display:none}
.wr .stage-frame.is-base{border-style:dashed}
.wr .stage-frame .empty{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;
  font-family:var(--mono);font-size:11px;color:#8a8a8a;text-align:center;padding:14px}
/* an explicit display beats the [hidden] attribute, so hiding needs its own rule */
.wr .stage-frame .empty[hidden]{display:none}
.wr .stage-name{color:#f2f2f2;font-size:13.5px;font-weight:600;text-align:center}
.wr .stage-name small{display:block;font-weight:400;color:#a9a9a9;font-size:11px;margin-top:2px}

/* right: the combine panel, minecraft's craft grid + output */
.wr .craft-row{display:flex;align-items:center;gap:10px;justify-content:center;margin:2px 0 10px}
.wr .craft-grid{display:grid;grid-template-columns:repeat(2,40px);gap:4px}
.wr .craft-slot,.wr .out-slot{width:40px;height:40px;border-radius:6px;background:var(--slot);
  border:2px solid var(--slot-bd);display:flex;align-items:center;justify-content:center;
  font-family:var(--mono);font-size:15px;color:#d9d9d9;overflow:hidden}
.wr .craft-slot img,.wr .out-slot img{width:100%;height:100%;object-fit:cover;display:block}
.wr .out-slot{width:54px;height:54px;font-size:20px;border-color:var(--tip-bd)}
.wr .craft-slot.filled{border-color:var(--stone-hi)}
.wr .arrow{font-size:20px;color:#3a3a3a;font-weight:700}
.wr .craft-note{font-size:11px;color:#2b2b2b;text-align:center;margin:0 0 10px;line-height:1.4}
.wr .btn{display:block;width:100%;border:0;border-radius:8px;padding:12px 14px;cursor:pointer;font-weight:700;
  font-family:var(--mono);font-size:12px;letter-spacing:.04em;text-transform:uppercase;color:#fff;
  background:var(--accent);border-top:3px solid #6f9bff;border-bottom:3px solid #11409e}
.wr .btn:disabled{opacity:.55;cursor:not-allowed}
.wr .btn.ghost{background:#7a7a7a;border-top-color:#a5a5a5;border-bottom-color:#4d4d4d}
.wr .status{margin:9px 0 0;font-size:11.5px;color:#1f1f1f;min-height:15px;line-height:1.4}
.wr .status.err{color:#7a0e1e;font-weight:600}
.wr .status.ok{color:#0b5227;font-weight:600}

/* what is on the character: a column, with the piece's own picture beside its name */
.wr .equip{display:flex;flex-direction:column;gap:5px}
.wr .equip-chip{display:flex;align-items:center;gap:7px;font-size:11px;font-family:var(--mono);
  color:#ececec;background:var(--slot);border:1px solid var(--slot-bd);
  border-radius:8px;padding:4px 8px;min-height:28px}
.wr .equip-chip img{width:20px;height:20px;border-radius:4px;flex:0 0 20px;background:#0f0f0f}
.wr .equip-chip.off{color:#9c9c9c;border-style:dashed;border-color:#5f5f5f;font-size:10.5px}

/* ---- the inventory: small squares, filled with the piece's own picture ---- */
.wr .inv{margin-top:14px}
.wr .tabs{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:10px}
.wr .tab{font-family:var(--mono);font-size:10.5px;letter-spacing:.04em;text-transform:uppercase;cursor:pointer;
  background:#8f8f8f;border:2px solid #6d6d6d;border-radius:6px;color:#f4f4f4;padding:5px 9px}
.wr .tab[aria-pressed="true"]{background:var(--accent);border-color:#11409e;color:#fff}
.wr .inv-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(78px,1fr));gap:8px}
.wr .cell{position:relative;border-radius:7px;background:var(--slot);cursor:pointer;padding:4px;
  border:2px solid var(--slot-bd);border-top-color:var(--slot-hi);display:flex;flex-direction:column;
  align-items:center;gap:2px;color:#eaeaea;overflow:hidden}
.wr .cell:hover{border-color:var(--tip-name)}
.wr .cell img{width:100%;aspect-ratio:1/1;object-fit:contain;display:block}
.wr .cell .nm{font-family:var(--mono);font-size:8.5px;letter-spacing:-.01em;text-align:center;
  line-height:1.15;color:#d4d4d4;height:2.3em;max-width:100%;overflow:hidden;
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow-wrap:anywhere}
.wr .cell .rar{position:absolute;left:5px;top:4px;width:6px;height:6px;border-radius:2px;z-index:1}
.wr .cell[aria-pressed="true"]{box-shadow:0 0 0 2px var(--wr-ok) inset;border-color:var(--wr-ok)}
.wr .cell[aria-pressed="true"]::after{content:"";position:absolute;right:5px;bottom:5px;width:10px;height:10px;
  border-radius:2px;background:var(--wr-ok)}
.wr .cell.empty-slot{cursor:default;opacity:.5}
/* a piece whose picture did not load: the tile keeps its name and shows its initials in the item's
   rarity colour, so the cell never reads as a broken board */
.wr .cell.noart img{display:none}
.wr .cell.noart::before{content:attr(data-initial);font-family:var(--mono);font-size:20px;
  font-weight:700;color:var(--rar);opacity:.85;
  display:flex;align-items:center;justify-content:center;width:100%;aspect-ratio:1/1}

/* ---- the tooltip ---- */
#tip{position:fixed;z-index:60;pointer-events:none;max-width:260px;background:var(--tip);
  border:2px solid var(--tip-bd);border-radius:6px;padding:8px 10px;display:none;
  box-shadow:0 12px 30px rgba(0,0,0,.5)}
#tip .tname{font-size:13.5px;font-weight:600;margin:0 0 2px}
#tip .tsub{font-size:11.5px;color:#b98ae0;margin:0 0 6px}
#tip .tdesc{font-size:11.5px;color:#d9b6f5;font-style:italic;margin:0 0 7px;line-height:1.4}
#tip .tid{font-family:var(--mono);font-size:10px;color:var(--tip-id);margin:0}
#tip .tnbt{font-family:var(--mono);font-size:10px;color:var(--tip-id);margin:2px 0 0}

/* ---- narrower screens: two columns, then one ---- */
@media(max-width:1000px){
  /* preview + compose side by side; what is worn drops under the preview */
  .wr .board-grid{grid-template-columns:minmax(0,1fr) 280px}
  .wr .base-strip{grid-template-columns:repeat(5,minmax(0,1fr))}
  .wr .base-tile b{font-size:11px}
  .wr .base-tile small{font-size:9.5px}
}
@media(max-width:680px){
  .wr .board{padding:12px;margin:14px 0 30px}
  .wr .board-grid{grid-template-columns:minmax(0,1fr);gap:12px}
  .wr .stage-frame{width:190px;height:190px}
  .wr .base-strip{display:flex;overflow-x:auto;scrollbar-width:none;gap:10px;padding-bottom:4px}
  .wr .base-strip::-webkit-scrollbar{display:none}
  .wr .base-tile{flex:0 0 88px}
  .wr .inv-grid{grid-template-columns:repeat(auto-fill,minmax(64px,1fr));gap:6px}
  .wr .cell .nm{font-size:8px}
  .wr .equip{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:5px}
}
