/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-deep: #0a0e1a;
  --bg-panel: rgba(12, 18, 36, 0.92);
  --border: rgba(100, 140, 220, 0.25);
  --text: #e8edf8;
  --text-dim: #8899bb;
  --accent: #4fc3f7;
  --accent-glow: rgba(79, 195, 247, 0.4);
  --success: #69f0ae;
  --warning: #ffab40;
  --danger: #ff5252;
  --gold: #ffd54f;
  --radius: 12px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

html, body {
  height: 100dvh;
  max-height: 100dvh;
  font-family: var(--font);
  background: var(--bg-deep);
  color: var(--text);
  overflow: hidden;
}

body {
  background:
    radial-gradient(ellipse at 20% 80%, rgba(30, 60, 120, 0.3) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(80, 40, 120, 0.2) 0%, transparent 50%),
    var(--bg-deep);
}

#app {
  height: 100dvh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ===== Top Bar ===== */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  flex-wrap: wrap;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon { font-size: 2rem; }

.brand h1 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.subtitle {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.resources {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.resource {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 120px;
}

.res-icon { font-size: 1.3rem; }

.res-label {
  display: block;
  font-size: 0.65rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.res-value {
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.header-stats {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.header-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.3rem 0.65rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.62rem;
  color: var(--text-dim);
  min-width: 72px;
}

.header-stat strong {
  font-size: 0.82rem;
  color: var(--text);
  margin-top: 0.1rem;
}

/* ===== Layout ===== */
.game-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 280px 1fr 320px;
  gap: 0;
  min-height: 0;
  overflow: hidden;
}

/* ===== Left Sidebar ===== */
.sidebar-left {
  border-right: 1px solid var(--border);
}

.status-panel {
  padding: 0.85rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-shrink: 0;
}

.status-panel .orbit-info { margin-bottom: 0.6rem; text-align: left; }
.status-panel .orbit-select-wrap { margin-bottom: 0.6rem; flex-wrap: wrap; }
.status-panel .purification-bar { width: 100%; margin-bottom: 0.5rem; }

.orbit-unlock-panel {
  width: 100%;
  padding: 0.55rem 0.6rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  transition: border-color 0.4s ease, background 0.4s ease;
}

.orbit-unlock-panel.unlock-geo {
  border-color: rgba(186, 104, 200, 0.35);
  background: rgba(156, 39, 176, 0.08);
}

.orbit-unlock-panel.unlock-graveyard {
  border-color: rgba(239, 83, 80, 0.35);
  background: rgba(183, 28, 28, 0.08);
}

.orbit-unlock-panel.unlock-prestige {
  border-color: rgba(255, 213, 79, 0.35);
  background: rgba(255, 213, 79, 0.08);
}

.orbit-unlock-panel.unlock-complete {
  border-color: rgba(105, 240, 174, 0.35);
  background: rgba(105, 240, 174, 0.08);
}

.orbit-unlock-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  margin-bottom: 0.35rem;
}

.orbit-unlock-header span {
  color: var(--text-dim);
}

.orbit-unlock-header strong {
  color: var(--accent);
  font-size: 0.78rem;
}

.orbit-unlock-panel.unlock-geo .orbit-unlock-header strong { color: #ce93d8; }
.orbit-unlock-panel.unlock-graveyard .orbit-unlock-header strong { color: #ef9a9a; }
.orbit-unlock-panel.unlock-prestige .orbit-unlock-header strong { color: var(--gold); }
.orbit-unlock-panel.unlock-complete .orbit-unlock-header strong { color: var(--success); }

.orbit-unlock-track {
  height: 8px;
  margin-bottom: 0.35rem;
}

.orbit-unlock-panel .bar-fill {
  background: linear-gradient(90deg, var(--accent), #69f0ae);
  transition: width 0.4s ease;
}

.orbit-unlock-panel.unlock-geo .bar-fill {
  background: linear-gradient(90deg, #9c27b0, #ce93d8);
}

.orbit-unlock-panel.unlock-graveyard .bar-fill {
  background: linear-gradient(90deg, #c62828, #ef5350);
}

.orbit-unlock-panel.unlock-prestige .bar-fill {
  background: linear-gradient(90deg, #ff8f00, #ffd54f);
}

.orbit-unlock-panel.unlock-complete .bar-fill {
  background: linear-gradient(90deg, #26a69a, #69f0ae);
}

.orbit-unlock-hint {
  font-size: 0.65rem;
  color: var(--text-dim);
  line-height: 1.35;
  margin: 0;
}

.purification-bar {
  width: 100%;
  margin-bottom: 0.5rem;
}

.purification-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  margin-bottom: 0.35rem;
}

.purification-header span {
  color: var(--text-dim);
}

.purification-header strong {
  color: var(--accent);
  font-size: 0.78rem;
}

/* ===== Click Arena (Center) ===== */
.click-arena {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: 0;
  height: 100%;
  padding: 1rem;
  gap: 0.75rem;
  overflow: hidden;
  background: #070b14;
  transition: background 0.8s ease;
}

.click-arena.orbit-leo {
  background:
    radial-gradient(ellipse at 50% 120%, rgba(33, 150, 243, 0.18) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 10%, rgba(79, 195, 247, 0.1) 0%, transparent 40%),
    linear-gradient(180deg, #0a1220 0%, #060a12 100%);
}

.click-arena.orbit-geo {
  background:
    radial-gradient(ellipse at 20% 15%, rgba(255, 193, 7, 0.1) 0%, transparent 42%),
    radial-gradient(ellipse at 75% 25%, rgba(156, 39, 176, 0.16) 0%, transparent 48%),
    radial-gradient(ellipse at 50% 100%, rgba(63, 81, 181, 0.14) 0%, transparent 50%),
    linear-gradient(180deg, #120a1e 0%, #08060f 100%);
}

.click-arena.orbit-graveyard {
  background:
    radial-gradient(ellipse at 60% 20%, rgba(102, 187, 106, 0.08) 0%, transparent 38%),
    radial-gradient(ellipse at 25% 70%, rgba(183, 28, 28, 0.14) 0%, transparent 45%),
    radial-gradient(ellipse at 85% 80%, rgba(106, 27, 154, 0.12) 0%, transparent 40%),
    linear-gradient(180deg, #140808 0%, #060408 100%);
}

.orbit-ambience {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.8s ease;
}

.orbit-ambience::before,
.orbit-ambience::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
}

/* 별빛 — LEO: 은은, GEO: 밝게, Graveyard: 희미하고 불안 */
.orbit-ambience::before {
  opacity: 0.35;
  background-image:
    radial-gradient(1px 1px at 12% 18%, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1px 1px at 28% 62%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1.5px 1.5px at 45% 35%, rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(1px 1px at 67% 22%, rgba(255, 255, 255, 0.45), transparent),
    radial-gradient(1px 1px at 82% 58%, rgba(255, 255, 255, 0.55), transparent),
    radial-gradient(1px 1px at 15% 78%, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(1.5px 1.5px at 55% 82%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1px 1px at 90% 12%, rgba(255, 255, 255, 0.45), transparent),
    radial-gradient(1px 1px at 38% 8%, rgba(255, 255, 255, 0.35), transparent),
    radial-gradient(1px 1px at 72% 88%, rgba(255, 255, 255, 0.4), transparent);
}

.click-arena.orbit-geo .orbit-ambience::before {
  opacity: 0.7;
  background-image:
    radial-gradient(1.5px 1.5px at 8% 25%, rgba(255, 236, 179, 0.9), transparent),
    radial-gradient(1px 1px at 22% 48%, rgba(255, 255, 255, 0.75), transparent),
    radial-gradient(1px 1px at 35% 15%, rgba(225, 190, 231, 0.8), transparent),
    radial-gradient(2px 2px at 50% 70%, rgba(255, 255, 255, 0.85), transparent),
    radial-gradient(1px 1px at 63% 32%, rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(1.5px 1.5px at 78% 55%, rgba(255, 224, 130, 0.75), transparent),
    radial-gradient(1px 1px at 88% 18%, rgba(255, 255, 255, 0.65), transparent),
    radial-gradient(1px 1px at 18% 85%, rgba(206, 147, 216, 0.7), transparent),
    radial-gradient(1px 1px at 42% 92%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1px 1px at 92% 72%, rgba(255, 255, 255, 0.55), transparent);
}

.click-arena.orbit-graveyard .orbit-ambience::before {
  opacity: 0.45;
  background-image:
    radial-gradient(1.5px 1.5px at 10% 30%, rgba(239, 83, 80, 0.7), transparent),
    radial-gradient(1px 1px at 25% 55%, rgba(255, 255, 255, 0.35), transparent),
    radial-gradient(1px 1px at 40% 20%, rgba(102, 187, 106, 0.55), transparent),
    radial-gradient(2px 2px at 58% 75%, rgba(186, 104, 200, 0.5), transparent),
    radial-gradient(1px 1px at 70% 40%, rgba(255, 138, 128, 0.6), transparent),
    radial-gradient(1px 1px at 85% 65%, rgba(255, 255, 255, 0.3), transparent),
    radial-gradient(1px 1px at 15% 80%, rgba(129, 199, 132, 0.45), transparent),
    radial-gradient(1px 1px at 48% 10%, rgba(255, 82, 82, 0.5), transparent),
    radial-gradient(1px 1px at 92% 28%, rgba(255, 255, 255, 0.25), transparent),
    radial-gradient(1px 1px at 33% 88%, rgba(171, 71, 188, 0.4), transparent);
}

/* 궤도별 안개/네뷸라 */
.orbit-ambience::after {
  opacity: 0;
}

.click-arena.orbit-geo .orbit-ambience::after {
  opacity: 1;
  background:
    radial-gradient(ellipse 50% 30% at 65% 40%, rgba(186, 104, 200, 0.12) 0%, transparent 70%),
    radial-gradient(ellipse 40% 25% at 25% 60%, rgba(255, 213, 79, 0.07) 0%, transparent 70%);
  animation: nebula-drift 24s ease-in-out infinite;
}

.click-arena.orbit-graveyard .orbit-ambience::after {
  opacity: 1;
  background:
    radial-gradient(ellipse 45% 35% at 50% 50%, rgba(183, 28, 28, 0.1) 0%, transparent 70%),
    radial-gradient(ellipse 30% 20% at 75% 25%, rgba(102, 187, 106, 0.06) 0%, transparent 70%);
  animation: nebula-drift 18s ease-in-out infinite reverse;
}

@keyframes nebula-drift {
  0%, 100% { transform: scale(1) translate(0, 0); }
  50% { transform: scale(1.04) translate(-1.5%, 1%); }
}

.arena-bg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 0;
}

.arena-bg .earth-container {
  width: min(460px, 82vmin);
  height: min(460px, 82vmin);
  margin: 0;
  opacity: 0.88;
  filter: drop-shadow(0 0 36px rgba(79, 195, 247, 0.4));
  transition: filter 0.8s ease, opacity 0.8s ease;
}

.click-arena.orbit-geo .arena-bg .earth-container {
  opacity: 0.82;
  filter: drop-shadow(0 0 42px rgba(186, 104, 200, 0.45))
    drop-shadow(0 0 20px rgba(255, 193, 7, 0.15));
}

.click-arena.orbit-graveyard .arena-bg .earth-container {
  opacity: 0.75;
  filter: drop-shadow(0 0 40px rgba(239, 83, 80, 0.35))
    drop-shadow(0 0 55px rgba(102, 187, 106, 0.18));
}

.click-arena .debris-field {
  position: relative;
  z-index: 1;
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  border: 1px solid rgba(79, 195, 247, 0.22);
  background: radial-gradient(
    ellipse at center,
    rgba(0, 0, 0, 0.02) 0%,
    rgba(0, 0, 0, 0.1) 100%
  );
  border-radius: var(--radius);
  transition: border-color 0.8s ease, box-shadow 0.8s ease, background 0.8s ease;
}

.click-arena.orbit-leo .debris-field {
  border-color: rgba(79, 195, 247, 0.28);
  box-shadow: inset 0 0 50px rgba(79, 195, 247, 0.06);
}

.click-arena.orbit-geo .debris-field {
  border-color: rgba(186, 104, 200, 0.32);
  background: radial-gradient(
    ellipse at center,
    rgba(156, 39, 176, 0.04) 0%,
    rgba(0, 0, 0, 0.12) 100%
  );
  box-shadow: inset 0 0 60px rgba(156, 39, 176, 0.08);
}

.click-arena.orbit-graveyard .debris-field {
  border-color: rgba(239, 83, 80, 0.3);
  background: radial-gradient(
    ellipse at center,
    rgba(183, 28, 28, 0.05) 0%,
    rgba(20, 5, 10, 0.2) 100%
  );
  box-shadow: inset 0 0 60px rgba(183, 28, 28, 0.1);
}

.earth {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 35%, #6ec6f5 0%, #2e86c1 28%, #1a6fa8 52%, #0e4d7a 100%);
  box-shadow:
    0 0 50px rgba(79, 195, 247, 0.45),
    0 0 90px rgba(79, 195, 247, 0.15),
    inset -8px -8px 20px rgba(0, 0, 0, 0.35);
  transition: filter 1.5s ease, box-shadow 1.5s ease;
}

.earth::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(ellipse 30% 20% at 25% 40%, rgba(46, 125, 50, 0.7) 0%, transparent 100%),
    radial-gradient(ellipse 25% 18% at 60% 55%, rgba(46, 125, 50, 0.6) 0%, transparent 100%),
    radial-gradient(ellipse 20% 15% at 70% 30%, rgba(46, 125, 50, 0.5) 0%, transparent 100%);
  opacity: 0;
  transition: opacity 1.5s ease;
}

.earth.clean::after { opacity: 1; }

.earth.stage-2 {
  box-shadow: 0 0 50px rgba(79, 195, 247, 0.5), inset -8px -8px 20px rgba(0, 0, 0, 0.3);
}

.earth.stage-2::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 70% 60%, rgba(255, 200, 50, 0.25) 0%, transparent 8%);
  opacity: 1;
}

.earth.stage-3::before {
  background:
    radial-gradient(circle at 30% 45%, rgba(255, 200, 50, 0.3) 0%, transparent 6%),
    radial-gradient(circle at 55% 35%, rgba(255, 180, 40, 0.25) 0%, transparent 5%),
    radial-gradient(circle at 70% 60%, rgba(255, 200, 50, 0.3) 0%, transparent 7%);
}

.earth.stage-complete {
  box-shadow: 0 0 60px rgba(105, 240, 174, 0.5), 0 0 100px rgba(79, 195, 247, 0.3);
}

.earth.stage-complete::before {
  background:
    radial-gradient(ellipse 80% 15% at 50% 10%, rgba(105, 240, 174, 0.4) 0%, transparent 100%),
    radial-gradient(circle at 30% 45%, rgba(255, 200, 50, 0.35) 0%, transparent 6%),
    radial-gradient(circle at 70% 55%, rgba(255, 200, 50, 0.3) 0%, transparent 6%);
}

.debris-overlay {
  position: absolute;
  inset: -10%;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(70, 75, 90, 0.55) 0%, rgba(55, 60, 75, 0.35) 50%, transparent 72%);
  pointer-events: none;
  transition: opacity 1.5s ease;
}

.orbit-info {
  text-align: center;
  margin-bottom: 0.75rem;
}

.orbit-info span:first-child {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--accent);
}

.orbit-info span:last-child {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.orbit-select-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.orbit-select-label {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.orbit-selector {
  display: flex;
  gap: 0.35rem;
}

.orbit-btn {
  padding: 0.35rem 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-dim);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
  touch-action: manipulation;
}

.orbit-btn.active {
  background: rgba(79, 195, 247, 0.2);
  border-color: var(--accent);
  color: var(--accent);
}

.orbit-btn.active[data-orbit-id="geo"] {
  background: rgba(186, 104, 200, 0.2);
  border-color: #ce93d8;
  color: #ce93d8;
}

.orbit-btn.active[data-orbit-id="graveyard"] {
  background: rgba(239, 83, 80, 0.18);
  border-color: #ef5350;
  color: #ef9a9a;
}

.orbit-btn.locked {
  opacity: 0.35;
  cursor: not-allowed;
}

.orbit-btn:hover:not(:disabled):not(.locked) {
  border-color: var(--accent);
}

.earth-container {
  position: relative;
  width: 100%;
  height: 100%;
}

.bar-track {
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #26a69a, #69f0ae);
  border-radius: 999px;
  transition: width 0.4s ease;
}

/* ===== Debris Field ===== */
.debris-field {
  position: relative;
}

.debris-item {
  position: absolute;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  z-index: 1;
}

.debris-emoji {
  display: inline-block;
  font-size: 1.6rem;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
  animation: debris-float 3s ease-in-out infinite;
  transition: transform 0.15s ease;
}

.debris-item.debris-tough .debris-emoji {
  filter: drop-shadow(0 0 6px rgba(255, 171, 64, 0.6)) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.debris-item:hover .debris-emoji {
  transform: scale(1.2);
}

.debris-hp-track {
  width: 34px;
  height: 5px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(239, 83, 80, 0.35);
  border-radius: 999px;
  overflow: hidden;
  pointer-events: none;
}

.debris-hp {
  display: block;
  height: 100%;
  width: 100%;
  min-width: 2px;
  background: linear-gradient(90deg, #e53935, #ef5350);
  border-radius: 999px;
  transition: width 0.15s ease;
  box-shadow: 0 0 6px rgba(239, 83, 80, 0.45);
}

.debris-hp-text {
  font-size: 0.58rem;
  line-height: 1;
  color: #ef9a9a;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}

.debris-item:hover { transform: none; }

.debris-item.collecting {
  animation: collect-pop 0.35s ease forwards;
  pointer-events: none;
}

@keyframes debris-float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-8px) rotate(5deg); }
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-8px) rotate(5deg); }
}

@keyframes collect-pop {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.5); opacity: 0.8; }
  100% { transform: scale(0); opacity: 0; }
}

.float-text {
  position: absolute;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--success);
  pointer-events: none;
  animation: float-up 0.8s ease forwards;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  z-index: 10;
}

@keyframes float-up {
  0% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-40px); }
}

/* ===== Sidebar ===== */
.sidebar {
  background: var(--bg-panel);
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 0;
  height: 100%;
  scrollbar-width: thin;
  scrollbar-color: rgba(100, 140, 220, 0.35) transparent;
}

.sidebar-right {
  border-left: 1px solid var(--border);
}

.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(100, 140, 220, 0.35);
  border-radius: 999px;
}

