/* KURO ELEVEN interactive paper-doll layer system.
   This file only overrides the existing Dress-up Game window. */

.dressup-canvas,
.dressup-render {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.dressup-canvas {
  z-index: 1;
  overflow: hidden;
}

.dressup-render {
  display: block;
  object-fit: contain;
  object-position: center bottom;
  pointer-events: none;
  user-select: none;
}

.character-stage > #b-look-caption,
.character-stage > .selected-stamp {
  z-index: 120;
}

.look-tabs {
  min-width: 0;
  overflow: hidden;
}

.look-tabs button {
  cursor: pointer;
}

.look-tabs button span {
  overflow-wrap: anywhere;
}

.inventory-panel {
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
}

.item-tabs {
  display: grid;
  flex: 0 0 auto;
  max-height: 96px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin-top: 3px;
  overflow-y: auto;
}

.item-tabs button {
  display: flex;
  min-width: 0;
  height: 31px;
  padding: 1px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
}

.item-tabs button small {
  display: block;
  margin-top: 2px;
  color: #111;
  font: 5px Arial, sans-serif;
}

.item-tabs button.active {
  border-style: inset;
  background: #baff00;
  color: #111;
}

.inventory-slots {
  flex: 1 1 auto;
  display: grid;
  min-height: 0;
  margin-top: 4px;
  padding: 2px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  overflow-x: hidden;
  overflow-y: auto;
  background: repeating-linear-gradient(135deg, #fff8db 0 8px, #ffe0ef 8px 10px);
  scrollbar-color: #ff1493 #fff500;
}

.inventory-slots .dressup-item {
  position: relative;
  display: block;
  min-width: 0;
  height: 88px;
  padding: 1px;
  border: 2px outset #fff;
  background: #fffdf0;
  cursor: pointer;
  overflow: hidden;
}

.inventory-slots .dressup-item img {
  display: block;
  width: 100%;
  height: 62px;
  border: 0;
  outline: 0;
  object-fit: contain;
  filter: none;
}

.inventory-slots .dressup-item span {
  display: block;
  height: 18px;
  margin-top: 1px;
  overflow: hidden;
  color: #111;
  font: 5px/1.15 Arial, sans-serif;
  text-align: center;
}

.inventory-slots .dressup-item-delete {
  position: absolute;
  top: 1px;
  right: 1px;
  z-index: 2;
  width: 14px;
  height: 14px;
  background: #111;
  color: #fff;
  font: bold 13px/14px Arial, sans-serif;
  text-align: center;
  cursor: pointer;
}

.inventory-slots .dressup-item-delete:hover {
  background: #d00;
}

.inventory-slots .dressup-item.selected {
  border-style: inset;
  outline: 3px solid #baff00;
  background: #ff79bd;
  box-shadow: 2px 2px 0 #111;
}

.inventory-slots .dressup-item.selected::after {
  content: "ON";
  position: absolute;
  top: 1px;
  right: 1px;
  padding: 2px;
  background: #111;
  color: #baff00;
  font: bold 6px Arial, sans-serif;
}

.inventory-slots .skin-swatch {
  position: relative;
  display: flex;
  min-width: 0;
  height: 88px;
  padding: 6px 4px 4px;
  border: 2px outset #fff;
  background: #fffdf0;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.inventory-slots .skin-swatch i {
  display: block;
  width: 42px;
  height: 42px;
  border: 2px solid #111;
  background: var(--skin-swatch-color);
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, .35), 2px 2px 0 #ff1493;
}

.inventory-slots .skin-swatch span {
  color: #111;
  font: bold 7px/1 Arial, sans-serif;
  letter-spacing: .02em;
}

.inventory-slots .skin-swatch.selected {
  border-style: inset;
  outline: 3px solid #baff00;
  background: #ff79bd;
  box-shadow: 2px 2px 0 #111;
}

.inventory-slots .skin-swatch.selected::after {
  content: "ON";
  position: absolute;
  top: 1px;
  right: 1px;
  padding: 2px;
  background: #111;
  color: #baff00;
  font: bold 6px Arial, sans-serif;
}

.inventory-slots .skin-color-editor {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 5px;
  border: 2px solid #111;
  background: #ffef42;
  box-shadow: inset 2px 2px 0 #fff, 2px 2px 0 #ff1493;
}

.inventory-slots .skin-color-editor label {
  display: grid;
  min-width: 0;
  gap: 2px;
  color: #111;
  font: bold 7px/1 Arial, sans-serif;
}

.inventory-slots .skin-color-editor input,
.inventory-slots .skin-color-editor button {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 28px;
  border: 2px solid #111;
  border-radius: 0;
  background: #fff;
  color: #111;
  font: bold 7px/1 Arial, sans-serif;
}

.inventory-slots .skin-color-editor input[type="color"] {
  padding: 1px;
  cursor: pointer;
}

.inventory-slots .skin-color-editor input[aria-invalid="true"] {
  outline: 3px solid #f00;
}

.inventory-slots .skin-color-editor button {
  padding: 2px;
  background: #baff00;
  cursor: pointer;
}

.inventory-empty {
  grid-column: 1 / -1;
  margin: 8px !important;
  padding: 20px 3px !important;
  border: 2px dashed #ff1493;
  background: #fff !important;
  color: #111 !important;
  text-align: center;
}

.inventory-panel #b-item-status {
  flex: 0 0 auto;
  margin: 4px 0 0;
  min-height: 28px;
}

