/*
 * Growtopia Clothing Planner — Clean Phase 21 foundation
 * Structural consolidation only. Rule order is preserved exactly.
 */

/* ===== Original source: app.css ===== */
@font-face {
  font-family: "Planner Century Gothic";
  src:
    local("Century Gothic Bold"),
    local("CenturyGothic-Bold"),
    url("../assets/fonts/CenturyGothic-Bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Planner Century Gothic";
  src:
    local("Century Gothic Bold"),
    local("CenturyGothic-Bold"),
    url("../assets/fonts/CenturyGothic-Bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 800;
  font-display: swap;
}

@font-face {
  font-family: "Planner Century Gothic";
  src:
    local("Century Gothic Bold"),
    local("CenturyGothic-Bold"),
    url("../assets/fonts/CenturyGothic-Bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --page-background: #000000;
  --gt-panel: #277d9f;
  --gt-border: #7bbad2;
  --gt-shadow: #000000;
  --gt-text: #ffffff;
  --gt-muted: #aeb8bd;
  --drawer-height: 360px;
  --action-width: 124px;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  overflow: visible;
  background: var(--page-background);
  color: var(--gt-text);
  font-family: "Planner Century Gothic", "Century Gothic", "AppleGothic", Arial, Helvetica, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

input:focus,
input:focus-visible,
select:focus,
select:focus-visible,
textarea:focus,
textarea:focus-visible {
  outline: none;
  outline-offset: 0;
}

.planner-shell {
  position: relative;
  width: 100vw;
  min-height: 100dvh;
}

.gt-window {
  border: 3px solid var(--gt-border);
  border-radius: 2px;
  background: var(--gt-panel);
  box-shadow:
    inset 2px 2px 0 var(--gt-shadow),
    2px 2px 0 var(--gt-shadow);
}

.gt-button {
  width: max-content;
  min-width: 0;
  padding: 2px;
  border: 0;
  border-radius: 2px;
  background: var(--gt-border);
  color: #ffffff;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.15;
  text-transform: uppercase;
  text-shadow: 1px 1px 0 #000000;
  box-shadow: 2px 2px 0 #000000;
  cursor: pointer;
}

.gt-button:hover:not(:disabled) {
  filter: brightness(1.08);
}

.gt-button:active:not(:disabled) {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 #000000;
}

.gt-button:disabled {
  opacity: 0.42;
  cursor: default;
}

.topbar {
  position: fixed;
  z-index: 20;
  inset: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) auto max(12px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.brand {
  margin: 0;
  font-size: clamp(16px, 2.4vw, 22px);
  line-height: 1;
  text-shadow: 1px 1px 0 #000000;
}

.settings-button {
  pointer-events: auto;
  font-size: 18px;
}

.player-workspace {
  position: fixed;
  inset: 58px 0 calc(var(--drawer-height) + 22px);
  display: grid;
  place-items: center;
  padding: 12px;
}

.player-anchor {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 128px;
  min-height: 128px;
}

#playerCanvas {
  display: block;
  width: 256px;
  height: 256px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  opacity: 0;
}

#playerCanvas.is-ready {
  opacity: 1;
}

.loading-label {
  position: absolute;
  margin: 0;
  color: var(--gt-muted);
  font-size: 13px;
  font-weight: 700;
  text-shadow: 1px 1px 0 #000000;
}

.loading-label[hidden] {
  display: none;
}

.renderer-status {
  position: fixed;
  z-index: 4;
  left: 50%;
  bottom: calc(var(--drawer-height) + 8px);
  max-width: calc(100vw - 32px);
  margin: 0;
  color: var(--gt-muted);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  text-shadow: 1px 1px 0 #000000;
  transform: translateX(-50%);
}

.inventory-dock {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: max(10px, env(safe-area-inset-bottom));
  width: min(1180px, calc(100vw - 150px));
  height: var(--drawer-height);
  transform: translateX(-50%);
}

.inventory-tabs {
  position: absolute;
  z-index: 1;
  top: 0;
  left: -108px;
  display: flex;
  width: 120px;
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
}

.inventory-tab {
  min-height: 46px;
  padding: 4px 12px 4px 5px;
  border: 3px solid var(--gt-border);
  border-radius: 2px 0 0 2px;
  background: #226c8a;
  color: #ffffff;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.08;
  text-align: center;
  text-shadow: 1px 1px 0 #000000;
  box-shadow:
    inset 2px 2px 0 #000000,
    2px 2px 0 #000000;
  cursor: pointer;
}

.inventory-tab--tall {
  min-height: 66px;
}

.inventory-tab.is-active {
  background: var(--gt-panel);
  filter: brightness(1.12);
}

.inventory-window {
  position: relative;
  z-index: 2;
  display: grid;
  width: 100%;
  height: 100%;
  grid-template-columns: minmax(0, 1fr) var(--action-width);
  overflow: visible;
}

.inventory-main {
  min-width: 0;
  min-height: 0;
  padding: 10px;
}

.inventory-toolbar {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(110px, 22%);
  align-items: center;
  gap: 9px;
  height: 44px;
  transition: opacity 120ms ease;
}

.inventory-toolbar.is-disabled {
  opacity: 0.38;
}

.search-control {
  display: grid;
  min-width: 0;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
}

.search-icon {
  position: relative;
  display: inline-block;
  width: 26px;
  height: 26px;
  border: 5px solid #ffffff;
  border-radius: 50%;
  filter: drop-shadow(2px 2px 0 #000000);
}

.search-icon::after {
  position: absolute;
  right: -9px;
  bottom: -7px;
  width: 12px;
  height: 5px;
  border-radius: 2px;
  background: #ffffff;
  content: "";
  transform: rotate(48deg);
  transform-origin: left center;
}

.search-icon--small {
  width: 17px;
  height: 17px;
  border-width: 3px;
  filter: none;
}

.search-icon--small::after {
  right: -7px;
  bottom: -5px;
  width: 9px;
  height: 3px;
}

.search-control input,
.filter-box {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 2px 8px;
  border: 3px solid var(--gt-border);
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.22);
  color: #ffffff;
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
  box-shadow:
    inset 2px 2px 0 #000000,
    2px 2px 0 #000000;
}

.search-control input::placeholder {
  color: #a9b0b4;
  opacity: 1;
  text-shadow: none;
}

.search-control input::-webkit-search-cancel-button {
  filter: brightness(2);
}

.filter-control {
  position: relative;
  min-width: 0;
}

.filter-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  text-shadow: 1px 1px 0 #000000;
}

.filter-box:disabled {
  cursor: default;
}

.filter-arrow {
  margin-left: 6px;
  font-size: 15px;
}

.filter-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  right: 0;
  width: min(220px, 70vw);
  max-height: 248px;
  padding: 5px;
  overflow-y: auto;
}

.filter-menu[hidden] {
  display: none;
}

.filter-option {
  display: block;
  width: 100%;
  padding: 6px 7px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
  text-align: left;
  text-shadow: 1px 1px 0 #000000;
  cursor: pointer;
}

.filter-option:hover,
.filter-option[aria-selected="true"] {
  background: var(--gt-border);
}

.inventory-content {
  position: relative;
  height: calc(100% - 44px);
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--gt-border) rgba(0, 0, 0, 0.22);
  scrollbar-width: thin;
}

.inventory-content::-webkit-scrollbar {
  width: 10px;
}

.inventory-content::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.22);
}

.inventory-content::-webkit-scrollbar-thumb {
  border: 2px solid #000000;
  border-radius: 2px;
  background: var(--gt-border);
}

.inventory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(82px, 1fr));
  gap: 8px;
  align-content: start;
  padding: 3px 5px 7px 3px;
}

.inventory-item {
  position: relative;
  display: grid;
  min-width: 0;
  aspect-ratio: 1;
  place-items: center;
  overflow: hidden;
  padding: 5px;
  border: 4px solid #ffffff;
  border-radius: 2px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.07), transparent 44%),
    #174e64;
  box-shadow:
    inset 2px 2px 0 #000000,
    2px 2px 0 #000000;
  cursor: pointer;
}

.inventory-item:hover {
  filter: brightness(1.08);
}

.inventory-item:active {
  transform: translate(1px, 1px);
  box-shadow:
    inset 1px 1px 0 #000000,
    1px 1px 0 #000000;
}

.inventory-item.is-selected::before,
.inventory-item.is-selected::after {
  position: absolute;
  z-index: 4;
  width: 24%;
  height: 24%;
  border-color: #ffdb16;
  content: "";
  pointer-events: none;
}

.inventory-item.is-selected::before {
  top: 1px;
  left: 1px;
  border-top: 5px solid #ffdb16;
  border-left: 5px solid #ffdb16;
}

.inventory-item.is-selected::after {
  right: 1px;
  bottom: 1px;
  border-right: 5px solid #ffdb16;
  border-bottom: 5px solid #ffdb16;
}

.inventory-item.is-info-pulse {
  animation: info-pulse 280ms steps(2, end);
}

@keyframes info-pulse {
  50% {
    filter: brightness(1.45);
  }
}

.item-name-overlay {
  position: absolute;
  z-index: 5;
  top: 0;
  right: 0;
  left: 0;
  display: block;
  max-height: 48%;
  padding: 3px 2px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.5);
  color: #ffffff;
  font-size: clamp(9px, 0.9vw, 13px);
  font-weight: 900;
  line-height: 1.02;
  text-align: center;
  text-overflow: ellipsis;
  opacity: 0;
  pointer-events: none;
}

.inventory-item.is-selected .item-name-overlay {
  opacity: 1;
}

.favorite-mark {
  position: absolute;
  z-index: 6;
  top: 2px;
  right: 3px;
  display: none;
  color: #ffe11d;
  font-size: 17px;
  line-height: 1;
  text-shadow: 1px 1px 0 #000000;
}

.inventory-item.is-favorite .favorite-mark {
  display: block;
}

.inventory-item.is-selected.is-favorite .favorite-mark {
  top: auto;
  bottom: 3px;
}

.inventory-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  color: #ffffff;
  font-size: 16px;
  font-weight: 900;
  text-align: center;
  text-shadow: 1px 1px 0 #000000;
}

.inventory-empty[hidden] {
  display: none;
}

.inventory-actions {
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 19px;
  padding: 10px 8px;
  border-left: 3px solid var(--gt-border);
  background: transparent;
  box-shadow: inset 2px 0 0 #000000;
}

.search-switch {
  width: 88px;
  height: 40px;
  padding: 3px;
  border: 3px solid var(--gt-border);
  border-radius: 2px;
  background: var(--gt-panel);
  box-shadow:
    inset 2px 2px 0 #000000,
    2px 2px 0 #000000;
  cursor: pointer;
}

.search-switch:disabled {
  opacity: 0.38;
  cursor: default;
}

.search-switch-track {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 18px;
  background: #091418;
  box-shadow: inset 2px 2px 0 #000000;
}

.search-switch-knob {
  position: absolute;
  top: 50%;
  left: 3px;
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border-radius: 50%;
  background: #6d7d8f;
  box-shadow: 2px 2px 0 #000000;
  transform: translateY(-50%);
  transition: left 120ms ease, background 120ms ease;
}

.search-switch.is-on .search-switch-knob {
  left: calc(100% - 32px);
  background: #26c932;
}

.inventory-action {
  min-width: 72px;
  font-size: 18px;
}

.inventory-action.is-active {
  background: #4dbb56;
}

