@font-face {
  font-family: "BoldPixels";
  src: url("assets/ui/fonts/BoldPixels.ttf") format("truetype");
}

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

html, body {
  height: 100%;
  background: #0d0d14;
  overflow: hidden;
  font-family: "BoldPixels", "Malgun Gothic", sans-serif;
  color: #e8e6f0;
  user-select: none;
}

#stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#game {
  image-rendering: pixelated;
  background: #000;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 16 / 9;
}

#overlay {
  position: absolute;
  inset: 0;
  pointer-events: none; /* 자식 요소가 개별적으로 활성화 */
}

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

#loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0d0d14;
  z-index: 100;
}

.loading-box { font-size: 24px; color: #9d8cff; letter-spacing: 2px; }

#loading.hidden { display: none; }

/* ── 툴팁 ─────────────────────────────── */
.sq-tooltip {
  position: absolute;
  z-index: 50;
  width: 240px;
  background: #16112a;
  border: 2px solid #4a3d78;
  padding: 10px;
  font-size: 14px;
  line-height: 1.45;
  pointer-events: none !important;
  color: #d8d2ec;
}
.sq-tooltip .tt-head { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.sq-tooltip .tt-head img { width: 32px; height: 32px; image-rendering: pixelated; }
.sq-tooltip .tt-name { font-size: 16px; color: #ffd35a; }
.sq-tooltip .tt-name.up { color: #7ce38b; }
.sq-tooltip .tt-meta { font-size: 12px; color: #8f85b5; }
.sq-tooltip .tt-tags { margin-top: 6px; }
.sq-tooltip .tag {
  display: inline-block;
  background: #2c2450;
  color: #b8a8e8;
  font-size: 11px;
  padding: 1px 6px;
  margin-right: 4px;
}
.sq-tooltip b { color: #ffd35a; }

/* ── 큐 편집기 ─────────────────────────── */
.qe-root {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 6, 16, 0.72);
}
.qe-panel {
  width: min(940px, 92%);
  background: #16112a;
  border: 3px solid #4a3d78;
  padding: 22px 26px;
  text-align: center;
}
.qe-title { font-size: 30px; color: #ffd35a; letter-spacing: 3px; }
.qe-boss { margin-top: 4px; color: #b8a8e8; font-size: 15px; }
.qe-boss b { color: #ff7a7a; }
.qe-hint { margin: 12px 0 14px; color: #8f85b5; font-size: 13px; }
.qe-track {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  min-height: 100px;
  padding: 12px;
  background: #0f0b1e;
  border: 2px dashed #35296078;
}
.qe-tile {
  width: 74px;
  height: 96px;
  background: #221a40;
  border: 2px solid #4a3d78;
  cursor: grab;
  position: relative;
  padding-top: 8px;
  transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
  touch-action: none;
}
.qe-tile:hover { transform: translateY(-4px); border-color: #ffd35a; }
.qe-tile.syn { border-color: #7ce38b; box-shadow: 0 0 10px #7ce38b88; }
.qe-tile.qe-dragging { opacity: 0.25; }
.qe-tile img { width: 40px; height: 40px; image-rendering: pixelated; }
.qe-tile .qe-order {
  position: absolute;
  top: 2px;
  left: 4px;
  font-size: 11px;
  color: #8f85b5;
}
.qe-tile .qe-name { font-size: 12px; color: #d8d2ec; margin-top: 2px; padding: 0 2px; }
.qe-tile .qe-name.up { color: #7ce38b; }
.qe-tile .qe-cast { font-size: 11px; color: #ffd35a; margin-top: 2px; }
.qe-ghost {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  opacity: 0.9;
  width: 74px;
  height: 96px;
  background: #221a40;
  border: 2px solid #ffd35a;
  padding-top: 8px;
  text-align: center;
}
.qe-ghost img { width: 40px; height: 40px; image-rendering: pixelated; }
.qe-ghost .qe-order { display: none; }
.qe-ghost .qe-name { font-size: 12px; color: #d8d2ec; }
.qe-ghost .qe-cast { font-size: 11px; color: #ffd35a; }
.qe-stats { margin: 14px 0 6px; font-size: 14px; color: #b8a8e8; }
.qe-stats b { color: #ffd35a; }
.qe-start {
  font-family: inherit;
  font-size: 20px;
  letter-spacing: 2px;
  background: #4a3d78;
  color: #ffe9b0;
  border: 2px solid #7a6cff;
  padding: 10px 34px;
  margin-top: 10px;
  cursor: pointer;
}
.qe-start:hover { background: #5c4c96; }

/* ── 보상 화면 ─────────────────────────── */
.rw-root {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 6, 16, 0.6);
}
.rw-panel {
  background: #16112a;
  border: 3px solid #4a3d78;
  padding: 24px 34px;
  text-align: center;
  max-width: 720px;
}
.rw-title { font-size: 34px; color: #ffd35a; letter-spacing: 4px; }
.rw-gold { margin-top: 6px; font-size: 18px; color: #ffcf4d; }
.rw-sub { margin: 10px 0 4px; font-size: 13px; color: #8f85b5; }
.rw-cards { display: flex; gap: 14px; justify-content: center; margin: 14px 0; }
.rw-card {
  width: 168px;
  background: #221a40;
  border: 2px solid #4a3d78;
  padding: 12px 10px;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.12s;
}
.rw-card:hover { transform: translateY(-5px); border-color: #ffd35a; }
.rw-card img { width: 44px; height: 44px; image-rendering: pixelated; }
.rw-card .rw-name { font-size: 16px; color: #ffd35a; margin-top: 4px; }
.rw-card .rw-cast { font-size: 11px; color: #8f85b5; margin: 3px 0 6px; }
.rw-card .rw-desc { font-size: 12px; color: #d8d2ec; line-height: 1.4; }
.rw-card .rw-desc b { color: #ffd35a; }
.rw-skip {
  font-family: inherit;
  font-size: 15px;
  background: #2c2450;
  color: #b8a8e8;
  border: 2px solid #4a3d78;
  padding: 8px 22px;
  cursor: pointer;
}
.rw-skip:hover { background: #3a2f66; }

/* ── 캠프 오버레이 ─────────────────────── */
.camp-root {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 6, 16, 0.55);
}
.camp-panel {
  background: #16112a;
  border: 3px solid #4a3d78;
  padding: 26px 40px;
  text-align: center;
  min-width: 380px;
}
.camp-title { font-size: 28px; color: #ffd35a; letter-spacing: 3px; }
.camp-desc { margin: 12px 0 18px; color: #b8a8e8; font-size: 15px; }
.camp-panel button {
  display: block;
  width: 100%;
  font-family: inherit;
  font-size: 16px;
  background: #2c2450;
  color: #e8e6f0;
  border: 2px solid #4a3d78;
  padding: 10px;
  margin-top: 8px;
  cursor: pointer;
}
.camp-panel button:hover { background: #3a2f66; border-color: #7a6cff; }

/* ── 타이틀 ────────────────────────────── */
.title-root {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.title-panel { text-align: center; }
.title-logo {
  font-size: 88px;
  color: #ffd35a;
  letter-spacing: 14px;
  text-shadow: 0 4px 0 #7a3a1d, 0 8px 24px #000;
}
.title-sub { margin-top: 6px; color: #b8a8e8; font-size: 17px; letter-spacing: 2px; }
.title-continue {
  font-family: inherit;
  font-size: 20px;
  margin-top: 26px;
  background: #4a3d78;
  color: #ffe9b0;
  border: 2px solid #7a6cff;
  padding: 10px 44px;
  cursor: pointer;
}
.title-continue:hover { background: #5c4c96; }
.title-choose { margin: 26px 0 10px; color: #8f85b5; font-size: 14px; }
.title-classes { display: flex; gap: 14px; justify-content: center; }
.title-class {
  font-family: inherit;
  width: 190px;
  background: #16112a;
  border: 2px solid #4a3d78;
  color: #e8e6f0;
  padding: 14px 10px;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.12s;
}
.title-class:hover:not(:disabled) { transform: translateY(-4px); border-color: #ffd35a; }
.title-class:disabled { opacity: 0.45; cursor: default; }
.title-class .tc-name { display: block; font-size: 22px; color: #ffd35a; }
.title-class .tc-desc { display: block; font-size: 12px; color: #b8a8e8; margin: 8px 0; line-height: 1.45; min-height: 50px; }
.title-class .tc-hp { display: block; font-size: 13px; color: #7ce38b; }
.title-stats { margin-top: 24px; font-size: 13px; color: #8f85b5; }

/* ── 카드 선택기 ───────────────────────── */
.cp-root {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 6, 16, 0.75);
  z-index: 20;
}
.cp-panel {
  background: #16112a;
  border: 3px solid #4a3d78;
  padding: 22px 30px;
  text-align: center;
  max-width: 760px;
}
.cp-title { font-size: 24px; color: #ffd35a; letter-spacing: 2px; }
.cp-sub { margin-top: 6px; font-size: 13px; color: #8f85b5; }
.cp-grid { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 16px 0; max-height: 380px; overflow-y: auto; }
.cp-card {
  width: 86px;
  background: #221a40;
  border: 2px solid #4a3d78;
  padding: 10px 4px;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.1s;
}
.cp-card:hover { transform: translateY(-3px); border-color: #ffd35a; }
.cp-card img { width: 36px; height: 36px; image-rendering: pixelated; }
.cp-card .cp-name { font-size: 12px; color: #d8d2ec; margin-top: 4px; }
.cp-card .cp-name.up { color: #7ce38b; }
.cp-card .cp-cast { font-size: 11px; color: #ffd35a; }
.cp-cancel {
  font-family: inherit;
  font-size: 14px;
  background: #2c2450;
  color: #b8a8e8;
  border: 2px solid #4a3d78;
  padding: 7px 20px;
  cursor: pointer;
}

/* ── 상점 ──────────────────────────────── */
.shop-root {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 6, 16, 0.72);
}
.shop-panel {
  background: #16112a;
  border: 3px solid #4a3d78;
  padding: 22px 34px;
  text-align: center;
  min-width: 620px;
}
.shop-title { font-size: 30px; color: #ffd35a; letter-spacing: 4px; }
.shop-gold { margin-top: 4px; font-size: 17px; color: #ffcf4d; }
.shop-section { margin: 14px 0 8px; font-size: 14px; color: #8f85b5; letter-spacing: 2px; }
.shop-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.shop-empty { color: #554a80; font-size: 13px; padding: 14px; }
.shop-item {
  width: 104px;
  background: #221a40;
  border: 2px solid #4a3d78;
  padding: 10px 6px;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.1s;
}
.shop-item:hover:not(.off) { transform: translateY(-3px); border-color: #ffd35a; }
.shop-item.off { opacity: 0.45; cursor: default; }
.shop-item.relic { border-color: #7a5c2e; }
.shop-item img { width: 38px; height: 38px; image-rendering: pixelated; }
.shop-item .si-name { font-size: 12px; color: #d8d2ec; margin-top: 4px; min-height: 28px; }
.shop-item .si-price { font-size: 13px; color: #ffcf4d; margin-top: 2px; }
.shop-actions { margin-top: 18px; display: flex; gap: 12px; justify-content: center; }
.shop-actions button {
  font-family: inherit;
  font-size: 15px;
  background: #2c2450;
  color: #e8e6f0;
  border: 2px solid #4a3d78;
  padding: 9px 22px;
  cursor: pointer;
}
.shop-actions button:hover:not(:disabled) { background: #3a2f66; border-color: #7a6cff; }
.shop-actions button:disabled { opacity: 0.45; cursor: default; }
