/**
 * Magic Sort - Main Styling (Mobile-First v5.0.0)
 * Features: Merged chunks, scoreboard panel, realistic glass bottles, accurate pour alignment, EX Stages
 */

:root {
  --bg-color: #383e44;
  --bg-gradient: radial-gradient(circle at 50% 25%, #474f57 0%, #292d32 100%);
  --panel-bg: rgba(30, 34, 38, 0.85);
  --accent-gold: #f5b316;
  --accent-orange: #e66025;
  --accent-blue: #2980b9;
  --accent-green: #2ecc71;
  --text-main: #f0f3f6;
  --text-muted: #8d98a5;
  --btn-bg: rgba(255, 255, 255, 0.08);
  --btn-border: rgba(255, 255, 255, 0.15);
  --btn-active: rgba(255, 255, 255, 0.22);
  --bottle-width: 58px;
  --bottle-height: 155px;
  --bottle-gap-x: 12px;
  --bottle-gap-y: 20px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: fixed;
  background: var(--bg-color);
  background-image: var(--bg-gradient);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text-main);
}

#app-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  max-width: 540px;
  margin: 0 auto;
  position: relative;
  padding-top: env(safe-area-inset-top, 8px);
  padding-bottom: env(safe-area-inset-bottom, 10px);
}

/* TOP HEADER */
.game-header {
  padding: 8px 14px 2px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 10;
}

.header-top-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-badge {
  display: flex;
  align-items: center;
  background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
  padding: 5px 12px;
  border-radius: 18px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35), inset 0 1px 1px rgba(255, 255, 255, 0.4);
  border: 1.5px solid rgba(255, 255, 255, 0.3);
}

.brand-title {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.5px;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  text-transform: uppercase;
}

.version-tag {
  font-size: 10px;
  margin-left: 6px;
  opacity: 0.9;
  background: rgba(0, 0, 0, 0.28);
  padding: 1px 5px;
  border-radius: 8px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

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

.icon-btn {
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  color: var(--text-main);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease;
  backdrop-filter: blur(8px);
}

.icon-btn:active {
  transform: scale(0.92);
  background: var(--btn-active);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* SCOREBOARD PANEL */
.scoreboard-panel {
  width: calc(100% - 24px);
  margin: 6px 12px 2px 12px;
  background: rgba(20, 24, 28, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 6px 10px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  z-index: 10;
}

.score-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.score-value {
  font-size: 14px;
  font-weight: 800;
  color: #ffffff;
  margin-top: 1px;
  font-variant-numeric: tabular-nums;
  transition: transform 0.2s ease;
}

.score-value.gold {
  color: var(--accent-gold);
}

.score-value.green {
  color: var(--accent-green);
}

/* LEVEL INFO BANNER */
.level-banner {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.level-title {
  font-size: 20px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.5px;
}

.level-subtitle {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.2px;
  margin-top: 1px;
}

/* ACTION CONTROLS BAR */
.action-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  z-index: 10;
}

.tool-btn {
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: 18px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: transform 0.1s ease, background 0.15s ease, opacity 0.2s ease;
}

.tool-btn:active {
  transform: scale(0.94);
  background: var(--btn-active);
}

.tool-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.tool-btn svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.tool-btn.gold {
  border-color: rgba(245, 179, 22, 0.4);
  color: var(--accent-gold);
}

/* GAME BOARD */
.game-board-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  overflow: hidden;
  position: relative;
}

.bottles-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: var(--bottle-gap-y) var(--bottle-gap-x);
  width: 100%;
  max-width: 480px;
  position: relative;
}

/* BOTTLE SLOT */
.bottle-slot {
  position: relative;
  width: var(--bottle-width);
  height: var(--bottle-height);
  display: flex;
  justify-content: center;
  align-items: flex-end;
  cursor: pointer;
  transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.3, 1.2);
}

.bottle-slot.selected {
  animation: bottleSelectedLift 0.2s forwards ease-out;
}

.bottle-slot.shake {
  animation: bottleShake 0.4s ease;
}

.bottle-slot.busy {
  cursor: default;
}

.bottle-slot.busy-source .bottle {
  opacity: 0; /* Hidden while floating clone is actively pouring */
}

.bottle-slot.hint-source {
  animation: hintPulse 1.2s infinite ease-in-out;
}

