@font-face { font-family: 'RoveWarden'; src: url('./assets/fonts/RoveWarden-Regular.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'RoveWarden'; src: url('./assets/fonts/RoveWarden-Bold.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'RoveThornleaf'; src: url('./assets/fonts/RoveThornleaf-Regular.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'RoveTacticalHUD'; src: url('./assets/fonts/RoveTacticalHUD-Light.woff2') format('woff2'); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: 'RoveTacticalHUD'; src: url('./assets/fonts/RoveTacticalHUD-Medium.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'RoveTacticalHUD'; src: url('./assets/fonts/RoveTacticalHUD-Bold.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }

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

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #8fd8ff;
  font-family: 'RoveTacticalHUD', 'RoveThornleaf', sans-serif;
}

#canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* Very gentle dappled canopy shadow framing only at extreme 4 corners (never obscures playfield!) */
#canopy-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  background:
    radial-gradient(ellipse 92% 88% at 50% 50%, rgba(20, 48, 42, 0) 64%, rgba(16, 42, 36, 0.24) 100%);
}

#hud {
  position: fixed;
  top: 10px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  z-index: 20;
}

.hud-left, .hud-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(32, 24, 18, 0.80);
  color: #fff8e6;
  font-weight: 800;
  font-size: 14px;
  border: 2px solid rgba(255, 224, 130, 0.55);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.28);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  display: inline-block;
}
.gold-dot { background: #ffd83d; box-shadow: 0 0 6px #ffbe1a; }
.life-dot { background: #ff5c5c; box-shadow: 0 0 6px #ff3333; }
.wave-dot { background: #4fe0ff; box-shadow: 0 0 6px #2bc4ff; }

.early-btn {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 12px 4px 6px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ff9f2e 0%, #d96414 100%);
  color: #fffdf5;
  border: 2px solid #ffe484;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.32);
  transition: transform 0.12s ease;
}
.early-btn:hover { transform: scale(1.04); }
.early-btn:active { transform: scale(0.96); }

.ring-svg {
  width: 28px;
  height: 28px;
  transform: rotate(-90deg);
}
.ring-bg {
  fill: none;
  stroke: rgba(0, 0, 0, 0.32);
  stroke-width: 4;
}
.ring-fg {
  fill: none;
  stroke: #fff394;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 94.25;
  stroke-dashoffset: 0;
}

.early-label b {
  color: #fff38a;
  margin-left: 2px;
}

.reset-btn, .mute-btn {
  pointer-events: auto;
  padding: 6px 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, #52b842 0%, #348229 100%);
  color: #ffffff;
  border: 2px solid #b8f294;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.28);
}
.reset-btn:hover, .mute-btn:hover { filter: brightness(1.08); }

.res-btn {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(24, 34, 36, 0.86);
  color: #fff8e8;
  border: 2px solid #ff9442;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.34);
  transition: transform 0.12s ease, border-color 0.2s ease;
}
.res-btn:hover { transform: scale(1.03); }
.res-dot {
  background: #ff9442;
  box-shadow: 0 0 8px #ff7722;
}

#world-ui {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 15;
  overflow: hidden;
}

.clear-gauge {
  position: absolute;
  transform: translate(-50%, -100%);
  background: rgba(28, 22, 16, 0.88);
  border: 2px solid #ffcf54;
  border-radius: 10px;
  padding: 5px 9px;
  min-width: 112px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.36);
}
.clear-gauge-title {
  color: #ffe888;
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 4px;
  white-space: nowrap;
}
.clear-bar-track {
  width: 100%;
  height: 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
}
.clear-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff9f2e, #ffe45e);
  border-radius: 4px;
}

.dormant-badge {
  position: absolute;
  transform: translate(-50%, -100%);
  padding: 2px 9px;
  border-radius: 999px;
  border: 1.5px solid rgba(255, 179, 107, 0.95);
  background: rgba(64, 30, 12, 0.92);
  color: #ffd9a8;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 0 10px rgba(255, 120, 40, 0.45);
}

