﻿*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0f0e14;
  --bg-card: #1a1824;
  --bg-hover: #242133;
  --bg-active: #2d2a3d;
  --border: #2e2b3d;
  --text: #e8e6f0;
  --text-muted: #8b879a;
  --accent: #c45b8a;
  --accent-light: #e07aab;
  --accent-glow: rgba(196, 91, 138, 0.25);
  --success: #5bc48a;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --header-h: 56px;
  --mobile-nav-h: 64px;
  --sidebar-w: 220px;
  --font: 'Noto Sans SC', system-ui, sans-serif;
  --font-en: 'Inter', 'Noto Sans SC', system-ui, sans-serif;
  --font-ja: 'Noto Sans JP', 'Noto Sans SC', system-ui, sans-serif;
}

.entry-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at top left, rgba(96, 194, 180, 0.16), transparent 34%),
    radial-gradient(circle at bottom right, rgba(240, 138, 170, 0.14), transparent 36%),
    var(--bg);
  color: var(--text);
}

.entry-shell {
  width: min(920px, 100%);
  padding: 30px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(25, 27, 34, 0.78);
  box-shadow: var(--shadow);
}

.entry-shell h1 {
  margin: 0 0 10px;
  font-size: clamp(1.8rem, 4vw, 3rem);
}

.entry-shell p {
  color: var(--text-muted);
}

.entry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin: 24px 0;
}

.entry-lang,
.entry-default {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 10px;
  background: rgba(12, 14, 19, 0.52);
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
}

.entry-lang:hover,
.entry-default:hover {
  border-color: rgba(96, 194, 180, 0.46);
  color: #fff;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
  overflow-x: hidden;
}

body.lang-en {
  font-family: var(--font-en);
  --sidebar-w: 240px;
}

body.lang-ja {
  font-family: var(--font-ja);
  --sidebar-w: 240px;
}

/* Header */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  background: rgba(15, 14, 20, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  height: 100%;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  font-size: 1.25rem;
  color: var(--accent);
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.lang-select {
  padding: 6px 32px 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b879a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  min-width: 110px;
}

.lang-select:hover,
.lang-select:focus {
  border-color: var(--accent);
  background-color: var(--bg-hover);
  outline: none;
}

.lang-select option {
  background: var(--bg-card);
  color: var(--text);
}

/* Layout - Figure Centric Redesign */
.figure-app {
  max-width: 1100px;
  margin: 0 auto;
  padding-top: calc(var(--header-h) + 12px);
  padding-bottom: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: calc(100dvh - var(--header-h));
}

.figure-wrapper {
  position: relative;
  width: min(340px, 94vw); /* 留空间给右侧标签 */
  margin: 12px auto 16px;
  display: flex;
  justify-content: center;
}

.female-figure {
  display: block;
  width: 100%;
  max-width: 320px;
  height: auto;
  filter: drop-shadow(0 8px 30px rgba(0,0,0,0.5));
  border-radius: 16px;
  background: #15131c;
  padding: 14px;
  border: 1px solid var(--border);
  cursor: default;
}

/* 可点击区域 */
.figure-zone {
  cursor: pointer;
  transition: filter 0.15s ease, opacity 0.15s;
}
.figure-zone:hover {
  filter: brightness(1.15) saturate(1.1);
}
.figure-zone.active {
  filter: brightness(1.25) drop-shadow(0 0 10px var(--accent));
}

/* 区域标签 - 叠加在图形旁边 */
.zone-labels {
  position: absolute;
  top: 0;
  left: 100%;
  height: 100%;
  width: 78px;
  pointer-events: none;
  font-size: 0.68rem;
  color: var(--text-muted);
}

.zone-label {
  position: absolute;
  right: 2px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: auto;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  line-height: 1.1;
}
.zone-label:hover {
  border-color: var(--accent);
  color: var(--accent-light);
}
.zone-label.selected {
  border-color: var(--accent);
  color: var(--accent-light);
  background: var(--accent-glow);
}

/* 定位提示标签到图形各部位 */
.zone-label[data-for="hair"] { top: 8%; }
.zone-label[data-for="face"] { top: 19%; }
.zone-label[data-for="torso"] { top: 38%; }
.zone-label[data-for="hips"] { top: 56%; }
.zone-label[data-for="pose"] { top: 76%; }

/* 浮动上下文面板 (出现在对应位置附近) */
.context-panel {
  position: absolute;
  z-index: 80;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px;
  width: 248px;
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.context-panel.hidden {
  display: none;
}
.context-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--accent-light);
}
.close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}
.context-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
  gap: 5px;
}