.missions-panel {
  padding: 0.85rem;
  background: rgba(79, 195, 247, 0.06);
  border: 1px solid rgba(79, 195, 247, 0.2);
  border-radius: var(--radius);
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.missions-panel h2 { font-size: 0.9rem; margin-bottom: 0.2rem; }
.missions-panel p { font-size: 0.7rem; color: var(--text-dim); margin-bottom: 0; }

.missions-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-shrink: 0;
}

.missions-count {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.06);
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  flex-shrink: 0;
}

.missions-count.has-ready {
  color: var(--success);
  background: rgba(105, 240, 174, 0.15);
  animation: prestige-pulse 1.5s ease infinite;
}

.missions-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.mission-item {
  padding: 0.6rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--mission-color, var(--accent));
  border-radius: 8px;
  font-size: 0.72rem;
  transition: border-color 0.2s ease;
}

.mission-item.bonus {
  background: rgba(255, 213, 79, 0.06);
  border-color: rgba(255, 213, 79, 0.25);
}

.mission-item.flash {
  background: rgba(255, 64, 129, 0.08);
  border-color: rgba(255, 64, 129, 0.35);
  border-left-color: #ff4081;
  animation: flash-pulse 2s ease-in-out infinite;
}

@keyframes flash-pulse {
  0%, 100% { box-shadow: 0 0 0 rgba(255, 64, 129, 0); }
  50% { box-shadow: 0 0 12px rgba(255, 64, 129, 0.25); }
}

