/* Dragon Numbers! (Number Monsters & Rods) Stylesheet */
:root {
  --bg-primary: #121026;
  --bg-secondary: #211c47;
  --bg-card: #2e2661;
  --panel-bg: #ffffff;
  --ink-dark: #1b1638;
  --ink-muted: #625a8c;
  --accent-gold: #ffd13b;
  --accent-orange: #ff9326;
  --accent-cyan: #00f5d4;
  --accent-purple: #9b5de5;
  --font-family: "Fredoka", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Rod Colors */
  --c-1: #ff4d6d;
  --c-2: #00bbf9;
  --c-3: #fee440;
  --c-4: #9b5de5;
  --c-5: #00f5d4;
  --c-6: #f15bb5;
  --c-7: #ff006e;
  --c-8: #38b000;
  --c-9: #4361ee;
  --c-10: #ffb703;
}

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

body {
  background: radial-gradient(circle at top center, #262152 0%, #0d0b1c 100%);
  color: #ffffff;
  font-family: var(--font-family);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
  transition: background 0.3s ease;
}

/* Background Celebration Pulse */
body.flash-correct {
  animation: flashDragon 0.7s ease-out;
}
@keyframes flashDragon {
  0% { background-color: #00f5d4; }
  50% { background-color: #ffd13b; }
  100% { background-color: transparent; }
}

/* Top Nav Bar */
.top-nav-bar {
  background: rgba(13, 11, 28, 0.95);
  border-bottom: 2px solid #362e6b;
  padding: 10px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.home-link {
  color: var(--accent-gold);
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.15s;
}
.home-link:hover {
  transform: translateX(-3px);
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 12px;
}
.nav-links a {
  color: #bcb6ea;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 5px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  transition: all 0.2s;
}
.nav-links a:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.active-badge {
  background: linear-gradient(135deg, #00f5d4, #00bbf9);
  color: #0d0b1c;
  padding: 5px 14px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 2px 8px rgba(0, 245, 212, 0.4);
}

/* Main Layout Shell */
.app-shell {
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 20px 60px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Header */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.dragon-avatar {
  font-size: 2.8rem;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.4));
  animation: dragonFloat 3s ease-in-out infinite alternate;
}
@keyframes dragonFloat {
  0% { transform: translateY(0) rotate(0deg); }
  100% { transform: translateY(-5px) rotate(4deg); }
}

.brand h1 {
  font-size: 2.1rem;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 3px 0 #1b1638;
}
.brand .tagline {
  color: #bcb6ea;
  font-size: 1rem;
  font-weight: 500;
}

.stats-group {
  display: flex;
  gap: 12px;
}

.stat-badge {
  background: #251f52;
  border: 2px solid #483d87;
  border-radius: 14px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 0 #14112e;
}
.stat-badge .icon {
  font-size: 1.4rem;
}
.stat-badge .label {
  font-size: 0.85rem;
  color: #aaa4db;
  font-weight: 600;
  text-transform: uppercase;
}
.stat-badge strong {
  font-size: 1.3rem;
  color: var(--accent-gold);
  font-weight: 700;
}

/* Dragon Dialogue Card (Top Banner) */
.dialogue-card {
  background: linear-gradient(135deg, #2b2059, #1b143d);
  border: 2px solid #5a4b9c;
  border-radius: 20px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

.dragon-speaker-avatar {
  font-size: 2.5rem;
  background: #3b2d73;
  border: 2px solid #6350ad;
  border-radius: 50%;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dialogue-bubble-box {
  flex: 1;
}

.target-bubble {
  background: #ffffff;
  border: 2px solid #ded8ff;
  border-radius: 16px;
  padding: 10px 18px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink-dark);
  box-shadow: 0 3px 0 #cfc7f5;
  line-height: 1.4;
}
.target-bubble strong {
  color: #ff006e;
  font-size: 1.15rem;
}

/* Settings Panel */
.settings-panel {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.setting {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #c9c3f7;
  font-weight: 600;
  font-size: 0.9rem;
}
.setting select {
  background: #251f52;
  border: 2px solid #4e418f;
  border-radius: 12px;
  padding: 8px 14px;
  color: #ffffff;
  font-family: var(--font-family);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}
.setting select:focus {
  border-color: var(--accent-gold);
}

.rank-indicator {
  background: #251f52;
  border: 2px solid #4e418f;
  border-radius: 12px;
  padding: 5px 12px;
  gap: 8px;
}
.rank-badge {
  color: var(--accent-gold);
  font-weight: 700;
  font-size: 0.9rem;
}

.streak-dots {
  display: inline-flex;
  gap: 5px;
}
.streak-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #3e3373;
  border: 1.5px solid #5a4b9f;
  transition: all 0.25s;
}
.streak-dot.active {
  background: #00f5d4;
  border-color: #00bbf9;
  box-shadow: 0 0 8px #00f5d4;
  transform: scale(1.2);
}

.level-reset-btn {
  border: 0;
  background: #3d3275;
  color: #dedaff;
  cursor: pointer;
  font: 600 0.8rem var(--font-family);
  padding: 3px 8px;
  border-radius: 6px;
  transition: all 0.15s;
}
.level-reset-btn:hover {
  background: #55469e;
  color: #fff;
}

/* Play Stage Board */
.play-stage {
  background: #ffffff;
  border-radius: 28px;
  padding: 24px 20px;
  color: var(--ink-dark);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35), 0 0 0 6px #3b3275;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Workbench Area */
.workbench-area {
  background: #f7f5ff;
  border: 3px dashed #7a6ab8;
  border-radius: 22px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Side-by-Side Split: Target Left, Tray Right */
.workbench-split {
  display: flex;
  gap: 14px;
  align-items: stretch;
  width: 100%;
}

/* TARGET SLOT COLUMN (Directly to the left of the feeding tray) */
.target-slot-column {
  background: #ffffff;
  border: 3px solid #00f5d4;
  border-radius: 18px;
  padding: 10px 12px;
  min-width: 130px;
  max-width: 155px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 6px 16px rgba(0, 245, 212, 0.2), inset 0 2px 4px rgba(0, 0, 0, 0.03);
}

.target-slot-header {
  background: linear-gradient(135deg, #00f5d4, #00bbf9);
  border-radius: 10px;
  padding: 5px 8px;
  width: 100%;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0, 187, 249, 0.3);
}

.target-slot-label {
  font-size: 0.72rem;
  font-weight: 800;
  color: #0b1a24;
  display: block;
  letter-spacing: 0.5px;
}

.target-slot-number {
  font-size: 2rem;
  font-weight: 800;
  color: #0b1a24;
  line-height: 1.05;
  display: block;
}

.target-rod-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  flex: 1;
  width: 100%;
  min-height: 120px;
  padding: 6px 0 2px;
}

.target-monster-graphic {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-height: 100px;
}

.target-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: #2e2661;
  text-align: center;
  margin-top: 4px;
  white-space: nowrap;
}

/* FEEDING TRAY COLUMN (Right side) */
.tray-slot-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.workbench-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.workbench-title {
  font-weight: 700;
  color: #3b306b;
  font-size: 0.95rem;
}
.tray-counter {
  background: #ffffff;
  border: 2px solid #cfc7f5;
  border-radius: 12px;
  padding: 4px 12px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #4a3e82;
}
.tray-counter strong {
  color: #ff006e;
  font-size: 1.2rem;
}

/* Tray Stage */
.tray-stage {
  min-height: 120px;
  background: #ffffff;
  border: 2px solid #e0dbfa;
  border-radius: 16px;
  padding: 14px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  position: relative;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.05);
  flex: 1;
}

.empty-tray-msg {
  color: #8c85b8;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
  margin: auto;
}

.tray-rods-container {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.tray-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: transform 0.15s;
}
.tray-item:hover {
  transform: translateY(-4px);
}

/* Action Buttons */
.workbench-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.action-btn {
  font-family: var(--font-family);
  font-size: 1.15rem;
  font-weight: 700;
  padding: 10px 24px;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.1s;
}

.feed-action-btn {
  background: linear-gradient(135deg, #00f5d4, #00bbf9);
  border: 3px solid #008fa3;
  color: #0b1a24;
  box-shadow: 0 6px 0 #006573;
}
.feed-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 0 #006573;
}
.feed-action-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #006573;
}

.clear-action-btn {
  background: #ede9fc;
  border: 2px solid #c9c0f0;
  color: #4b3f82;
  box-shadow: 0 4px 0 #b3a6e6;
}
.clear-action-btn:hover {
  background: #dfd8f7;
  transform: translateY(-1px);
}
.clear-action-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #b3a6e6;
}

/* Monster Bench / Inventory */
.inventory-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.inventory-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #4a3e82;
  text-align: center;
}

.monster-bench {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px 0;
}

/* Rod SVG and Monster Style */
.monster-rod-card {
  background: #ffffff;
  border: 2px solid #d4ccf7;
  border-radius: 16px;
  padding: 8px 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  box-shadow: 0 5px 0 #cfc5f5;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}
.monster-rod-card:hover {
  background: #f7f5ff;
  transform: translateY(-4px);
  box-shadow: 0 8px 0 #cfc5f5;
}
.monster-rod-card:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #cfc5f5;
}

.rod-number-badge {
  font-size: 0.95rem;
  font-weight: 700;
  color: #2b2361;
}

.rod-svg {
  display: block;
}

/* Feedback text */
.feedback {
  font-size: 1.15rem;
  font-weight: 600;
  color: #4b3e82;
  min-height: 32px;
  text-align: center;
  transition: all 0.2s;
}
.feedback.success {
  color: #0b9e76;
  font-weight: 700;
  transform: scale(1.05);
}
.feedback.try-again {
  color: #d6335e;
}

/* Footer controls */
.game-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.footer-tip {
  font-size: 0.9rem;
  color: #a49dda;
}
.footer-actions {
  display: flex;
  gap: 12px;
}
.footer-btn {
  font-family: var(--font-family);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 12px;
  border: 2px solid #554999;
  background: #251f52;
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 4px 0 #14112e;
  transition: all 0.15s;
}
.footer-btn:hover {
  background: #352b75;
  transform: translateY(-1px);
}
.footer-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #14112e;
}
.footer-btn.hint-btn {
  border-color: #ffd13b;
  color: var(--accent-gold);
}