/* Category Nav */
.category-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 8px;
}

.cat-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  font-family: inherit;
}

.cat-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.cat-btn.active {
  background: var(--accent-glow);
  color: var(--accent-light);
  border-left: 3px solid var(--accent);
  padding-left: 9px;
}

.cat-btn.has-selection .cat-label,
.mobile-cat-btn.has-selection {
  position: relative;
}

.cat-btn.has-selection .cat-label::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: middle;
}

.mobile-cat-btn.has-selection .cat-icon::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 8px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.mobile-cat-btn {
  position: relative;
}

.cat-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
}

/* Panels */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

.panel-title {
  flex: 1;
  min-width: 0;
  font-size: clamp(0.9rem, 2.5vw, 1.05rem);
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-muted);
}

.panel-actions {
  display: flex;
  gap: 8px;
}

/* Options Grid */
.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.option-card {
  padding: 14px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.option-card:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
  transform: translateY(-1px);
}

.option-card.selected {
  border-color: var(--accent);
  background: var(--accent-glow);
  box-shadow: 0 0 16px var(--accent-glow);
}

.option-card .opt-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
}

.option-card.selected .opt-label {
  color: var(--accent-light);
}

.option-card.selected::after {
  content: '✓';
  display: block;
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--accent-light);
  font-weight: 700;
}

/* 上下文面板内的紧凑选项卡 */
.context-panel .option-card {
  padding: 8px 6px;
  font-size: 0.8rem;
}
.context-panel .option-card .opt-label {
  font-size: 0.78rem;
}

