/* ==========================================================================
   DEVELOPMENT BUILD & VISUAL LAYOUT EDITOR STYLES
   Exact UI/UX Reference: media_1791284573530.png
   ========================================================================== */

:root {
  --dev-bg: rgba(18, 24, 27, 0.96);
  --dev-bg-header: rgba(14, 20, 24, 0.98);
  --dev-card-bg: rgba(10, 18, 24, 0.95);
  --dev-card-border: #06b6d4;
  --dev-border: rgba(255, 255, 255, 0.12);
  --dev-text: #f8fafc;
  --dev-text-muted: #94a3b8;
  --dev-gold: #facc15;
  --dev-gold-glow: #eab308;
  --dev-cyan: #38bdf8;
  --dev-cyan-bright: #06b6d4;
  --dev-cyan-bg: rgba(6, 182, 212, 0.18);
  --dev-green: #22c55e;
  --dev-green-bright: #4ade80;
  --dev-green-bg: rgba(34, 197, 94, 0.16);
  --dev-red: #ef4444;
  --dev-purple: #c084fc;
  --dev-btn-bg: rgba(30, 41, 59, 0.85);
  --dev-btn-hover: rgba(45, 60, 80, 0.95);
  --dev-radius-panel: 16px;
  --dev-radius-card: 12px;
  --dev-radius-btn: 8px;
}

/* Floating Bottom-Left Circular Gear Button (Hidden in production) */
.dev-floating-gear-btn {
  display: none !important;
  position: fixed;
  bottom: 16px;
  left: 16px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #141c22;
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  color: #f1f5f9;
  font-size: 19px;
  line-height: 1;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 999999;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.05);
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
  -webkit-user-select: none;
}

body.dev-editor-enabled .dev-floating-gear-btn:not(.hidden) {
  display: flex !important;
}

.dev-floating-gear-btn:hover {
  background: #1e2a34;
  border-color: var(--dev-cyan);
  color: var(--dev-cyan);
  transform: scale(1.08) rotate(30deg);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.8), 0 0 12px rgba(6, 182, 212, 0.4);
}

.dev-floating-gear-btn:active {
  transform: scale(0.95) rotate(60deg);
}

.dev-floating-gear-btn.hidden {
  display: none !important;
}

/* Main Development Tool Panel Window (Hidden in production) */
.dev-panel-window {
  display: none !important;
  position: fixed;
  top: 14px;
  left: 14px;
  width: 326px;
  max-width: calc(100vw - 28px);
  max-height: calc(100vh - 28px);
  background: var(--dev-bg);
  color: var(--dev-text);
  border-radius: var(--dev-radius-panel);
  border: 1.5px solid var(--dev-border);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 999980;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  box-sizing: border-box;
}

body.dev-editor-enabled .dev-panel-window:not(.minimized) {
  display: flex !important;
}

.dev-panel-window.minimized {
  display: none !important;
}

/* Panel Header (Draggable) */
.dev-panel-header {
  padding: 10px 14px 6px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: grab;
  position: relative;
}

.dev-panel-header:active {
  cursor: grabbing;
}

.dev-panel-title {
  margin: 0 auto;
  font-size: 14px;
  font-weight: 900;
  color: var(--dev-gold);
  letter-spacing: 0.9px;
  text-transform: uppercase;
  text-align: center;
  text-shadow: 0 0 10px rgba(250, 204, 21, 0.35);
}

.dev-header-btn {
  position: absolute;
  right: 10px;
  top: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--dev-text-muted);
  border: none;
  border-radius: 6px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.dev-header-btn:hover {
  background: rgba(239, 68, 68, 0.6);
  color: #ffffff;
}

/* Scrollable Body */
.dev-panel-body {
  padding: 4px 12px 14px;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-sizing: border-box;
}

.dev-panel-body::-webkit-scrollbar {
  width: 5px;
}

.dev-panel-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

/* Scene Status Subtitle Row */
.dev-scene-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
  padding: 0 2px;
}