.game-controls .b-done {
  background: #ffef42;
}

.game-controls .b-hood-toggle {
  background: #fff !important;
  color: #111 !important;
  font-weight: 900;
}

.game-controls .b-hood-toggle.active {
  background: #baff00 !important;
  box-shadow: inset 2px 2px 0 #111 !important;
}

.game-controls .b-hood-toggle[hidden] {
  display: none !important;
}

/* Background picker: keep the existing controls and events, but give the
   * background library its own readable, scrollable thumbnail panel. */
.inventory-slots:has(.dressup-background-tools) {
  display: block;
  position: absolute;
  z-index: 150;
  top: 0;
  left: calc(100% + 8px);
  width: 220px;
  height: auto;
  min-height: 0;
  margin: 0;
  overflow: visible;
  padding: 5px;
  border: 2px solid #111;
  background: #fff8db;
  box-shadow: 5px 5px 0 #ff1493;
}

.inventory-panel:has(.dressup-background-tools) {
  z-index: 140;
  overflow: visible;
}

.dressup-background-tools {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 5px;
}

.dressup-background-tools > label {
  display: flex;
  min-height: 30px;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 4px 6px;
  border: 2px solid #111;
  background: #baff00;
  color: #111;
  font: bold 8px/1 Arial, sans-serif;
}

.dressup-background-tools > label input[type="file"] {
  min-width: 0;
  max-width: 62%;
  font: 7px Arial, sans-serif;
}

.dressup-background-adjust {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  align-items: end;
}

.dressup-background-adjust label,
.dressup-background-adjust button {
  box-sizing: border-box;
  min-width: 0;
  min-height: 28px;
  padding: 3px;
  border: 2px solid #111;
  background: #fff;
  color: #111;
  font: bold 7px/1 Arial, sans-serif;
}

.dressup-background-adjust label {
  display: grid;
  gap: 2px;
}

.dressup-background-adjust input {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 20px;
  border: 1px solid #111;
  font: 8px Arial, sans-serif;
}

.dressup-background-adjust button {
  cursor: pointer;
  background: #ffef42;
}

.dressup-background-list {
  display: grid;
  min-height: 280px;
  height: 300px;
  max-height: 300px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 155px;
  align-content: start;
  gap: 6px;
  padding: 5px;
  overflow-x: hidden;
  overflow-y: auto;
  border: 2px solid #111;
  background: #111;
  scrollbar-color: #ff1493 #fff500;
}

.dressup-background-item {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 155px;
  padding: 4px;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  border: 3px solid #fff;
  background: #fffdf0;
  color: #111;
  cursor: pointer;
  font: bold 8px/1.15 Arial, sans-serif;
  text-align: center;
}

.dressup-background-thumb {
  display: flex;
  width: 100%;
  height: 120px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid #111;
  background: #eee;
  color: #111;
  font: bold 9px Arial, sans-serif;
}

.dressup-background-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dressup-background-item.selected {
  border: 3px solid #ff1493 !important;
  outline: 3px solid #baff00;
  background: #ff79bd !important;
  box-shadow: 2px 2px 0 #fff;
}

.dress-game[data-look-complete="true"] .character-stage {
  outline: 4px solid #baff00;
  outline-offset: -7px;
}

.dress-game[data-dressup-error="true"] .inventory-panel {
  opacity: .55;
}

