/* Coordinate Simulator — scoped styles for /tmgs4/wardrobe/.
   Reuses the site tokens from style.css (--border, --gold, --pink, --text…). */

/* this page only — hide the character-select sidebar for more room.
   Scoped with :has(#wardrobe) so no other page is affected. */
#layout:has(#wardrobe) .sidebar { display: none; }

.wardrobe { margin-top: .5rem; }
.wd-intro { margin-bottom: 1.25rem; }
.wd-title { font-size: 1.7rem; }
.wd-intro p { max-width: 60ch; color: var(--text-light); }

.wd-loading { padding: 2rem; text-align: center; color: var(--text-light); }

/* ---- layout ---- */
.wd-main {
  display: grid;
  grid-template-columns: 270px 1fr;   /* left: calculator (stats) · right: preview + selector */
  gap: 1.1rem;
  align-items: start;
}
@media (max-width: 820px) { .wd-main { grid-template-columns: 1fr; } }

/* ---- left column: calculator (stats only) ---- */
.wd-calc { display: block; }
/* ---- right column: Preview stacked above the clothing selector ---- */
.wd-stage { display: flex; flex-direction: column; gap: 1rem; }
.wd-preview {
  background: var(--cream); border: 2px solid var(--border); border-radius: 16px;
  padding: .8rem; box-shadow: 0 4px 14px var(--shadow);
}
.wd-coord-head { margin-bottom: .5rem; text-align: center; }
.wd-flatlay {
  display: flex; flex-wrap: wrap; gap: .35rem; justify-content: center; align-content: flex-start;
  min-height: 118px; padding: .4rem;
  background:
    radial-gradient(circle at 18% 20%, rgba(232,130,154,.06), transparent 60%),
    linear-gradient(180deg, #fffdf8, #fdf3e6);
  border: 1.5px dashed var(--border); border-radius: 14px;
}
.wd-piece {
  position: relative; width: 78px; display: flex; flex-direction: column; align-items: center;
  gap: .12rem; padding: .3rem .25rem .35rem; background: var(--white);
  border: 1.5px solid var(--border); border-radius: 10px; box-shadow: 0 2px 6px var(--shadow);
}
.wd-piece.is-default { border-style: dashed; background: linear-gradient(180deg, #fffdf8, #fbf3ff); }
.wd-piece-img { width: 54px; height: 54px; display: flex; align-items: center; justify-content: center; }
.wd-piece-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.wd-noicon {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%; border: 1px dashed var(--border); border-radius: 8px;
  color: var(--text-light); font-size: .58rem; line-height: 1; text-align: center;
  background: #fffaf2;
}
.wd-piece-name { font-size: .62rem; line-height: 1.08; text-align: center; }
.wd-piece .wd-slot-tag { font-size: .46rem; }
.wd-piece-x, .wd-piece-link {
  position: absolute; top: 2px; width: 16px; height: 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: .62rem;
  border: none; cursor: pointer; text-decoration: none;
}
.wd-piece-x { right: 3px; background: var(--pink-light); color: var(--pink-dark); }
.wd-piece-x:hover { background: var(--pink); color: #fff; }
.wd-piece-link { left: 3px; background: var(--pink-light); color: var(--pink-dark); }
.wd-piece-link:hover { background: var(--gold); color: #fff; }
.wd-flatlay-hint { color: var(--text-light); font-size: .76rem; text-align: center; align-self: center; max-width: 24ch; }

/* ---- right column: category-tab browser (the star) ---- */
.wd-browser {
  background: var(--cream); border: 2px solid var(--border);
  border-radius: 16px; padding: .9rem; box-shadow: 0 4px 14px var(--shadow);
}
.wd-tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.wd-tabs { justify-content: center; gap: .25rem; margin-bottom: .5rem; }
.wd-tab {
  display: flex; flex-direction: column; align-items: center; gap: 0;
  flex: 0 1 50px; padding: .2rem .1rem; cursor: pointer; border-radius: 10px;
  border: 1.5px solid transparent; background: transparent;
  font-family: 'Nunito', sans-serif; font-size: .56rem; font-weight: 700; color: var(--text-light);
  transition: background .12s, border-color .12s, transform .1s;
}
.wd-tab img { width: 28px; height: 28px; object-fit: contain; filter: grayscale(.5) opacity(.75); }
.wd-tab-all {
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem; color: var(--text-light); opacity: .75;
}
.wd-tab:hover { background: var(--white); transform: translateY(-1px); }
.wd-tab.on { background: var(--white); border-color: var(--pink); color: var(--pink-dark); }
.wd-tab.on img { filter: none; }
.wd-tab.on .wd-tab-all { color: var(--pink); opacity: 1; }
.wd-tile { position: relative; }
.wd-tile.worn { border-color: var(--pink); box-shadow: 0 0 0 2px var(--pink) inset; }
.wd-tile.worn::after {
  content: "✓"; position: absolute; top: 3px; right: 3px;
  width: 15px; height: 15px; border-radius: 50%; background: var(--pink); color: #fff;
  font-size: .6rem; display: flex; align-items: center; justify-content: center;
}
.wd-browser .wd-grid { max-height: 430px; padding: .3rem .2rem .3rem 0; }

/* ---- dresser / slots (legacy; kept harmless) ---- */
.wd-dresser {
  background: var(--cream);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: 0 4px 14px var(--shadow);
}
.wd-slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: .7rem;
}
.wd-slot {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  padding: .6rem .4rem .7rem;
  background: linear-gradient(180deg, #fffdf8, #fdf4e6);
  border: 2px dashed var(--border);
  border-radius: 14px;
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  color: var(--text);
  transition: border-color .15s, transform .1s, box-shadow .15s;
}
.wd-slot:hover { border-color: var(--pink); transform: translateY(-2px); box-shadow: 0 6px 14px var(--shadow); }
.wd-slot.filled { border-style: solid; background: var(--white); }
.wd-slot.is-default { border-style: dashed; background: linear-gradient(180deg, #fffdf8, #fbf3ff); }
.wd-slot-tag {
  font-size: .6rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  color: var(--purple); background: #f3e6ff; border-radius: 6px; padding: 0 .3rem;
}
.wd-slot.covered { border-style: dashed; background: linear-gradient(180deg, #fffdf8, #f6f1ea); }
.wd-covered { font-size: .66rem; color: var(--text-light); font-style: italic; line-height: 1.2; }
.wd-slot-label {
  font-size: .68rem; letter-spacing: .04em; text-transform: uppercase;
  color: var(--gold-dark); font-weight: 700;
}
.wd-slot-thumb {
  display: flex; align-items: center; justify-content: center;
  width: 84px; height: 84px;
}
.wd-slot-img { max-width: 100%; max-height: 100%; object-fit: contain; }
.wd-slot-empty { font-size: 2rem; color: var(--border); line-height: 1; }
.wd-slot-name {
  font-size: .8rem; text-align: center; line-height: 1.2;
  display: flex; align-items: center; gap: .3rem; min-height: 2.1em;
}
.wd-slot-x {
  position: absolute; top: 4px; right: 6px;
  font-size: .7rem; color: var(--text-light);
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--pink-light);
}
.wd-slot-x:hover { background: var(--pink); color: #fff; }
.wd-slot-link {
  position: absolute; top: 4px; left: 6px;
  font-size: .72rem; color: var(--pink-dark);
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--pink-light);
}
.wd-slot-link:hover { background: var(--gold); color: #fff; }

.wd-sw {
  display: inline-block; width: 11px; height: 11px; border-radius: 50%;
  border: 1px solid rgba(0,0,0,.15); flex: none;
}

/* ---- buttons ---- */
.wd-actions { display: flex; gap: .6rem; margin-top: 1rem; }
.wd-btn {
  flex: 1; padding: .55rem 1rem; border-radius: 10px; cursor: pointer;
  font-family: 'Nunito', sans-serif; font-weight: 700; font-size: .9rem;
  border: 2px solid var(--pink); background: var(--pink); color: #fff;
  transition: filter .12s, transform .1s;
}
.wd-btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.wd-btn-ghost { background: transparent; color: var(--pink-dark); }

/* ---- stats panel ---- */
.wd-panel {
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 1.1rem 1.2rem 1.3rem;
  box-shadow: 0 4px 14px var(--shadow);
}
.wd-status {
  margin-bottom: .9rem; padding: .5rem .7rem; border-radius: 10px;
  font-size: .85rem; font-weight: 700; text-align: center;
}
.wd-status-ok { background: #e3f4d8; color: #4f7a32; border: 1.5px solid #b6e3a7; }
.wd-status-warn { background: #fdeede; color: #b06a28; border: 1.5px solid #f6c39a; }
.wd-status-default { background: var(--pink-light); color: var(--pink-dark); border: 1.5px solid #f2c4d4; }
.wd-sense { display: flex; align-items: baseline; gap: .6rem; }
.wd-sense-num {
  font-family: 'MaruGothic', 'Nunito', sans-serif;
  font-size: 2.6rem; line-height: 1; color: var(--pink-dark);
}
.wd-sense-cap { font-weight: 700; color: var(--text); }
.wd-sense-cap small { display: block; font-weight: 400; color: var(--text-light); font-size: .68rem; }
.wd-rank { display: block; margin: .6rem 0 1rem; font-size: .82rem; color: var(--text-light); }
.wd-rank-hint { display: block; margin-top: .25rem; font-size: .7rem; color: var(--text-light); font-style: italic; }
.wd-rank select, .wd-filters select, .wd-filters input {
  font-family: 'Nunito', sans-serif; font-size: .82rem;
  padding: .25rem .4rem; border: 1.5px solid var(--border);
  border-radius: 8px; background: var(--cream); color: var(--text);
}

/* fixed-size box so swapping logo / badge / "no style" never reflows the panel */
.wd-styles { display: flex; align-items: center; justify-content: center; height: 66px; margin-bottom: .5rem; }
.wd-style-img { max-height: 56px; width: auto; filter: drop-shadow(0 1px 2px var(--shadow)); }
.wd-styles .wd-dim { font-size: 1.05rem; } /* "No distinct style yet" placeholder */
/* text-badge fallback for styles with no game logo (Natural/Sexy base, Danger) */
.wd-badge.wd-style-base, .wd-badge.wd-style-ultra, .wd-badge.wd-style-combo {
  background: var(--pink-light); color: var(--pink-dark); border: 1.5px solid var(--pink);
  font-size: .95rem; padding: .25rem .8rem;
}
.wd-style-natural { background: #e3f2d6 !important; color: #4f7a32 !important; border-color: #9fce7a !important; }
.wd-style-sexy { background: #fde0e6 !important; color: #c03b5e !important; border-color: #ec9bb0 !important; }
.wd-style-ultra { letter-spacing: .02em; }
.wd-badge.wd-style-danger {
  background: repeating-linear-gradient(45deg, #fff0d8, #fff0d8 7px, #ffe2b8 7px, #ffe2b8 14px);
  color: #b3402a; border: 2px solid #e06a48; font-weight: 800; font-size: 1rem;
  padding: .3rem .9rem; text-transform: uppercase; letter-spacing: .06em;
}
.wd-clash-note { display: block; text-align: center; font-size: .72rem; color: #b3402a; margin: -.2rem 0 .8rem; }
.wd-badge {
  padding: .2rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 700;
  background: var(--gold-light); color: var(--gold-dark); border: 1px solid var(--gold);
}
.wd-badge-vibe { background: var(--pink-light); color: var(--pink-dark); border-color: var(--pink); }
.wd-dim { color: var(--text-light); font-size: .82rem; }

/* attribute bars */
/* vertical bar graph (matches the catalogue), in the game's per-attribute colours */
.wd-attrs { display: flex; gap: .35rem; align-items: flex-end; justify-content: space-between; margin-bottom: 1.1rem; }
.wd-attr { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.wd-attr-n { font-size: .82rem; font-weight: 800; color: var(--text); line-height: 1; font-variant-numeric: tabular-nums; }
.wd-attr-bar { width: 15px; height: 64px; background: #e7ddd0; border-radius: 5px; display: flex; align-items: flex-end; overflow: hidden; box-shadow: inset 0 1px 2px rgba(120,90,50,.18); }
.wd-attr-fill { width: 100%; background: var(--ac); border-radius: 5px; min-height: 0; transition: height .25s ease; }
.wd-attr-l { font-size: .62rem; color: var(--text-light); }

/* Fashion level — labelled stepper + clickable stars */
.wd-fashlv-wrap { margin: .55rem 0 1rem; display: flex; flex-direction: column; align-items: center; }
.wd-fashlv-label { display: block; font-size: .82rem; font-weight: 700; color: var(--text); margin-bottom: .3rem; }
.wd-tap { font-weight: 400; color: var(--pink-dark); font-size: .74rem; }
.wd-fashlv {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .3rem .45rem; border: 1.5px solid var(--pink); border-radius: 999px; background: var(--cream);
}
.wd-lv-step {
  width: 26px; height: 26px; flex: none; border: 1.5px solid var(--pink); background: #fff;
  color: var(--pink-dark); border-radius: 50%; cursor: pointer; font-weight: 800; font-size: 1.1rem;
  line-height: 1; display: flex; align-items: center; justify-content: center; transition: background .12s;
}
.wd-lv-step:hover:not([disabled]) { background: var(--pink); color: #fff; }
.wd-lv-step[disabled] { opacity: .3; cursor: default; }
.wd-stars { display: flex; gap: 1px; }
.wd-star {
  width: 24px; height: 24px; border: none; padding: 0; cursor: pointer;
  background: transparent center / contain no-repeat url(/assets/clothes/fashion/lv_star.png);
  filter: grayscale(1) brightness(1.05) opacity(.45); /* visible grey empty star */
  transition: filter .12s, transform .1s;
}
.wd-star.on { filter: none; }
.wd-star:hover { transform: scale(1.18); }
.wd-lv-num { font-size: .82rem; color: var(--pink-dark); font-weight: 800; min-width: 2.6em; text-align: center; }

/* WARM sweater (centered above) + full-width season strip */
.wd-season { margin-bottom: 1rem; }
.wd-warm { text-align: center; margin-bottom: .45rem; }
.wd-warm-img { width: 44px; height: 44px; object-fit: contain; }
.wd-months { display: grid; grid-template-columns: repeat(12, 1fr); gap: 2px; }
.wd-month {
  aspect-ratio: 1 / 1.4; border-radius: 4px; display: flex;
  align-items: flex-end; justify-content: center; padding-bottom: 1px; overflow: hidden;
}
.wd-month small { font-size: .5rem; color: rgba(0,0,0,.5); }
.wd-proper { background: #b6e3a7; }
.wd-cold   { background: #bcdcf5; }
.wd-hot    { background: #f6c39a; }
.wd-legend { display: flex; gap: .8rem; margin-top: .4rem; font-size: .7rem; color: var(--text-light); }
.wd-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 2px; vertical-align: -1px; }

.wd-price {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: .8rem; border-top: 1.5px dashed var(--border);
}
.wd-price-num { font-weight: 800; color: var(--gold-dark); font-size: 1.05rem; }

/* ---- picker modal ---- */
.wd-picker {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(92, 74, 58, .35);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
/* class display rules beat the UA [hidden] rule, so restore it explicitly */
.wd-picker[hidden], .wd-main[hidden] { display: none; }
.wd-picker-box {
  background: var(--cream); border: 2px solid var(--border); border-radius: 18px;
  width: min(720px, 100%); max-height: 85vh; display: flex; flex-direction: column;
  box-shadow: 0 12px 40px rgba(120, 90, 50, .3);
}
.wd-picker-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: .9rem 1.1rem; border-bottom: 1.5px solid var(--border);
}
.wd-picker-close {
  border: none; background: var(--pink-light); color: var(--pink-dark);
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: .85rem;
}
.wd-picker-close:hover { background: var(--pink); color: #fff; }
.wd-filters { display: flex; flex-wrap: wrap; gap: .4rem; padding: 0 .2rem .6rem; }
.wd-filters #wd-f-q { flex: 1 1 130px; }
.wd-filters select, .wd-filters input { font-size: .76rem; padding: .25rem .4rem; }

.wd-grid {
  overflow-y: auto; padding: .2rem .2rem .2rem 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: .4rem;
}
.wd-tile {
  display: flex; flex-direction: column; align-items: center; gap: .15rem;
  padding: .35rem .25rem .4rem; background: var(--white);
  border: 1.5px solid var(--border); border-radius: 10px; cursor: pointer;
  font-family: 'Nunito', sans-serif; color: var(--text); text-align: center;
  transition: border-color .12s, transform .1s, box-shadow .12s;
}
.wd-tile:hover { border-color: var(--pink); transform: translateY(-2px); box-shadow: 0 4px 10px var(--shadow); }
.wd-tile-img { width: 50px; height: 50px; display: flex; align-items: center; justify-content: center; }
.wd-tile-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.wd-tile-name {
  font-size: .6rem; line-height: 1.1; min-height: 2.1em;
  display: flex; align-items: center; justify-content: center; gap: .2rem; flex-wrap: wrap;
}
.wd-tile-name .wd-sw { width: 8px; height: 8px; }

/* ---- appearance modes ---- */
html[data-theme="dark"] .wd-preview,
html[data-theme="dark"] .wd-browser,
html[data-theme="dark"] .wd-dresser,
html[data-theme="dark"] .wd-panel,
html[data-theme="dark"] .wd-picker-box,
html[data-theme="dark"] .wd-tile,
html[data-theme="dark"] .wd-piece,
html[data-theme="dark"] .wd-slot.filled {
  background: var(--white);
}

html[data-theme="dark"] .wd-flatlay,
html[data-theme="dark"] .wd-slot,
html[data-theme="dark"] .wd-piece.is-default,
html[data-theme="dark"] .wd-slot.is-default,
html[data-theme="dark"] .wd-slot.covered {
  background:
    radial-gradient(circle at 18% 20%, rgba(238,140,164,.08), transparent 60%),
    linear-gradient(180deg, color-mix(in srgb, var(--white) 90%, var(--cream)), var(--cream));
}

html[data-theme="dark"] .wd-rank select,
html[data-theme="dark"] .wd-filters select,
html[data-theme="dark"] .wd-filters input,
html[data-theme="dark"] .wd-fashlv,
html[data-theme="dark"] .wd-lv-step {
  background: var(--cream);
  color: var(--text);
}

html[data-theme="dark"] .wd-attr-bar {
  background: #3c332d;
}

html[data-theme="dark"] .wd-picker {
  background: rgba(0, 0, 0, .55);
}

/* ---- mobile ---- */
@media (max-width: 820px) {
  .wd-main {
    gap: .85rem;
  }

  .wd-calc {
    order: 0;
  }

  .wd-stage {
    order: 1;
    gap: .85rem;
  }

  .wd-preview,
  .wd-browser,
  .wd-panel {
    border-radius: 10px;
    padding: .75rem;
  }

  .wd-tabs {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: .3rem;
    scrollbar-width: thin;
  }

  .wd-tab {
    flex: 0 0 58px;
    min-height: 52px;
    padding: .28rem .14rem;
  }

  .wd-browser .wd-grid {
    max-height: none;
  }

  .wd-filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .45rem;
    padding: 0 0 .65rem;
  }

  .wd-filters #wd-f-q {
    grid-column: 1 / -1;
  }

  .wd-filters select,
  .wd-filters input {
    width: 100%;
    min-height: 38px;
    font-size: .82rem;
  }

  .wd-grid {
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    gap: .45rem;
    padding-right: 0;
  }

  .wd-tile {
    min-height: 104px;
    padding: .45rem .3rem;
  }

  .wd-tile-img {
    width: 56px;
    height: 56px;
  }

  .wd-tile-name {
    font-size: .62rem;
  }

  .wd-actions {
    gap: .45rem;
  }

  .wd-btn {
    min-height: 40px;
    padding: .55rem .65rem;
  }

  .wd-months {
    gap: 3px;
  }

  .wd-month small {
    font-size: .48rem;
  }
}

@media (max-width: 430px) {
  .wd-title {
    font-size: 1.3rem;
  }

  .wd-flatlay {
    min-height: 86px;
  }

  .wd-piece {
    width: 58px;
  }

  .wd-piece-img {
    width: 38px;
    height: 38px;
  }

  .wd-filters {
    grid-template-columns: 1fr;
  }

  .wd-grid {
    grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  }

  .wd-sense-num {
    font-size: 2.25rem;
  }

  .wd-attrs {
    gap: .2rem;
  }

  .wd-attr-bar {
    width: 13px;
  }
}
