:root {
  --bg-top: #d8c7a7;
  --bg-bottom: #8b6a52;
  --panel: rgba(36, 28, 24, 0.82);
  --panel-border: rgba(255, 231, 194, 0.18);
  --text: #f7eddc;
  --muted: #ccbda7;
  --accent: #f0b35b;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 229, 173, 0.45), transparent 32%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

body {
  height: 100vh;
  overflow: hidden;
}

.shell {
  display: grid;
  grid-template-columns: minmax(360px, min(560px, 42vw)) 1fr;
  height: 100vh;
  overflow: hidden;
}

.panel {
  padding: 28px 24px;
  background: var(--panel);
  border-right: 1px solid var(--panel-border);
  backdrop-filter: blur(8px);
  overflow-y: auto;
  min-height: 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 12px;
}

h1 {
  margin: 0;
  font-size: 36px;
  line-height: 1;
}

.intro {
  margin: 14px 0 24px;
  line-height: 1.5;
  color: var(--muted);
}

.field,
.toggle {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 18px;
}

.toggle {
  flex-direction: row;
  align-items: center;
}

fieldset.wardrobe-group {
  border: 1px solid rgba(255, 234, 204, 0.14);
  border-radius: 12px;
  padding: 12px 16px;
  margin: 0 0 18px;
  background: rgba(255, 247, 232, 0.03);
}

fieldset.wardrobe-group legend {
  padding: 0 8px;
  font-size: 13px;
  color: var(--accent);
}

input[type="checkbox"] {
  accent-color: var(--accent);
}

.viewer-custom-dropdown {
  position: relative;
  width: 100%;
}

.viewer-native-select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
}

.viewer-dropdown-button {
  width: 100%;
  border: 1px solid rgba(255, 234, 204, 0.2);
  border-radius: 12px;
  background: rgba(255, 247, 232, 0.08);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 46px;
  padding: 0 14px;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.viewer-dropdown-button:hover,
.viewer-dropdown-button:focus-visible,
.viewer-dropdown-button[aria-expanded="true"] {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(240, 179, 91, 0.16);
}

.viewer-dropdown-button-content,
.viewer-dropdown-option {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.viewer-dropdown-button-content {
  flex: 1 1 auto;
}

.viewer-dropdown-label,
.viewer-dropdown-option-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-dropdown-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  object-fit: contain;
}

.viewer-dropdown-icon[hidden] {
  display: none;
}

.viewer-dropdown-caret {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  opacity: 0.8;
  transition: transform 0.2s ease;
}

.viewer-dropdown-button[aria-expanded="true"] .viewer-dropdown-caret {
  transform: translateY(2px) rotate(-135deg);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.viewer-dropdown-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 1000;
  overflow: hidden;
  border: 1px solid rgba(255, 234, 204, 0.22);
  border-radius: 12px;
  background: rgba(36, 28, 24, 0.98);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.viewer-dropdown-list {
  display: grid;
  gap: 4px;
  max-height: min(420px, 60vh);
  overflow-y: auto;
  padding: 6px;
}

.viewer-dropdown-option {
  width: 100%;
  min-height: 42px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.viewer-dropdown-option:hover,
.viewer-dropdown-option:focus {
  outline: none;
  background: rgba(255, 247, 232, 0.08);
}

.viewer-dropdown-option[aria-selected="true"] {
  border-color: rgba(240, 179, 91, 0.5);
  background: rgba(240, 179, 91, 0.16);
}

.legend {
  margin-top: 24px;
  padding: 16px;
  border: 1px solid rgba(255, 234, 204, 0.14);
  border-radius: 16px;
  background: rgba(255, 247, 232, 0.05);
  color: var(--muted);
  line-height: 1.45;
}

.legend div + div {
  margin-top: 8px;
}

.status {
  margin-top: 18px;
  color: var(--accent);
  min-height: 1.4em;
}

.wardrobe-controls {
  display: grid;
  gap: 14px;
}

.stage-customize-panel {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 7;
  width: min(360px, calc(100% - 36px));
  max-height: calc(100% - 36px);
  padding: 0 8px 8px 0;
  overflow-y: auto;
  background: transparent;
  user-select: none;
  -webkit-user-select: none;
}

.stage-customize-panel .wardrobe-group {
  border: 0;
  border-radius: 0;
  padding: 0 4px;
  margin-bottom: 14px;
  background: transparent;
}

.stage-customize-panel .wardrobe-group legend {
  padding: 0 4px 0 0;
}

.accessory-adjust-fieldset,
.accessory-adjust-fieldset * {
  user-select: none;
  -webkit-user-select: none;
}

.wardrobe-slot {
  margin-bottom: 0;
}

.slot-note {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.wardrobe-color-field {
  margin-bottom: 12px;
}

.wardrobe-color-field:last-child {
  margin-bottom: 0;
}

.stage-wrap {
  position: relative;
  height: 100vh;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

#stage {
  display: block;
  width: 100%;
  height: 100%;
}

.photo-control {
  position: relative;
  flex: 0 0 auto;
}

.photo-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 7px;
  border: 1px solid rgba(255, 238, 205, 0.3);
  border-radius: 10px;
  color: var(--text);
  background: rgba(48, 36, 30, 0.84);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.24);
  cursor: pointer;
}

.photo-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.photo-button:hover,
.photo-button:focus-visible,
.photo-button[aria-expanded="true"] {
  outline: none;
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 3px rgba(240, 179, 91, 0.16);
}

.photo-button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.photo-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 10;
  display: grid;
  gap: 5px;
  min-width: 150px;
  padding: 8px;
  border: 1px solid rgba(255, 238, 205, 0.22);
  border-radius: 11px;
  background: rgba(48, 36, 30, 0.96);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
}

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

.photo-option {
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 8px 10px;
  color: var(--text);
  background: transparent;
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}

.photo-option:hover,
.photo-option:focus-visible {
  outline: none;
  border-color: rgba(255, 238, 205, 0.25);
  background: rgba(240, 179, 91, 0.18);
}

.photo-option:disabled {
  cursor: wait;
  opacity: 0.6;
}

.reset-view-button {
  position: static;
  flex: 0 0 auto;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid rgba(255, 238, 205, 0.3);
  border-radius: 10px;
  color: var(--text);
  background: rgba(48, 36, 30, 0.84);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.24);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.reset-view-button:hover,
.reset-view-button:focus-visible {
  outline: none;
  border-color: var(--accent);
  background: rgba(240, 179, 91, 0.2);
}

.exit-wardrobe-button {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: 10px 16px;
  border: 1px solid rgba(255, 238, 205, 0.3);
  border-radius: 10px;
  color: var(--text);
  background: rgba(48, 36, 30, 0.84);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.24);
  font: inherit;
  font-size: 16px;
  text-decoration: none;
  white-space: nowrap;
}