.item-glyph {
  position: relative;
  display: block;
  width: 64%;
  height: 64%;
  max-width: 64px;
  max-height: 64px;
  filter: drop-shadow(2px 2px 0 #000000);
  pointer-events: none;
}

.item-glyph::before,
.item-glyph::after {
  position: absolute;
  content: "";
}

.item-glyph--shirt::before {
  inset: 18% 22% 10%;
  border-radius: 3px 3px 6px 6px;
  background: var(--item-accent);
}

.item-glyph--shirt::after {
  top: 22%;
  left: 5%;
  width: 90%;
  height: 27%;
  border-radius: 8px 8px 3px 3px;
  background: var(--item-accent);
}

.item-glyph--pants::before {
  inset: 14% 20% 12%;
  background: var(--item-accent);
  clip-path: polygon(0 0, 100% 0, 91% 100%, 58% 100%, 50% 55%, 42% 100%, 9% 100%);
}

.item-glyph--pants::after {
  top: 18%;
  left: 30%;
  width: 40%;
  height: 7%;
  background: rgba(255, 255, 255, 0.35);
}

.item-glyph--feet::before,
.item-glyph--feet::after {
  bottom: 18%;
  width: 42%;
  height: 28%;
  border-radius: 3px 10px 4px 4px;
  background: var(--item-accent);
}

.item-glyph--feet::before {
  left: 4%;
}

.item-glyph--feet::after {
  right: 4%;
  transform: scaleX(-1);
}

.item-glyph--hair::before {
  inset: 10% 8% 20%;
  border-radius: 48% 52% 38% 40%;
  background: var(--item-accent);
  clip-path: polygon(5% 42%, 15% 13%, 31% 22%, 46% 4%, 60% 20%, 79% 7%, 95% 39%, 84% 83%, 65% 68%, 50% 95%, 35% 69%, 15% 87%);
}

.item-glyph--hat::before {
  top: 16%;
  left: 24%;
  width: 52%;
  height: 48%;
  border-radius: 5px 5px 2px 2px;
  background: var(--item-accent);
}

.item-glyph--hat::after {
  top: 58%;
  left: 5%;
  width: 90%;
  height: 16%;
  border-radius: 8px;
  background: var(--item-accent);
}

.item-glyph--face::before,
.item-glyph--face::after {
  top: 29%;
  width: 36%;
  height: 34%;
  border: 6px solid var(--item-accent);
  border-radius: 50%;
}

.item-glyph--face::before {
  left: 7%;
}

.item-glyph--face::after {
  right: 7%;
  box-shadow: -18px 1px 0 -15px var(--item-accent);
}

.item-glyph--hand::before {
  top: 45%;
  left: 4%;
  width: 92%;
  height: 14%;
  border-radius: 6px;
  background: var(--item-accent);
  transform: rotate(-38deg);
}

.item-glyph--hand::after {
  top: 7%;
  right: 8%;
  width: 25%;
  height: 31%;
  border: 5px solid var(--item-accent);
  border-radius: 4px;
  transform: rotate(-38deg);
}

.item-glyph--neck::before {
  inset: 10% 8% 20%;
  border-right: 6px solid var(--item-accent);
  border-bottom: 6px solid var(--item-accent);
  border-left: 6px solid var(--item-accent);
  border-radius: 0 0 50% 50%;
}

.item-glyph--neck::after {
  bottom: 10%;
  left: 39%;
  width: 22%;
  height: 22%;
  background: var(--item-accent);
  transform: rotate(45deg);
}

.item-glyph--back::before,
.item-glyph--back::after {
  top: 12%;
  width: 45%;
  height: 70%;
  border-radius: 70% 20% 70% 20%;
  background: var(--item-accent);
}

.item-glyph--back::before {
  left: 4%;
  transform: rotate(-16deg);
}

.item-glyph--back::after {
  right: 4%;
  transform: scaleX(-1) rotate(-16deg);
}

.item-glyph--dye::before,
.item-glyph--drops::before {
  inset: 20% 24% 8%;
  border-radius: 8px 8px 4px 4px;
  background: var(--item-accent);
}

.item-glyph--dye::after,
.item-glyph--drops::after {
  top: 5%;
  left: 35%;
  width: 30%;
  height: 23%;
  border-radius: 3px 3px 0 0;
  background: #d9e3e8;
}

.item-glyph--drops::before {
  clip-path: polygon(50% 0, 100% 55%, 85% 88%, 50% 100%, 15% 88%, 0 55%);
}

.item-glyph--iris::before {
  inset: 12%;
  border: 8px solid var(--item-accent);
  border-radius: 50%;
  background: #f7fbfd;
  box-shadow: inset 0 0 0 7px #111111;
}

.item-glyph--iris::after {
  top: 39%;
  left: 39%;
  width: 22%;
  height: 22%;
  border-radius: 50%;
  background: #ffffff;
}

.item-glyph--skin::before {
  inset: 9% 15%;
  border-radius: 8px 8px 13px 13px;
  background: var(--item-accent);
}

.item-glyph--skin::after {
  top: 30%;
  left: 28%;
  width: 10%;
  height: 10%;
  border-radius: 50%;
  background: #1e1e1e;
  box-shadow: 22px 0 0 #1e1e1e;
}

.item-glyph--background::before {
  inset: 8%;
  border: 5px solid #ffffff;
  border-radius: 3px;
  background: var(--item-accent);
}

.settings-panel {
  position: fixed;
  z-index: 40;
  top: max(54px, calc(env(safe-area-inset-top) + 50px));
  right: max(12px, env(safe-area-inset-right));
  width: min(360px, calc(100vw - 24px));
  padding: 11px;
}

.settings-panel[hidden] {
  display: none;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 17px;
  text-shadow: 1px 1px 0 #000000;
}

.close-button {
  min-width: 26px;
  font-size: 22px;
  line-height: 1;
}

.control-group {
  display: grid;
  grid-template-columns: 86px 44px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  margin-top: 8px;
}

.control-group label,
.alpha-row label {
  font-size: 12px;
  font-weight: 900;
  text-shadow: 1px 1px 0 #000000;
}

input[type="color"] {
  width: 44px;
  height: 34px;
  padding: 2px;
  border: 3px solid var(--gt-border);
  border-radius: 2px;
  background: transparent;
  box-shadow:
    inset 2px 2px 0 #000000,
    2px 2px 0 #000000;
}

input[type="text"],
input[type="number"] {
  min-width: 0;
  height: 34px;
  padding: 2px 6px;
  border: 3px solid var(--gt-border);
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.22);
  color: #ffffff;
  font-weight: 800;
  box-shadow:
    inset 2px 2px 0 #000000,
    2px 2px 0 #000000;
}

input[type="text"] {
  width: 100%;
  text-transform: uppercase;
}

.alpha-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  margin-top: 8px;
}

.alpha-row input {
  width: 100%;
}

.rgb-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 7px;
  margin: 11px 0 0;
  padding: 8px;
  border: 3px solid var(--gt-border);
  border-radius: 2px;
  box-shadow:
    inset 2px 2px 0 #000000,
    2px 2px 0 #000000;
}

.rgb-control legend {
  padding: 0 4px;
  font-size: 12px;
  font-weight: 900;
  text-shadow: 1px 1px 0 #000000;
}

.rgb-control label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 900;
  text-shadow: 1px 1px 0 #000000;
}

.rgb-control input {
  width: 100%;
}

.rgb-control output {
  align-self: center;
  font-size: 12px;
  font-weight: 900;
  text-shadow: 1px 1px 0 #000000;
}

.reset-button {
  margin-top: 12px;
  font-size: 15px;
}

@media (max-width: 900px) {
  :root {
    --drawer-height: 330px;
    --action-width: 96px;
  }

  .inventory-dock {
    width: calc(100vw - 124px);
  }

  .inventory-tabs {
    left: -91px;
    width: 102px;
  }

  .inventory-tab {
    min-height: 42px;
    padding-right: 11px;
    font-size: 10px;
  }

  .inventory-tab--tall {
    min-height: 61px;
  }

  .inventory-grid {
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 7px;
  }

  .inventory-actions {
    gap: 16px;
    padding-inline: 5px;
  }

  .search-switch {
    width: 74px;
  }

  .inventory-action {
    min-width: 60px;
    font-size: 15px;
  }
}