.bottle-slot.hint-target::before {
  content: "▼";
  position: absolute;
  top: -26px;
  font-size: 18px;
  color: var(--accent-gold);
  animation: arrowBob 0.8s infinite ease-in-out;
  text-shadow: 0 0 8px rgba(245, 179, 22, 0.8);
}

/* BOTTLE GRAPHIC */
.bottle {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

/* BOTTLE NECK & LIP */
.bottle-neck-wrapper {
  position: relative;
  width: 42%;
  height: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.bottle-lip {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.25);
  border: 1.5px solid rgba(255, 255, 255, 0.65);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35), inset 0 1px 1px rgba(255, 255, 255, 0.45);
  z-index: 4;
}

.bottle-neck {
  width: 76%;
  height: 16px;
  border-left: 2px solid rgba(255, 255, 255, 0.5);
  border-right: 2px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset -2px 0 3px rgba(0, 0, 0, 0.25);
  z-index: 2;
}

/* CORK STOPPER */
.cork-stopper {
  position: absolute;
  top: -6px;
  left: 50%;
  width: 82%;
  height: 18px;
  background: linear-gradient(135deg, #dfba8a 0%, #c19a6b 40%, #8d6239 100%);
  border-radius: 3px 3px 2px 2px;
  border: 1px solid #6d4c41;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5), inset 0 2px 1px rgba(255, 255, 255, 0.35);
  z-index: 6;
  display: none;
}

.cork-stopper.popped {
  display: block;
  animation: corkPopIn 0.45s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}

/* SPARKLE EFFECT */
.cork-sparkle {
  position: absolute;
  top: -14px;
  left: 50%;
  width: 32px;
  height: 32px;
  margin-left: -16px;
  pointer-events: none;
  display: none;
  z-index: 7;
}

.cork-sparkle.active {
  display: block;
  animation: sparkleBurst 0.65s forwards ease-out;
}

/* BOTTLE BODY */
.bottle-body {
  position: relative;
  width: 100%;
  flex: 1;
  border-radius: 12px 12px 16px 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 2.2px solid rgba(255, 255, 255, 0.45);
  box-shadow: 
    inset 3px 0 4px rgba(255, 255, 255, 0.35),
    inset -3px 0 5px rgba(0, 0, 0, 0.35),
    0 8px 16px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  display: flex;
  flex-direction: column-reverse;
}

/* GLASS SHINE OVERLAY */
.bottle-shine {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: linear-gradient(
    90deg, 
    rgba(255, 255, 255, 0.35) 0%, 
    rgba(255, 255, 255, 0.05) 20%, 
    rgba(255, 255, 255, 0.0) 60%, 
    rgba(255, 255, 255, 0.25) 100%
  );
  z-index: 5;
}

/* MERGED CONTIGUOUS LIQUID CHUNKS */
.liquid-chunk {
  width: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: height 0.32s cubic-bezier(0.33, 1, 0.68, 1);
}

.liquid-inner {
  width: 100%;
  height: 100%;
  position: relative;
  box-shadow: inset 0 2px 3px rgba(255, 255, 255, 0.25), inset 0 -2px 3px rgba(0, 0, 0, 0.3);
}

.liquid-chunk:first-child .liquid-inner {
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
}

/* Top Surface Meniscus */
.liquid-chunk.top-chunk .liquid-inner::before {
  content: "";
  position: absolute;
  top: -2px;
  left: 0;
  width: 100%;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  z-index: 2;
}

.liquid-chunk.rippling .liquid-inner::before {
  animation: liquidRippleWave 0.4s ease;
}

/* Chunk Multiplier Badge */
.chunk-badge {
  position: absolute;
  font-size: 10px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.95);
  background: rgba(0, 0, 0, 0.35);
  padding: 1px 4px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  z-index: 4;
  pointer-events: none;
}

/* FLOATING ANIMATION LAYER FOR ACCURATE POUR ALIGNMENT (v1.2.1) */
#flying-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 80;
  overflow: visible;
}

.flying-bottle {
  position: absolute;
  width: var(--bottle-width);
  height: var(--bottle-height);
  pointer-events: none;
  will-change: transform;
  transform-origin: 50% 10px; /* Pivots directly around the bottle mouth/lip! */
  transition: transform 0.34s cubic-bezier(0.33, 1, 0.68, 1);
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.55));
}