.flash-mission-slot:not(:empty) {
  margin-bottom: 0.5rem;
}

.event-buffs {
  display: none;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.5rem 0;
}

.event-buffs.active {
  display: flex;
}

.event-buff-chip {
  font-size: 0.65rem;
  padding: 0.2rem 0.45rem;
  background: rgba(79, 195, 247, 0.12);
  border: 1px solid rgba(79, 195, 247, 0.3);
  border-radius: 999px;
  color: var(--accent);
}

.event-buff-chip strong {
  color: #fff;
  font-weight: 700;
}

.event-banner {
  position: absolute;
  top: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  padding: 0.35rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(79, 195, 247, 0.35);
  color: var(--accent);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.event-banner.active {
  opacity: 1;
}

.event-banner.giant {
  border-color: rgba(255, 171, 64, 0.5);
  color: #ffab40;
  background: rgba(60, 30, 0, 0.65);
  box-shadow: 0 0 20px rgba(255, 171, 64, 0.35);
}

/* ===== Event glow borders ===== */
.event-glow {
  transition: box-shadow 0.45s ease, border-color 0.45s ease;
}

.click-arena.event-glow {
  animation: event-arena-pulse 2.4s ease-in-out infinite;
}

.click-arena.event-ping {
  animation: event-arena-burst 0.85s ease-out 1;
}

@keyframes event-arena-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.04); }
}