@media (max-width: 700px) {
  .dress-game {
    height: 971px !important;
  }

  .game-layout {
    display: grid !important;
    height: 846px !important;
    grid-template-columns: 86px minmax(0, 1fr) !important;
    grid-template-rows: 568px 270px;
    gap: 4px;
  }

  .look-tabs {
    grid-column: 1;
    grid-row: 1;
    height: 560px;
    overflow-y: auto;
  }

  .look-tabs > b {
    position: sticky;
    top: 0;
    z-index: 2;
    font-size: 6px;
  }

  .look-tabs button {
    display: grid;
    width: 78px;
    height: 161px;
    margin: 5px 0;
    padding: 2px;
    grid-template-columns: 1fr;
  }

  .look-tabs img {
    width: 70px;
    height: 128px;
  }

  .character-stage {
    grid-column: 2;
    grid-row: 1;
    height: 560px !important;
  }

  .inventory-panel {
    grid-column: 1 / 3;
    grid-row: 2;
    height: 270px !important;
    padding: 3px;
  }

  .item-tabs {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 2px;
  }

  .item-tabs button {
    min-height: 44px;
    height: 44px;
    font-size: 7px;
  }

  .inventory-slots {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow-x: hidden;
    overflow-y: auto;
  }

  .inventory-slots .dressup-item {
    min-height: 86px;
    height: 86px;
  }

  .inventory-slots .dressup-item img {
    width: 100%;
    height: 60px;
  }

  .inventory-panel #b-item-status {
    min-height: 24px;
    margin-top: 3px;
  }

  .game-controls {
    height: 62px;
    overflow-x: auto;
  }

  .game-controls button,
  .game-controls a {
    min-width: 0;
    height: 46px;
    padding: 2px;
    flex: 1 1 0;
    font-size: 6px;
    text-align: center;
  }

  .game-controls strong {
    min-width: 42px;
    margin-left: 0;
    flex: 0 0 42px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dressup-render { animation: none; }
}
.b-delete-look-dialog{position:fixed;z-index:9999;inset:0;display:grid;place-items:center;padding:12px;background:rgba(0,0,0,.55);color:#111;font:11px "Courier New",monospace}.b-delete-look-dialog[hidden]{display:none!important}.b-delete-look-dialog form{width:min(310px,calc(100vw - 24px));margin:0;padding:12px;border:5px outset #fff;background:#fff6dc;box-shadow:5px 5px 0 #111}.b-delete-look-dialog strong{display:block;padding:5px;background:#111;color:#baff00}.b-delete-look-dialog p{margin:10px 0}.b-delete-look-dialog form>div{display:flex;justify-content:flex-end;gap:7px}.b-delete-look-dialog button{min-width:76px;padding:6px;border:3px outset #fff;background:#fff;font:bold 10px "Courier New",monospace}.b-delete-look-dialog [data-confirm-delete-look]{background:#ff1493;color:#fff}.b-delete-look-dialog button:active{border-style:inset}
.dress-game{border:1px solid #111!important;box-shadow:5px 5px 0 #ff1493!important;background:#fffce8!important}.game-title{border-bottom:1px solid #111!important;background:linear-gradient(90deg,#ff1493,#9d38ff 55%,#315cff)!important;color:#fff!important;font-family:Tahoma,"MS Sans Serif",sans-serif!important}.game-status{border-bottom:1px solid #111!important;background:#111!important;color:#baff00!important}.game-layout{background:repeating-linear-gradient(45deg,#ffd4ee 0 12px,#fff 12px 24px)!important}.look-tabs,.inventory-panel{border:1px solid #111!important;background:#fffce8!important}.look-tabs button,.inventory-slots button,.game-controls button,.game-controls a{border:1px solid #111!important;background:linear-gradient(#fff,#fff69e 45%,#baff00 50%,#ecff9b)!important;box-shadow:2px 2px 0 #111!important;color:#111!important}.look-tabs button:nth-child(2n),.inventory-slots button:nth-child(2n){background:linear-gradient(#fff,#c6ffff 45%,#19dfe8 50%,#a6ffff)!important}.look-tabs button.is-active,.inventory-slots button.is-active{background:linear-gradient(#fff,#e8caff 45%,#9d38ff 50%,#e5c6ff)!important}.character-stage{border:1px solid #111!important;background:#fff!important}.inventory-panel>b,.look-tabs>b{border:1px solid #111!important;background:#111!important;color:#baff00!important}.game-controls{border-top:1px solid #111!important;background:#ffb7e2!important}