/* Celebration particles & fireworks */
.celebration {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  overflow: hidden;
}
.celebration.playing {
  animation: celebrationPulse 1.2s ease-out;
}
@keyframes celebrationPulse {
  0% { box-shadow: inset 0 0 80px rgba(0, 245, 212, 0.6); }
  100% { box-shadow: inset 0 0 0 rgba(0, 245, 212, 0); }
}

.confetti {
  position: absolute;
  top: -20px;
  left: var(--left);
  width: var(--size);
  height: calc(var(--size) * 1.4);
  background: var(--color);
  opacity: 0.95;
  transform: rotate(var(--tilt));
  animation: confettiFall 1.8s ease-out forwards;
  animation-delay: var(--delay);
  border-radius: 3px;
}
@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(105vh) translateX(var(--drift)) rotate(720deg); opacity: 0; }
}

.firework {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color);
  animation: fireworkPop 0.9s ease-out forwards;
  animation-delay: var(--delay);
}
@keyframes fireworkPop {
  0% { transform: scale(1); opacity: 1; box-shadow: 0 0 0 0 var(--color); }
  50% { opacity: 0.9; }
  100% {
    transform: scale(22);
    opacity: 0;
    box-shadow: 0 0 30px var(--color), 0 0 60px #fff;
  }
}

/* Responsive */
@media (max-width: 600px) {
  .app-shell { padding: 16px 12px 40px; }
  .brand h1 { font-size: 1.6rem; }
  .dragon-avatar { font-size: 2.2rem; }
  .workbench-split { flex-direction: row; gap: 8px; }
  .target-slot-column { min-width: 95px; padding: 8px 6px; }
  .target-slot-number { font-size: 1.6rem; }
  .monster-bench { gap: 4px; }
  .monster-rod-card { padding: 4px 3px; }
  .settings-panel { flex-direction: column; align-items: stretch; }
  .setting { justify-content: space-between; }
  .game-footer { flex-direction: column; text-align: center; }
}