.flying-stream {
  position: absolute;
  width: 7px;
  border-radius: 4px;
  pointer-events: none;
  z-index: 85;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.55), inset 1px 0 2px rgba(255, 255, 255, 0.6);
  animation: streamFlowIn 0.45s ease forwards;
}

/* TUTORIAL HAND POINTER */
.tutorial-hand {
  position: absolute;
  width: 44px;
  height: 44px;
  pointer-events: none;
  z-index: 20;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
  animation: arrowBob 1.1s infinite ease-in-out;
  display: none;
}

/* MODALS */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: #252b31;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 22px 18px;
  width: 90%;
  max-width: 420px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6);
  animation: winModalPop 0.35s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.modal-title {
  font-size: 19px;
  font-weight: 800;
  color: #ffffff;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

/* LEVELS GRID */
.levels-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  overflow-y: auto;
  padding: 4px;
  max-height: 60vh;
}

.level-grid-item {
  aspect-ratio: 1;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-main);
  transition: transform 0.1s ease, background 0.15s ease;
  position: relative;
}

.level-grid-item:active {
  transform: scale(0.92);
}

.level-grid-item.current {
  border-color: var(--accent-gold);
  background: rgba(245, 179, 22, 0.18);
  box-shadow: 0 0 10px rgba(245, 179, 22, 0.4);
}

.level-grid-item.completed {
  border-color: rgba(46, 204, 113, 0.5);
  background: rgba(46, 204, 113, 0.12);
}

.level-grid-item.completed::after {
  content: "✓";
  font-size: 10px;
  color: #2ecc71;
  position: absolute;
  bottom: 3px;
}

.level-grid-item.locked {
  opacity: 0.35;
  cursor: not-allowed;
}

/* EX STAGE BADGES & PROHIBITED STATES */
.badge-ex-glow {
  background: linear-gradient(135deg, #ff0844 0%, #ff4e50 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 0 12px rgba(255, 8, 68, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.6);
  padding: 2px 7px;
  border-radius: 8px;
  font-weight: 800;
  letter-spacing: 0.5px;
  display: inline-block;
  animation: exGlowPulse 1.5s infinite alternate ease-in-out;
}

@keyframes exGlowPulse {
  from { box-shadow: 0 0 8px rgba(255, 8, 68, 0.5); }
  to { box-shadow: 0 0 18px rgba(255, 8, 68, 0.95); }
}

.ex-subtitle {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: #ff6b81;
  letter-spacing: 0.5px;
  margin-top: 3px;
  text-shadow: 0 0 8px rgba(255, 8, 68, 0.4);
}

.btn-prohibited {
  opacity: 0.28 !important;
  filter: grayscale(1) contrast(0.8) !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  border-style: dashed !important;
  position: relative;
}

.btn-prohibited::after {
  content: "✕";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #ff0844;
  font-weight: 900;
  font-size: 14px;
}

/* EX LEVELS MODAL SECTION */
.ex-levels-section {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  width: 100%;
}

.ex-levels-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.ex-divider-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 8, 68, 0.4), transparent);
}

.ex-divider-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.5px;
}