@keyframes event-arena-burst {
  0% { filter: brightness(1.15); }
  100% { filter: brightness(1); }
}

.click-arena.event-glow--debrisSurge {
  box-shadow:
    inset 0 0 0 2px rgba(79, 195, 247, 0.55),
    0 0 28px rgba(79, 195, 247, 0.22);
}

.debris-field.event-glow--debrisSurge {
  border-color: rgba(79, 195, 247, 0.65) !important;
  box-shadow:
    inset 0 0 24px rgba(79, 195, 247, 0.12),
    0 0 18px rgba(79, 195, 247, 0.2);
  animation: event-field-brightness 2s ease-in-out infinite;
}

.click-arena.event-glow--sellSpike,
.sell-panel.event-glow--sellSpike {
  box-shadow:
    inset 0 0 0 2px rgba(105, 240, 174, 0.5),
    0 0 26px rgba(105, 240, 174, 0.2);
}

.debris-field.event-glow--sellSpike {
  border-color: rgba(105, 240, 174, 0.45) !important;
}

.missions-panel.event-glow--sellSpike {
  border-color: rgba(105, 240, 174, 0.45);
  box-shadow: 0 0 16px rgba(105, 240, 174, 0.15);
}

.click-arena.event-glow--coreResonance {
  box-shadow:
    inset 0 0 0 2px rgba(186, 104, 200, 0.55),
    0 0 30px rgba(186, 104, 200, 0.25);
}