@media (max-width: 680px) {
  :root {
    --drawer-height: 276px;
    --action-width: 74px;
  }

  .topbar {
    inset-inline: 8px;
  }

  .brand {
    max-width: 190px;
    font-size: 15px;
  }

  .settings-button {
    font-size: 15px;
  }

  .player-workspace {
    inset: 48px 0 calc(var(--drawer-height) + 12px);
    padding: 4px;
  }

  .renderer-status {
    display: none;
  }

  .inventory-dock {
    left: auto;
    right: 7px;
    width: calc(100vw - 68px);
    transform: none;
  }

  .inventory-tabs {
    left: -56px;
    width: 64px;
    gap: 4px;
  }

  .inventory-tab {
    min-height: 38px;
    padding: 3px 8px 3px 2px;
    border-width: 2px;
    font-size: 8px;
  }

  .inventory-tab--tall {
    min-height: 56px;
  }

  .inventory-window {
    grid-template-columns: minmax(0, 1fr) var(--action-width);
    border-width: 2px;
  }

  .inventory-main {
    padding: 6px;
  }

  .inventory-toolbar {
    grid-template-columns: minmax(0, 1fr) 78px;
    gap: 5px;
    height: 39px;
  }

  .search-control {
    grid-template-columns: 23px minmax(0, 1fr);
    gap: 4px;
  }

  .search-icon {
    width: 18px;
    height: 18px;
    border-width: 3px;
  }

  .search-icon::after {
    right: -7px;
    bottom: -5px;
    width: 9px;
    height: 3px;
  }

  .search-control input,
  .filter-box {
    height: 29px;
    padding: 2px 4px;
    border-width: 2px;
    font-size: 11px;
  }

  .inventory-content {
    height: calc(100% - 39px);
  }

  .inventory-grid {
    grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
    gap: 5px;
    padding: 2px 4px 6px 2px;
  }

  .inventory-item {
    padding: 3px;
    border-width: 3px;
  }

  .item-name-overlay {
    font-size: 8px;
  }

  .favorite-mark {
    font-size: 13px;
  }

  .inventory-actions {
    gap: 13px;
    padding: 7px 3px;
    border-left-width: 2px;
  }

  .search-switch {
    width: 60px;
    height: 34px;
    padding: 2px;
    border-width: 2px;
  }

  .search-switch-knob {
    width: 24px;
    height: 24px;
  }

  .search-switch.is-on .search-switch-knob {
    left: calc(100% - 27px);
  }

  .search-icon--small {
    width: 14px;
    height: 14px;
  }

  .inventory-action {
    min-width: 48px;
    font-size: 12px;
  }

  .settings-panel {
    top: 46px;
    right: 7px;
    width: min(340px, calc(100vw - 14px));
  }

  .control-group {
    grid-template-columns: 76px 40px minmax(0, 1fr);
  }

  .alpha-row {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .rgb-control {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .rgb-control output {
    grid-column: 1 / -1;
  }
}

@media (max-height: 620px) and (orientation: landscape) {
  :root {
    --drawer-height: 248px;
  }

  .player-workspace {
    inset-block: 44px calc(var(--drawer-height) + 8px);
  }

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


/* Phase 1: supplied inventory-tab artwork, kept behind the drawer border. */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.inventory-tabs {
  top: 0;
  left: -55px;
  width: 60px;
  gap: 2px;
  align-items: flex-end;
  pointer-events: auto;
}

.inventory-tab,
.inventory-tab--tall {
  position: relative;
  display: block;
  flex: 0 0 auto;
  width: 60px;
  height: 58px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  filter: none;
  cursor: pointer;
  overflow: visible;
}

.inventory-tab:hover,
.inventory-tab:focus-visible,
.inventory-tab.is-active {
  background: transparent;
  filter: none;
}

.inventory-tab:hover .inventory-tab-image {
  filter: brightness(1.06);
}

.inventory-tab:active {
  transform: translate(1px, 1px);
}

.inventory-tab-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.inventory-tab-image--current {
  display: none;
}

.inventory-tab.is-active .inventory-tab-image--normal {
  display: none;
}

.inventory-tab.is-active .inventory-tab-image--current {
  display: block;
}

@media (max-width: 900px) {
  .inventory-tabs {
    left: -48px;
    width: 52px;
    gap: 3px;
  }

  .inventory-tab,
  .inventory-tab--tall {
    width: 52px;
    height: 52px;
    min-height: 0;
    padding: 0;
    border: 0;
    font-size: 0;
  }
}

@media (max-width: 680px) {
  .inventory-tabs {
    left: -39px;
    width: 43px;
    gap: 3px;
  }

  .inventory-tab,
  .inventory-tab--tall {
    width: 43px;
    height: 43px;
    min-height: 0;
    padding: 0;
    border: 0;
  }
}

@media (max-height: 620px) and (orientation: landscape) {
  .inventory-tabs {
    left: -35px;
    width: 39px;
    gap: 2px;
  }

  .inventory-tab,
  .inventory-tab--tall {
    width: 39px;
    height: 39px;
  }
}

/* Phase 2: draggable Growtopia-style inventory drawer mechanics. */
:root {
  --drawer-offset-y: 0px;
  --drawer-visible-height: calc(var(--drawer-height) + 10px);
  --drawer-motion-duration: 230ms;
}

.inventory-dock {
  transform: translate(-50%, var(--drawer-offset-y));
  will-change: transform;
}

.inventory-dock.is-snap-animating {
  transition: transform var(--drawer-motion-duration) cubic-bezier(0.2, 0.78, 0.28, 1);
}

.inventory-dock.is-dragging {
  transition: none;
  user-select: none;
}

.inventory-handle {
  position: absolute;
  z-index: 4;
  top: -44px;
  left: 50%;
  display: block;
  width: clamp(170px, 28vw, 300px);
  height: auto;
  aspect-ratio: 4778 / 1024;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: grab;
  touch-action: none;
  transform: translateX(-50%);
  user-select: none;
  -webkit-user-select: none;
}

.inventory-handle.is-dragging {
  cursor: grabbing;
}

.inventory-handle:active {
  transform: translateX(-50%) translate(1px, 1px);
}

.inventory-handle:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
  border-radius: 8px;
}

.inventory-handle img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

.inventory-tabs {
  transition: opacity 120ms linear;
}

.inventory-dock[data-drawer-state="closed"] .inventory-tabs {
  opacity: 0;
  pointer-events: none;
}


.player-workspace {
  bottom: calc(var(--drawer-visible-height) + 22px);
  transition: bottom var(--drawer-motion-duration) cubic-bezier(0.2, 0.78, 0.28, 1);
}

.renderer-status {
  bottom: calc(var(--drawer-visible-height) + 8px);
  transition: bottom var(--drawer-motion-duration) cubic-bezier(0.2, 0.78, 0.28, 1);
}

.inventory-dock.is-dragging ~ .settings-panel,
.inventory-dock.is-dragging + .settings-panel {
  pointer-events: none;
}

.inventory-actions {
  min-width: 0;
  overflow: hidden;
}

.inventory-action,
.search-switch {
  max-width: 100%;
}

@media (max-width: 900px) {
  .inventory-handle {
    top: -39px;
    width: clamp(150px, 32vw, 245px);
  }
}

@media (max-width: 680px) {
  :root {
    --drawer-visible-height: calc(var(--drawer-height) + 7px);
  }

  .inventory-dock {
    transform: translateY(var(--drawer-offset-y));
  }

  .inventory-handle {
    top: -34px;
    width: 58px;
    aspect-ratio: 2398 / 1727;
  }

  .player-workspace {
    bottom: calc(var(--drawer-visible-height) + 12px);
  }

  .inventory-window {
    min-width: 0;
  }
}

@media (max-width: 430px) {
  :root {
    --action-width: 66px;
  }

  .inventory-dock {
    right: 5px;
    width: calc(100vw - 62px);
  }

  .inventory-tabs {
    left: -36px;
    width: 40px;
  }

  .inventory-tab,
  .inventory-tab--tall {
    width: 40px;
    height: 40px;
  }

  .inventory-main {
    padding: 5px;
  }

  .inventory-toolbar {
    grid-template-columns: minmax(0, 1fr) 69px;
  }

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

  .inventory-action {
    min-width: 43px;
    font-size: 11px;
  }

  .search-switch {
    width: 54px;
  }
}

@media (max-height: 620px) and (orientation: landscape) {
  .inventory-handle {
    top: -31px;
    width: clamp(132px, 24vw, 205px);
  }

  .player-workspace {
    bottom: calc(var(--drawer-visible-height) + 8px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .inventory-dock.is-snap-animating,
  .player-workspace,
  .renderer-status {
    transition-duration: 1ms;
  }
}

.drawer-is-dragging .player-workspace,
.drawer-is-dragging .renderer-status {
  transition: none;
}

/* Phase 3: UI text and free-position drawer corrections. */
:root {
  --gt-input-text: #d2d6d9;
}

/* GrowTool windows use clean text; only standalone page/button text may retain shadows. */
.gt-window,
.gt-window * {
  text-shadow: none !important;
}

.search-control input,
.filter-box,
.gt-window input[type="text"],
.gt-window input[type="search"],
.gt-window input[type="number"],
.gt-window textarea,
.gt-window select {
  color: var(--gt-input-text);
  text-shadow: none !important;
}

.search-control input::placeholder,
.gt-window input::placeholder,
.gt-window textarea::placeholder {
  color: #bfc5c8;
  opacity: 1;
  text-shadow: none !important;
}

/* The handle's lower edge rests directly on the 3px inventory window border. */
.inventory-handle {
  top: 3px;
  transform: translate(-50%, -100%);
}

.inventory-handle:active {
  transform: translate(-50%, -100%) translate(1px, 1px);
}

@media (max-width: 900px) {
  .inventory-handle {
    top: 3px;
  }
}

@media (max-width: 680px) {
  .inventory-handle {
    top: 3px;
  }
}

@media (max-height: 620px) and (orientation: landscape) {
  .inventory-handle {
    top: 3px;
  }
}

/* Phase 4: real inventory artwork, full item grid, font, and handle alignment. */
:root {
  --item-atlas-width: 2048px;
  --item-atlas-height: 1984px;
}

body {
  font-family: "Planner Century Gothic", "Century Gothic", Arial, sans-serif;
  font-weight: 900;
  letter-spacing: 1.25px;
}

button,
input,
select,
textarea,
output {
  font-family: "Planner Century Gothic", "Century Gothic", Arial, sans-serif;
  font-weight: 900;
  letter-spacing: 1px;
}

/* Button labels retain the GrowTool 1px bottom-right shadow. */
.gt-button,
.gt-button *,
.filter-option,
.filter-option * {
  text-shadow: 1px 1px 0 #000000 !important;
}

/* Search and dropdown fields remain clean light-gray input text. */
.search-control input,
.filter-box,
.filter-box *,
.gt-window input,
.gt-window textarea,
.gt-window select {
  color: var(--gt-input-text);
  text-shadow: none !important;
}

/* Center the handle over the main inventory region, excluding tabs and side actions. */
.inventory-handle {
  z-index: 8;
  top: 3px;
  left: calc((100% - var(--action-width)) / 2);
  transform: translate(-50%, -100%);
}

.inventory-handle:active {
  transform: translate(-50%, -100%) translate(1px, 1px);
}

.search-control {
  grid-template-columns: 36px minmax(0, 1fr);
}

.search-icon-image {
  display: block;
  width: 34px;
  height: 34px;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.search-switch {
  display: grid;
  width: 92px;
  height: 47px;
  place-items: center;
  padding: 3px;
  border: 3px solid var(--gt-border);
  border-radius: 2px;
  background: #505b83;
  box-shadow:
    inset 2px 2px 0 #000000,
    2px 2px 0 #000000;
  overflow: hidden;
}

.search-switch.is-on {
  background: #409067;
}

.search-switch img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.search-switch-track,
.search-switch-knob {
  display: none !important;
}

.inventory-grid {
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 7px;
  padding: 3px 5px 10px 3px;
}

.inventory-item {
  position: relative;
  display: grid;
  min-width: 0;
  aspect-ratio: 1;
  place-items: center;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  isolation: isolate;
}

.inventory-item:hover {
  filter: brightness(1.07);
}

.inventory-item:active {
  transform: translate(1px, 1px);
  box-shadow: none;
}

.inventory-item::before,
.inventory-item::after {
  display: none !important;
}

.item-box-base,
.item-selection-overlay,
.item-favorite-overlay,
.item-equipped-check {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.item-selection-overlay {
  z-index: 4;
  display: none;
  padding: 4%;
}

.inventory-item.is-selected .item-selection-overlay {
  display: block;
}

.item-favorite-overlay {
  z-index: 6;
  top: 0;
  right: 0;
  bottom: auto;
  left: auto;
  display: none;
  width: 58%;
  height: 58%;
  object-position: top right;
}

.inventory-item.is-favorite .item-favorite-overlay {
  display: block;
}

.item-equipped-check {
  z-index: 7;
  top: auto;
  right: 2%;
  bottom: 2%;
  left: auto;
  display: none;
  width: 48%;
  height: 48%;
  object-position: right bottom;
}

.inventory-item.is-equipped .item-equipped-check {
  display: block;
}

.item-icon {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  display: block;
  width: 32px;
  height: 32px;
  max-width: none;
  max-height: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transform-origin: center;
}

.inventory-item .item-glyph {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  width: 32px;
  height: 32px;
  max-width: none;
  max-height: none;
  transform: translate(-50%, -50%) scale(1.55);
}

.inventory-item.has-missing-icon::after {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  display: block !important;
  width: 30%;
  height: 30%;
  border: 3px solid rgba(210, 214, 217, 0.7);
  border-radius: 50%;
  content: "";
  transform: translate(-50%, -50%);
}

.item-name-overlay {
  z-index: 8;
  max-height: 52%;
  padding: 3px 2px;
  background: rgba(0, 0, 0, 0.5);
  color: #ffffff;
  font-size: clamp(8px, 0.82vw, 12px);
  letter-spacing: 0.5px;
  text-shadow: none !important;
}

.favorite-mark {
  display: none !important;
}

.inventory-empty {
  color: var(--gt-input-text);
  letter-spacing: 1px;
  text-shadow: none !important;
}

@media (max-width: 900px) {
  .inventory-grid {
    grid-template-columns: repeat(auto-fill, minmax(69px, 1fr));
    gap: 6px;
  }

  .item-icon {
    transform: translate(-50%, -50%) scale(1.55);
  }
}

@media (max-width: 680px) {
  .inventory-handle {
    top: 2px;
    left: calc((100% - var(--action-width)) / 2);
  }

  .inventory-toolbar {
    grid-template-columns: minmax(0, 1fr) 82px;
  }

  .search-control {
    grid-template-columns: 27px minmax(0, 1fr);
  }

  .search-icon-image {
    width: 26px;
    height: 26px;
  }

  .search-control input,
  .filter-box,
  .gt-window input[type="text"],
  .gt-window input[type="search"],
  .gt-window input[type="number"] {
    min-height: 30px;
    font-size: 16px;
    letter-spacing: 0.5px;
  }

  .inventory-grid {
    grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
    gap: 4px;
  }

  .item-icon {
    transform: translate(-50%, -50%) scale(1.28);
  }

  .item-name-overlay {
    font-size: 7px;
    letter-spacing: 0;
  }

  .search-switch {
    width: 61px;
    height: 36px;
    padding: 2px;
    border-width: 2px;
  }
}

@media (max-width: 430px) {
  .inventory-toolbar {
    grid-template-columns: minmax(0, 1fr) 74px;
  }

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

  .item-icon {
    transform: translate(-50%, -50%) scale(1.15);
  }
}

@media (max-height: 620px) and (orientation: landscape) {
  .inventory-handle {
    top: 2px;
    left: calc((100% - var(--action-width)) / 2);
  }

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

/* Specificity correction over the Phase 3 window-wide no-shadow rule. */
.gt-window .gt-button,
.gt-window .gt-button *,
.gt-window .filter-option,
.gt-window .filter-option * {
  text-shadow: 1px 1px 0 #000000 !important;
}

/* Phase 4 hotfix: final inventory chrome and font cleanup. */
html, body, body *, .planner-shell, .planner-shell * {
  letter-spacing: 0 !important;
}
body,
button,
input,
textarea,
select,
option {
  font-family: "Planner Century Gothic", "Century Gothic", "AppleGothic", Arial, Helvetica, sans-serif !important;
}
.inventory-handle {
  z-index: 12 !important;
  top: 3px !important;
  left: calc((100% - var(--action-width)) / 2) !important;
  transform: translate(-50%, -100%) !important;
}
.inventory-handle:active {
  transform: translate(-50%, -100%) translate(1px, 1px) !important;
}
.search-control input,
.filter-box,
.gt-window input[type="text"],
.gt-window input[type="search"],
.gt-window input[type="number"] {
  border-radius: 4px !important;
}
.search-control input::placeholder,
.gt-window input::placeholder,
.gt-window textarea::placeholder {
  font-size: 0.84em;
  color: #c7cbcf !important;
}
.filter-box,
.filter-box *,
.search-control input,
.search-control input *,
.gt-window input,
.gt-window textarea,
.gt-window select {
  text-shadow: none !important;
  color: var(--gt-input-text) !important;
}
.gt-button,
.gt-button *,
.inventory-action,
.inventory-action * {
  text-shadow: 1px 1px 0 #000000 !important;
}
.search-switch {
  display: grid !important;
  width: 100% !important;
  min-width: 0 !important;
  height: 50px !important;
  place-items: center !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 2px !important;
  background: #505b83 !important;
  box-shadow: none !important;
  overflow: hidden !important;
}
.search-switch.is-on {
  background: #409067 !important;
}
.search-switch img {
  display: block !important;
  width: auto !important;
  height: 42px !important;
  object-fit: contain !important;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.inventory-actions {
  gap: 14px !important;
  padding: 8px 8px 10px !important;
}
.inventory-action {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 52px;
  padding: 4px 6px !important;
  font-size: 18px !important;
  line-height: 1.05 !important;
}
.item-icon {
  transform: translate(-50%, -50%) scale(1.62) !important;
  image-rendering: pixelated !important;
  image-rendering: crisp-edges !important;
}
@media (max-width: 900px) {
  .item-icon {
    transform: translate(-50%, -50%) scale(1.48) !important;
  }
  .inventory-action {
    min-height: 48px;
    font-size: 16px !important;
  }
}
@media (max-width: 680px) {
  .inventory-handle {
    left: calc((100% - var(--action-width)) / 2) !important;
    top: 3px !important;
  }
  .search-control input,
  .filter-box,
  .gt-window input[type="text"],
  .gt-window input[type="search"],
  .gt-window input[type="number"] {
    border-radius: 4px !important;
  }
  .search-control input::placeholder,
  .gt-window input::placeholder,
  .gt-window textarea::placeholder {
    font-size: 0.8em;
  }
  .search-switch {
    height: 42px !important;
  }
  .search-switch img {
    height: 34px !important;
  }
  .inventory-action {
    min-height: 42px;
    font-size: 13px !important;
  }
  .item-icon {
    transform: translate(-50%, -50%) scale(1.18) !important;
  }
}


/* Phase 4 hotfix 2: final layout corrections before Phase 5. */
.inventory-dock {
  bottom: max(0px, env(safe-area-inset-bottom)) !important;
}

.inventory-window {
  overflow: visible;
}

.inventory-handle {
  z-index: 12 !important;
  top: 0 !important;
  left: calc((100% - var(--action-width)) / 2) !important;
  transform: translate(-50%, -100%) translateY(3px) !important;
}
.inventory-handle:active,
.inventory-handle.is-dragging {
  transform: translate(-50%, -100%) translateY(3px) !important;
}
.inventory-handle img {
  display: block;
}

.inventory-actions {
  overflow: hidden;
  gap: 12px !important;
  padding: 0 8px 10px !important;
}

.search-switch {
  margin: 0 -8px 8px !important;
  width: calc(100% + 16px) !important;
  min-width: calc(100% + 16px) !important;
  height: 60px !important;
  border-radius: 0 !important;
  background: #505b83 !important;
  border: 0 !important;
  box-shadow: none !important;
}
.search-switch.is-on {
  background: #409067 !important;
}
.search-switch img {
  height: 44px !important;
}

.inventory-action {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  height: 38px !important;
  padding: 2px 8px !important;
  font-size: 15px !important;
  line-height: 1 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.search-control input,
.filter-box,
.gt-window input[type="text"],
.gt-window input[type="search"],
.gt-window input[type="number"] {
  height: 32px !important;
  border-radius: 4px !important;
}
.search-control input {
  font-size: 15px !important;
}
.search-control input::placeholder,
.gt-window input::placeholder,
.gt-window textarea::placeholder {
  font-size: 13px !important;
  color: #c7cbcf !important;
}
.filter-box,
.filter-box span,
.filter-box .filter-arrow {
  font-size: 15px !important;
  line-height: 1 !important;
}
.filter-box {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}
#filterLabel {
  display: inline-flex;
  align-items: center;
  min-height: 100%;
}

.inventory-content {
  padding-top: 6px;
}
.inventory-content.show-player-customization {
  overflow: auto;
}
.inventory-content.show-player-customization .inventory-empty,
.inventory-content.show-player-customization .inventory-grid {
  display: none !important;
}

.player-customization-panel {
  position: static !important;
  z-index: auto !important;
  top: auto !important;
  right: auto !important;
  width: 100% !important;
  min-width: 0;
  max-width: none !important;
  padding: 4px 3px 8px !important;
  border: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
}
.player-customization-panel .panel-heading {
  margin-bottom: 8px;
}
.player-customization-panel .panel-heading h2 {
  font-size: 18px;
  text-shadow: none !important;
}
.player-customization-panel .close-button {
  display: none !important;
}
.player-customization-panel .control-group,
.player-customization-panel .alpha-row {
  margin-top: 6px;
}
.player-customization-panel .control-group label,
.player-customization-panel .alpha-row label,
.player-customization-panel .rgb-control legend,
.player-customization-panel .rgb-control label,
.player-customization-panel .rgb-control output {
  text-shadow: none !important;
}
.player-customization-panel input[type="text"],
.player-customization-panel input[type="number"] {
  color: var(--gt-input-text) !important;
}

.inventory-item .item-equipped-check {
  width: 32% !important;
  height: 32% !important;
  right: 2px !important;
  bottom: 2px !important;
  left: auto !important;
  top: auto !important;
  z-index: 8 !important;
}
.inventory-item .item-icon {
  z-index: 3 !important;
}

@media (max-width: 680px) {
  .inventory-dock {
    bottom: max(0px, env(safe-area-inset-bottom)) !important;
  }
  .inventory-handle {
    top: 0 !important;
    left: calc((100% - var(--action-width)) / 2) !important;
    transform: translate(-50%, -100%) translateY(3px) !important;
  }
  .search-switch {
    height: 48px !important;
  }
  .search-switch img {
    height: 34px !important;
  }
  .inventory-action {
    height: 34px !important;
    font-size: 12px !important;
  }
  .search-control input,
  .filter-box,
  .gt-window input[type="text"],
  .gt-window input[type="search"],
  .gt-window input[type="number"] {
    height: 30px !important;
  }
}

/* Phase 4 Hotfix 3: Growtopia skin window and expanded player customization. */
.player-anchor {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.player-identity {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: #7dff62;
  font-size: clamp(12px, 1.8vw, 17px);
  font-weight: 900;
  line-height: 1;
  text-shadow: 1px 1px 0 #000000;
  white-space: nowrap;
}

.identity-side {
  display: inline-grid;
  width: 25px;
  height: 21px;
  place-items: center;
  flex: 0 0 auto;
}

.identity-side img {
  display: block;
  width: 24px;
  height: auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(1px 1px 0 #000000);
}

.player-name-label {
  max-width: min(50vw, 260px);
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-wrench-preview {
  display: block;
  width: 21px;
  height: 21px;
  object-fit: contain;
  filter: drop-shadow(1px 1px 0 #000000);
}

.guild-icon-preview,
.title-icon-preview,
.legendary-orb-preview {
  display: inline-grid;
  width: 21px;
  height: 21px;
  place-items: center;
  border: 2px solid #ffffff;
  border-radius: 2px;
  background: #315b7d;
  color: #ffffff;
  font-size: 9px;
  box-shadow: 1px 1px 0 #000000;
}

.title-icon-preview[data-title="supporter"] {
  background: #52a23b;
}

.title-icon-preview[data-title="super"] {
  background: #d49b22;
}

.legendary-orb-preview {
  border-radius: 50%;
  background: radial-gradient(circle at 35% 32%, #fff9bc 0 12%, #ffd52e 13% 38%, #f18619 39% 70%, #704300 71% 100%);
}

.settings-panel.player-customization-panel {
  position: static !important;
  width: 100% !important;
  max-width: none !important;
  padding: 5px 5px 10px !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.player-customization-panel .panel-heading h2,
.player-customization-panel label,
.player-customization-panel span,
.player-customization-panel output,
.player-customization-panel legend {
  text-shadow: none !important;
}

.customization-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 10px;
}

.customization-field,
.guild-controls,
.color-setting-row {
  display: grid;
  min-width: 0;
  gap: 4px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
}

.customization-field--wide {
  grid-column: 1 / -1;
}

.customization-field input,
.customization-field select,
.player-customization-panel select {
  width: 100%;
  min-width: 0;
  height: 30px;
  padding: 2px 6px;
  border: 2px solid var(--gt-border);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.22);
  color: var(--gt-input-text);
  font: inherit;
  text-shadow: none !important;
  box-shadow:
    inset 2px 2px 0 #000000,
    2px 2px 0 #000000;
}

.guild-button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.compact-option-button,
.skin-colors-button {
  min-height: 30px;
  padding: 3px 8px !important;
  font-size: 13px !important;
}

.guild-controls output,
.color-setting-row output {
  color: #d2d6d9;
  font-size: 11px;
}

.color-setting-row {
  grid-template-columns: auto max-content minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.player-customization-panel .control-group {
  grid-template-columns: 90px 42px minmax(0, 1fr);
}

.player-customization-panel .rgb-control {
  margin-top: 2px;
}

input[type="color"] {
  box-sizing: border-box !important;
  width: 42px !important;
  height: 42px !important;
  min-width: 42px !important;
  min-height: 42px !important;
  aspect-ratio: 1 / 1 !important;
  padding: 0 !important;
  border: 3px solid #ffffff !important;
  border-radius: 2px !important;
  background: transparent !important;
  box-shadow: inset 2px 2px 0 #000000, 2px 2px 0 #000000 !important;
  overflow: hidden !important;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

input[type="color"]::-webkit-color-swatch {
  border: 0;
  border-radius: 0;
  box-shadow: inset 2px 2px 0 #000000;
}

input[type="color"]::-moz-color-swatch {
  border: 0;
  border-radius: 0;
  box-shadow: inset 2px 2px 0 #000000;
}

.inventory-content.show-player-customization {
  padding-top: 0 !important;
}

.inventory-actions .inventory-action,
.inventory-actions .inventory-action *,
.inventory-actions .gt-button,
.inventory-actions .gt-button * {
  text-shadow: none !important;
}

.search-switch {
  height: 58px !important;
}

.search-switch img {
  height: 42px !important;
}

.modal-backdrop {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: rgba(0, 0, 0, 0.68);
}

.modal-backdrop[hidden] {
  display: none !important;
}

.skin-colors-window {
  width: min(1110px, calc(100vw - 24px));
  max-height: min(760px, calc(100dvh - 24px));
  padding: 13px;
  overflow: auto;
}

.skin-colors-window .panel-heading {
  margin-bottom: 12px;
}

.skin-colors-window .panel-heading h2 {
  font-size: 22px;
  text-shadow: none !important;
}

.skin-swatches-scroll {
  width: 100%;
  overflow: visible;
}

.skin-swatches-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(92px, 1fr));
  gap: 18px 24px;
  align-items: center;
}

.skin-swatch {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1.52 / 1;
  padding: 0;
  overflow: hidden;
  border: 3px solid var(--swatch-solid);
  border-radius: 4px;
  background: transparent;
  box-shadow:
    inset 2px 2px 0 #000000,
    2px 2px 0 #000000;
  cursor: pointer;
}

.skin-swatch-panel {
  position: absolute;
  z-index: 0;
  inset: 0;
  display: block;
  background: var(--swatch-panel);
}

.skin-swatch:hover {
  filter: brightness(1.06);
}

.skin-swatch.is-selected {
  outline: none;
}

.skin-swatch.is-selected::before {
  content: "";
  position: absolute;
  z-index: 4;
  inset: -8px;
  pointer-events: none;
  background: url("../assets/ui/skin_swatch_border.png") center / 100% 100% no-repeat;
}

.skin-custom-row {
  display: grid;
  grid-template-columns: 90px 44px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin-top: 20px;
}

.skin-custom-row label,
.skin-alpha-control label,
.skin-alpha-control output {
  font-size: 14px;
  font-weight: 900;
  text-shadow: none !important;
}

.skin-custom-row input[type="text"] {
  height: 32px !important;
}

.skin-alpha-control {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 9px;
  margin-top: 15px;
}

input[type="range"] {
  width: 100%;
  height: 26px;
  margin: 0;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 2px;
  background: #ffffff;
  box-shadow: 1px 1px 0 #000000;
}

input[type="range"]::-webkit-slider-thumb {
  width: 24px;
  height: 24px;
  margin-top: -10.5px;
  border: 0;
  border-radius: 50%;
  appearance: none;
  -webkit-appearance: none;
  background: url("../assets/ui/slider_circle.png") center / contain no-repeat;
  filter: drop-shadow(1px 1px 0 #000000);
}

input[type="range"]::-moz-range-track {
  height: 3px;
  border: 0;
  border-radius: 2px;
  background: #ffffff;
  box-shadow: 1px 1px 0 #000000;
}

input[type="range"]::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: url("../assets/ui/slider_circle.png") center / contain no-repeat;
  filter: drop-shadow(1px 1px 0 #000000);
}

body.modal-open {
  touch-action: none;
}

@media (max-width: 900px) {
  .skin-swatches-grid {
    gap: 14px 17px;
  }
}

@media (max-width: 680px) {
  .player-identity {
    gap: 3px;
    font-size: 12px;
  }

  .identity-side {
    width: 20px;
    height: 18px;
  }

  .identity-side img {
    width: 19px;
  }

  .player-wrench-preview,
  .guild-icon-preview,
  .title-icon-preview,
  .legendary-orb-preview {
    width: 18px;
    height: 18px;
  }

  .customization-grid {
    grid-template-columns: 1fr;
  }

  .customization-field--wide {
    grid-column: auto;
  }

  .color-setting-row,
  .player-customization-panel .control-group {
    grid-template-columns: 78px 40px minmax(0, 1fr);
  }

  .color-setting-row .skin-colors-button {
    grid-column: 2 / -1;
    width: 100%;
  }

  .color-setting-row output {
    grid-column: 2 / -1;
  }

  .search-switch {
    height: 46px !important;
  }

  .search-switch img {
    height: 32px !important;
  }

  .skin-colors-window {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    padding: 10px;
  }

  .skin-colors-window .panel-heading h2 {
    font-size: 18px;
  }

  .skin-swatches-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 5px 10px;
    overscroll-behavior-x: contain;
    scrollbar-color: var(--gt-border) rgba(0, 0, 0, 0.22);
  }

  .skin-swatches-grid {
    display: flex;
    width: max-content;
    gap: 13px;
  }

  .skin-swatch {
    width: 112px;
    flex: 0 0 112px;
  }

  .skin-custom-row {
    grid-template-columns: 70px 40px minmax(0, 1fr);
    margin-top: 13px;
  }

  .skin-alpha-control {
    grid-template-columns: 70px minmax(0, 1fr) 34px;
  }
}

/* Keep the swatch's hard inner border shadow visible above its alpha panel. */
.skin-swatch::after {
  position: absolute;
  z-index: 2;
  inset: 0;
  content: "";
  pointer-events: none;
  box-shadow: inset 2px 2px 0 #000000;
}

/* Phase 4 Hotfix 4: identity row, control typography, and side-panel sizing. */
:root {
  --ui-control-font-size: 13px;
  --ui-control-height: 30px;
  --action-width: 136px;
}

.gt-button,
.gt-button *,
.inventory-action,
.inventory-action * {
  text-transform: none !important;
}

.player-identity[hidden] {
  display: none !important;
}

.player-identity {
  display: grid !important;
  grid-template-columns: 24px minmax(0, auto) 24px;
  align-items: center;
  justify-content: center;
  column-gap: 5px;
  min-height: 24px;
  color: #ffffff !important;
  font-size: clamp(12px, 1.8vw, 17px);
  font-weight: 900;
  line-height: 1;
  text-shadow: 1px 1px 0 #000000;
  white-space: nowrap;
}

.identity-side {
  display: grid;
  width: 24px;
  height: 21px;
  place-items: center;
}

.identity-side--left {
  justify-self: end;
}

.identity-side--right {
  justify-self: start;
}

.player-name-label {
  color: #ffffff !important;
  text-align: center;
}

.player-wrench-preview,
.identity-side img {
  max-width: 100%;
  max-height: 100%;
}

.search-control input,
.filter-box,
.customization-field input,
.customization-field select,
.player-customization-panel select,
.gt-window input[type="text"],
.gt-window input[type="search"],
.gt-window input[type="number"],
.gt-window select,
.skin-custom-row input[type="text"] {
  height: var(--ui-control-height) !important;
  min-height: var(--ui-control-height) !important;
  font-size: var(--ui-control-font-size) !important;
  line-height: 1 !important;
}

.search-control input::placeholder,
.gt-window input::placeholder,
.gt-window textarea::placeholder {
  font-size: var(--ui-control-font-size) !important;
}

.filter-box,
.filter-box span,
.filter-box .filter-arrow,
#filterLabel {
  font-size: var(--ui-control-font-size) !important;
  line-height: 1 !important;
}

.inventory-actions {
  padding-inline: 8px !important;
}

.inventory-action {
  width: 100% !important;
  height: 36px !important;
  min-width: 0 !important;
  padding: 2px 6px !important;
  font-size: 14px !important;
  line-height: 1 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: clip !important;
}

.inventory-actions .inventory-action,
.inventory-actions .inventory-action *,
.inventory-actions .gt-button,
.inventory-actions .gt-button * {
  text-shadow: none !important;
}

@media (max-width: 900px) {
  :root {
    --action-width: 112px;
  }

  .inventory-action {
    font-size: 13px !important;
  }
}

@media (max-width: 680px) {
  :root {
    --action-width: 96px;
    --ui-control-font-size: 13px;
  }

  .inventory-dock {
    right: 5px !important;
    width: calc(100vw - 58px) !important;
  }

  .player-identity {
    grid-template-columns: 20px minmax(0, auto) 20px;
    column-gap: 3px;
  }

  .identity-side {
    width: 20px;
    height: 18px;
  }

  .inventory-action {
    height: 34px !important;
    padding-inline: 4px !important;
    font-size: 12px !important;
  }
}

@media (max-width: 430px) {
  :root {
    --action-width: 92px;
  }
}

/* Phase 4 Hotfix 5: larger GrowID row, tighter wrench sizing, and final control spacing. */
:root {
  --action-width: 148px;
  --ui-control-font-size: 13px;
}

.player-identity {
  grid-template-columns: 28px minmax(0, auto) 18px !important;
  column-gap: 8px !important;
  font-size: clamp(15px, 2.3vw, 22px) !important;
  min-height: 28px !important;
}

.identity-side--left {
  width: 28px !important;
  height: 22px !important;
  justify-self: end;
  margin-right: 2px;
}

.identity-side--right {
  width: 18px !important;
  height: 18px !important;
  justify-self: start;
}

.identity-side--left img {
  width: 24px !important;
  max-height: 22px !important;
}

.player-name-label {
  font-size: inherit !important;
  line-height: 1 !important;
}

.player-wrench-preview {
  width: 16px !important;
  height: 16px !important;
}

.inventory-action {
  height: 32px !important;
  padding: 2px 8px !important;
  font-size: 13px !important;
}

.inventory-actions {
  padding-inline: 6px !important;
}

@media (max-width: 680px) {
  :root {
    --action-width: 102px;
  }

  .player-identity {
    grid-template-columns: 24px minmax(0, auto) 16px !important;
    column-gap: 6px !important;
    font-size: 16px !important;
  }

  .identity-side--left {
    width: 24px !important;
    height: 20px !important;
  }

  .identity-side--left img {
    width: 21px !important;
    max-height: 20px !important;
  }

  .identity-side--right,
  .player-wrench-preview {
    width: 15px !important;
    height: 15px !important;
  }

  .inventory-action {
    height: 30px !important;
    padding-inline: 5px !important;
    font-size: 11px !important;
  }
}


/* Phase 4 Hotfix 6: larger GrowID, animated wrench, and corrected identity spacing. */
@keyframes wrenchRock {
  0%, 100% { transform: rotate(-12deg); }
  50% { transform: rotate(12deg); }
}

.player-identity {
  grid-template-columns: 34px minmax(0, auto) 16px !important;
  column-gap: 11px !important;
  /* Increase the player name size to emphasise GrowID */
  font-size: clamp(24px, 4vw, 38px) !important;
  min-height: 38px !important;
}

.identity-side--left {
  width: 34px !important;
  height: 24px !important;
  margin-right: 6px;
}

.identity-side--left img {
  width: 26px !important;
  max-height: 24px !important;
}

.identity-side--right {
  width: 16px !important;
  height: 16px !important;
}

.player-name-label {
  font-size: inherit !important;
  line-height: 0.95 !important;
}

.player-wrench-preview {
  width: 14px !important;
  height: 14px !important;
  transform-origin: 22% 22%;
  animation: wrenchRock 3.2s ease-in-out infinite;
}

@media (max-width: 680px) {
  .player-identity {
    grid-template-columns: 26px minmax(0, auto) 15px !important;
    column-gap: 8px !important;
    font-size: clamp(17px, 4.2vw, 22px) !important;
    min-height: 28px !important;
  }

  .identity-side--left {
    width: 26px !important;
    height: 20px !important;
    margin-right: 4px;
  }

  .identity-side--left img {
    width: 22px !important;
    max-height: 20px !important;
  }

  .identity-side--right,
  .player-wrench-preview {
    width: 14px !important;
    height: 14px !important;
  }
}

/* Phase 4 Hotfix 7: GrowID casing, hidden identity pieces, and GrowTool wrench motion. */
#growIdInput,
#growIdInput::placeholder,
.customization-field input#growIdInput,
.gt-window input#growIdInput {
  text-transform: none !important;
}

.identity-side[hidden],
.identity-side img[hidden],
.player-wrench-preview[hidden],
#playerFlagPreview[hidden],
#playerWrenchPreview[hidden] {
  display: none !important;
}

.player-wrench-preview {
  width: clamp(22px, 3.8vw, 28px) !important;
  height: clamp(22px, 3.8vw, 28px) !important;
  min-width: clamp(22px, 3.8vw, 28px) !important;
  max-width: clamp(22px, 3.8vw, 28px) !important;
  object-fit: contain !important;
  transform-origin: 50% 50% !important;
  animation: gtConverterWrenchRock 2.8s ease-in-out infinite !important;
}

@keyframes gtConverterWrenchRock {
  0%, 100% { transform: rotate(-8deg); }
  50% { transform: rotate(8deg); }
}

@media (max-width: 680px) {
  .player-wrench-preview {
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    max-width: 20px !important;
  }
}

/* Phase 5: Growtopia RTFont for player names and equipped-check bounce. */
@font-face {
  font-family: "Growtopia RTFont Bigx2";
  src: url("../assets/fonts/RTFont_GrowEmoji_Color.woff2") format("woff2");
  font-style: normal;
  font-weight: 700 900;
  font-display: swap;
}

.player-name-label {
  font-family: "Growtopia RTFont Bigx2", "Planner Century Gothic", "Century Gothic", Arial, sans-serif !important;
  font-feature-settings: "liga" 1, "clig" 1;
}

.inventory-item.is-equipped.just-equipped .item-equipped-check {
  animation: equipped-check-pop 280ms cubic-bezier(.2, 1.65, .35, 1) both;
}

@keyframes equipped-check-pop {
  0% {
    transform: translateY(-8px) scale(.65);
    opacity: 0;
  }
  62% {
    transform: translateY(2px) scale(1.12);
    opacity: 1;
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* Phase 6: final panel opacity, player header sizing/placement, and stable identity proportions. */
:root {
  --gt-panel-rgb: 39, 125, 159;
  --gt-panel-alpha: 0.75;
  --gt-panel-75: rgba(var(--gt-panel-rgb), var(--gt-panel-alpha));
}

.gt-window,
.settings-panel,
.skin-colors-window,
.player-customization-panel,
.inventory-window,
.inventory-tab.is-active {
  background: var(--gt-panel-75) !important;
}

.player-identity {
  transform: translateY(-10px) !important;
  font-size: clamp(17px, 2.25vw, 22px) !important;
  min-height: 28px !important;
  grid-template-columns: 28px minmax(0, auto) 24px !important;
  column-gap: 7px !important;
}

.identity-side--left {
  width: 28px !important;
  height: 22px !important;
  margin-right: 4px !important;
}

.identity-side--left img {
  width: 24px !important;
  max-height: 22px !important;
}

.identity-side--right {
  width: 24px !important;
  height: 22px !important;
}

.player-wrench-preview {
  width: 22px !important;
  height: 22px !important;
  min-width: 22px !important;
  max-width: 22px !important;
}

@media (min-width: 681px) {
  .player-identity {
    font-size: 22px !important;
  }
}

@media (max-width: 680px) {
  .player-identity {
    transform: translateY(-8px) !important;
    grid-template-columns: 26px minmax(0, auto) 22px !important;
    column-gap: 6px !important;
    font-size: clamp(17px, 4.2vw, 22px) !important;
    min-height: 27px !important;
  }

  .identity-side--left {
    width: 26px !important;
    height: 20px !important;
    margin-right: 4px !important;
  }

  .identity-side--left img {
    width: 22px !important;
    max-height: 20px !important;
  }

  .identity-side--right,
  .player-wrench-preview {
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    max-width: 20px !important;
  }
}

/* Phase 7: RTFont name, face mini-inventory, corrected compact identity. */
@font-face {
  font-family: "RTFont CenturyGothic Boldx2";
  src: url("../assets/fonts/RTFont_CenturyGothic_Boldx2.ttf") format("truetype");
  font-style: normal;
  font-weight: 700 900;
  font-display: swap;
}

.player-name-label {
  font-family: "RTFont CenturyGothic Boldx2", "Growtopia RTFont Bigx2", "Planner Century Gothic", Arial, sans-serif !important;
}

.expression-picker-field {
  display: grid;
  gap: 5px;
}

.expression-picker-field > select[hidden] {
  display: none !important;
}

.expression-mini-inventory {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(54px, 1fr));
  gap: 5px;
  max-height: 158px;
  overflow: auto;
  padding: 4px;
  border: 3px solid var(--gt-border);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.22);
  box-shadow: inset 2px 2px 0 #000000, 2px 2px 0 #000000;
}

.no-face-expression-warning {
  display: block;
  margin: 2px 0 6px;
  line-height: 1.25;
  text-wrap: balance;
}

.no-face-expression-warning[hidden] {
  display: none;
}

.expression-mini-inventory.is-disabled {
  opacity: 0.42;
  filter: grayscale(0.75);
  pointer-events: none;
}

.expression-mini-inventory.is-disabled .expression-item {
  cursor: not-allowed;
}

.expression-item {
  position: relative;
  display: grid;
  aspect-ratio: 1;
  place-items: center;
  padding: 5px;
  overflow: hidden;
  border: 0;
  background: center / 100% 100% no-repeat url("../assets/ui/inventory/boxes/clothes_itembox.png");
  image-rendering: pixelated;
  cursor: pointer;
}

.expression-item.is-selected {
  background-image: url("../assets/ui/inventory/boxes/select_clothes_itembox.png");
}

.expression-icon {
  width: 74%;
  height: 74%;
  object-fit: contain;
  image-rendering: pixelated;
  transform: scale(1.1);
  pointer-events: none;
}

.expression-name-overlay {
  position: absolute;
  z-index: 4;
  top: 0;
  right: 5px;
  left: 5px;
  max-height: 45%;
  overflow: hidden;
  padding: 2px 1px;
  background: rgba(0, 0, 0, 0.5);
  color: #ffffff;
  font-size: 9px;
  line-height: 1;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  text-shadow: none;
}

.expression-item.is-selected .expression-name-overlay,
.expression-item:focus-visible .expression-name-overlay,
.expression-item:hover .expression-name-overlay {
  opacity: 1;
}

.expression-equipped-check {
  position: absolute;
  right: 4px;
  bottom: 4px;
  z-index: 5;
  display: none;
  width: 30%;
  height: 30%;
  image-rendering: pixelated;
  pointer-events: none;
}

.expression-item.is-selected .expression-equipped-check {
  display: block;
  animation: equipped-check-pop 280ms cubic-bezier(.2, 1.65, .35, 1) both;
}

.player-identity {
  transform: translateY(-14px) !important;
  font-size: clamp(16px, 2.1vw, 21px) !important;
}

@media (min-width: 681px) {
  .player-identity {
    font-size: 21px !important;
  }
}

@media (max-width: 680px) {
  .expression-mini-inventory {
    grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
    max-height: 138px;
  }

  .expression-name-overlay {
    font-size: 8px;
  }

  .player-identity {
    transform: translateY(-12px) !important;
  }
}

/* Phase 8: face-grid spacing, flag picker, formatted GrowID, and makeup relocation. */
.player-name-label span { color: inherit; }

.identity-dependent-control {
  display: none !important;
}
body.has-growid .identity-dependent-control {
  display: grid !important;
}

.flag-picker-button {
  width: 100%;
  min-height: 30px;
  justify-content: flex-start;
  text-align: left;
  text-shadow: none !important;
}

.flag-picker-window {
  width: min(92vw, 520px);
  max-height: min(76vh, 560px);
  padding: 8px;
}
.flag-picker-heading h2 {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.right-sign-icon {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  color: #ffffff;
  text-shadow: 1px 1px 0 #000000;
}
.flag-picker-list {
  display: grid;
  gap: 5px;
  max-height: min(60vh, 440px);
  overflow: auto;
  padding: 4px;
}
.flag-picker-option {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 3px 8px;
  border: 2px solid var(--gt-border);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.22);
  color: #ffffff;
  font: inherit;
  text-align: left;
  box-shadow: inset 2px 2px 0 #000000, 2px 2px 0 #000000;
  cursor: pointer;
}
.flag-picker-option.is-selected {
  outline: 3px solid #ffdb16;
  outline-offset: -3px;
}
.flag-picker-option img {
  width: 28px;
  max-height: 22px;
  image-rendering: pixelated;
  filter: drop-shadow(1px 1px 0 #000000);
}
.flag-picker-blank {
  display: grid;
  place-items: center;
  width: 28px;
  height: 22px;
  color: #ffffff;
}

.expression-mini-inventory {
  grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)) !important;
  gap: 8px !important;
  padding: 3px 5px 7px 3px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
.expression-item {
  padding: 5px !important;
}
.expression-picker-field > span,
.rgb-control > legend {
  display: block;
  margin-bottom: 2px;
  color: #ffffff;
  font-weight: 900;
  text-shadow: none !important;
}

.makeup-settings-panel .panel-heading h2 {
  font-size: 18px;
}
.makeup-settings-panel .rgb-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 4px 0 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
.makeup-settings-panel .rgb-control legend {
  grid-column: 1 / -1;
  padding: 0;
}
.makeup-settings-panel .rgb-control output {
  grid-column: 1 / -1;
}

@media (max-width: 680px) {
  .expression-mini-inventory {
    grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)) !important;
    gap: 7px !important;
    max-height: 178px !important;
  }
}


/* Phase 9: final integration and interaction hardening. */
.expression-item:focus-visible,
.flag-picker-option:focus-visible,
.inventory-item:focus-visible,
.inventory-tab:focus-visible,
.inventory-handle:focus-visible,
.gt-button:focus-visible,
.search-switch:focus-visible {
  outline: 3px solid #ffdb16 !important;
  outline-offset: 2px;
}

.expression-item.has-missing-asset::before,
.flag-picker-option.has-missing-asset::before {
  content: "?";
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  inset: 18%;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.72);
  font-size: 18px;
  text-shadow: none;
}

.flag-picker-option.has-missing-asset {
  position: relative;
}

.flag-picker-option.has-missing-asset::before {
  position: static;
  grid-column: 1;
  grid-row: 1;
  width: 28px;
  height: 22px;
  inset: auto;
}

.planner-shell[inert] {
  user-select: none;
}

@media (prefers-reduced-motion: reduce) {
  .player-wrench-preview,
  .inventory-item.is-equipped.just-equipped .item-equipped-check,
  .expression-item.is-selected .expression-equipped-check {
    animation: none !important;
  }

  .inventory-dock,
  .inventory-handle,
  .expression-name-overlay {
    transition: none !important;
  }
}

/* Phase 10 hotfix: flags, GrowID input formatting, drawer reach, and face spacing. */
.flag-picker-button {
  display: inline-flex !important;
  align-items: center;
  justify-content: flex-start !important;
  gap: 8px;
  text-align: left !important;
  text-transform: none !important;
}
.flag-button-icon {
  width: 28px;
  max-height: 22px;
  flex: 0 0 auto;
  image-rendering: pixelated;
  filter: drop-shadow(1px 1px 0 #000000);
}
.formatted-growid-input {
  position: relative;
  display: block;
  min-width: 0;
}
.formatted-growid-input input {
  position: relative;
  z-index: 2;
  background-color: transparent !important;
  caret-color: #ffffff;
}
.formatted-growid-input input.has-formatted-preview {
  color: transparent !important;
}
.formatted-growid-input input.has-formatted-preview::selection {
  color: #ffffff;
  background: rgba(123, 186, 210, 0.45);
}
.growid-input-preview {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 2px 6px;
  overflow: hidden;
  white-space: pre;
  pointer-events: none;
  color: #ffffff;
  font: inherit;
  text-shadow: none;
}
.expression-mini-inventory {
  grid-template-columns: repeat(auto-fill, 58px) !important;
  justify-content: start !important;
  align-content: start !important;
  gap: 8px !important;
  padding: 6px 4px 8px 4px !important;
}
.expression-item {
  width: 58px !important;
  height: 58px !important;
  aspect-ratio: auto !important;
}
@media (max-width: 680px) {
  .inventory-handle {
    top: -42px !important;
    width: 58px !important;
  }
  .expression-mini-inventory {
    grid-template-columns: repeat(3, minmax(0, 58px)) !important;
    justify-content: space-evenly !important;
    gap: 8px 6px !important;
    max-height: 188px !important;
    padding: 6px 2px 9px 2px !important;
  }
  .expression-item {
    width: 58px !important;
    height: 58px !important;
  }
}
@media (min-width: 681px) {
  .expression-mini-inventory {
    grid-template-columns: repeat(auto-fill, 62px) !important;
    justify-content: start !important;
    gap: 9px !important;
  }
  .expression-item {
    width: 62px !important;
    height: 62px !important;
  }
}

/* Phase 9 Hotfix 2: bottom-attached drawer, clipped inventory content, and legacy skin. */
:root {
  --drawer-height: clamp(360px, 43dvh, 480px);
}

.inventory-dock {
  bottom: max(0px, env(safe-area-inset-bottom)) !important;
}

.inventory-window {
  overflow: hidden !important;
}

.inventory-main {
  display: grid !important;
  grid-template-rows: auto minmax(0, 1fr) !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

.inventory-content {
  min-height: 0 !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
}

.inventory-grid {
  align-content: start !important;
  padding-bottom: 10px !important;
}

.player-customization-panel,
.makeup-customization-panel {
  min-height: 0 !important;
  max-height: none !important;
}

/* Keep the mobile handle literally seated on the inventory's top border. */
.inventory-handle,
.inventory-handle:active,
.inventory-handle.is-dragging {
  top: 0 !important;
  transform: translate(-50%, -100%) translateY(3px) !important;
}

.skin-swatch--legacy {
  margin-inline-start: 8px;
}

.skin-swatch--legacy::before {
  content: none;
}

@media (max-width: 900px) {
  :root {
    --drawer-height: clamp(350px, 42dvh, 455px);
  }
}

@media (max-width: 680px) {
  :root {
    --drawer-height: clamp(330px, 41dvh, 430px);
  }

  .inventory-dock {
    bottom: max(0px, env(safe-area-inset-bottom)) !important;
  }

  .inventory-window {
    height: 100% !important;
  }

  .inventory-handle,
  .inventory-handle:active,
  .inventory-handle.is-dragging {
    top: 0 !important;
    width: 58px !important;
    transform: translate(-50%, -100%) translateY(3px) !important;
  }
}

@media (max-height: 620px) and (orientation: landscape) {
  :root {
    --drawer-height: min(280px, 52dvh);
  }
}

/* Phase 9 Hotfix 3: identity, legacy palette, custom-tab, and inventory reset fixes. */

/* Formatting codes remain stored in the real input, but leading codes occupy
   no visible/caret space while the formatted preview is active. */
.formatted-growid-input input.has-formatted-preview {
  text-indent: calc(0ch - var(--growid-format-indent, 0ch)) !important;
}

/* The legacy monolithic item atlas was removed for the upcoming native
   clothing/icon rebuild. */
.item-icon {
  background-image: none !important;
}

/* Match the larger in-game equipped check treatment without overflowing. */
.inventory-item .item-equipped-check {
  width: 40% !important;
  height: 40% !important;
  right: 1px !important;
  bottom: 1px !important;
}

/* Every piece of button text uses one consistent 1px bottom-right shadow. */
button,
button * {
  text-shadow: 1px 1px 0 #000000 !important;
}

.flag-picker-button,
.flag-picker-button span {
  justify-content: flex-start !important;
  text-align: left !important;
}

/* Phase 9 Hotfix 4: UI opacity, flags as buttons, menu/settings, handle, bottom docking. */
:root {
  --action-width: 104px;
}
.inventory-dock {
  bottom: 0 !important;
  transform: translate(-50%, var(--drawer-offset-y, 0px)) !important;
}
.inventory-window {
  background: rgba(39, 125, 159, 0.75) !important;
}
.settings-panel,
.makeup-settings-panel,
.flag-picker-window,
.skin-colors-window,
.growtool-popup-window,
.filter-menu {
  background: rgba(39, 125, 159, 0.75) !important;
}
.search-control input,
.filter-box,
.customization-field input,
.customization-field select,
.control-group input[type="text"],
.control-group input[type="number"],
.rgb-control input,
.flag-picker-button {
  background: rgba(39, 125, 159, 0.5) !important;
}
.formatted-growid-input input {
  background: rgba(39, 125, 159, 0.5) !important;
}
.formatted-growid-input input.has-formatted-preview {
  text-indent: 0 !important;
  color: transparent !important;
}
.growid-input-preview { padding-left: 6px !important; }
.inventory-actions {
  width: var(--action-width) !important;
  min-width: var(--action-width) !important;
}
.inventory-action {
  width: 74px !important;
  min-width: 74px !important;
  margin-inline: auto !important;
}
.search-switch {
  filter: drop-shadow(0 2px 0 #000000) !important;
}
.flag-picker-option {
  border: 0 !important;
  border-radius: 2px !important;
  background: #7bbad2 !important;
  box-shadow: 2px 2px 0 #000000 !important;
  text-shadow: 1px 1px 0 #000000 !important;
}
.flag-picker-option.is-selected {
  outline: 3px solid #ffdc19 !important;
  outline-offset: -2px !important;
  background: #8bc6dc !important;
}
.flag-picker-option img { image-rendering: pixelated !important; }
.inventory-item .item-equipped-check,
.expression-item .expression-equipped-check {
  width: 48% !important;
  height: 48% !important;
  right: 0 !important;
  bottom: 0 !important;
}
.growtool-top-actions {
  pointer-events: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}
.growtool-top-button {
  min-width: 72px;
  padding: 5px 8px;
  border: 3px solid var(--gt-border);
  border-radius: 2px;
  background: rgba(39,125,159,.75);
  color: #fff;
  font-weight: 900;
  text-shadow: 1px 1px 0 #000;
  box-shadow: inset 2px 2px 0 #000, 2px 2px 0 #000;
  cursor: pointer;
}
.growtool-popup-window {
  width: min(520px, calc(100vw - 32px));
  padding: 14px;
}
.growtool-popup-actions,
.growtool-settings-body {
  display: grid;
  gap: 12px;
  padding: 10px 2px 2px;
}
.growtool-popup-button { min-width: 150px; justify-self: start; }
.inventory-handle {
  top: 0 !important;
  width: 56px !important;
  transform: translate(-50%, -100%) translateY(3px) !important;
}
.inventory-handle img {
  width: 100% !important;
  height: auto !important;
  image-rendering: pixelated;
}
@media (min-width: 681px) {
  .inventory-handle { width: 44px !important; transform: translate(-50%, -100%) translateY(3px) !important; }
  .inventory-actions { --action-width: 96px; }
  .inventory-action { width: 68px !important; font-size: 14px !important; }
}
@media (max-width: 680px) {
  :root { --action-width: 86px; }
  .inventory-dock { bottom: 0 !important; width: calc(100vw - 100px) !important; }
  .inventory-actions { width: 86px !important; min-width: 86px !important; }
  .inventory-action { width: 66px !important; font-size: 14px !important; }
  .inventory-handle { width: 58px !important; top: 0 !important; transform: translate(-50%, -100%) translateY(3px) !important; }
  .growtool-top-actions { gap: 4px; }
  .growtool-top-button { min-width: 54px; padding: 3px 5px; font-size: 12px; }
}

/* ======================================================================
   Phase 10 — responsive repair, title/wrench systems, GrowTool navigation
   ====================================================================== */
:root {
  --gt-nav-size: 62px;
  --phase10-dimmer: rgba(0, 0, 0, .50);
}

/* Restore a viewport-bound drawer without allowing the action rail to clip. */
.inventory-dock,
.inventory-window,
.inventory-main,
.inventory-toolbar,
.inventory-content,
.inventory-actions {
  box-sizing: border-box !important;
  min-width: 0 !important;
}

@media (min-width: 681px) {
  .inventory-dock {
    left: 50% !important;
    right: auto !important;
    width: min(1100px, calc(100vw - 240px)) !important;
    max-width: calc(100vw - 240px) !important;
    transform: translate(-50%, var(--drawer-offset-y, 0px)) !important;
  }
  .inventory-window {
    grid-template-columns: minmax(0, 1fr) 96px !important;
  }
  .inventory-actions {
    width: 96px !important;
    min-width: 96px !important;
    max-width: 96px !important;
    overflow: hidden !important;
  }
}

@media (max-width: 680px) {
  :root {
    --phase10-tab-width: clamp(48px, 8.8vw, 62px);
    --phase10-dock-left: calc(var(--phase10-tab-width) + clamp(10px, 3.8vw, 28px));
    --action-width: clamp(72px, 12vw, 86px);
  }
  .inventory-dock {
    left: var(--phase10-dock-left) !important;
    right: 0 !important;
    width: calc(100vw - var(--phase10-dock-left)) !important;
    max-width: calc(100vw - var(--phase10-dock-left)) !important;
    transform: translate(0, var(--drawer-offset-y, 0px)) !important;
  }
  .inventory-tabs {
    left: calc(-1 * var(--phase10-tab-width)) !important;
    width: var(--phase10-tab-width) !important;
    gap: 4px !important;
  }
  .inventory-tab {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 44px !important;
    padding: 3px 5px !important;
  }
  .inventory-window {
    grid-template-columns: minmax(0, 1fr) var(--action-width) !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  .inventory-main {
    padding: 7px 6px !important;
  }
  .inventory-toolbar {
    grid-template-columns: minmax(0, 1fr) minmax(70px, 34%) !important;
    gap: 5px !important;
  }
  .search-control {
    grid-template-columns: 28px minmax(0, 1fr) !important;
    gap: 3px !important;
  }
  .search-control input,
  .filter-box {
    padding-inline: 5px !important;
    font-size: clamp(11px, 3vw, 14px) !important;
  }
  .inventory-actions {
    width: var(--action-width) !important;
    min-width: var(--action-width) !important;
    max-width: var(--action-width) !important;
    overflow: hidden !important;
  }
  .inventory-action {
    width: calc(100% - 14px) !important;
    min-width: 0 !important;
    padding-inline: 2px !important;
    font-size: clamp(11px, 3vw, 14px) !important;
  }
  .search-switch {
    max-width: 100% !important;
  }
}

/* Change Flag must remain visibly separate from the 75% panel. */
.flag-picker-button,
.wrench-customize-button {
  border: 3px solid var(--gt-border) !important;
  background: #7bbad2 !important;
  color: #fff !important;
  box-shadow: inset 2px 2px 0 rgba(255,255,255,.16), 2px 2px 0 #000 !important;
  opacity: 1 !important;
}
.flag-picker-button:hover,
.wrench-customize-button:hover { filter: brightness(1.08); }
.flag-picker-button:active,
.wrench-customize-button:active { filter: brightness(.82); transform: translate(1px,1px); }

/* Exact layered GrowTool floating navigation buttons. */
.phase10-floating-nav {
  position: fixed !important;
  z-index: 60;
  top: max(14px, env(safe-area-inset-top)) !important;
  right: max(14px, env(safe-area-inset-right)) !important;
  display: grid !important;
  gap: 10px !important;
  width: var(--gt-nav-size) !important;
  pointer-events: auto;
}
.gt-strict-icon-button {
  position: relative;
  display: block;
  width: var(--gt-nav-size);
  height: var(--gt-nav-size);
  padding: 0;
  border: 0;
  background: transparent;
  filter: drop-shadow(3px 3px 0 #000);
  cursor: pointer;
  isolation: isolate;
}
.gt-strict-layer {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  image-rendering: pixelated;
}
.gt-strict-layer--panel { z-index: 1; }
.gt-strict-layer--border { z-index: 2; }
.gt-strict-layer--icon { z-index: 3; }
.gt-strict-icon-button:hover { filter: brightness(1.06) drop-shadow(3px 3px 0 #000); }
.gt-strict-icon-button:active { filter: brightness(.76) drop-shadow(1px 1px 0 #000); transform: translate(2px,2px); }

/* GrowTool modal shell. */
.modal-backdrop,
.growtool-modal-backdrop { background: var(--phase10-dimmer) !important; }
.growtool-popup-window,
.wrench-customizer-window {
  position: relative;
  border: 4px solid var(--gt-border) !important;
  background: rgba(39,125,159,.75) !important;
  box-shadow: inset 3px 3px 0 #000, 3px 3px 0 #000 !important;
}
.growtool-menu-window {
  width: min(525px, calc(100vw - 70px)) !important;
  min-height: 410px;
  padding: 28px 26px 32px !important;
}
.growtool-settings-window {
  width: min(660px, calc(100vw - 44px)) !important;
  max-height: min(86dvh, 820px) !important;
  padding: 28px 30px 30px !important;
  overflow: auto;
}
.gt-overlap-close {
  position: absolute;
  z-index: 8;
  top: -31px;
  right: -31px;
  width: 66px;
  height: 66px;
  padding: 0;
  border: 0;
  background: transparent;
  filter: drop-shadow(3px 3px 0 #000);
  cursor: pointer;
}
.gt-overlap-close img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.gt-overlap-close:active { filter: brightness(.75) drop-shadow(1px 1px 0 #000); transform: translate(2px,2px); }
.growtool-popup-title,
.wrench-customizer-heading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0 0 18px;
}
.growtool-popup-title h2,
.wrench-customizer-heading h2 {
  margin: 0;
  color: #fff;
  font-size: clamp(30px, 6vw, 43px);
  text-align: center;
  text-shadow: 2px 2px 0 #000 !important;
}
.settings-title-gear { color: #fff; font-size: 44px; line-height: 1; filter: drop-shadow(2px 2px 0 #000); }
.growtool-popup-actions {
  display: grid !important;
  justify-items: center;
  gap: 16px !important;
  padding-top: 6px !important;
}
.growtool-popup-button {
  display: flex;
  width: min(330px, 90%);
  min-height: 72px;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  padding: 10px 24px;
  border: 0 !important;
  background: #8ccbe2 !important;
  color: #fff;
  font-size: clamp(24px, 5vw, 34px);
  box-shadow: 3px 4px 0 #000 !important;
}
.growtool-popup-button img { width: 48px; height: 48px; object-fit: contain; filter: drop-shadow(1px 1px 0 #000); }
.growtool-popup-button:disabled { opacity: .52; }
.growtool-settings-body { display: grid !important; gap: 18px !important; padding: 0 !important; }
.growtool-settings-section { border-bottom: 2px solid rgba(255,255,255,.45); padding: 4px 0 20px; }
.growtool-settings-section:last-child { border-bottom: 0; }
.growtool-settings-section h3 { margin: 0 0 9px; color: #fff; font-size: 25px; text-shadow: 1px 1px 0 #000; }
.growtool-settings-section p { margin: 0 0 12px; color: #fff; font-weight: 700; }
.growtool-check-row { display: flex; align-items: center; gap: 12px; min-height: 54px; color: #fff; font-size: 20px; font-weight: 900; }
.growtool-check-row input { width: 38px; height: 38px; accent-color: #7ec7e4; }
.nav-size-options { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.nav-size-option.is-selected { outline: 4px solid #ffdc19; outline-offset: -4px; filter: brightness(1.08); }

/* Wrench customization reuses the same inventory item box/check assets. */
.wrench-customizer-window {
  width: min(910px, calc(100vw - 38px));
  max-height: min(90dvh, 820px);
  padding: 22px 22px 20px;
  overflow: auto;
}
.wrench-customizer-heading img { width: 42px; height: 42px; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(2px 2px 0 #000); }
.wrench-customizer-subtitle,
.wrench-option-section h3 { color: #fff78c; font-weight: 900; text-shadow: 1px 1px 0 #000; }
.wrench-customizer-subtitle { margin: 0 0 15px; font-size: clamp(18px,3vw,28px); }
.wrench-option-section { margin: 12px 0 16px; }
.wrench-option-section h3 { margin: 0 0 8px; font-size: clamp(24px,4vw,36px); }
.wrench-option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 72px);
  gap: 8px;
  max-height: 184px;
  overflow: auto;
  padding: 5px;
  border: 3px solid rgba(0,0,0,.65);
  background: rgba(0,0,0,.14);
  overscroll-behavior: contain;
}
.wrench-option-tile {
  position: relative !important;
  display: grid !important;
  width: 72px !important;
  height: 72px !important;
  min-width: 72px !important;
  padding: 0 !important;
  place-items: center !important;
  border: 0 !important;
  background: none !important;
  box-shadow: none !important;
  overflow: hidden;
}
.wrench-option-tile .item-box-base { position: absolute; z-index: 0; inset: 0; width: 100%; height: 100%; object-fit: fill; pointer-events: none; }
.wrench-option-icon { position: relative; z-index: 2; width: 62%; height: 62%; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(1px 1px 0 #000); pointer-events: none; }
.wrench-option-label { position: absolute; z-index: 3; right: 4px; bottom: 3px; left: 4px; overflow: hidden; color: #fff; font-size: 8px; line-height: 1; text-align: center; text-overflow: ellipsis; white-space: nowrap; text-shadow: 1px 1px 0 #000; opacity: 0; pointer-events: none; }
.wrench-option-tile:hover .wrench-option-label,
.wrench-option-tile:focus-visible .wrench-option-label { opacity: 1; }
.wrench-option-tile .item-equipped-check { z-index: 5; display: none; position: absolute; right: 0 !important; bottom: 0 !important; width: 48% !important; height: 48% !important; pointer-events: none; image-rendering: pixelated; }
.wrench-option-tile.is-equipped .item-equipped-check { display: block; animation: equipped-check-pop 280ms cubic-bezier(.2,1.65,.35,1) both; }
.wrench-visibility-toggle { display: flex; align-items: center; gap: 10px; color: #fff; font-size: 17px; font-weight: 900; }
.wrench-visibility-toggle input { width: 30px; height: 30px; accent-color: #7bc7e4; }
.wrench-selection-info { min-height: 24px; margin: 8px 0; color: #fff; font-weight: 800; }
.wrench-back-button { min-width: 120px; background: #8ccbe2 !important; font-size: 22px; }

/* Player title and composite wrench header. */
.player-identity { overflow: visible !important; max-width: min(95vw, 650px); }
.identity-side--left { display: inline-flex !important; width: auto !important; min-width: 24px; gap: 3px; }
.identity-side--left.has-leading-title-icon { min-width: 49px !important; }
.title-leading-icon { width: 22px !important; height: 22px !important; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(1px 1px 0 #000); }
.title-side-decoration { display: inline-grid; width: 28px; height: 28px; place-items: center; flex: 0 0 auto; }
.title-side-decoration img { width: 28px; height: 28px; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(1px 1px 0 #000); }
.title-side-decoration--right img { transform: scaleX(-1); }
.player-wrench-stack { position: relative; display: inline-grid; width: 24px; height: 24px; place-items: center; }
.player-wrench-stack > img { position: absolute; inset: 0; width: 100% !important; height: 100% !important; object-fit: contain; image-rendering: pixelated; }
.player-wrench-decoration { z-index: 1; }
.player-wrench-preview { z-index: 2; }
.player-name-label.title-legendary { font-size: 1.18em; color: #fff36e !important; }
.player-name-label.title-level125 { color: rgba(103,208,255,.72) !important; animation: title-level125-pulse 2.4s ease-in-out infinite; }
.player-name-label.title-doctor,
.player-name-label.title-doctor span { color: #ff3c34 !important; }
@keyframes title-level125-pulse { 50% { opacity: .55; filter: brightness(1.35); } }
body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .001ms !important; }

@media (max-width: 680px) {
  .phase10-floating-nav { top: max(10px, env(safe-area-inset-top)) !important; right: max(10px, env(safe-area-inset-right)) !important; gap: 7px !important; }
  .brand { max-width: calc(100vw - var(--gt-nav-size) - 42px); }
  .growtool-menu-window { min-height: 360px; padding: 25px 18px !important; }
  .growtool-settings-window { padding: 25px 17px 22px !important; }
  .gt-overlap-close { top: -22px; right: -18px; width: 54px; height: 54px; }
  .growtool-popup-button { min-height: 64px; width: min(300px, 94%); }
  .wrench-customizer-window { padding: 18px 10px 15px; }
  .wrench-option-grid { grid-template-columns: repeat(auto-fill, 60px); max-height: 158px; gap: 6px; }
  .wrench-option-tile { width: 60px !important; height: 60px !important; min-width: 60px !important; }
  .title-side-decoration { width: 22px; height: 22px; }
  .title-side-decoration img { width: 22px; height: 22px; }
  .player-identity { gap: 3px !important; font-size: clamp(15px, 4vw, 20px) !important; }
}

/* Strict icons are colorized masks, matching GrowTool's source implementation. */
.gt-strict-layer {
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-size: 100% 100% !important;
  -webkit-mask-repeat: no-repeat !important;
  -webkit-mask-position: center !important;
  -webkit-mask-size: 100% 100% !important;
  mask-repeat: no-repeat !important;
  mask-position: center !important;
  mask-size: 100% 100% !important;
}
.gt-strict-panel {
  z-index: 0 !important;
  background-color: #fff !important;
  -webkit-mask-image: url('../assets/ui/growtool/icobtn_panel_hsb.png') !important;
  mask-image: url('../assets/ui/growtool/icobtn_panel_hsb.png') !important;
}
.gt-strict-border {
  z-index: 1 !important;
  background-color: #a5e3fb !important;
  -webkit-mask-image: url('../assets/ui/growtool/icobtn_border_hsb.png') !important;
  mask-image: url('../assets/ui/growtool/icobtn_border_hsb.png') !important;
  filter: drop-shadow(2px 2px 0 #000) !important;
}
.gt-strict-icon { z-index: 2 !important; background-color: #6fd3f8 !important; }
.gt-strict-icon-menu {
  -webkit-mask-image: url('../assets/ui/growtool/menu_icobtn_hsb.png') !important;
  mask-image: url('../assets/ui/growtool/menu_icobtn_hsb.png') !important;
}
.gt-strict-icon-settings {
  -webkit-mask-image: url('../assets/ui/growtool/setting_icobtn_hsb.png') !important;
  mask-image: url('../assets/ui/growtool/setting_icobtn_hsb.png') !important;
}
.gt-strict-icon-button:active .gt-strict-panel,
.gt-strict-icon-button:active .gt-strict-icon { opacity: .76 !important; }

/* Phase 10 final integration refinements. */
@media (min-width: 681px) {
  .inventory-dock {
    width: min(1180px, calc(100vw - 150px)) !important;
    max-width: calc(100vw - 150px) !important;
  }
}

.gt-strict-fallback {
  position: absolute;
  z-index: 4;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  pointer-events: none;
}
/* The flattened image guarantees a complete icon in local/offline contexts.
   Source masks remain packaged for future theme recoloring. */
.gt-strict-icon-button .gt-strict-layer { display: none !important; }

.settings-title-icon {
  width: 48px;
  height: 48px;
  object-fit: contain;
  filter: drop-shadow(2px 2px 0 #000);
}

.growtool-check-row {
  position: relative;
  cursor: pointer;
  user-select: none;
}
.growtool-check-row > input[type="checkbox"] {
  position: absolute;
  width: 1px !important;
  height: 1px !important;
  opacity: 0;
  pointer-events: none;
}
.gt-checkbox-visual {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-radius: 5px;
  background: rgba(24, 84, 111, .92);
  box-shadow: inset 2px 2px 0 #000, 2px 2px 0 #000;
}
.gt-checkbox-visual::before,
.gt-checkbox-visual::after,
.gt-checkbox-check {
  position: absolute;
  inset: 0;
  content: "";
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  pointer-events: none;
}
.gt-checkbox-visual::before {
  background-color: #a5e3fb;
  -webkit-mask: url('../assets/ui/growtool/check_border_hsb.png') center / contain no-repeat;
  mask: url('../assets/ui/growtool/check_border_hsb.png') center / contain no-repeat;
}
.gt-checkbox-visual::after {
  background-color: #fff;
  -webkit-mask: url('../assets/ui/growtool/check_outline_mask.png') center / contain no-repeat;
  mask: url('../assets/ui/growtool/check_outline_mask.png') center / contain no-repeat;
}
.gt-checkbox-check {
  display: none;
  background-color: #fff;
  -webkit-mask: url('../assets/ui/growtool/check_hsb.png') center / contain no-repeat;
  mask: url('../assets/ui/growtool/check_hsb.png') center / contain no-repeat;
  filter: drop-shadow(2px 2px 0 #245a8c);
}
.growtool-check-row > input[type="checkbox"]:checked + .gt-checkbox-visual .gt-checkbox-check {
  display: block;
}
.growtool-check-row > input[type="checkbox"]:focus-visible + .gt-checkbox-visual {
  outline: 3px solid #ffdb16;
  outline-offset: 2px;
}
.wrench-visibility-toggle.growtool-check-row {
  min-height: 50px;
}

.planner-transfer-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.planner-transfer-button {
  min-height: 52px;
  padding: 8px 12px !important;
  background: #8ccbe2 !important;
  font-size: 17px !important;
}
.planner-transfer-status {
  min-height: 22px;
  margin: 10px 0 0 !important;
  color: #d7ffd1 !important;
}
.planner-transfer-status.is-error { color: #ffd0ca !important; }

@media (max-width: 680px) {
  .settings-title-icon { width: 40px; height: 40px; }
  .gt-checkbox-visual { width: 40px; height: 40px; flex-basis: 40px; }
  .planner-transfer-actions { grid-template-columns: 1fr; }
}

/* Keep the external tab rail and the internal action rail inside narrow desktop-mode viewports. */
@media (min-width: 681px) {
  .inventory-dock {
    left: max(120px, calc(50% - 540px)) !important;
    right: 16px !important;
    width: auto !important;
    max-width: 1180px !important;
    transform: translateY(var(--drawer-offset-y, 0px)) !important;
  }
}
@media (max-width: 680px) {
  .inventory-dock {
    right: max(5px, env(safe-area-inset-right)) !important;
    width: auto !important;
    max-width: none !important;
  }
}
.wrench-selection-info { display: grid; gap: 3px; }
.wrench-selection-line { display: block; }

/* ===== Original source: phase11-foundation.css ===== */
/* ======================================================================
   Phase 11 — Phase 10 UI foundation lock

   This file is deliberately isolated from css/app.css. It establishes
   protective layout invariants and shared popup-content alignment without
   replacing the Phase 10 drawer, tab, window, or responsive systems.
   ====================================================================== */

body[data-planner-phase="11"][data-ui-foundation="phase10-locked"] {
  --phase11-popup-copy-align: left;
  --phase11-popup-icon-gap: 10px;
}

/* Preserve the Phase 10 geometry contract. New content must shrink inside
   existing columns instead of widening the drawer or action rail. */
body[data-planner-phase="11"] :is(
  .inventory-dock,
  .inventory-window,
  .inventory-main,
  .inventory-toolbar,
  .inventory-content,
  .inventory-actions,
  .settings-panel,
  .makeup-settings-panel,
  .customization-grid,
  .customization-field,
  .modal-backdrop .gt-window
) {
  box-sizing: border-box;
  min-width: 0;
}

body[data-planner-phase="11"] :is(
  .inventory-window,
  .inventory-main,
  .inventory-toolbar,
  .inventory-content,
  .settings-panel,
  .makeup-settings-panel,
  .customization-grid,
  .modal-backdrop .gt-window
) {
  max-width: 100%;
}

/* Tabs remain image-only controls physically behind the inventory window.
   The selected sprite is the state; no extra blue button panel is drawn. */
body[data-planner-phase="11"] .inventory-tabs {
  z-index: 1;
}

body[data-planner-phase="11"] .inventory-window {
  z-index: 2;
  isolation: isolate;
}

body[data-planner-phase="11"] .inventory-tab,
body[data-planner-phase="11"] .inventory-tab:hover,
body[data-planner-phase="11"] .inventory-tab:focus-visible,
body[data-planner-phase="11"] .inventory-tab.is-active {
  border: 0;
  background: transparent !important;
  box-shadow: none;
}

body[data-planner-phase="11"] .inventory-tab::before,
body[data-planner-phase="11"] .inventory-tab::after {
  content: none !important;
}

/* Shared popup copy language. Window titles keep their authored placement;
   labels, descriptions, option copy, and their icons always read left-to-right. */
body[data-planner-phase="11"] .modal-backdrop .gt-window :is(
  label,
  p,
  h3,
  legend,
  output,
  .wrench-selection-info,
  .wrench-option-section,
  .growtool-settings-section,
  .skin-custom-row,
  .skin-alpha-control
) {
  text-align: var(--phase11-popup-copy-align);
}

body[data-planner-phase="11"] :is(
  .flag-picker-option,
  .growtool-popup-button,
  .growtool-check-row,
  .wrench-visibility-toggle,
  .skin-custom-row,
  .skin-alpha-control
) {
  direction: ltr;
  text-align: left;
}

/* Existing icon-and-label controls already use icon-first DOM order. These
   rules lock that order so later phases cannot place an empty slot or label
   before the icon. */
body[data-planner-phase="11"] :is(
  .flag-picker-option,
  .growtool-popup-button,
  .growtool-check-row
) > :is(img, .gt-checkbox-visual, .flag-button-icon, .settings-title-icon) {
  order: -1;
  flex: 0 0 auto;
}

body[data-planner-phase="11"] .flag-picker-option {
  grid-template-columns: 34px minmax(0, 1fr);
}

body[data-planner-phase="11"] .growtool-popup-button,
body[data-planner-phase="11"] .growtool-check-row {
  justify-content: flex-start;
}

/* Popup content may scroll inside its own authored area, but cannot force a
   shared window or the page wider than the viewport. */
body[data-planner-phase="11"] .modal-backdrop .gt-window :is(
  .flag-picker-list,
  .wrench-option-grid,
  .growtool-settings-body,
  .skin-swatches-scroll
) {
  min-width: 0;
  max-width: 100%;
}

/* Phase 29 hotfix: title icons, badges, and flags render without drop shadows. */
.identity-side img,
.phase13-title-icon,
.phase14-title-badge,
.phase14-title-decoration,
.title-leading-icon,
.title-side-decoration img,
.flag-picker-option img,
.flag-button-icon {
  filter: none !important;
  box-shadow: none !important;
}