.exit-wardrobe-button:hover,
.exit-wardrobe-button:focus-visible {
  outline: none;
  border-color: var(--accent);
  background: rgba(240, 179, 91, 0.2);
}

.avatar-settings-bar {
  position: absolute;
  top: 18px;
  left: 50%;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 32px);
  padding: 8px 10px;
  border: 1px solid rgba(255, 238, 205, 0.22);
  border-radius: 14px;
  background: rgba(48, 36, 30, 0.76);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(10px);
  transform: translateX(-50%);
}

.avatar-settings-field {
  display: block;
  margin: 0;
}

.avatar-settings-field:first-child .viewer-custom-dropdown {
  width: 64px;
}

.avatar-settings-job-field .viewer-custom-dropdown {
  width: 170px;
}

.avatar-settings-field .viewer-dropdown-button {
  min-height: 38px;
  padding: 0 9px;
}

.avatar-settings-field .viewer-dropdown-icon {
  width: 24px;
  height: 24px;
  flex-basis: 24px;
}

.animation-timeline {
  position: absolute;
  left: 50%;
  bottom: 18px;
  z-index: 5;
  width: min(680px, calc(100% - 32px));
  transform: translateX(-50%);
  padding: 11px 14px 12px;
  border: 1px solid rgba(255, 238, 205, 0.22);
  border-radius: 14px;
  background: rgba(36, 28, 24, 0.78);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(10px);
}

.animation-timeline[hidden] {
  display: none;
}