.debris-field.event-glow--coreResonance {
  border-color: rgba(186, 104, 200, 0.6) !important;
  box-shadow:
    inset 0 0 28px rgba(186, 104, 200, 0.1),
    0 0 20px rgba(186, 104, 200, 0.22);
  animation: event-field-brightness 2.2s ease-in-out infinite;
}

.missions-panel.event-glow--coreResonance {
  border-color: rgba(186, 104, 200, 0.45);
  box-shadow: 0 0 18px rgba(186, 104, 200, 0.18);
}

.click-arena.event-glow--smashRush {
  box-shadow:
    inset 0 0 0 2px rgba(255, 112, 67, 0.55),
    0 0 28px rgba(255, 112, 67, 0.22);
}

.debris-field.event-glow--smashRush {
  border-color: rgba(255, 112, 67, 0.6) !important;
  box-shadow:
    inset 0 0 24px rgba(255, 112, 67, 0.1),
    0 0 18px rgba(255, 87, 34, 0.2);
  animation: event-field-brightness 1.6s ease-in-out infinite;
}

.click-arena.event-glow--giant {
  box-shadow:
    inset 0 0 0 2px rgba(255, 171, 64, 0.65),
    0 0 36px rgba(255, 171, 64, 0.28);
}

.debris-field.event-glow--giant {
  border-color: rgba(255, 171, 64, 0.7) !important;
  box-shadow:
    inset 0 0 32px rgba(255, 171, 64, 0.12),
    0 0 24px rgba(255, 171, 64, 0.3);
  animation: event-field-brightness 1.4s ease-in-out infinite;
}

.missions-panel.event-glow--giant {
  border-color: rgba(255, 171, 64, 0.5);
  box-shadow: 0 0 20px rgba(255, 171, 64, 0.2);
}

.click-arena.event-glow--flash {
  box-shadow:
    inset 0 0 0 2px rgba(255, 64, 129, 0.55),
    0 0 28px rgba(255, 64, 129, 0.22);
}

.debris-field.event-glow--flash,
.flash-mission-slot.event-glow--flash {
  box-shadow: 0 0 16px rgba(255, 64, 129, 0.25);
}

.missions-panel.event-glow--flash {
  border-color: rgba(255, 64, 129, 0.45);
  box-shadow: 0 0 18px rgba(255, 64, 129, 0.15);
}

@keyframes event-field-brightness {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.1); }
}

.event-buff-chip--debrisSurge {
  background: rgba(79, 195, 247, 0.15);
  border-color: rgba(79, 195, 247, 0.45);
  box-shadow: 0 0 10px rgba(79, 195, 247, 0.2);
}

.event-buff-chip--sellSpike {
  background: rgba(105, 240, 174, 0.12);
  border-color: rgba(105, 240, 174, 0.4);
  box-shadow: 0 0 10px rgba(105, 240, 174, 0.18);
}

.event-buff-chip--coreResonance {
  background: rgba(186, 104, 200, 0.14);
  border-color: rgba(186, 104, 200, 0.45);
  box-shadow: 0 0 10px rgba(186, 104, 200, 0.22);
}

.event-buff-chip--smashRush {
  background: rgba(255, 112, 67, 0.14);
  border-color: rgba(255, 112, 67, 0.45);
  box-shadow: 0 0 10px rgba(255, 112, 67, 0.2);
}

.debris-item.debris-giant .debris-emoji {
  font-size: 2.4rem;
  filter: drop-shadow(0 0 12px rgba(255, 171, 64, 0.8)) drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6));
  animation: giant-pulse 1.5s ease-in-out infinite;
}

@keyframes giant-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.mission-top {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.3rem;
}

.mission-type-badge { font-size: 0.9rem; }

.mission-type-label {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--mission-color, var(--accent));
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.mission-tier-badge {
  margin-left: auto;
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--gold);
  background: rgba(255, 213, 79, 0.12);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.mission-tier-badge.hidden { display: none; }

.mission-orbit-badge {
  font-size: 0.58rem;
  font-weight: 600;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.06);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.mission-orbit-badge.hidden { display: none; }

.mission-item.complete { border-color: var(--success); }
.mission-item.claimed {
  opacity: 0.5;
  pointer-events: none;
}

.mission-desc { font-weight: 600; margin-bottom: 0.35rem; }