.dev-scene-indicator {
  font-size: 12px;
  font-weight: 700;
  color: #f8fafc;
}

.dev-hotkey-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--dev-gold);
}

/* Buttons and Grids */
.dev-btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.dev-btn-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.dev-btn-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.dev-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: var(--dev-btn-bg);
  border: 1px solid var(--dev-border);
  color: #f8fafc;
  border-radius: var(--dev-radius-btn);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  padding: 6px 10px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
  user-select: none;
  box-sizing: border-box;
  text-align: center;
  white-space: nowrap;
}

.dev-btn:hover {
  background: var(--dev-btn-hover);
  border-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.dev-btn:active {
  transform: scale(0.97);
}

.dev-btn-sm {
  font-size: 10.5px;
  padding: 5px 4px;
}

/* Edit Layout Prominent Button */
.dev-btn-edit-layout {
  width: 100%;
  padding: 8px 12px;
  font-size: 12.5px;
  font-weight: 800;
  border: 1.5px solid var(--dev-green);
  color: var(--dev-green-bright);
  background: var(--dev-green-bg);
  border-radius: var(--dev-radius-btn);
  transition: all 0.15s ease;
}

.dev-btn-edit-layout:hover {
  background: rgba(34, 197, 94, 0.26);
  border-color: #86efac;
  color: #86efac;
  box-shadow: 0 0 14px rgba(34, 197, 94, 0.35);
}

.dev-btn-edit-layout.active {
  background: rgba(34, 197, 94, 0.3);
  color: #86efac;
  border-color: #4ade80;
  box-shadow: 0 0 16px rgba(34, 197, 94, 0.45);
}

/* ACTIVE TARGET Framed Card (Cyan Border) */
.dev-active-card {
  border: 1.5px solid var(--dev-card-border);
  border-radius: var(--dev-radius-card);
  background: var(--dev-card-bg);
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), inset 0 0 16px rgba(6, 182, 212, 0.05);
  box-sizing: border-box;
}

.dev-active-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2px;
}

.dev-active-title {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--dev-cyan);
  font-weight: 900;
  font-size: 11.5px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.dev-active-tag {
  color: var(--dev-cyan);
  font-weight: 700;
  font-size: 10.5px;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Target Dropdown Select */
.dev-select-wrap {
  width: 100%;
}

.dev-target-select {
  width: 100%;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #f8fafc;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  padding: 6px 8px;
  border-radius: 7px;
  outline: none;
  cursor: pointer;
  box-sizing: border-box;
  transition: border-color 0.15s ease;
}

.dev-target-select:focus,
.dev-target-select:hover {
  border-color: var(--dev-cyan);
}

.dev-target-select optgroup {
  background: #0f172a;
  color: #94a3b8;
  font-weight: 800;
  font-size: 11px;
}

.dev-target-select option {
  background: #141f2e;
  color: #f8fafc;
  font-weight: 600;
  font-size: 11.5px;
  padding: 4px;
}

/* Slider Rows */
.dev-slider-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dev-slider-label {
  width: 76px;
  color: #f1f5f9;
  font-weight: 600;
  font-size: 11px;
  flex-shrink: 0;
}

.dev-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: rgba(56, 189, 248, 0.25);
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}

.dev-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--dev-cyan);
  cursor: pointer;
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.8);
  transition: transform 0.1s ease;
}

.dev-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.dev-slider::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--dev-cyan);
  border: none;
  cursor: pointer;
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.8);
}

.dev-badge-input {
  width: 44px;
  height: 22px;
  background: rgba(14, 23, 30, 0.95);
  border: 1px solid rgba(56, 189, 248, 0.5);
  color: var(--dev-cyan);
  font-family: inherit;
  font-weight: 800;
  font-size: 11px;
  text-align: center;
  border-radius: 5px;
  outline: none;
  box-sizing: border-box;
  padding: 0;
  -moz-appearance: textfield;
}

.dev-badge-input::-webkit-outer-spin-button,
.dev-badge-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.dev-badge-input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.4);
}