.ex-divider-badge.unlocked {
  background: linear-gradient(135deg, #ff0844, #ff4e50);
  color: #fff;
  box-shadow: 0 0 10px rgba(255, 8, 68, 0.5);
}

.ex-divider-badge.locked {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.ex-levels-status {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 10px;
}

.ex-levels-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.level-grid-item.ex-item {
  background: rgba(255, 8, 68, 0.08);
  border-color: rgba(255, 8, 68, 0.35);
  color: #ff6b81;
}

.level-grid-item.ex-item.current {
  border-color: #ff0844;
  background: rgba(255, 8, 68, 0.28);
  box-shadow: 0 0 14px rgba(255, 8, 68, 0.6);
  color: #ffffff;
}

.level-grid-item.ex-item.completed {
  border-color: rgba(255, 215, 0, 0.7);
  background: rgba(255, 215, 0, 0.15);
  color: #ffd700;
}

.level-grid-item.ex-item.completed::after {
  content: "✓";
  font-size: 11px;
  position: absolute;
  bottom: 2px;
}

.level-grid-item.ex-item.locked {
  opacity: 0.35;
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  cursor: not-allowed;
}

.ex-sub {
  font-size: 9px;
  opacity: 0.7;
  margin-top: 1px;
}

/* WIN MODAL BREAKDOWN */
.win-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.win-trophy {
  font-size: 44px;
  margin-bottom: 6px;
  animation: arrowBob 1.2s infinite ease-in-out;
}

.win-title {
  font-size: 22px;
  font-weight: 900;
  color: #ffffff;
  margin-bottom: 4px;
}

.score-breakdown-card {
  width: 100%;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 10px 14px;
  margin: 10px 0 14px 0;
  text-align: left;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
  padding: 3px 0;
}

.breakdown-row.highlight {
  font-size: 15px;
  font-weight: 800;
  color: var(--accent-gold);
  border-top: 1px dashed rgba(255, 255, 255, 0.15);
  margin-top: 6px;
  padding-top: 6px;
}

.win-actions {
  display: flex;
  width: 100%;
  gap: 10px;
}

.primary-btn {
  flex: 1;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  font-size: 15px;
  font-weight: 800;
  padding: 12px 18px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

.primary-btn:active {
  transform: scale(0.96);
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
}

.secondary-btn:active {
  transform: scale(0.96);
}

/* CONFETTI CANVAS */
#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 150;
}

/* RESPONSIVE BREAKPOINTS */
@media (max-width: 380px) {
  :root {
    --bottle-width: 48px;
    --bottle-height: 132px;
    --bottle-gap-x: 8px;
    --bottle-gap-y: 16px;
  }
  .score-value {
    font-size: 12px;
  }
  .score-label {
    font-size: 9px;
  }
}

/* ================================================= */
/* G1 HINT VISUAL ARROW & DEADLOCK MODAL (v4.1.2)   */
/* ================================================= */

/* HINT ARROW OVERLAY */
.hint-arrow-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 85;
  overflow: visible;
}

.hint-arrow-path {
  fill: none;
  stroke: url(#grad-hint-arrow);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-dasharray: 8 6;
  animation: hintArrowFlow 0.8s linear infinite;
  filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.7));
}

@keyframes hintArrowFlow {
  from { stroke-dashoffset: 28; }
  to { stroke-dashoffset: 0; }
}

/* HINT SOURCE & TARGET BADGES */
.hint-badge {
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  pointer-events: none;
  z-index: 90;
  white-space: nowrap;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.hint-badge.from {
  background: rgba(245, 158, 11, 0.95);
  color: #fff;
  border: 1px solid #fbbf24;
  animation: hintBadgeBob 0.8s infinite ease-in-out;
}

.hint-badge.to {
  background: rgba(16, 185, 129, 0.95);
  color: #fff;
  border: 1px solid #34d399;
  animation: hintBadgeBob 0.8s infinite ease-in-out reverse;
}

@keyframes hintBadgeBob {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-3px); }
}

/* DEADLOCK DETECTION IN-GAME MODAL */
.deadlock-card {
  max-width: 380px;
  text-align: center;
  padding: 28px 24px;
  background: rgba(24, 24, 32, 0.96);
  border: 1px solid rgba(245, 158, 11, 0.35);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 30px rgba(245, 158, 11, 0.15);
}

.deadlock-icon-wrap {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(245, 158, 11, 0.12);
  border-radius: 50%;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.line-icon-deadlock {
  width: 36px;
  height: 36px;
  filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.5));
}

.deadlock-title {
  font-size: 19px;
  font-weight: 700;
  color: #f8fafc;
  margin: 0 0 10px;
  letter-spacing: -0.3px;
}

.deadlock-message {
  font-size: 13px;
  line-height: 1.6;
  color: #94a3b8;
  margin: 0 0 22px;
}

.deadlock-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.deadlock-actions .primary-btn.pulse-glow {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
  font-weight: 700;
  font-size: 14px;
  padding: 12px 18px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
  transition: transform 0.15s, box-shadow 0.15s;
  animation: pulseGlowBtn 2s infinite ease-in-out;
}

.deadlock-actions .primary-btn.pulse-glow:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.55);
}

.deadlock-actions .primary-btn svg {
  width: 18px;
  height: 18px;
}

.deadlock-actions .secondary-btn {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.deadlock-actions .secondary-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.25);
}

.deadlock-actions .secondary-btn.danger {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.25);
}

.deadlock-actions .secondary-btn.danger:hover {
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.4);
}

@keyframes pulseGlowBtn {
  0%, 100% { box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4); }
  50% { box-shadow: 0 4px 24px rgba(245, 158, 11, 0.7); }
}
