* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Pretendard", "Noto Sans KR", -apple-system, BlinkMacSystemFont, sans-serif;
  background: #0a1628;
  color: #f8fafc;
  overflow: hidden;
  user-select: none;
}

#canvas-container {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
}

.hidden {
  display: none !important;
}

/* Login Overlay */
.overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top, rgba(0, 75, 145, 0.78), rgba(8, 17, 34, 0.94));
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.login-card {
  width: 460px;
  max-width: 92vw;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
}

.kjb-brand-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.brand-sub {
  font-size: 12px;
  color: #38bdf8;
  font-weight: 600;
  letter-spacing: 0.4px;
}

.kjb-brand-header h1 {
  font-size: 21px;
  font-weight: 800;
  color: #ffffff;
}

.login-desc {
  font-size: 13px;
  color: #cbd5e1;
  line-height: 1.5;
  margin-bottom: 12px;
}

.branch-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.branch-card {
  padding: 10px 8px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(30, 41, 59, 0.78);
  color: #cbd5e1;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.branch-card:hover {
  border-color: #38bdf8;
}

.branch-card.active {
  background: rgba(0, 102, 179, 0.48);
  border-color: #38bdf8;
  color: #ffffff;
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.4);
}

.bc-title {
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 3px;
}

.bc-sub {
  font-size: 10px;
  color: #94a3b8;
}

.branch-card.active .bc-sub {
  color: #bae6fd;
}

.tab-row {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  background: rgba(30, 41, 59, 0.8);
  padding: 4px;
  border-radius: 10px;
}

.tab-btn {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.tab-btn.active {
  background: #0066b3;
  color: #ffffff;
}

.auth-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-panel label {
  font-size: 12px;
  color: #94a3b8;
  font-weight: 600;
}

.auth-panel input {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(30, 41, 59, 0.9);
  color: #fff;
  font-size: 14px;
}

.color-picker {
  display: flex;
  gap: 10px;
  margin: 4px 0 8px;
}

.color-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
}

.color-dot.active {
  border-color: #ffffff;
  transform: scale(1.12);
}

.btn-primary {
  margin-top: 6px;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #004b91, #00a0e9);
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary:hover {
  filter: brightness(1.1);
}

.error-msg {
  margin-top: 10px;
  padding: 10px;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.5);
  color: #fca5a5;
  font-size: 13px;
}

.loading-card {
  width: 440px;
  max-width: 90vw;
  background: rgba(15, 23, 42, 0.94);
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 20px;
  padding: 32px 28px;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65);
}

.loading-logo {
  width: 68px;
  height: 68px;
  border-radius: 14px;
  object-fit: cover;
  box-shadow: 0 8px 24px rgba(0, 160, 233, 0.4);
}

.progress-track {
  width: 100%;
  height: 10px;
  background: rgba(30, 41, 59, 0.95);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #004b91, #00a0e9, #38bdf8);
  border-radius: 999px;
  transition: width 0.25s ease;
}

/* HUD */
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 20;
}

#hud > * {
  pointer-events: auto;
}

.hud-top {
  position: absolute;
  top: 12px;
  left: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: transparent;
  border: none;
  padding: 0;
  pointer-events: none;
}

.hud-top > * {
  pointer-events: auto;
}

.hud-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 6px 12px;
  border-radius: 12px;
}

.badge-kjb {
  background: linear-gradient(135deg, #004b91, #00a0e9);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
}

.pill {
  background: rgba(56, 189, 248, 0.18);
  color: #7dd3fc;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.hud-ticket-status {
  background: rgba(0, 75, 145, 0.45);
  border: 1px solid rgba(56, 189, 248, 0.4);
  padding: 6px 14px;
  border-radius: 10px;
  font-size: 13px;
}

.hud-ticket-status strong {
  color: #38bdf8;
  margin-left: 4px;
}

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

.btn-hud {
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: #f1f5f9;
  padding: 7px 12px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.btn-hud:hover {
  background: #0066b3;
  border-color: #38bdf8;
}

/* Left Guide */
.hud-left-guide {
  position: absolute;
  top: 78px;
  left: 16px;
  width: 226px;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 12px;
  padding: 12px;
  font-size: 12px;
}

.guide-title {
  font-weight: 700;
  color: #38bdf8;
  margin-bottom: 6px;
}

.hud-left-guide ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: #cbd5e1;
  margin-bottom: 10px;
}

.quick-tp {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.tp-btn {
  padding: 6px;
  border-radius: 7px;
  border: 1px solid rgba(56, 189, 248, 0.28);
  background: rgba(30, 41, 59, 0.85);
  color: #e2e8f0;
  font-size: 11px;
  cursor: pointer;
}

.tp-btn:hover {
  background: #004b91;
}

/* Right Queue Board */
.hud-queue-board {
  position: absolute;
  top: 78px;
  right: 16px;
  width: 248px;
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 12px;
  padding: 12px;
}

.qb-header {
  font-size: 13px;
  font-weight: 700;
  color: #38bdf8;
  margin-bottom: 8px;
}

.qb-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 300px;
  overflow-y: auto;
}

.qb-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(30, 41, 59, 0.75);
  cursor: pointer;
}