.mission-progress {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.mission-progress .bar-track { flex: 1; height: 6px; }
.mission-progress span { font-size: 0.65rem; color: var(--text-dim); white-space: nowrap; }

.mission-reward {
  color: var(--gold);
  font-size: 0.68rem;
  margin-bottom: 0.35rem;
}

.claim-btn {
  width: 100%;
  padding: 0.35rem;
  background: var(--success);
  color: #0a0e1a;
  border: none;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  pointer-events: auto;
}

.claim-btn:disabled {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
  cursor: not-allowed;
}

.mission-item.complete .claim-btn:not(:disabled) {
  box-shadow: 0 0 8px rgba(105, 240, 174, 0.4);
}

.codex-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-bottom: 0.5rem;
}

.codex-summary {
  padding: 0.65rem;
  background: rgba(105, 240, 174, 0.08);
  border: 1px solid rgba(105, 240, 174, 0.25);
  border-radius: 8px;
}

.codex-summary-title {
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.codex-summary-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 600;
}

.codex-summary-progress {
  font-size: 0.68rem;
  color: var(--text-dim);
  margin-top: 0.35rem;
}

.codex-orbit-section {
  padding: 0.55rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.codex-orbit-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0;
  border: none;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.codex-orbit-toggle:hover .codex-chevron,
.codex-orbit-toggle:hover strong {
  color: var(--accent);
}

.codex-chevron {
  flex-shrink: 0;
  font-size: 0.55rem;
  color: var(--text-dim);
  transition: transform 0.2s ease, color 0.15s ease;
}

.codex-orbit-section:not(.collapsed) .codex-chevron {
  transform: rotate(90deg);
}

.codex-orbit-toggle strong {
  flex: 1;
  font-size: 0.75rem;
  transition: color 0.15s ease;
}

.codex-orbit-count {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-weight: 600;
}

.codex-orbit-body {
  overflow: hidden;
  max-height: 3000px;
  opacity: 1;
  transition: max-height 0.28s ease, opacity 0.2s ease, padding 0.2s ease;
  padding-top: 0.4rem;
}

.codex-orbit-section.collapsed .codex-orbit-body {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  pointer-events: none;
}

.codex-orbit-items {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.45rem;
}

.codex-full-section .codex-orbit-body small {
  display: block;
  font-size: 0.65rem;
  color: var(--text-dim);
  margin-bottom: 0.45rem;
}

.codex-orbit-section.locked {
  opacity: 0.55;
}

.codex-orbit-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  margin-bottom: 0.35rem;
}

.codex-orbit-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.4rem;
}

.codex-orbit-bar .bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #4fc3f7);
  transition: width 0.3s ease;
}

.codex-orbit-reward {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.codex-orbit-reward small {
  font-size: 0.65rem;
  color: var(--text-dim);
  flex: 1;
}

.codex-lock-hint {
  font-size: 0.65rem;
  color: var(--text-dim);
}

.codex-claim-btn {
  padding: 0.3rem 0.55rem;
  border: none;
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: 700;
  cursor: pointer;
  background: var(--accent);
  color: #0a1628;
  white-space: nowrap;
  flex-shrink: 0;
}

.codex-claim-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-dim);
}

.codex-claim-btn.full {
  width: 100%;
  margin-top: 0.4rem;
  padding: 0.45rem;
}

.codex-full-section {
  background: rgba(255, 215, 64, 0.08);
  border-color: rgba(255, 215, 64, 0.25);
}

.codex-empty {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-align: center;
  padding: 1rem;
}

.codex-item {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.8rem;
}

.codex-item.unknown {
  opacity: 0.65;
}

.codex-item.discovered {
  border-color: rgba(105, 240, 174, 0.2);
}

.codex-emoji { font-size: 1.3rem; flex-shrink: 0; }
.codex-item-body { flex: 1; min-width: 0; }
.codex-item strong { display: block; font-size: 0.78rem; }
.codex-item small { color: var(--text-dim); font-size: 0.65rem; display: block; }
.codex-bonus-line { color: var(--accent) !important; }

.codex-milestones {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.35rem;
}

.codex-milestone-btn {
  padding: 0.15rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.58rem;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  cursor: pointer;
}

.codex-milestone-btn.ready {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(105, 240, 174, 0.1);
}

.codex-milestone-btn.claimed {
  opacity: 0.5;
  cursor: default;
}

.codex-milestone-btn:disabled:not(.ready) {
  cursor: not-allowed;
}

