/* ── Fishes Game Engine Stylesheet ────────────────────────── */
:root {
  --bg-dark: #090d16;
  --bg-secondary: #111827;
  --bg-tertiary: #1f2937;
  --border-color: #374151;
  --text-main: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-gold: #eab308;
  --accent-rose: #f43f5e;
  --accent-pink: #ec4899;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-dark);
  color: var(--text-main);
  height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* Hide number input spinners */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
}

/* Frameless Color Swatch Picker */
input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
  padding: 0;
  overflow: hidden;
}
input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
  border-radius: 6px;
}
input[type="color"]::-webkit-color-swatch {
  border: 1px solid var(--border-color);
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

/* ── HEADER ─────────────────────────────────────────────── */
header.bp-header {
  height: 60px;
  padding: 0 24px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 20;
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-back-hub {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.btn-back-hub:hover {
  color: #fff;
  border-color: var(--accent-emerald);
}

.bp-title {
  font-size: 18px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
}

/* ── STUDIO DASHBOARD ────────────────────────────────────── */
.bp-dashboard-container {
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 24px;
  flex: 1;
  overflow-y: auto;
}

.dashboard-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.section-title-group h1 {
  font-size: 24px;
  font-weight: 800;
  color: #fff;
}

.section-title-group p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.btn-create-game {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
  color: #0f172a;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
  transition: all 0.15s ease;
}

.btn-create-game:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
  color: #ffffff;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.bp-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: all 0.15s ease;
}

.bp-card:hover {
  border-color: rgba(16, 185, 129, 0.4);
  transform: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.bp-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.bp-card-title {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
}

.bp-card-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.meta-chip {
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-secondary);
}

.bp-card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.btn-play {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--accent-emerald);
  color: #0f172a;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-play:hover {
  background: #059669;
  color: #ffffff;
}

.btn-edit-card, .btn-delete-card {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-edit-card:hover { color: var(--accent-emerald); border-color: var(--accent-emerald); }
.btn-delete-card:hover { color: var(--accent-rose); border-color: var(--accent-rose); }

/* ── GAMEPLAY WORKSPACE (WITH RIGHT SIDEBAR) ─────────────── */
.game-workspace {
  display: flex;
  flex: 1;
  height: calc(100vh - 60px);
  overflow: hidden;
}

.game-main-area {
  flex: 1;
  position: relative;
  background: #050b14;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  overflow: hidden;
  background-image: radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 24px 24px;
}

/* ── 16:9 DOTTED SCREEN & PLAY AREA ────────────────────────── */
.fish-play-area {
  position: relative;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 50% 20%, #0369a1 0%, #0c4a6e 40%, #082f49 70%, #031926 100%);
  border: none;
  border-radius: 0;
  box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  cursor: crosshair;
}

/* ── GIANT MASSIVE WARMUP COUNTDOWN OVERLAY ───────────────── */
.countdown-overlay {
  position: absolute;
  inset: 0;
  background: rgba(11, 14, 23, 0.93);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 500;
}

.countdown-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin-bottom: 4px;
}

.countdown-number {
  font-size: clamp(140px, 22vw, 260px) !important;
  font-weight: 900 !important;
  line-height: 0.9 !important;
  letter-spacing: -0.04em !important;
  color: #10b981 !important;
  background: linear-gradient(180deg, #ffffff 0%, #10b981 50%, #059669 100%) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  filter: drop-shadow(0 15px 35px rgba(16, 185, 129, 0.7)) drop-shadow(0 8px 0 #0f172a) !important;
  user-select: none !important;
}

.countdown-number.pop {
  animation: numPopOnce 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes numPopOnce {
  0% { transform: scale(0.6); opacity: 0; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* ── RIGHT SIDEBAR ATTEMPTS PANEL ───────────────────────── */
.game-sidebar-right {
  width: 340px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex-shrink: 0;
}

.attempts-counter-box {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  text-align: center;
}

.attempts-big-num {
  font-size: 44px;
  font-weight: 900;
  color: var(--accent-emerald);
  line-height: 1;
}

.attempts-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

.attempts-log-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 4px;
}

.attempts-log-list::-webkit-scrollbar {
  width: 6px;
}
.attempts-log-list::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.6);
  border-radius: 4px;
}
.attempts-log-list::-webkit-scrollbar-thumb {
  background: rgba(16, 185, 129, 0.4);
  border-radius: 4px;
}

.cast-log-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hud-top-bar {
  position: absolute;
  top: 16px;
  left: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 50;
  pointer-events: none;
}

.hud-badge {
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 8px 16px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 800;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
}

/* ── MODAL CONTROLS ─────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 740px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}

#fishesContainer::-webkit-scrollbar {
  width: 6px;
}
#fishesContainer::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.6);
  border-radius: 4px;
}
#fishesContainer::-webkit-scrollbar-thumb {
  background: rgba(16, 185, 129, 0.4);
  border-radius: 4px;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
}

.modal-body {
  padding: 24px;
  overflow-y: auto !important;
  flex: 1 1 auto;
  min-height: 0;
  max-height: calc(88vh - 130px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 11px; font-weight: 800; text-transform: uppercase; color: var(--text-secondary); }
.form-input { width: 100%; padding: 9px 12px; background: var(--bg-tertiary); border: 1px solid var(--border-color); border-radius: var(--radius-sm); color: #ffffff; font-size: 13px; outline: none; }

.btn-secondary {
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

/* Universal Modal & Input Full-Height Fix */
.modal-content {
  max-height: 90vh !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

.modal-body {
  overflow-y: auto !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
}

.form-input {
  box-sizing: border-box !important;
  height: 44px !important;
  line-height: normal !important;
  font-family: inherit !important;
}


/* ========================================================================== */
/* FLAWLESS FULL-HEIGHT SCROLLABLE MODAL SYSTEM                               */
/* ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 13, 0.85);
  backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px 16px;
}

.modal-content {
  background: #0f1424;
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  width: 100%;
  max-width: 760px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75);
  overflow: hidden;
  margin: auto;
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: #0f1424;
}

.modal-body {
  padding: 22px 24px;
  overflow-y: auto !important;
  overflow-x: hidden;
  flex: 1 1 auto;
  min-height: 0;
  max-height: calc(90vh - 130px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-shrink: 0;
  background: rgba(10, 14, 26, 0.8);
}

/* Custom Scrollbar on Modal Body */
.modal-body::-webkit-scrollbar {
  width: 7px;
}
.modal-body::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
}
.modal-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 6px;
}
.modal-body::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.7);
}

/* Ensure all inner item lists expand naturally without internal nested cutoff */
#balloonsContainer, .bal-sections-wrapper,
#discountsContainer, #discountsList,
#fishesContainer, #fishesList,
#recipesContainer, #recipesList,
#ingredientsContainer, #ingredientsList,
#normalBalloonsList, #specialBalloonsList, #bombBalloonsList {
  max-height: none !important;
  overflow: visible !important;
  height: auto !important;
}

.form-input, input[type="text"].form-input, input[type="number"].form-input {
  box-sizing: border-box;
  height: 44px;
  line-height: normal;
  font-family: inherit;
}

.modal-body > * { flex-shrink: 0; }