.qb-item:hover {
  background: rgba(0, 102, 179, 0.45);
}

.qb-status {
  padding: 2px 6px;
  border-radius: 5px;
  font-weight: 700;
  font-size: 10px;
}

.qb-status.IDLE {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
}

.qb-status.CALLING {
  background: rgba(245, 158, 11, 0.25);
  color: #fcd34d;
}

.qb-status.SERVING {
  background: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
}

/* Chat */
.hud-chat {
  position: absolute;
  bottom: 146px;
  left: 16px;
  width: 310px;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 12px;
  padding: 10px;
}

/* Jog Shuttle (Bottom-Left) */
.jog-shuttle {
  position: absolute;
  bottom: 16px;
  left: 16px;
  width: 116px;
  height: 116px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.76);
  backdrop-filter: blur(8px);
  border: 2px solid rgba(56, 189, 248, 0.45);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  cursor: grab;
}

.jog-ring {
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  border: 1px dashed rgba(125, 211, 252, 0.35);
  pointer-events: none;
}

.jog-knob {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #38bdf8, #004b91);
  border: 2px solid #bae6fd;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  transition: transform 0.05s linear;
}

/* Exit Button (Bottom-Right) */
.btn-exit-branch {
  position: absolute;
  bottom: 16px;
  right: 16px;
  padding: 10px 18px;
  border-radius: 11px;
  border: 1px solid rgba(248, 113, 113, 0.55);
  background: rgba(127, 29, 29, 0.85);
  backdrop-filter: blur(8px);
  color: #fecaca;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.btn-exit-branch:hover {
  background: #dc2626;
  color: #ffffff;
}

.chat-messages {
  height: 125px;
  overflow-y: auto;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.chat-line b {
  color: #38bdf8;
}

.chat-form {
  display: flex;
  gap: 6px;
}

.chat-form input {
  flex: 1;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(30, 41, 59, 0.9);
  color: #fff;
  font-size: 12px;
}

.chat-form button {
  padding: 7px 12px;
  border: none;
  border-radius: 8px;
  background: #0066b3;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* Mini Audio */
.mini-audio {
  position: absolute;
  bottom: 64px;
  right: 16px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 12px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}

.mini-audio button {
  background: #0066b3;
  border: none;
  color: #fff;
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
}

/* Interact Prompt */
.interact-prompt {
  position: absolute;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 75, 145, 0.92);
  border: 1px solid #38bdf8;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* Toast */
.toast-container {
  position: absolute;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 60;
}

.toast {
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid #38bdf8;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 90;
}

.modal-box {
  width: 620px;
  max-width: 94vw;
  max-height: 86vh;
  background: #0f172a;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(135deg, #003a70, #005ca9);
}

.modal-header h2 {
  font-size: 17px;
  font-weight: 700;
}

.modal-close {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 14px;
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.service-card {
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  text-align: left;
  color: #f8fafc;
}

.service-card:hover {
  border-color: #38bdf8;
  background: rgba(0, 102, 179, 0.35);
}

.service-card h3 {
  font-size: 15px;
  margin-bottom: 4px;
  color: #38bdf8;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row input,
.form-row select {
  padding: 10px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: #1e293b;
  color: #fff;
  font-size: 14px;
}

.btn-secondary {
  padding: 10px 14px;
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 8px;
  background: rgba(30, 41, 59, 0.9);
  color: #e2e8f0;
  font-weight: 600;
  cursor: pointer;
}

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: rgba(30, 41, 59, 0.8);
  border-radius: 10px;
  gap: 10px;
}

.chat-box-npc {
  background: rgba(30, 41, 59, 0.75);
  border-radius: 10px;
  padding: 12px;
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