.sell-panel {
  padding: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.sell-panel h2 { font-size: 0.95rem; margin-bottom: 0.25rem; }
.sell-panel p { font-size: 0.75rem; color: var(--text-dim); margin-bottom: 0.5rem; }
.sell-hint {
  color: var(--accent);
  font-size: 0.72rem;
  margin-top: -0.25rem;
  margin-bottom: 0.35rem;
}

.sell-hint kbd,
.missions-panel kbd {
  display: inline-block;
  padding: 0.05rem 0.3rem;
  margin: 0 0.05rem;
  font-size: 0.65rem;
  font-family: inherit;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.missions-shortcuts {
  font-size: 0.65rem;
  color: var(--text-dim);
  margin: 0.15rem 0 0.35rem;
}
.sell-rate { font-size: 0.8rem; margin-bottom: 0.75rem; }

.action-btn {
  width: 100%;
  padding: 0.65rem;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}

.action-btn:hover:not(:disabled) { opacity: 0.9; transform: translateY(-1px); }
.action-btn:active:not(:disabled) { transform: translateY(0); }
.action-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.sell-btn {
  background: linear-gradient(135deg, #2e7d32, #1b5e20);
  color: white;
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px solid var(--border);
}

/* ===== Shop ===== */
.shop-tabs {
  display: flex;
  gap: 0.25rem;
}

.tab {
  flex: 1;
  padding: 0.5rem 0.25rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.2s;
}

.tab.active {
  background: rgba(79, 195, 247, 0.15);
  border-color: var(--accent);
  color: var(--accent);
}

.tab-prestige.has-reward {
  border-color: var(--gold);
  color: var(--gold);
  animation: prestige-pulse 1.5s ease infinite;
}

@keyframes prestige-pulse {
  0%, 100% { box-shadow: 0 0 0 rgba(255, 213, 79, 0); }
  50% { box-shadow: 0 0 10px rgba(255, 213, 79, 0.35); }
}

.resource-essence .res-value {
  color: var(--gold);
}

.prestige-panel {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.prestige-summary {
  padding: 0.65rem;
  background: rgba(255, 213, 79, 0.08);
  border: 1px solid rgba(255, 213, 79, 0.25);
  border-radius: 8px;
}

.prestige-summary-title {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.prestige-desc {
  font-size: 0.68rem;
  color: var(--text-dim);
  line-height: 1.4;
  margin-bottom: 0.4rem;
}

.prestige-stats,
.prestige-active-bonus {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.68rem;
}

.prestige-active-bonus {
  margin-top: 0.35rem;
  color: var(--gold);
  font-weight: 600;
}

.prestige-rebirth-box {
  padding: 0.65rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.prestige-rebirth-box.ready {
  border-color: rgba(255, 213, 79, 0.45);
  background: rgba(255, 213, 79, 0.06);
}

.prestige-rebirth-info strong {
  display: block;
  font-size: 0.78rem;
}

.prestige-rebirth-info small {
  display: block;
  font-size: 0.65rem;
  color: var(--text-dim);
  margin-top: 0.2rem;
}

.prestige-btn {
  width: 100%;
  padding: 0.65rem;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(135deg, #ffd54f, #ffab40);
  color: #1a1200;
  transition: opacity 0.2s;
}

.prestige-btn:hover:not(:disabled) { opacity: 0.9; }
.prestige-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-dim);
}

.prestige-upgrades-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-dim);
  margin-top: 0.25rem;
}

.prestige-upgrades {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.prestige-item .shop-item-cost {
  color: var(--gold);
}

.shop-panel {
  display: none;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  overflow-y: auto;
}

.shop-panel.active { display: flex; }

.shop-item {
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s;
}

.shop-item.owned { border-color: var(--success); opacity: 0.7; }
.shop-item.locked { opacity: 0.45; }

.shop-item-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}

.shop-item-emoji { font-size: 1.4rem; }
.shop-item-name { font-size: 0.85rem; font-weight: 600; flex: 1; }
.shop-item-level { font-size: 0.7rem; color: var(--accent); }

.shop-item-desc {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}

.shop-item-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.shop-item-cost {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gold);
}

.buy-btn {
  padding: 0.35rem 0.75rem;
  background: var(--accent);
  color: #0a0e1a;
  border: none;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
}

.buy-btn:hover:not(:disabled) { opacity: 0.85; }
.buy-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  width: max-content;
  max-width: min(92vw, 24rem);
  z-index: 200;
  pointer-events: none;
}

.toast {
  padding: 0.6rem 1.2rem;
  background: rgba(20, 30, 50, 0.95);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.85rem;
  animation: toast-in 0.3s ease, toast-out 0.3s ease 2.2s forwards;
  white-space: nowrap;
  max-width: 100%;
  text-align: center;
}

.toast.success { border-color: var(--success); color: var(--success); }
.toast.warning { border-color: var(--warning); color: var(--warning); }
.toast.rare { border-color: var(--gold); color: var(--gold); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateY(-10px); }
}

/* ===== Responsive ===== */
.mobile-nav,
.mobile-play-hud,
.mobile-orbit-bar {
  display: none;
}

