/* === ARENA LAYOUT === */
.arena-body {
  overflow: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.arena-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: rgba(10, 10, 15, 0.95);
  border-bottom: 1px solid rgba(0, 212, 255, 0.1);
  backdrop-filter: blur(10px);
  z-index: 100;
  flex-shrink: 0;
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--fg-primary);
  text-decoration: none;
  letter-spacing: 1px;
}

.kashes-display {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid rgba(255, 204, 0, 0.3);
  border-radius: 100px;
  padding: 8px 16px;
  box-shadow: 0 0 12px rgba(255, 204, 0, 0.1);
}

.kashes-icon {
  color: var(--accent-gold);
  font-size: 1.1rem;
}

.kashes-amount {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-gold);
  min-width: 32px;
  text-align: center;
  transition: all 0.3s ease;
}

.kashes-amount.bump {
  transform: scale(1.3);
  color: #fff;
}

.kashes-label {
  font-family: var(--font-display);
  font-size: 0.65rem;
  letter-spacing: 2px;
  color: var(--fg-secondary);
}

.arena-layout {
  display: grid;
  grid-template-columns: 200px 1fr 240px;
  flex: 1;
  overflow: hidden;
}

/* === TOOL PANEL === */
.tool-panel {
  background: var(--bg-secondary);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  padding: 16px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.panel-label {
  font-family: var(--font-display);
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--fg-secondary);
  font-weight: 600;
}

.slider {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  cursor: pointer;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-blue);
  cursor: pointer;
  box-shadow: 0 0 6px rgba(0, 212, 255, 0.5);
}

.slider-val {
  font-size: 0.75rem;
  color: var(--accent-blue);
  font-family: var(--font-display);
  font-size: 10px;
}

.color-palette {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.color-btn {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.1s ease, border-color 0.15s ease;
}

.color-btn:hover { transform: scale(1.1); }
.color-btn.active { border-color: #fff; box-shadow: 0 0 8px rgba(255,255,255,0.4); }

.custom-color {
  width: 100%;
  height: 28px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  background: var(--bg-card);
  cursor: pointer;
  padding: 2px;
}

.brush-types {
  display: flex;
  gap: 6px;
}

.brush-type-btn {
  flex: 1;
  padding: 8px;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  color: var(--fg-secondary);
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.15s ease;
}

.brush-type-btn.active,
.brush-type-btn:hover {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  background: rgba(0, 212, 255, 0.08);
}

.object-btns {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.object-btn {
  padding: 7px 10px;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 6px;
  color: var(--fg-secondary);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 1px;
  text-align: left;
  transition: all 0.15s ease;
}

.object-btn.active,
.object-btn:hover {
  border-color: var(--accent-magenta);
  color: var(--accent-magenta);
  background: rgba(255, 0, 170, 0.08);
}

.btn-secondary {
  width: 100%;
  padding: 8px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  color: var(--fg-secondary);
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  border-color: rgba(255,255,255,0.3);
  color: var(--fg-primary);
}

/* === CANVAS AREA === */
.canvas-area {
  position: relative;
  background: #08080e;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.canvas-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
}

#arenaCanvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.canvas-hint {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  color: rgba(136, 136, 160, 0.5);
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

/* === CHALLENGE HUD === */
.challenge-hud {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 24px;
  background: rgba(10, 10, 15, 0.85);
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: var(--radius);
  padding: 12px 24px;
  backdrop-filter: blur(10px);
  z-index: 10;
}

.hud-timer, .hud-stat {
  text-align: center;
}

.hud-label {
  font-family: var(--font-display);
  font-size: 8px;
  letter-spacing: 2px;
  color: var(--fg-secondary);
  margin-bottom: 2px;
}

.timer-display {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
  color: var(--accent-blue);
  line-height: 1;
  min-width: 2.5ch;
  transition: color 0.3s ease;
}

.timer-display.urgent { color: var(--accent-magenta); animation: pulse 0.5s ease infinite alternate; }

@keyframes pulse {
  from { opacity: 1; }
  to { opacity: 0.5; }
}

.hud-val {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent-gold);
}

/* === CHALLENGE PANEL === */
.challenge-panel {
  background: var(--bg-secondary);
  border-left: 1px solid rgba(255, 255, 255, 0.05);
  padding: 20px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.challenge-card, .result-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

.challenge-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.3;
}

.challenge-desc {
  font-size: 0.85rem;
  color: var(--fg-secondary);
  line-height: 1.7;
}

.challenge-rewards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 14px;
}

.reward-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--fg-secondary);
}