/* Step Buttons */
.dev-btn-step {
  padding: 5px 4px;
  font-size: 10.5px;
}

.dev-btn-step.active {
  border: 1.5px solid var(--dev-card-border);
  background: var(--dev-cyan-bg);
  color: var(--dev-cyan);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
}

/* Actions Below Card */
.dev-btn-save {
  width: 100%;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 800;
  background: rgba(40, 30, 60, 0.85);
  border-color: rgba(192, 132, 252, 0.4);
  color: #ffffff;
}

.dev-btn-save:hover {
  background: rgba(60, 40, 90, 0.95);
  border-color: var(--dev-purple);
  box-shadow: 0 0 12px rgba(192, 132, 252, 0.3);
}

.dev-btn-danger {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.3);
}

.dev-btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: var(--dev-red);
  color: #ffffff;
}

.dev-btn-export {
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 800;
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(255, 255, 255, 0.2);
}

.dev-btn-export:hover {
  border-color: var(--dev-gold);
  color: var(--dev-gold);
}

/* ==========================================================================
   DIRECT ON-SCREEN SELECTION & RESIZE HANDLES
   ========================================================================== */

.layout-editor-selection-box {
  position: absolute;
  pointer-events: auto;
  border: 2px dashed #06b6d4;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 0 14px rgba(6, 182, 212, 0.5);
  z-index: 999950;
  box-sizing: border-box;
}

.layout-editor-selection-tag {
  position: absolute;
  top: -24px;
  left: 0;
  background: #06b6d4;
  color: #042f2e;
  font-family: 'Outfit', sans-serif;
  font-size: 10.5px;
  font-weight: 900;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: auto;
  cursor: move;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.layout-editor-move-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(6, 182, 212, 0.85);
  color: #042f2e;
  font-size: 14px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: move;
  pointer-events: auto;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.layout-editor-handle {
  position: absolute;
  width: 9px;
  height: 9px;
  background: #ffffff;
  border: 2px solid #06b6d4;
  border-radius: 2px;
  box-sizing: border-box;
  pointer-events: auto;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.6);
}

.handle-nw { top: -5px; left: -5px; cursor: nwse-resize; }
.handle-n  { top: -5px; left: calc(50% - 4.5px); cursor: ns-resize; }
.handle-ne { top: -5px; right: -5px; cursor: nesw-resize; }
.handle-e  { top: calc(50% - 4.5px); right: -5px; cursor: ew-resize; }
.handle-se { bottom: -5px; right: -5px; cursor: nwse-resize; }
.handle-s  { bottom: -5px; left: calc(50% - 4.5px); cursor: ns-resize; }
.handle-sw { bottom: -5px; left: -5px; cursor: nesw-resize; }
.handle-w  { top: calc(50% - 4.5px); left: -5px; cursor: ew-resize; }

/* Alignment Grid Overlay */
.dev-grid-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999900;
  display: none;
  background-size: 5% 5%, 5% 5%, 25% 25%, 25% 25%;
  background-image:
    linear-gradient(to right, rgba(6, 182, 212, 0.12) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(6, 182, 212, 0.12) 1px, transparent 1px),
    linear-gradient(to right, rgba(250, 204, 21, 0.3) 1.5px, transparent 1.5px),
    linear-gradient(to bottom, rgba(250, 204, 21, 0.3) 1.5px, transparent 1.5px);
}

/* Safe Area Overlay */
.dev-safe-area-overlay {
  position: fixed;
  top: 5%;
  left: 5%;
  right: 5%;
  bottom: 5%;
  border: 2px dashed rgba(239, 68, 68, 0.65);
  pointer-events: none;
  z-index: 999901;
  display: none;
  border-radius: 8px;
}