@media (max-width: 960px) {
  .game-layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden;
  }

  .top-bar {
    padding: 0.5rem 0.75rem;
    gap: 0.5rem;
    justify-content: flex-start;
  }

  .brand-icon { font-size: 1.5rem; }
  .brand h1 { font-size: 0.95rem; }
  .subtitle { display: none; }

  .header-stats {
    order: 3;
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.15rem;
  }

  .header-stats::-webkit-scrollbar { display: none; }

  .header-stat {
    flex-shrink: 0;
    min-width: 64px;
    padding: 0.25rem 0.5rem;
  }

  .resources {
    order: 2;
    flex: 1;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0.4rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    min-width: 0;
  }

  .resources::-webkit-scrollbar { display: none; }

  .resource {
    flex-shrink: 0;
    min-width: 0;
    padding: 0.3rem 0.55rem;
  }

  .resource-essence { display: none; }

  .res-icon { font-size: 1.1rem; }
  .res-value { font-size: 0.82rem; }

  .missions-shortcuts,
  .sell-hint kbd,
  .missions-panel kbd {
    display: none;
  }

  .sell-hint::after {
    content: ' · 탭으로 판매';
    font-size: 0.68rem;
  }

  html, body {
    overscroll-behavior: none;
    -webkit-tap-highlight-color: transparent;
  }

  #app {
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .mobile-nav {
    display: flex;
    flex-shrink: 0;
    align-items: stretch;
    justify-content: space-around;
    gap: 0.15rem;
    padding: 0.35rem 0.5rem calc(0.35rem + env(safe-area-inset-bottom, 0));
    background: var(--bg-panel);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(12px);
    z-index: 50;
  }

  .mobile-nav-btn {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.1rem;
    min-height: 48px;
    padding: 0.35rem 0.25rem;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: var(--text-dim);
    font-family: inherit;
    cursor: pointer;
    touch-action: manipulation;
    transition: background 0.2s, color 0.2s;
  }

  .mobile-nav-btn.active {
    background: rgba(79, 195, 247, 0.12);
    color: var(--accent);
  }

  .mobile-nav-icon { font-size: 1.25rem; line-height: 1; }
  .mobile-nav-label { font-size: 0.62rem; font-weight: 600; }

  .mobile-nav-dot {
    position: absolute;
    top: 0.4rem;
    right: calc(50% - 0.75rem);
    width: 0.5rem;
    height: 0.5rem;
    background: #ff5252;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(255, 82, 82, 0.65);
  }

  .mobile-nav-dot.hidden { display: none; }

  .mobile-orbit-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    padding: 0.45rem 0.65rem;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
    z-index: 40;
  }

  .mobile-orbit-selector {
    flex: 1;
    justify-content: stretch;
    min-width: 0;
  }

  .mobile-orbit-selector .orbit-btn {
    flex: 1;
    min-height: 38px;
    padding: 0.4rem 0.35rem;
    font-size: 0.76rem;
  }

  .mobile-status-btn {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.05rem;
    min-width: 3.1rem;
    min-height: 38px;
    padding: 0.3rem 0.45rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-dim);
    font-family: inherit;
    cursor: pointer;
    touch-action: manipulation;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
  }

  .mobile-status-btn.active {
    background: rgba(79, 195, 247, 0.14);
    border-color: rgba(79, 195, 247, 0.45);
    color: var(--accent);
  }

  .mobile-status-btn-icon { font-size: 0.95rem; line-height: 1; }

  .mobile-status-btn strong {
    font-size: 0.68rem;
    color: inherit;
    font-weight: 700;
  }

  .game-layout {
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden;
  }

  .game-layout > * {
    min-height: 0;
    height: 100%;
    overflow: hidden;
  }

  .click-arena {
    order: 0;
    padding: 0.5rem 0.5rem 0.25rem;
    gap: 0.35rem;
  }

  .sidebar {
    order: 0;
    padding: 0.65rem;
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .game-layout:not(.mobile-panel-play) .click-arena { display: none !important; }
  .game-layout:not(.mobile-panel-status):not(.mobile-panel-missions) .sidebar-left { display: none !important; }
  .game-layout:not(.mobile-panel-shop) .sidebar-right { display: none !important; }

  .game-layout.mobile-panel-status .sidebar-left .mobile-section-missions { display: none; }
  .game-layout.mobile-panel-missions .sidebar-left .mobile-section-status { display: none; }

  .game-layout.mobile-panel-missions .missions-panel {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  .mobile-play-hud {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-shrink: 0;
    padding: 0.25rem 0;
    z-index: 2;
  }

  .mobile-quick-sell {
    flex-shrink: 0;
    min-height: 40px;
    padding: 0.45rem 0.9rem;
    background: linear-gradient(135deg, #2e7d32, #1b5e20);
    border: none;
    border-radius: 999px;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    touch-action: manipulation;
    white-space: nowrap;
  }

  .mobile-quick-sell:disabled {
    opacity: 0.4;
    cursor: not-allowed;
  }

  .game-layout:not(.mobile-panel-play) .mobile-play-hud { display: none; }

  .status-panel .orbit-select-wrap { display: none; }

  .mobile-status-btn.active {
    background: rgba(79, 195, 247, 0.14);
    border-color: rgba(79, 195, 247, 0.45);
    color: var(--accent);
  }

  .click-arena .debris-field {
    flex: 1;
    min-height: 0;
  }

  .arena-bg .earth-container {
    max-width: min(72vw, 280px);
    max-height: min(72vw, 280px);
    margin: 0 auto;
  }

  .debris-item {
    min-width: 48px;
    min-height: 48px;
    justify-content: center;
    -webkit-touch-callout: none;
  }

  .debris-emoji {
    font-size: 2rem;
  }

  .debris-item.debris-giant .debris-emoji {
    font-size: 2.6rem;
  }

  .debris-hp-track {
    width: 40px;
    height: 6px;
  }

  .event-banner {
    top: 0.35rem;
    font-size: 0.7rem;
    padding: 0.3rem 0.65rem;
    max-width: calc(100% - 1rem);
    text-align: center;
  }

  .shop-tabs {
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--bg-panel);
    padding: 0.25rem 0;
    margin: -0.25rem 0 0.25rem;
  }

  .tab {
    min-height: 44px;
    padding: 0.55rem 0.2rem;
    font-size: 0.68rem;
    touch-action: manipulation;
  }

  .action-btn,
  .claim-btn {
    min-height: 44px;
    padding: 0.55rem;
    font-size: 0.8rem;
  }

  .shop-item .buy-btn {
    min-height: 40px;
    min-width: 64px;
  }

  .toast-container {
    bottom: calc(4.25rem + env(safe-area-inset-bottom, 0));
    max-width: calc(100% - 1.5rem);
  }

  .toast {
    font-size: 0.78rem;
    white-space: normal;
    border-radius: 12px;
    padding: 0.55rem 1rem;
    line-height: 1.35;
  }
}

@media (max-width: 400px) {
  .brand h1 { font-size: 0.85rem; }
  .header-stat strong { font-size: 0.72rem; }
  .mobile-nav-label { font-size: 0.58rem; }
  .mobile-orbit-selector .orbit-btn { font-size: 0.7rem; padding: 0.4rem 0.35rem; }
}