.reward-icon { font-size: 1rem; }
.reward-row strong { color: var(--fg-primary); }

.btn-primary {
  padding: 14px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-magenta));
  border: none;
  border-radius: var(--radius);
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 2px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0, 212, 255, 0.3); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-glow {
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.2);
}

/* Result card */
.result-score-label {
  font-family: var(--font-display);
  font-size: 9px;
  letter-spacing: 3px;
  color: var(--fg-secondary);
  text-align: center;
}

.result-score {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 900;
  text-align: center;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-magenta));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.result-breakdown {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 12px;
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  color: var(--fg-secondary);
}

.breakdown-row span:last-child { color: var(--fg-primary); font-weight: 600; }

.result-kashes {
  background: rgba(255, 204, 0, 0.05);
  border: 1px solid rgba(255, 204, 0, 0.2);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 0.8rem;
  color: var(--accent-gold);
  letter-spacing: 1px;
}

.ai-comment {
  background: rgba(0, 212, 255, 0.05);
  border: 1px solid rgba(0, 212, 255, 0.15);
  border-radius: var(--radius);
  padding: 12px;
  font-size: 0.85rem;
  color: var(--accent-blue);
  font-style: italic;
  text-align: center;
  min-height: 44px;
}

/* === MODAL === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--bg-card);
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 480px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

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

.modal-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--fg-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s;
}
.modal-close:hover { color: var(--fg-primary); }

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lb-row {
  display: grid;
  grid-template-columns: 2rem 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
}

.lb-rank {
  font-family: var(--font-display);
  font-size: 0.8rem;
  color: var(--fg-secondary);
  text-align: center;
}

.lb-rank.gold { color: var(--accent-gold); }
.lb-rank.silver { color: #c0c0c0; }
.lb-rank.bronze { color: #cd7f32; }

.lb-name { font-size: 0.9rem; }

.lb-score {
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--accent-blue);
}

.lb-kashes {
  font-family: var(--font-display);
  font-size: 0.8rem;
  color: var(--accent-gold);
}

/* === SCORE FLASH === */
.score-flash {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-display);
  font-size: 4rem;
  font-weight: 900;
  color: var(--accent-gold);
  text-shadow: 0 0 40px rgba(255, 204, 0, 0.8);
  z-index: 300;
  pointer-events: none;
  animation: scoreAnim 1.5s ease forwards;
}

@keyframes scoreAnim {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  30% { opacity: 1; transform: translate(-50%, -60%) scale(1.1); }
  70% { opacity: 1; transform: translate(-50%, -60%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -80%) scale(0.8); }
}

/* === RESPONSIVE === */
@media (max-width: 900px) {
  .arena-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
    overflow-y: auto;
    height: calc(100vh - 56px);
  }

  .tool-panel {
    flex-direction: row;
    flex-wrap: wrap;
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding: 12px;
    max-height: 160px;
    overflow-y: hidden;
  }

  .canvas-area {
    min-height: 55vh;
  }

  .challenge-panel {
    border-left: none;
    border-top: 1px solid rgba(255,255,255,0.05);
    max-height: 300px;
  }
}

@media (max-width: 600px) {
  .arena-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
  }

  .tool-panel {
    max-height: 130px;
  }
}