.animation-timeline-header,
.animation-timeline-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.animation-timeline-header {
  justify-content: flex-start;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.animation-timeline-header strong {
  overflow: hidden;
  flex: 1 1 auto;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.animation-timeline-collapse {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255, 234, 204, 0.22);
  border-radius: 7px;
  padding: 0;
  background: rgba(255, 247, 232, 0.08);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 16px;
  line-height: 1;
}

.animation-timeline-collapse:hover,
.animation-timeline-collapse:focus-visible {
  outline: none;
  border-color: var(--accent);
  background: rgba(240, 179, 91, 0.18);
}

.animation-picker {
  display: flex;
  align-items: stretch;
  gap: 10px;
  min-height: 48px;
  margin-bottom: 10px;
}

.animation-picker[hidden] {
  display: none;
}

.animation-category-list {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 3px;
}

.animation-category-mobile-toggle,
.animation-category-mobile-options {
  display: none;
}

.animation-category-button,
.animation-choice-arrow {
  border: 1px solid rgba(255, 234, 204, 0.22);
  border-radius: 7px;
  background: rgba(255, 247, 232, 0.08);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
}

.animation-category-button {
  min-width: 68px;
  padding: 4px 7px;
  text-align: left;
}

.animation-category-button:hover,
.animation-category-button:focus-visible,
.animation-category-button.active {
  outline: none;
  border-color: var(--accent);
  background: rgba(240, 179, 91, 0.18);
  color: var(--text);
}

.animation-choice-strip {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  border: 1px solid rgba(255, 238, 205, 0.12);
  border-radius: 10px;
  padding: 6px 8px;
  background: rgba(255, 247, 232, 0.04);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.animation-choice-viewport {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}

.animation-choice-list {
  display: flex;
  flex: 1 1 auto;
  gap: 6px;
  width: 100%;
  min-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  overscroll-behavior: contain;
}

.animation-choice-list::-webkit-scrollbar {
  display: none;
}

.animation-choice-card {
  display: flex;
  flex: 0 0 max(48px, calc((100% - 30px) / 6));
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 48px;
  border: 1px solid rgba(255, 234, 204, 0.14);
  border-radius: 7px;
  padding: 3px;
  background: rgba(255, 247, 232, 0.04);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 9px;
  line-height: 1.05;
  overflow: hidden;
}

.animation-choice-card:hover,
.animation-choice-card:focus-visible,
.animation-choice-card.active {
  outline: none;
  border-color: var(--accent);
  background: rgba(240, 179, 91, 0.18);
  color: var(--text);
}

.animation-choice-icon {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.animation-choice-card-label {
  width: 100%;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.animation-choice-strip:active {
  cursor: grabbing;
}

.animation-choice-strip[data-dragging="true"] {
  cursor: grabbing;
}

.animation-choice-arrow {
  flex: 0 0 auto;
  width: 28px;
  height: 30px;
  color: var(--text);
  font-size: 18px;
  line-height: 1;
}

.animation-choice-arrow:hover,
.animation-choice-arrow:focus-visible {
  outline: none;
  border-color: var(--accent);
  background: rgba(240, 179, 91, 0.18);
}

.animation-choice-arrow:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.animation-timeline.is-minimized {
  width: min(260px, calc(100% - 32px));
  padding-bottom: 9px;
}

.animation-timeline.is-minimized .animation-timeline-header {
  margin-bottom: 0;
}

.animation-timeline.is-minimized #animation-timeline-time {
  display: none;
}

.animation-timeline.is-minimized .animation-picker {
  display: none;
}

.animation-timeline.is-minimized .animation-timeline-controls {
  display: none;
}

.animation-timeline-button {
  flex: 0 0 auto;
  border: 1px solid rgba(255, 234, 204, 0.22);
  border-radius: 8px;
  padding: 6px 10px;
  background: rgba(255, 247, 232, 0.08);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}

.animation-timeline-button:hover,
.animation-timeline-button:focus-visible {
  outline: none;
  border-color: var(--accent);
  background: rgba(240, 179, 91, 0.18);
}

.animation-timeline-button:disabled,
.animation-timeline-controls input:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.animation-timeline-controls input[type="range"] {
  flex: 1 1 auto;
  min-width: 80px;
  accent-color: var(--accent);
}

@media (max-width: 900px), (hover: none) and (pointer: coarse) {
  body {
    height: auto;
    overflow: auto;
  }

  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .panel {
    border-right: 0;
    border-bottom: 1px solid var(--panel-border);
  }

  .stage-wrap {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  #stage {
    flex: 0 0 60vh;
    height: 60vh;
  }

  .animation-timeline {
    position: relative;
    left: auto;
    bottom: auto;
    width: min(560px, calc(100% - 16px));
    max-width: calc(100% - 16px);
    margin: 8px auto 10px;
    transform: none;
    overflow: hidden;
    padding: 9px 10px 10px;
  }

  .animation-picker {
    width: 100%;
    flex-direction: column;
    gap: 7px;
  }

  .animation-category-list {
    position: relative;
    display: block;
    width: 100%;
  }

  .animation-category-button {
    display: none;
  }

  .animation-category-mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 34px;
    padding: 6px 9px;
    border: 1px solid rgba(255, 234, 204, 0.22);
    border-radius: 7px;
    background: rgba(240, 179, 91, 0.18);
    color: var(--text);
    cursor: pointer;
    font: inherit;
    font-size: 11px;
    text-align: left;
  }

  .animation-category-mobile-toggle::after {
    content: "⌄";
    margin-left: 8px;
    font-size: 16px;
    line-height: 1;
  }

  .animation-category-mobile-toggle:focus-visible {
    outline: none;
    border-color: var(--accent);
  }

  .animation-category-mobile-options {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 4px;
    padding: 5px;
    border: 1px solid rgba(255, 238, 205, 0.22);
    border-radius: 9px;
    background: rgba(36, 28, 24, 0.98);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.28);
  }

  .animation-category-mobile-options[hidden] {
    display: none;
  }

  .animation-category-mobile-option {
    min-height: 30px;
    padding: 5px 6px;
    border: 1px solid rgba(255, 234, 204, 0.18);
    border-radius: 6px;
    background: rgba(255, 247, 232, 0.08);
    color: var(--muted);
    cursor: pointer;
    font: inherit;
    font-size: 11px;
  }

  .animation-category-mobile-option:hover,
  .animation-category-mobile-option:focus-visible,
  .animation-category-mobile-option.active {
    outline: none;
    border-color: var(--accent);
    background: rgba(240, 179, 91, 0.18);
    color: var(--text);
  }

  .animation-choice-strip {
    width: 100%;
    gap: 6px;
    padding: 6px;
  }

  .animation-choice-list {
    min-width: 0;
  }

  .wardrobe-controls {
    gap: 5px;
  }

  fieldset.wardrobe-group {
    padding: 8px 10px;
    margin-bottom: 6px;
  }

  .tab-container {
    margin-bottom: 8px;
  }

  .subtab-container {
    margin: -4px 0 8px;
    gap: 4px;
  }
}

.hair-palette-selector {
  display: none;
}

@media (max-width: 640px), (hover: none) and (pointer: coarse) {
  .hair-palette-selector {
    display: flex;
    gap: 5px;
    margin-bottom: 9px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .hair-palette-selector::-webkit-scrollbar {
    display: none;
  }

  .hair-palette-button {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    white-space: nowrap;
  }

  .hair-palette-section {
    min-width: 0;
  }

  .hair-palette-section .color-palette {
    display: grid;
    grid-template-columns: repeat(6, 28px);
    gap: 8px;
    justify-content: start;
    min-width: 0;
  }

  .hair-palette-section .color-circle {
    flex: none;
  }

  .hair-palette-button.active,
  .hair-palette-button:focus-visible {
    outline: none;
    border-color: var(--accent);
    background: rgba(240, 179, 91, 0.25);
    color: var(--accent);
  }

  .hair-palette-section:not(.mobile-active) {
    display: none;
  }

  .animation-choice-card {
    flex-basis: 82px;
    min-height: 58px;
    font-size: 10px;
  }

  .animation-choice-icon {
    width: 34px;
    height: 34px;
  }

  .animation-timeline-controls {
    display: grid;
    grid-template-columns: auto auto;
    gap: 6px;
  }

  .animation-timeline-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
  }

  .animation-timeline-controls input[type="range"] {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
  }

  .avatar-settings-bar {
    gap: 5px;
    padding: 5px;
  }

  .avatar-settings-job-field .viewer-custom-dropdown {
    width: 145px;
  }
}

.tab-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 18px;
}