.dev-safe-area-overlay::after {
  content: "SAFE AREA (90% x 90%)";
  position: absolute;
  top: 6px;
  right: 8px;
  font-family: 'Outfit', sans-serif;
  font-size: 10px;
  font-weight: 800;
  color: #ef4444;
  background: rgba(0, 0, 0, 0.7);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Stage Entity Zones (Baby Hanuman & Cradle) */
.stage-entity-zone {
  position: absolute;
  pointer-events: none;
  box-sizing: border-box;
}

#entityBabyHanumanS1 {
  left: 28%;
  top: 46%;
  width: 40%;
  height: 44%;
  z-index: 5;
}

#entityCradle {
  left: 27%;
  top: 40%;
  width: 46%;
  height: 42%;
  z-index: 4;
}

#entityBabyHanumanS2 {
  left: 38%;
  top: 42%;
  width: 20%;
  height: 26%;
  z-index: 5;
}

#entityBabyHanumanS3 {
  left: 35%;
  top: 36%;
  width: 30%;
  height: 48%;
  z-index: 5;
}

body.layout-editor-active .stage-entity-zone {
  pointer-events: auto;
  cursor: move;
  border: 1.5px dashed rgba(245, 158, 11, 0.7);
  background: rgba(245, 158, 11, 0.08);
}

body.layout-editor-active .stage-entity-zone:hover {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.18);
}

body.layout-editor-active .room-target-spot {
  cursor: move;
}

body.layout-editor-active .room-placed-asset-spot,
body.layout-edit-mode-active .room-placed-asset-spot {
  cursor: move !important;
  pointer-events: auto !important;
}

body.layout-editor-active .room-placed-asset-spot.layout-editor-selected,
body.layout-edit-mode-active .room-placed-asset-spot.layout-editor-selected {
  opacity: 1 !important;
  visibility: visible !important;
  z-index: 45 !important;
}

body.layout-editor-active .tray-item-card,
body.layout-edit-mode-active .tray-item-card {
  cursor: move !important;
}

body.layout-editor-active #introBannerImg,
body.layout-edit-mode-active #introBannerImg,
body.layout-editor-active #celebrationBannerImg,
body.layout-edit-mode-active #celebrationBannerImg,
body.layout-editor-active #btnStartGame,
body.layout-edit-mode-active #btnStartGame {
  cursor: move !important;
  pointer-events: auto !important;
}

.dev-btn-pair {
  white-space: normal !important;
  word-break: break-word !important;
  line-height: 1.25 !important;
  text-align: center !important;
  display: block !important;
  padding: 7px 10px !important;
  min-height: 36px;
  transition: all 0.18s ease;
}

.dev-btn-pair:hover {
  background: rgba(6, 182, 212, 0.35) !important;
  border-color: #38bdf8 !important;
  color: #ffffff !important;
  transform: translateY(-1px);
}

/* Export CSS Modal */
.dev-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  z-index: 999995;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dev-modal-window {
  width: 580px;
  max-width: 90vw;
  max-height: 85vh;
  background: #0f172a;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Outfit', sans-serif;
  color: #f8fafc;
}

.dev-modal-header {
  padding: 12px 18px;
  background: #1e293b;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.dev-modal-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--dev-gold);
}

.dev-modal-body {
  padding: 14px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dev-css-codeblock {
  background: #020617;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 12px;
  font-family: Consolas, Monaco, monospace;
  font-size: 12px;
  color: #38bdf8;
  max-height: 360px;
  overflow-y: auto;
  white-space: pre;
  user-select: all;
}

.dev-modal-footer {
  padding: 12px 18px;
  background: #1e293b;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Toast Message */
.dev-toast-notification {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: #0f172a;
  border: 1.5px solid var(--dev-cyan);
  color: #f8fafc;
  padding: 10px 20px;
  border-radius: 9999px;
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 16px rgba(6, 182, 212, 0.4);
  z-index: 1000000;
  pointer-events: none;
  animation: devToastFade 1.6s ease forwards;
}

@keyframes devToastFade {
  0% { opacity: 0; transform: translate(-50%, 14px); }
  15% { opacity: 1; transform: translate(-50%, 0); }
  80% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -10px); }
}
