:root {
  --arcade-bg: #141026;
  --panel-bg: #241c3d;
  --accent-pink: #ff2a85;
  --accent-cyan: #00f0ff;
  --accent-yellow: #ffe600;
  --accent-green: #00ff88;
  --accent-red: #ff334b;
  --frame-edge: #43336c;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body {
  background: radial-gradient(circle at center, #1e1438 0%, #0a0815 100%);
  color: #fff;
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px;
}

.arcade-container {
  width: 100%;
  max-width: 860px;
  background: var(--panel-bg);
  border-radius: 28px;
  border: 4px solid var(--frame-edge);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7),
              0 0 35px rgba(255, 42, 133, 0.3),
              inset 0 2px 4px rgba(255, 255, 255, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* 머신 상단 헤더 - 핑크 판 제거 및 다크 네온 아케이드 스타일 적용 */
.machine-header {
  background: linear-gradient(180deg, #2b224d 0%, #161226 100%);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 3px solid #4a3a78;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.1), 0 4px 15px rgba(0, 0, 0, 0.4);
}

.logo-box {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.neon-title {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 3px;
  color: #fff;
  text-shadow: 0 0 10px #ffe600, 0 0 20px #ff2a85, 2px 2px 0px #000;
}

.sub-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #ffe600;
  text-shadow: 1px 1px 2px #000;
}

.marquee-lights {
  width: 48px;
  height: 12px;
  background: radial-gradient(circle, #fff 30%, #ffe600 70%);
  border-radius: 10px;
  box-shadow: 0 0 10px #ffe600;
  animation: blink 0.8s infinite alternate ease-in-out;
}
.right-lights {
  animation-delay: 0.4s;
}

@keyframes blink {
  0% { opacity: 0.4; filter: drop-shadow(0 0 2px #ffe600); }
  100% { opacity: 1; filter: drop-shadow(0 0 12px #ffe600); }
}

/* 3D 쇼케이스 프레임 - 더 넓고 웅장하게 확장! */
.showcase-frame {
  position: relative;
  background: #090814;
  margin: 12px 16px 0 16px;
  border-radius: 18px;
  border: 4px solid #130f24;
  box-shadow: inset 0 0 35px rgba(0, 0, 0, 0.9);
  overflow: hidden;
  height: 520px;
  display: flex;
  justify-content: center;
  align-items: center;
}

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

#webglContainer canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
  outline: none;
}

/* 카메라 뷰 시점 변경 툴바 */
.camera-toolbar {
  position: absolute;
  bottom: 12px;
  right: 12px;
  display: flex;
  gap: 5px;
  z-index: 20;
}

.cam-btn {
  background: rgba(18, 14, 34, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #c4bcdc;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: all 0.15s ease;
}

.cam-btn:hover {
  background: rgba(255, 42, 133, 0.6);
  color: #fff;
  border-color: #ff2a85;
}

.cam-btn.active {
  background: #ff2a85;
  color: #fff;
  border-color: #ff2a85;
  box-shadow: 0 0 10px rgba(255, 42, 133, 0.6);
}

.cam-btn.shelf-btn {
  background: rgba(255, 184, 0, 0.2);
  border-color: #ffb800;
  color: #ffe600;
}

.cam-btn.shelf-btn:hover,
.cam-btn.shelf-btn.active {
  background: linear-gradient(135deg, #ffb800 0%, #ff8800 100%);
  color: #000;
  font-weight: 800;
  border-color: #ffe600;
  box-shadow: 0 0 12px rgba(255, 184, 0, 0.8);
}

/* 3D 선반 진열장 상단 배너 */
.shelf-banner {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(18, 12, 38, 0.92);
  border: 2px solid #ffb800;
  border-radius: 12px;
  padding: 8px 14px;
  z-index: 25;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6), 0 0 15px rgba(255, 184, 0, 0.3);
  backdrop-filter: blur(8px);
  animation: slideDown 0.3s ease-out;
}

.shelf-banner.hidden {
  display: none !important;
}

@keyframes slideDown {
  0% { transform: translateY(-20px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

.shelf-banner-title {
  font-size: 14px;
  font-weight: 800;
  color: #ffe600;
  display: flex;
  align-items: center;
  gap: 6px;
  text-shadow: 0 0 8px rgba(255, 230, 0, 0.5);
}

.shelf-banner-controls {
  display: flex;
  gap: 8px;
}

.shelf-mode-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #e2e8f0;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.shelf-mode-btn:hover {
  background: rgba(255, 184, 0, 0.3);
  border-color: #ffb800;
  color: #fff;
}

.shelf-mode-btn.active {
  background: #ffb800;
  color: #120e24;
  border-color: #ffb800;
  font-weight: 800;
  box-shadow: 0 0 8px rgba(255, 184, 0, 0.6);
}

.shelf-mode-btn.back-btn {
  background: linear-gradient(135deg, #00f0ff 0%, #0088ff 100%);
  color: #0b081a;
  border-color: #00f0ff;
  font-weight: 800;
}

.shelf-mode-btn.back-btn:hover {
  background: #00f0ff;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.7);
}

.drag-hint {
  position: absolute;
  bottom: 14px;
  left: 14px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  pointer-events: none;
  background: rgba(0, 0, 0, 0.5);
  padding: 3px 8px;
  border-radius: 4px;
  z-index: 15;
}

/* 상태 전광판 HUD */
.status-overlay {
  position: absolute;
  top: 10px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
  z-index: 20;
}

.status-chip {
  background: rgba(12, 10, 24, 0.85);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 4px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.chip-title {
  font-size: 10px;
  color: #a09fc0;
  text-transform: uppercase;
}

.chip-val {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.text-green { color: var(--accent-green); }
.text-pink { color: var(--accent-pink); }
.text-yellow { color: var(--accent-yellow); }

/* 하단 컨트롤 패널 */
.control-panel {
  background: linear-gradient(180deg, #372a5a 0%, #201738 100%);
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 3px solid #574685;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.1);
}

.panel-label {
  font-size: 11px;
  font-weight: 800;
  color: #b5a9dd;
  margin-top: 6px;
  text-align: center;
  letter-spacing: 1px;
}

.btn-group {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* 큼직한 아케이드 돔 버튼 */
.arcade-btn {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  outline: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.08s ease, filter 0.1s ease, box-shadow 0.1s ease;
  position: relative;
}

.arcade-btn:disabled {
  filter: grayscale(80%) opacity(0.5);
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.arcade-btn:active:not(:disabled) {
  transform: translateY(4px);
}

.arcade-btn * {
  pointer-events: none;
}

.green-btn {
  background: #00aa55;
  box-shadow: 0 8px 0 #005f30, 0 10px 18px rgba(0, 0, 0, 0.5), 0 0 18px rgba(0, 255, 136, 0.5);
}
.green-btn:active:not(:disabled) {
  box-shadow: 0 4px 0 #005f30, 0 5px 10px rgba(0, 0, 0, 0.5), 0 0 10px rgba(0, 255, 136, 0.4);
}

.red-btn {
  background: #d61838;
  box-shadow: 0 8px 0 #850c20, 0 10px 18px rgba(0, 0, 0, 0.5), 0 0 18px rgba(255, 51, 75, 0.5);
}
.red-btn:active:not(:disabled) {
  box-shadow: 0 4px 0 #850c20, 0 5px 10px rgba(0, 0, 0, 0.5), 0 0 10px rgba(255, 51, 75, 0.4);
}

.btn-inner {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.4) 0%, transparent 60%);
  pointer-events: none;
}

.btn-icon {
  font-size: 24px;
  line-height: 1;
}

.btn-label {
  font-size: 13px;
  font-weight: 900;
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.6);
  margin-top: 2px;
}

/* D-PAD / 조이스틱 화살표 */
.joystick-section {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.dpad-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: #19142b;
  padding: 8px;
  border-radius: 16px;
  box-shadow: inset 0 2px 6px #000, 0 2px 6px rgba(255, 255, 255, 0.08);
}

.dpad-middle-row {
  display: flex;
  align-items: center;
  gap: 3px;
}

.dpad-center {
  width: 32px;
  height: 32px;
  background: #2b2349;
  border-radius: 4px;
}

.dpad-btn {
  width: 44px;
  height: 38px;
  background: linear-gradient(180deg, #4f3f77 0%, #30264b 100%);
  border: 1px solid #635096;
  border-radius: 6px;
  color: #ffe600;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 0 #1c162e, 0 4px 6px rgba(0, 0, 0, 0.4);
  transition: transform 0.06s ease, box-shadow 0.06s ease;
  user-select: none;
}

.dpad-btn:active, .dpad-btn.active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #1c162e, 0 2px 4px rgba(0, 0, 0, 0.4);
  background: linear-gradient(180deg, #ff2a85 0%, #aa1050 100%);
  color: #fff;
}

/* 인벤토리 섹션 */
.inventory-section {
  background: #171329;
  padding: 12px 18px 16px 18px;
  border-top: 2px solid #2e264a;
}

.inventory-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #d1c7f0;
}

.inventory-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.shelf-action-btn {
  background: linear-gradient(135deg, #ffb800 0%, #ff8800 100%);
  border: 1px solid #ffe600;
  color: #120e24;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 11px;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(255, 184, 0, 0.4);
  transition: all 0.15s ease;
}

.shelf-action-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 15px rgba(255, 184, 0, 0.7);
  background: #ffe600;
}

.sound-toggle-btn {
  background: #2a2245;
  border: 1px solid #4a3c77;
  color: #bbb;
  border-radius: 6px;
  font-size: 11px;
  padding: 4px 10px;
  cursor: pointer;
}
.sound-toggle-btn:hover {
  background: #392f5d;
  color: #fff;
}

.doll-grid {
  min-height: 46px;
  background: #0f0c1c;
  border-radius: 10px;
  padding: 6px 10px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  align-items: center;
}

.empty-hint {
  font-size: 12px;
  color: #635a82;
  width: 100%;
  text-align: center;
}

.collected-doll-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #231b3e;
  border: 1px solid #42366b;
  border-radius: 8px;
  padding: 4px 8px;
  min-width: 60px;
  animation: popIn 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.collected-doll-card .emoji {
  font-size: 24px;
}

.collected-doll-card .name {
  font-size: 10px;
  color: #eae5ff;
  margin-top: 2px;
  white-space: nowrap;
}

@keyframes popIn {
  0% { transform: scale(0.3); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* 모달 */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.modal-backdrop.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-card {
  background: linear-gradient(135deg, #2b1f50 0%, #16112c 100%);
  border: 3px solid #ff2a85;
  border-radius: 20px;
  padding: 24px 32px;
  text-align: center;
  position: relative;
  box-shadow: 0 10px 40px rgba(255, 42, 133, 0.4), 0 0 20px rgba(0, 0, 0, 0.8);
  max-width: 320px;
  width: 90%;
  animation: modalBounce 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes modalBounce {
  0% { transform: scale(0.7); }
  100% { transform: scale(1); }
}

.modal-title {
  color: #ffe600;
  font-size: 20px;
  margin-bottom: 12px;
  text-shadow: 0 0 8px rgba(255, 230, 0, 0.6);
}

.modal-doll-preview {
  font-size: 68px;
  margin: 8px 0;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.5));
  animation: floatDoll 1.2s infinite alternate ease-in-out;
}

@keyframes floatDoll {
  0% { transform: translateY(0); }
  100% { transform: translateY(-8px); }
}

.modal-doll-name {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 16px;
}

.modal-btn-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.modal-btn {
  border: none;
  color: #fff;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
}

.shelf-modal-btn {
  background: linear-gradient(135deg, #ffb800 0%, #ff8800 100%);
  color: #120e24;
  box-shadow: 0 4px 15px rgba(255, 184, 0, 0.5);
}

.shelf-modal-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 184, 0, 0.8);
  background: #ffe600;
}

.secondary-modal-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #eae5ff;
}

.secondary-modal-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* 모바일 화면 최적화 */
@media (max-width: 480px) {
  .showcase-frame {
    height: 340px;
  }
  .arcade-btn {
    width: 68px;
    height: 68px;
  }
  .btn-inner {
    width: 54px;
    height: 54px;
  }
  .btn-icon {
    font-size: 20px;
  }
  .btn-label {
    font-size: 11px;
  }
  .dpad-btn {
    width: 36px;
    height: 32px;
    font-size: 13px;
  }
  .dpad-center {
    width: 24px;
    height: 24px;
  }
  .neon-title {
    font-size: 20px;
  }
  .camera-toolbar {
    bottom: 6px;
    right: 6px;
    gap: 3px;
  }
  .cam-btn {
    font-size: 10px;
    padding: 3px 6px;
  }
  .drag-hint {
    display: none;
  }
}