/* Figure controls area (bottom info) */
.figure-controls {
  width: min(92vw, 620px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.figure-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.prompt-compact {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.prompt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.prompt-header span {
  font-weight: 600;
}

.selection-mini {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  min-height: 34px;
}

/* Preview (legacy styles kept for compatibility) */
.preview-panel {
  position: sticky;
  top: calc(var(--header-h) + 20px);
  align-self: start;
  max-height: calc(100dvh - var(--header-h) - 40px);
  overflow-y: auto;
}

.preview-block {
  margin-bottom: 16px;
}

.preview-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.preview-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.preview-text {
  width: 100%;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.85rem;
  line-height: 1.6;
  resize: vertical;
  font-family: 'Consolas', 'Monaco', monospace;
}

.summary-text {
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  line-height: 1.8;
  color: var(--text-muted);
  white-space: pre-wrap;
  font-family: inherit;
}

.panel-subtitle {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0;
}

.prompt-text {
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--accent-light);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: 'Consolas', 'Monaco', monospace;
  min-height: 60px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #9b3d6a);
  color: #fff;
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.btn-copy {
  padding: 4px 10px;
  font-size: 0.75rem;
  background: var(--bg-hover);
  color: var(--accent-light);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.btn-copy:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
}

.btn-full {
  width: 100%;
  margin-top: 8px;
}

/* Mobile Nav */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--mobile-nav-h);
  background: rgba(26, 24, 36, 0.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  z-index: 100;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.mobile-nav-inner {
  display: flex;
  height: 100%;
  padding: 0 8px;
  gap: 4px;
  min-width: min-content;
}

.mobile-cat-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 10px;
  min-width: 56px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.65rem;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.2s;
  white-space: nowrap;
}

.mobile-cat-btn .cat-icon {
  font-size: 1.2rem;
}

.mobile-cat-btn.active {
  color: var(--accent-light);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 10px 20px;
  background: var(--bg-active);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.875rem;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s;
  z-index: 200;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Responsive - Figure Centric */
@media (max-width: 1024px) {
  .preview-panel {
    position: static;
    max-height: none;
  }
}

@media (max-width: 768px) {
  .figure-app {
    padding-left: 8px;
    padding-right: 8px;
  }

  .female-figure {
    width: 100%;
    max-width: 280px;
  }

  .zone-labels {
    display: none; /* 移动端用点击触发即可 */
  }

  .context-panel {
    width: 82vw;
    max-width: 260px;
  }

  .mobile-nav {
    display: block;
  }

  .prompt-compact {
    font-size: 0.78rem;
  }
}

@media (max-width: 420px) {
  .female-figure {
    max-width: 240px;
  }
}

@media (max-width: 380px) {
  .options-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Chinese figure UI overrides */
body[data-ui="figure"] {
  --bg: #101116;
  --bg-card: #191b22;
  --bg-hover: #23262f;
  --bg-active: #2a2f38;
  --border: #30343f;
  --accent: #d15c83;
  --accent-light: #f08aaa;
  --accent-glow: rgba(209, 92, 131, 0.24);
  --accent-2: #60c2b4;
}

body[data-ui="figure"] .figure-app {
  max-width: 1440px;
  padding-top: calc(var(--header-h) + 18px);
}

body[data-ui="figure"] .figure-stage {
  width: 100%;
  display: flex;
  justify-content: center;
}

body[data-ui="figure"] .figure-wrapper {
  width: min(560px, 94vw);
  margin: 4px auto 20px;
}

body[data-ui="figure"] .female-figure {
  max-width: min(540px, calc((100dvh - var(--header-h) - 230px) * 0.75));
  min-width: 390px;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: center;
  filter: drop-shadow(0 18px 48px rgba(0, 0, 0, 0.56));
  border-radius: 18px;
  background:
    radial-gradient(circle at 48% 18%, rgba(96, 194, 180, 0.13), transparent 28%),
    radial-gradient(circle at 60% 60%, rgba(209, 92, 131, 0.12), transparent 34%),
    #15171d;
  padding: 10px;
  user-select: none;
}

body[data-ui="figure"] .figure-zone {
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, opacity 0.16s;
}

body[data-ui="figure"] .hotspot {
  position: absolute;
  z-index: 3;
  border: 1px solid transparent;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.01);
  appearance: none;
  padding: 0;
}

body[data-ui="figure"] .hotspot:hover,
body[data-ui="figure"] .hotspot:focus-visible,
body[data-ui="figure"] .hotspot.active,
body[data-ui="figure"] .hotspot.has-selection {
  border-color: rgba(240, 138, 170, 0.72);
  background: rgba(209, 92, 131, 0.15);
  box-shadow: 0 0 0 4px rgba(209, 92, 131, 0.13), inset 0 0 28px rgba(96, 194, 180, 0.08);
  outline: none;
}

body[data-ui="figure"] .hotspot.has-selection {
  border-color: rgba(96, 194, 180, 0.7);
  background: rgba(96, 194, 180, 0.1);
}

body[data-ui="figure"] .hotspot.active {
  border-color: var(--accent-light);
  background: rgba(209, 92, 131, 0.18);
  box-shadow: 0 0 0 4px rgba(209, 92, 131, 0.18), inset 0 0 34px rgba(209, 92, 131, 0.12);
}

body[data-ui="figure"] .hotspot-hair { left: 31%; top: 4%; width: 38%; height: 21%; }
body[data-ui="figure"] .hotspot-face { left: 38%; top: 17%; width: 24%; height: 15%; }
body[data-ui="figure"] .hotspot-torso { left: 24%; top: 30%; width: 52%; height: 28%; border-radius: 34% 34% 42% 42%; }
body[data-ui="figure"] .hotspot-hips { left: 22%; top: 55%; width: 56%; height: 18%; border-radius: 38% 38% 46% 46%; }
body[data-ui="figure"] .hotspot-pose { left: 24%; top: 68%; width: 52%; height: 27%; border-radius: 28% 28% 44% 44%; }

body[data-ui="figure"] .zone-labels {
  top: 5px;
  left: calc(50% + min(268px, 37dvh));
  width: 108px;
  font-size: 0.75rem;
}

body[data-ui="figure"] .zone-label {
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  line-height: 1.2;
}

body[data-ui="figure"] .context-panel {
  position: fixed;
  z-index: 180;
  padding: 14px;
  width: min(460px, 92vw);
  max-height: min(70vh, 560px);
  backdrop-filter: blur(18px);
}

body[data-ui="figure"] .context-header {
  margin-bottom: 6px;
  font-size: 0.98rem;
  position: sticky;
  top: -14px;
  z-index: 2;
  padding: 2px 0 10px;
  background: linear-gradient(var(--bg-card) 70%, rgba(25, 27, 34, 0));
}

body[data-ui="figure"] .context-options {
  grid-template-columns: repeat(auto-fill, minmax(126px, 1fr));
  gap: 8px;
}

body[data-ui="figure"] .context-group-title {
  grid-column: 1 / -1;
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

body[data-ui="figure"] .context-group-title:first-child {
  margin-top: 0;
  border-top: 0;
  padding-top: 0;
}

body[data-ui="figure"] .context-panel .option-card {
  min-height: 44px;
  padding: 10px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.86rem;
}

body[data-ui="figure"] .context-panel .option-card .opt-label {
  font-size: 0.86rem;
  line-height: 1.3;
}

body[data-ui="figure"] .figure-controls {
  width: min(92vw, 760px);
}

body[data-ui="figure"] .global-controls {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

body[data-ui="figure"] .global-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  background: rgba(25, 27, 34, 0.72);
  color: rgba(232, 230, 240, 0.78);
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 10px 24px rgba(0, 0, 0, 0.18);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

body[data-ui="figure"] .global-control:hover,
body[data-ui="figure"] .global-control.active,
body[data-ui="figure"] .global-control.has-selection {
  border-color: rgba(96, 194, 180, 0.42);
  background: rgba(28, 34, 39, 0.90);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.055), 0 0 22px rgba(96, 194, 180, 0.10);
}

body[data-ui="figure"] .global-control:hover,
body[data-ui="figure"] .global-control.active {
  transform: translateY(-1px);
}

body[data-ui="figure"] .global-icon {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid rgba(96, 194, 180, 0.28);
  border-radius: 50%;
  background: rgba(96, 194, 180, 0.08);
  color: var(--accent-2);
  font-size: 0.78rem;
  line-height: 1;
}

body[data-ui="figure"] .global-icon svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (min-height: 960px) and (min-width: 1200px) {
  body[data-ui="figure"] .female-figure {
    max-width: 540px;
  }
}

@media (max-width: 768px) {
  body[data-ui="figure"] .figure-wrapper {
    width: min(360px, 96vw);
  }

  body[data-ui="figure"] .female-figure {
    min-width: 0;
    max-width: 330px;
  }

  body[data-ui="figure"] .context-panel {
    position: fixed;
    left: 12px !important;
    right: 12px;
    bottom: 12px;
    top: auto !important;
    width: auto;
    max-width: none;
    max-height: min(62vh, 520px);
    z-index: 150;
  }

  body[data-ui="figure"] .context-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 420px) {
  body[data-ui="figure"] .female-figure {
    max-width: 300px;
  }
}

/* Chinese UI polish: refined tool surface and callout hotspots */
body[data-ui="figure"] {
  background:
    radial-gradient(circle at 50% 18%, rgba(96, 194, 180, 0.08), transparent 30%),
    radial-gradient(circle at 68% 34%, rgba(209, 92, 131, 0.10), transparent 34%),
    linear-gradient(180deg, #101116 0%, #0c0d11 100%);
}

body[data-ui="figure"] .header {
  background: rgba(12, 13, 17, 0.86);
  border-bottom-color: rgba(255, 255, 255, 0.07);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.22);
}

body[data-ui="figure"] .brand-icon {
  display: inline-grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid rgba(240, 138, 170, 0.34);
  border-radius: 50%;
  background: rgba(209, 92, 131, 0.12);
  color: var(--accent-light);
  font-size: 0.92rem;
  box-shadow: 0 0 22px rgba(209, 92, 131, 0.18);
}

body[data-ui="figure"] .lang-select,
body[data-ui="figure"] .prompt-compact,
body[data-ui="figure"] .selection-mini,
body[data-ui="figure"] .context-panel {
  border-color: rgba(255, 255, 255, 0.085);
  background: rgba(25, 27, 34, 0.82);
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

body[data-ui="figure"] .figure-wrapper {
  overflow: visible;
  isolation: isolate;
}

body[data-ui="figure"] .female-figure {
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.025),
    0 26px 70px rgba(0, 0, 0, 0.55),
    0 0 54px rgba(96, 194, 180, 0.08);
}

body[data-ui="figure"] .zone-labels {
  display: block;
  inset: 0;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  z-index: 30;
  pointer-events: none;
  font-size: 0.75rem;
}

body[data-ui="figure"] .hotspot {
  --pin-x: 50%;
  --pin-y: 50%;
  --line-w: 72px;
  --line-angle: 0deg;
  --label-x: calc(var(--pin-x) + var(--line-w) + 14px);
  --label-y: var(--pin-y);
  position: absolute;
  z-index: 5;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: rgba(232, 230, 240, 0.78);
}

body[data-ui="figure"] .hotspot::before {
  content: '';
  position: absolute;
  left: var(--pin-x);
  top: var(--pin-y);
  width: 12px;
  height: 12px;
  border: 2px solid rgba(240, 138, 170, 0.72);
  border-radius: 50%;
  background: rgba(15, 17, 22, 0.82);
  box-shadow:
    0 0 0 5px rgba(209, 92, 131, 0.10),
    0 0 18px rgba(209, 92, 131, 0.22);
  transform: translate(-50%, -50%);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

body[data-ui="figure"] .hotspot::after {
  content: none;
  position: absolute;
  left: var(--label-x);
  top: var(--label-y);
  min-width: max-content;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  background: rgba(16, 17, 22, 0.72);
  color: rgba(232, 230, 240, 0.76);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0;
  pointer-events: none;
  transform: translateY(-50%);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(10px);
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

body[data-ui="figure"] .zone-label {
  right: auto;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  background: rgba(16, 17, 22, 0.72);
  color: rgba(232, 230, 240, 0.76);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(10px);
  pointer-events: auto;
  transform: translateY(-50%);
}

body[data-ui="figure"] .zone-label:hover,
body[data-ui="figure"] .zone-label.selected {
  border-color: rgba(240, 138, 170, 0.45);
  background: rgba(28, 25, 34, 0.90);
  color: var(--accent-light);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.34), 0 0 22px rgba(209, 92, 131, 0.14);
}

body[data-ui="figure"] .zone-label[data-for="hair"] {
  left: 81%;
  top: 9%;
}

body[data-ui="figure"] .zone-label[data-for="face"] {
  left: 81%;
  top: 23%;
}

body[data-ui="figure"] .zone-label[data-for="torso"] {
  left: 81%;
  top: 43%;
}

body[data-ui="figure"] .zone-label[data-for="hips"] {
  left: 81%;
  top: 61%;
}

body[data-ui="figure"] .zone-label[data-for="pose"] {
  left: 81%;
  top: 82%;
}

body[data-ui="figure"] .hotspot-line {
  position: absolute;
  left: var(--pin-x);
  top: var(--pin-y);
  width: var(--line-w);
  height: 1px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(240, 138, 170, 0.58), rgba(96, 194, 180, 0.16));
  pointer-events: none;
  transform: rotate(var(--line-angle));
  transform-origin: left center;
  transition: opacity 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  opacity: 0.72;
}

body[data-ui="figure"] .hotspot:hover,
body[data-ui="figure"] .hotspot:focus-visible,
body[data-ui="figure"] .hotspot.active,
body[data-ui="figure"] .hotspot.has-selection {
  border: 0;
  background: transparent;
  box-shadow: none;
  outline: none;
}

body[data-ui="figure"] .hotspot:hover::before,
body[data-ui="figure"] .hotspot:focus-visible::before,
body[data-ui="figure"] .hotspot.active::before,
body[data-ui="figure"] .hotspot.has-selection::before {
  border-color: var(--accent-light);
  background: rgba(209, 92, 131, 0.36);
  box-shadow:
    0 0 0 7px rgba(209, 92, 131, 0.16),
    0 0 26px rgba(240, 138, 170, 0.50),
    0 0 38px rgba(96, 194, 180, 0.14);
  transform: translate(-50%, -50%) scale(1.12);
}

body[data-ui="figure"] .hotspot:hover::after,
body[data-ui="figure"] .hotspot:focus-visible::after,
body[data-ui="figure"] .hotspot.active::after,
body[data-ui="figure"] .hotspot.has-selection::after {
  border-color: rgba(240, 138, 170, 0.45);
  background: rgba(28, 25, 34, 0.90);
  color: var(--accent-light);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.34), 0 0 22px rgba(209, 92, 131, 0.14);
  transform: translateY(-50%) translateX(2px);
}

body[data-ui="figure"] .hotspot:hover .hotspot-line,
body[data-ui="figure"] .hotspot:focus-visible .hotspot-line,
body[data-ui="figure"] .hotspot.active .hotspot-line,
body[data-ui="figure"] .hotspot.has-selection .hotspot-line {
  opacity: 1;
  background: linear-gradient(90deg, rgba(240, 138, 170, 0.95), rgba(96, 194, 180, 0.35));
  box-shadow: 0 0 12px rgba(209, 92, 131, 0.22);
}

body[data-ui="figure"] .hotspot-hair {
  --pin-x: 76%;
  --pin-y: 28%;
  --line-w: 76px;
  --line-angle: -8deg;
  --label-x: calc(var(--pin-x) + 92px);
  --label-y: calc(var(--pin-y) - 10px);
}

body[data-ui="figure"] .hotspot-face {
  --pin-x: 88%;
  --pin-y: 42%;
  --line-w: 72px;
  --line-angle: 2deg;
  --label-x: calc(var(--pin-x) + 88px);
  --label-y: var(--pin-y);
}

body[data-ui="figure"] .hotspot-torso {
  --pin-x: 88%;
  --pin-y: 45%;
  --line-w: 88px;
  --line-angle: -3deg;
  --label-x: calc(var(--pin-x) + 104px);
  --label-y: calc(var(--pin-y) - 3px);
}

body[data-ui="figure"] .hotspot-hips {
  --pin-x: 88%;
  --pin-y: 48%;
  --line-w: 88px;
  --line-angle: 6deg;
  --label-x: calc(var(--pin-x) + 104px);
  --label-y: calc(var(--pin-y) + 5px);
}

body[data-ui="figure"] .hotspot-pose {
  --pin-x: 84%;
  --pin-y: 70%;
  --line-w: 82px;
  --line-angle: 9deg;
  --label-x: calc(var(--pin-x) + 98px);
  --label-y: calc(var(--pin-y) + 10px);
}

body[data-ui="figure"] .figure-actions {
  gap: 10px;
  margin-top: -4px;
}

body[data-ui="figure"] .action-btn {
  min-width: 104px;
  padding: 10px 16px;
  border-color: rgba(255, 255, 255, 0.09);
  background: rgba(25, 27, 34, 0.72);
  color: rgba(232, 230, 240, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 10px 24px rgba(0, 0, 0, 0.22);
}

body[data-ui="figure"] .action-btn:hover {
  color: #fff;
  border-color: rgba(240, 138, 170, 0.42);
  background: rgba(35, 38, 47, 0.88);
  transform: translateY(-1px);
}

body[data-ui="figure"] .action-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

body[data-ui="figure"] .action-icon rect,
body[data-ui="figure"] .action-icon path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body[data-ui="figure"] .action-icon circle {
  fill: currentColor;
}

body[data-ui="figure"] .prompt-compact {
  border-radius: 10px;
  padding: 12px;
}

body[data-ui="figure"] .prompt-header {
  margin-bottom: 8px;
  color: rgba(232, 230, 240, 0.58);
}

body[data-ui="figure"] .prompt-text {
  min-height: 74px;
  border-color: rgba(96, 194, 180, 0.12);
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    #0d0f14;
  background-size: 100% 28px;
  color: #f2a4bd;
}

body[data-ui="figure"] .selection-mini {
  color: rgba(232, 230, 240, 0.66);
  background: rgba(12, 14, 19, 0.72);
}

body[data-ui="figure"] .btn-copy {
  border-color: rgba(240, 138, 170, 0.30);
  background: rgba(209, 92, 131, 0.13);
  color: var(--accent-light);
}

body[data-ui="figure"] .context-panel {
  border-radius: 14px;
  scrollbar-width: thin;
  scrollbar-color: rgba(240, 138, 170, 0.48) rgba(255, 255, 255, 0.04);
}

body[data-ui="figure"] .context-panel::-webkit-scrollbar {
  width: 10px;
}

body[data-ui="figure"] .context-panel::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 999px;
}

body[data-ui="figure"] .context-panel::-webkit-scrollbar-thumb {
  border: 2px solid rgba(25, 27, 34, 0.9);
  border-radius: 999px;
  background: rgba(240, 138, 170, 0.48);
}

body[data-ui="figure"] .context-panel::-webkit-scrollbar-thumb:hover {
  background: rgba(240, 138, 170, 0.68);
}

body[data-ui="figure"] .context-panel .option-card {
  border-width: 1px;
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(12, 14, 19, 0.54);
}

body[data-ui="figure"] .context-panel .option-card:hover {
  border-color: rgba(240, 138, 170, 0.38);
  background: rgba(35, 38, 47, 0.72);
}

body[data-ui="figure"] .context-panel .option-card.selected {
  border-color: rgba(240, 138, 170, 0.64);
  background: rgba(209, 92, 131, 0.16);
  box-shadow: 0 0 18px rgba(209, 92, 131, 0.12);
}

body[dir="rtl"] {
  direction: rtl;
}

body[dir="rtl"] .header-inner,
body[dir="rtl"] .brand,
body[dir="rtl"] .figure-actions,
body[dir="rtl"] .global-control,
body[dir="rtl"] .prompt-header,
body[dir="rtl"] .context-header {
  flex-direction: row-reverse;
}

body[dir="rtl"] .lang-select,
body[dir="rtl"] .prompt-text,
body[dir="rtl"] .selection-mini,
body[dir="rtl"] .context-panel {
  direction: rtl;
  text-align: right;
}

body[dir="rtl"] .context-options {
  direction: rtl;
}

@media (max-width: 768px) {
  body[data-ui="figure"] .global-controls {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  body[data-ui="figure"] .global-control {
    min-height: 40px;
    gap: 5px;
    padding: 6px 8px;
    font-size: 0.78rem;
  }

  body[data-ui="figure"] .global-icon {
    width: 19px;
    height: 19px;
    font-size: 0.7rem;
  }

  body[data-ui="figure"] .hotspot::after,
  body[data-ui="figure"] .hotspot-line {
    display: none;
  }

  body[data-ui="figure"] .zone-labels {
    display: none;
  }

  body[data-ui="figure"] .hotspot::before {
    width: 14px;
    height: 14px;
    box-shadow:
      0 0 0 8px rgba(209, 92, 131, 0.12),
      0 0 20px rgba(209, 92, 131, 0.28);
  }
}



.site-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 28px 16px 34px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.9rem;
}

.site-footer a,
.legal-shell a {
  color: #f08aaa;
  text-decoration: none;
}

.site-footer a:hover,
.legal-shell a:hover {
  text-decoration: underline;
}

.legal-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 25% 20%, rgba(35, 120, 105, 0.14), transparent 32%),
    radial-gradient(circle at 78% 22%, rgba(209, 92, 131, 0.16), transparent 34%),
    #090b10;
  color: #f6f2f4;
}

.legal-shell {
  width: min(760px, calc(100% - 32px));
  margin: 0 auto;
  padding: 72px 0;
  line-height: 1.75;
}

.legal-shell h1,
.legal-shell h2 {
  line-height: 1.2;
}

.legal-shell p {
  color: rgba(246, 242, 244, 0.78);
}
