/* Ass Bench — clean-room rebuild from SPEC.md */

/* ── Reset & base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }

:root {
  --background: #242834;
  --foreground: #f1f5f9;
  --primary: #a4e2dc;
  --primary-foreground: #193d43;
  --muted: #3d4556;
  --muted-foreground: #c3d1df;
  --border: rgba(200, 219, 227, 0.2);
  --canvas-bg: #151922;
  --dock-bg: rgba(29, 34, 46, 0.91);
  --dock-border: rgba(216, 230, 241, 0.23);
  --glass: rgba(32, 38, 50, 0.7);
  --glass-border: rgba(166, 191, 206, 0.42);
  --tool-active: #fff3df;
  --tool-ink: #3a2a1f;
  --font: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--foreground);
  background: var(--canvas-bg);
  overflow: hidden;
  height: 100dvh;
}

/* ── Loading state ────────────────────────────────────────────── */
.bench-starting {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100dvh;
  font-size: 18px;
  color: var(--muted-foreground);
}

/* ── Main layout ──────────────────────────────────────────────── */
.character-atelier {
  position: relative;
  height: 100dvh;
  overflow: hidden;
  background: var(--canvas-bg);
}

/* 3D viewport (placeholder in static version) */
.atelier-viewport {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 44%, #1e2436 0%, var(--canvas-bg) 70%);
}

/* Vignette overlay */
.game-vignette {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(12, 14, 22, 0.35), transparent 22% 64%, rgba(12, 14, 22, 0.6)),
    radial-gradient(at 50% 44%, transparent 40%, rgba(17, 20, 32, 0.27));
}

/* Placeholder mannequin silhouette */
.mannequin-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.15;
}
.mannequin-placeholder svg {
  width: 200px;
  height: 400px;
  fill: var(--muted-foreground);
}

/* ── Header ───────────────────────────────────────────────────── */
.game-header {
  position: absolute;
  top: max(24px, env(safe-area-inset-top));
  left: max(28px, env(safe-area-inset-left));
  right: max(28px, env(safe-area-inset-right));
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}
.game-header > * { pointer-events: auto; }

.game-wordmark {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 18px;
  text-shadow: 0 2px 16px rgba(23, 44, 75, 0.31);
}
.game-wordmark .logo {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-foreground);
}

/* Version picker */
.bench-version-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 14px;
  color: var(--foreground);
  backdrop-filter: blur(12px);
}
.bench-version-trigger:hover { border-color: var(--primary); }
.bench-version-label { font-weight: 500; }
.bench-version-icon { font-size: 12px; opacity: 0.7; }

.bench-version-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  min-width: 240px;
  box-shadow: 0 12px 38px rgba(18, 39, 65, 0.2);
  display: none;
}
.bench-version-menu.open { display: block; }
.bench-version-heading {
  font-size: 12px;
  color: var(--muted-foreground);
  padding: 4px 8px 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.bench-version-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}
.bench-version-entry:hover { background: var(--muted); }
.bench-version-entry[aria-pressed="true"] { background: var(--muted); }
.bench-version-entry .desc {
  font-size: 12px;
  color: var(--muted-foreground);
}

/* Menu button */
.game-menu-trigger {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--foreground);
  font-size: 18px;
}
.game-menu-trigger:hover { border-color: var(--primary); }

/* ── Left tool dock ───────────────────────────────────────────── */
.game-interaction-dock {
  position: absolute;
  left: max(24px, env(safe-area-inset-left));
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 56px;
}

.game-rotation-controls {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  border-radius: 18px;
  background: var(--glass);
  border: none;
  backdrop-filter: blur(16px) saturate(1.4);
  box-shadow: 0 4px 16px rgba(18, 39, 65, 0.2);
}

.game-tool-button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #c9c1b6;
  position: relative;
  font-size: 18px;
  transition: background 0.15s, color 0.15s;
}
.game-tool-button:hover { background: rgba(255, 243, 223, 0.1); }
.game-tool-button[aria-pressed="true"] {
  background: var(--tool-active);
  color: var(--tool-ink);
}
.game-tool-button .lock-icon {
  position: absolute;
  bottom: 2px;
  right: 2px;
  font-size: 10px;
  opacity: 0.7;
}

/* Tool tooltip */
.game-tooltip {
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 13px;
  white-space: nowrap;
  pointer-events: none;
  display: none;
}
.game-tool-button:hover .game-tooltip { display: block; }

/* ── Footer ───────────────────────────────────────────────────── */
.game-footer {
  position: absolute;
  bottom: max(26px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 17px;
  max-width: calc(100% - 32px);
  pointer-events: none;
}
.game-footer > * { pointer-events: auto; }

.game-character-name {
  font-size: 28px;
  font-weight: 600;
  line-height: 1.15;
  color: #f3f7fc;
  text-shadow: 0 2px 18px rgba(16, 39, 71, 0.6);
  letter-spacing: 0.1px;
}

/* Dock bar */
.game-dock {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 17px;
  border-radius: 54px;
  background: var(--dock-bg);
  border: 1px solid var(--dock-border);
  backdrop-filter: blur(22px);
  box-shadow: 0 12px 38px rgba(18, 39, 65, 0.2), inset 0 1px rgba(232, 246, 255, 0.07);
}

.game-roster, .game-actions, .game-playback {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  border: none;
  margin: 0;
  padding: 0;
}
.game-actions, .game-playback {
  border-left: 1px solid rgba(200, 219, 227, 0.2);
  padding-left: 20px;
}

/* Character avatars in dock */
.game-avatar {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: #202632;
  padding: 4px;
  cursor: pointer;
  position: relative;
  opacity: 0.72;
  transition: transform 0.15s, opacity 0.15s, border-color 0.15s;
}
.game-avatar:hover { opacity: 0.9; transform: scale(1.05); }
.game-avatar[aria-pressed="true"] {
  opacity: 1;
  border-color: var(--primary);
  transform: scale(1.08);
}
.game-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.game-avatar .avatar-placeholder {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
}
.game-avatar .lock-badge {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
}

/* ── Outfit roster (horizontal strip) ─────────────────────────── */
.game-outfit-roster {
  display: flex;
  gap: 8px;
  align-items: center;
}
.game-outfit-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 4px;
  border-radius: 10px;
  border: 2px solid transparent;
  transition: border-color 0.15s;
}
.game-outfit-choice:hover { border-color: var(--border); }
.game-outfit-choice[aria-pressed="true"] { border-color: var(--primary); }
.game-outfit-portrait {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  background: #202632;
}
.game-outfit-portrait .color-swatch {
  width: 100%;
  height: 100%;
}
.game-outfit-label {
  font-size: 11px;
  color: var(--muted-foreground);
  white-space: nowrap;
}