.float-text {
  position: absolute;
  transform: translate(-50%, -50%);
  font-weight: 900;
  font-size: 16px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.85), 0 0 8px rgba(0, 0, 0, 0.45);
  white-space: nowrap;
  pointer-events: none;
}

.popover {
  position: fixed;
  transform: translate(-50%, -100%);
  background: rgba(28, 22, 17, 0.92);
  border: 2px solid #ffe07d;
  border-radius: 14px;
  padding: 8px 10px;
  z-index: 25;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.42);
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 152px;
  max-width: 248px;
  overflow-y: auto;
}
.popover.hidden { display: none; }
.popover-title {
  color: #fff3c4;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}
.popover-grid {
  display: grid;
  grid-template-columns: 1fr;
  width: 100%;
  gap: 6px;
}
.pop-btn {
  min-height: 38px;
  padding: 4px 8px;
  border-radius: 9px;
  border: 1.5px solid rgba(255, 232, 150, 0.65);
  background: linear-gradient(180deg, #4b3a2c 0%, #31251c 100%);
  color: #fff9e6;
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.pop-btn.primary {
  background: linear-gradient(180deg, #ffae38 0%, #d46d14 100%);
  border-color: #fff0a0;
}
.pop-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.pop-sub {
  font-size: 12px;
  color: #9bf7a8;
  text-align: center;
  font-weight: 700;
}

.pop-btn.sell {
  background: linear-gradient(180deg, #7a3430 0%, #52201d 100%);
  border-color: #ff9a8b;
}

/* ---- P0/P1 playability pass: compact popover, split sell, badges, onboarding, countdown ---- */
.popover-grid .pop-btn { padding: 3px 4px; line-height: 1.15; font-size: 12px; white-space: normal; min-width: 0; }
.pop-btn .pop-btn-sub { display: block; font-size: 12px; font-weight: 700; opacity: 0.88; letter-spacing: -0.01em; }
.pop-badge {
  align-self: center;
  font-size: 11px;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(157, 255, 184, 0.7);
  background: rgba(24, 58, 40, 0.85);
  color: #b8ffd0;
  white-space: nowrap;
}
.pop-badge.bypass { border-color: rgba(255, 207, 120, 0.8); background: rgba(70, 48, 18, 0.88); color: #ffe0a0; }
.pop-rule { font-size: 12px; color: #e8f4dc; text-align: center; font-weight: 700; line-height: 1.3; }
.pop-stats { font-size: 12px; color: #d8ecff; text-align: center; font-weight: 800; }
.pop-sep { border: 0; border-top: 1px solid rgba(255, 232, 150, 0.28); margin: 2px 0 0; width: 100%; }
.pop-btn.sell.small {
  align-self: center;
  min-height: 26px;
  padding: 2px 12px;
  font-size: 12px;
  opacity: 0.88;
  background: linear-gradient(180deg, #5c2a27 0%, #3f1a18 100%);
}
.pop-btn.sell.small.armed {
  opacity: 1;
  background: linear-gradient(180deg, #c8403a 0%, #8c1f1b 100%);
  border-color: #ffd0c8;
  animation: sellArmPulse 0.9s ease-in-out infinite;
}
@keyframes sellArmPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 120, 100, 0.0); } 50% { box-shadow: 0 0 10px 2px rgba(255, 120, 100, 0.75); } }

.wave-next { margin-left: 6px; font-size: 12px; font-weight: 800; color: #ffe9a8; white-space: nowrap; }
.wave-next .wn-icons { margin-left: 3px; }
.early-btn.start-mode { box-shadow: 0 0 14px rgba(125, 255, 176, 0.65); border-color: rgba(157, 255, 184, 0.95); }

.onboard-hint {
  position: fixed;
  top: 66px; /* clear of the orange 방어 시작 chip */
  left: 50%;
  transform: translateX(-50%);
  z-index: 24;
  padding: 4px 14px;
  border-radius: 999px;
  background: rgba(18, 36, 30, 0.9);
  border: 1.5px solid rgba(157, 255, 184, 0.75);
  color: #e6ffe9;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}
.onboard-hint.hidden { display: none; }
.pulse-ring {
  position: absolute;
  width: 74px;
  height: 74px;
  margin: -37px 0 0 -37px;
  border-radius: 50%;
  border: 3px solid rgba(255, 245, 160, 0.95);
  box-shadow: 0 0 16px 4px rgba(255, 245, 160, 0.7), inset 0 0 12px rgba(255, 245, 160, 0.45);
  pointer-events: none;
  animation: onboardPulse 1.15s ease-out infinite;
}
@keyframes onboardPulse { 0% { transform: scale(0.7); opacity: 1; } 100% { transform: scale(1.25); opacity: 0.45; } }
.altar-badge.onboard-pulse { animation: onboardBadgePulse 1.0s ease-in-out infinite; border-color: rgba(255, 245, 160, 0.95); }
@keyframes onboardBadgePulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 245, 160, 0); } 50% { box-shadow: 0 0 14px 4px rgba(255, 245, 160, 0.85); } }
.hero-btn.onboard-glow { animation: onboardGlow 1.0s ease-in-out infinite; border-color: #fff3a0 !important; }
@keyframes onboardGlow { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 220, 120, 0); } 50% { box-shadow: 0 0 16px 4px rgba(255, 220, 120, 0.9); } }

.top-toast {
  position: fixed;
  top: 98px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 29;
  padding: 8px 20px;
  border-radius: 14px;
  background: rgba(60, 20, 16, 0.94);
  border: 2px solid #ff8a6a;
  color: #ffe6dc;
  font-size: 16px;
  font-weight: 900;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  animation: topToastIn 0.18s ease-out;
}
.top-toast.soft { background: rgba(18, 52, 38, 0.94); border-color: #8dffbc; color: #e0ffe9; font-size: 14px; }
.top-toast.hidden { display: none; }
@keyframes topToastIn { from { transform: translate(-50%, -8px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

.enemy-hp {
  position: absolute;
  transform: translate(-50%, -100%);
  width: 32px;
  height: 5px;
  border-radius: 3px;
  background: rgba(15, 22, 20, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.35);
  overflow: hidden;
  pointer-events: none;
}
.enemy-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff6b4a, #ffd64a);
}

#pilot-dock {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 22;
  pointer-events: none;
}
.dock-group {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(20, 30, 32, 0.86);
  border: 2px solid rgba(255, 200, 102, 0.65);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.36);
}
.dock-title {
  color: #ffe394;
  font-size: 12px;
  font-weight: 800;
  padding: 0 5px;
}
.dock-btn {
  pointer-events: auto;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1.5px solid rgba(255, 230, 160, 0.45);
  background: rgba(48, 56, 54, 0.85);
  color: #fff8e6;
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
}
.dock-btn.active {
  background: linear-gradient(180deg, #ff9933 0%, #cc4f14 100%);
  border-color: #ffe878;
}

#motion-banner-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 55;
}

/* Mobile Landscape Responsive HUD (844x475 & compact viewports — zero clipping or horizontal overflow!) */
@media (max-width: 920px) {
  #hud {
    padding: 6px 8px;
    gap: 4px;
  }
  .hud-left, .hud-right {
    gap: 4px;
  }
  .pill, .res-btn, .reset-btn, .mute-btn, .early-btn {
    padding: 3px 7px;
    font-size: 10.5px;
    height: 26px;
  }
  .ring-svg {
    width: 18px;
    height: 18px;
  }
  .zoom-pill {
    display: none;
  }
  #boss-bar {
    top: 38px !important;
    min-width: 240px !important;
    padding: 4px 10px !important;
  }
  #pilot-dock {
    bottom: 6px;
    gap: 4px;
    max-width: 98vw;
  }
  .dock-group {
    padding: 3px 5px;
    gap: 3px;
  }
  .dock-title {
    font-size: 10px;
    padding: 0 3px;
  }
  .dock-btn {
    padding: 4px 7px;
    font-size: 10px;
  }
}

.hero-btn {
  background: linear-gradient(180deg, #2e8c5c 0%, #1c5c42 100%);
  border: 2px solid #8ef5c8;
  padding: 7px 14px;
}

.altar-badge {
  position: absolute;
  transform: translate(-50%, -100%);
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(24, 16, 40, 0.84);
  border: 1px solid rgba(190, 130, 255, 0.72);
  color: #ebd6ff;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}

.spirit-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-color: rgba(125, 255, 206, 0.72) !important;
  color: #a8ffe0 !important;
}

.spirit-bar-track {
  display: inline-block;
  width: 56px;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
  vertical-align: middle;
}

.spirit-bar-fill {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #4ef5d6, #ffe478);
  transition: width 0.2s ease;
}

.spirit-gauge-text {
  font-size: 10.5px;
  color: #ffe89e;
  font-weight: 800;
}

.result-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 18, 22, 0.72);
  backdrop-filter: blur(4px);
}

.result-modal.hidden {
  display: none;
}

.result-card {
  width: min(92vw, 420px);
  padding: 24px 26px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(22, 36, 34, 0.97), rgba(14, 24, 26, 0.98));
  border: 2px solid #ffd86b;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.62);
  text-align: center;
  color: #f3fff8;
}

.result-card.defeat {
  border-color: #ff6b57;
  background: linear-gradient(180deg, rgba(44, 18, 22, 0.97), rgba(24, 12, 16, 0.98));
}

.result-title {
  font-size: 24px;
  font-weight: 900;
  color: #ffe885;
  margin-bottom: 8px;
}

.result-card.defeat .result-title {
  color: #ff8a75;
}

.result-subtitle {
  font-size: 13px;
  color: #d7f5e8;
  margin-bottom: 16px;
}

.result-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px;
  margin-bottom: 18px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
  font-size: 12.5px;
  font-weight: 700;
}