.subtab-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: -8px 0 18px;
}

.tab-button {
  flex: 1 1 calc(33.33% - 6px);
  padding: 8px 10px;
  background: rgba(255, 247, 232, 0.05);
  border: 1px solid rgba(255, 234, 204, 0.12);
  border-radius: 8px;
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  transition: all 0.2s ease;
}

.tab-icon,
.subtab-icon {
  width: 34px;
  height: 34px;
  object-fit: contain;
  pointer-events: none;
}

.tab-button:hover {
  background: rgba(255, 247, 232, 0.1);
  color: var(--text);
}

.tab-button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #241c18;
  font-weight: bold;
}

.subtab-button {
  padding: 8px 10px;
  background: rgba(255, 247, 232, 0.04);
  border: 1px solid rgba(255, 234, 204, 0.12);
  border-radius: 999px;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  transition: all 0.2s ease;
}

.subtab-button:hover {
  background: rgba(255, 247, 232, 0.1);
  color: var(--text);
}

.subtab-button.active {
  background: rgba(240, 179, 91, 0.16);
  border-color: var(--accent);
  color: var(--text);
}

.item-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  max-height: none;
  overflow-y: visible;
  padding: 4px;
}

.item-button {
  padding: 5px;
  background: rgba(255, 247, 232, 0.04);
  border: 1px solid rgba(255, 234, 204, 0.1);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
  text-align: center;
  word-break: break-all;
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.item-icon {
  width: 76px;
  height: 76px;
  object-fit: contain;
  pointer-events: none;
}

.item-button:hover {
  background: rgba(255, 247, 232, 0.08);
}

.item-button.active {
  border-color: var(--accent);
  background: rgba(240, 179, 91, 0.15);
}

.color-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.color-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.color-circle:hover {
  transform: scale(1.15);
}

.color-circle.active {
  border-color: var(--accent);
  transform: scale(1.1);
  box-shadow: 0 0 8px var(--accent);
}

@media (max-width: 900px), (hover: none) and (pointer: coarse) {
  .exit-wardrobe-button {
    display: none;
  }

  .avatar-settings-bar {
    top: 4px;
    gap: 4px;
    max-width: calc(100% - 16px);
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
  }

  .avatar-settings-field:first-child .viewer-custom-dropdown {
    width: 56px;
  }

  .avatar-settings-job-field .viewer-custom-dropdown {
    width: 145px;
  }

  .avatar-settings-field .viewer-dropdown-button {
    min-height: 32px;
    padding: 0 7px;
    border-radius: 9px;
    gap: 6px;
  }

  .avatar-settings-field .viewer-dropdown-icon {
    width: 20px;
    height: 20px;
    flex-basis: 20px;
  }

  .photo-button {
    width: 32px;
    height: 32px;
    padding: 5px;
    border-radius: 9px;
  }

  .photo-button svg {
    width: 18px;
    height: 18px;
  }

  .avatar-settings-bar .reset-view-button {
    min-height: 32px;
    padding: 5px 8px;
    border-radius: 9px;
    font-size: 11px;
  }

  .tab-container {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    justify-content: start;
    gap: 4px;
    margin-bottom: 8px;
  }

  .subtab-container {
    margin: -4px 0 8px;
    gap: 4px;
  }

  .tab-button {
    width: 100%;
    min-width: 0;
    min-height: 40px;
    height: 40px;
    padding: 3px;
    border-radius: 6px;
    overflow: hidden;
  }

  .tab-button.animation-tab {
    display: none;
  }

  .tab-button .tab-icon {
    width: 30px;
    height: 30px;
  }

  .item-list {
    grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
    gap: 5px;
    padding: 2px;
  }

  .item-button {
    min-height: 56px;
    padding: 2px;
    border-radius: 5px;
    font-size: 8px;
  }

  .item-icon {
    width: 48px;
    height: 48px;
  }
}

.area-selector {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.area-button {
  padding: 4px 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
}

.area-button.active {
  background: rgba(240, 179, 91, 0.25);
  border-color: var(--accent);
  color: var(--accent);
}

.diy-reset-button {
  margin: 0 0 8px;
}

.slider-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.slider-group span {
  font-size: 12px;
  color: var(--muted);
}

.slider-group input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

@media (max-width: 640px), (hover: none) and (pointer: coarse) {
  .accessory-adjust-fieldset {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 10px;
  }

  .accessory-adjust-fieldset legend {
    grid-column: 1 / -1;
  }

  .accessory-adjust-fieldset .slider-group {
    min-width: 0;
    gap: 4px;
    margin-bottom: 0;
  }

  .accessory-adjust-fieldset .slider-group span {
    white-space: nowrap;
  }
}

@media (max-width: 900px), (hover: none) and (pointer: coarse) {
  .stage-customize-panel {
    position: static;
    width: auto;
    max-height: none;
    padding: 0;
    overflow: visible;
  }

  .stage-customize-panel .wardrobe-group {
    border: 1px solid rgba(255, 234, 204, 0.14);
    border-radius: 12px;
    padding: 8px 10px;
    margin-bottom: 6px;
    background: rgba(255, 247, 232, 0.03);
  }
}

#__tdt {
  display: none !important;
}