/* ── Scene roster ─────────────────────────────────────────────── */
.game-scene-roster {
  display: flex;
  gap: 8px;
  align-items: center;
}
.game-scene-avatar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 4px;
  border-radius: 10px;
  border: 2px solid transparent;
  transition: border-color 0.15s;
}
.game-scene-avatar:hover { border-color: var(--border); }
.game-scene-avatar[aria-pressed="true"] { border-color: var(--primary); }
.game-scene-portrait {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  overflow: hidden;
  background: #202632;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.game-scene-label {
  font-size: 11px;
  color: var(--muted-foreground);
  white-space: nowrap;
}
.game-scene-label .lock-icon {
  font-size: 10px;
  margin-left: 2px;
  opacity: 0.7;
}

/* ── Camera options panel ─────────────────────────────────────── */
.game-camera-options-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.game-camera-options {
  display: flex;
  gap: 6px;
}
.game-camera-options button,
.game-camera-reset,
.game-camera-rotate {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--glass);
  color: var(--foreground);
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font);
}
.game-camera-options button:hover,
.game-camera-reset:hover,
.game-camera-rotate:hover {
  border-color: var(--primary);
}
.game-camera-rotate[aria-pressed="true"] {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}
.game-panel-note {
  font-size: 12px;
  color: var(--muted-foreground);
  margin: 0;
}

/* ── Supporter dialog ─────────────────────────────────────────── */
.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
}
.dialog-overlay.open { display: flex; }

.supporter-dialog {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  max-width: 400px;
  width: calc(100% - 32px);
}
.supporter-dialog h2 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 600;
}
.supporter-dialog .subtitle {
  color: var(--muted-foreground);
  font-size: 14px;
  margin: 0 0 16px;
}
.supporter-perks {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.supporter-perks li {
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.supporter-perks li::before {
  content: "✓";
  color: var(--primary);
  font-weight: 700;
}
.supporter-price {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 4px;
}
.supporter-price .currency {
  font-size: 16px;
  font-weight: 400;
  color: var(--muted-foreground);
}
.supporter-refund {
  font-size: 12px;
  color: var(--muted-foreground);
  margin: 0 0 16px;
}
.supporter-checkout {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: none;
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
}
.supporter-checkout:hover { opacity: 0.9; }
.supporter-secondary {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--foreground);
  font-size: 14px;
  cursor: pointer;
  margin-top: 8px;
  font-family: var(--font);
}
.supporter-secondary:hover { border-color: var(--primary); }

/* ── Photo dialog ─────────────────────────────────────────────── */
.photo-dialog .supporter-dialog { max-width: 500px; }
.game-photo-preview {
  width: 100%;
  border-radius: 10px;
  margin: 12px 0;
  background: #202632;
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-foreground);
  font-size: 14px;
}
.game-photo-save {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--primary);
  color: var(--primary-foreground);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}

/* ── Help / menu panel ────────────────────────────────────────── */
.game-hud-menu {
  position: absolute;
  top: max(72px, calc(env(safe-area-inset-top) + 48px));
  right: max(28px, env(safe-area-inset-right));
  z-index: 20;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  width: 300px;
  display: none;
}
.game-hud-menu.open { display: block; }
.game-menu-help {
  border: none;
  margin: 0;
  padding: 0;
}
.game-menu-help summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
}
.game-menu-help summary::-webkit-details-marker { display: none; }
.game-menu-help p {
  font-size: 13px;
  color: var(--muted-foreground);
  margin: 8px 0 0;
  line-height: 1.5;
}
.game-info-links {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.game-info-links a {
  color: var(--muted-foreground);
  text-decoration: none;
  font-size: 13px;
}
.game-info-links a:hover { color: var(--foreground); text-decoration: underline; }

/* ── Supporter trigger in header ──────────────────────────────── */
.supporter-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  cursor: pointer;
  font-size: 14px;
  color: var(--foreground);
  backdrop-filter: blur(12px);
}
.supporter-trigger:hover { border-color: var(--primary); }
.supporter-trigger .heart { font-size: 16px; }
.supporter-badge {
  font-size: 12px;
  background: var(--primary);
  color: var(--primary-foreground);
  padding: 1px 6px;
  border-radius: 6px;
  font-weight: 600;
}

/* ── Fixed outfit indicator ───────────────────────────────────── */
.game-fixed-outfit {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted-foreground);
  padding: 4px 8px;
}
.game-fixed-outfit .lock-icon { font-size: 12px; }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 768px) {
  .game-interaction-dock { width: 48px; left: 12px; }
  .game-tool-button { width: 38px; height: 38px; font-size: 16px; }
  .game-dock { gap: 12px; padding: 8px 12px; }
  .game-avatar { width: 50px; height: 50px; }
  .game-character-name { font-size: 22px; }
}