.result-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.result-actions .pop-btn {
  flex: 1;
  padding: 10px 14px;
  font-size: 13.5px;
}

.portrait-hint {
  display: none;
  position: fixed;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 26;
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(18, 24, 34, 0.80);
  border: 1px solid rgba(255, 214, 118, 0.55);
  color: #fff2cc;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.portrait-hint.visible {
  display: block;
}

@media (max-width: 520px) and (orientation: portrait) {
  #hud {
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px 8px;
  }
  .hud-left, .hud-right {
    gap: 4px;
    flex-wrap: wrap;
  }
  .pill, .res-btn, .reset-btn, .mute-btn, .early-btn {
    font-size: 11px;
    padding: 4px 8px;
  }
  .zoom-pill, .reset-btn {
    display: none;
  }
  #pilot-dock {
    flex-wrap: wrap;
    justify-content: center;
    bottom: 8px;
    gap: 4px;
    max-width: 96vw;
  }
  .dock-btn {
    padding: 4px 7px;
    font-size: 10px;
  }
}

/* 게임연락소 #25 확정 자체 폰트: 제목류 = RoveWarden, 작은 HUD·수치·버튼·본문·툴팁 = RoveTacticalHUD */
button, input, select, textarea { font-family: 'RoveTacticalHUD', 'RoveThornleaf', sans-serif; }
.popover, .pop-btn, .pop-sub, .pop-badge, .pop-rule, .pop-stats, .onboard-hint, .portrait-hint, .early-btn, .reset-btn, .mute-btn, .res-btn, .dock-btn, .hero-btn, .altar-badge, .hud-left, .hud-right {
  font-family: 'RoveTacticalHUD', 'RoveThornleaf', sans-serif;
}
.popover-title, .result-title, .result-subtitle, .dock-title, .clear-gauge-title {
  font-family: 'RoveWarden', 'RoveThornleaf', sans-serif;
}

/* Mini camera chip (zoom / 360 orbit / reset) */
.cam-chip {
  position: fixed;
  right: 10px;
  bottom: 10px;
  z-index: 26;
  display: flex;
  gap: 2px;
  height: 30px;
  padding: 2px;
  border-radius: 999px;
  background: rgba(14, 20, 16, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.cam-chip button {
  width: 28px;
  height: 26px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #eaf7de;
  font-weight: 800;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.cam-chip button:hover { background: rgba(255, 255, 255, 0.16); }
