/* ══════════════════════════════════════════════
   MODALS
══════════════════════════════════════════════ */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 1000; align-items: center; justify-content: center;
  padding: 12px;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--panel); border: 2px solid var(--border2);
  width: min(540px, 100%); max-height: 92vh; overflow-y: auto;
  position: relative; box-shadow: 0 0 80px rgba(0,212,255,0.12);
}
.modal.modal-large { width: min(680px, 100%); }
.modal::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--purple), var(--accent), var(--green));
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 12px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--panel); z-index: 1;
}
.modal-title { font-family: 'Press Start 2P'; font-size: 9px; color: var(--accent); }
.btn-close {
  background: none; border: none; color: var(--text-dim);
  font-size: 20px; cursor: pointer; line-height: 1; padding: 2px 6px;
}
.btn-close:hover { color: var(--red); }

.modal-body { padding: 16px 18px; }
.modal-footer {
  padding: 12px 18px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end;
  position: sticky; bottom: 0; background: var(--panel); z-index: 1;
}

.modal-section { margin-bottom: 18px; }
.modal-section-title {
  font-family: 'Press Start 2P'; font-size: 7px; color: var(--text-dim);
  margin-bottom: 9px; letter-spacing: 1px; text-transform: uppercase;
}
.modal-section-title .required { color: var(--accent); }
.modal-section-title .optional { color: var(--text-dark); }

/* Prompt textarea */
.prompt-input {
  width: 100%; background: var(--bg2); border: 2px solid var(--border);
  color: var(--text); font-family: 'VT323'; font-size: 18px;
  padding: 9px 12px; resize: none; outline: none; min-height: 65px;
  transition: border-color 0.15s;
}
.prompt-input:focus { border-color: var(--accent); }

/* Parent selector */
.parent-selector { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.parent-slot {
  border: 2px dashed var(--border); padding: 10px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  cursor: pointer; transition: all 0.15s; min-height: 80px; justify-content: center;
}
.parent-slot:hover { border-color: var(--border2); }
.parent-slot.selected { border-style: solid; border-color: var(--accent); background: rgba(0,212,255,0.04); }
.parent-slot-label { font-family: 'Press Start 2P'; font-size: 6px; color: var(--text-dim); }
.parent-slot-icon { font-size: 24px; }
.parent-slot-name { font-size: 13px; color: var(--text); text-align: center; line-height: 1.3; }

/* Items grid */
.items-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
  gap: 6px; max-height: 190px; overflow-y: auto; padding-right: 2px;
}
.item-chip {
  border: 2px solid var(--border); padding: 6px 7px;
  cursor: pointer; transition: all 0.15s;
  display: flex; flex-direction: column; gap: 3px; background: var(--bg2);
}
.item-chip:hover { border-color: var(--border2); }
.item-chip.selected { border-color: var(--gold); background: rgba(255,215,0,0.05); }
.item-chip.locked { opacity: 0.4; cursor: not-allowed; }
.item-chip-name { font-family: 'Press Start 2P'; font-size: 5px; color: var(--text); line-height: 1.5; }
.item-chip-type { font-size: 11px; color: var(--text-dim); }

/* Parent picker grid */
.parent-picker-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px; max-height: 360px; overflow-y: auto; padding: 14px;
}
.parent-pick-card {
  background: var(--bg2); border: 2px solid var(--border);
  padding: 9px; cursor: pointer; transition: all 0.15s;
  display: flex; flex-direction: column; align-items: center; gap: 5px; text-align: center;
}
.parent-pick-card:hover { border-color: var(--border2); }
.parent-pick-card.selected { border-color: var(--accent); background: rgba(0,212,255,0.06); }
.parent-pick-icon { font-size: 32px; }
.parent-pick-name { font-family: 'Press Start 2P'; font-size: 6px; color: var(--text); line-height: 1.5; }

/* Genesis progress */
.genesis-progress {
  padding: 32px 20px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.genesis-dna { font-size: 36px; animation: spinAnim 1.5s linear infinite; }
@keyframes spinAnim { to { transform: rotate(360deg); } }
.genesis-text { font-family: 'Press Start 2P'; font-size: 9px; color: var(--accent); animation: blink 1s step-end infinite; }
.genesis-step { font-size: 14px; color: var(--text-dim); font-family: 'Share Tech Mono'; }
@keyframes blink { 50% { opacity: 0.3; } }

/* Profile */
.profile-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.profile-card {
  background: var(--bg3); border: 2px solid var(--border);
  padding: 16px; display: flex; align-items: center; gap: 14px;
}
.profile-avatar {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; flex-shrink: 0; border: 2px solid var(--border2);
}
.profile-username { font-family: 'Press Start 2P'; font-size: 11px; color: var(--text); margin-bottom: 5px; }
.profile-code { font-size: 14px; color: var(--text-dim); font-family: 'Share Tech Mono'; }
.profile-code span { color: var(--accent); letter-spacing: 2px; }

.profile-stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.profile-stat-card { background: var(--bg3); border: 2px solid var(--border); padding: 12px; text-align: center; }
.profile-stat-val { font-family: 'Press Start 2P'; font-size: 14px; color: var(--accent); margin-bottom: 4px; }
.profile-stat-label { font-size: 12px; color: var(--text-dim); }

.stage-list { display: flex; flex-direction: column; gap: 3px; }
.stage-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 9px; background: var(--bg2); border: 1px solid var(--border); font-size: 14px;
}
.stage-item.unlocked { border-color: var(--green); }
.stage-item.locked { opacity: 0.45; }
.stage-icon { font-size: 16px; flex-shrink: 0; }
.stage-name { flex: 1; font-family: 'Share Tech Mono'; font-size: 14px; }
.stage-status { font-size: 11px; color: var(--green); font-family: 'Share Tech Mono'; }
.stage-status.locked-status { color: var(--text-dark); }

.btn-logout {
  background: none; border: 2px solid var(--red); color: var(--red);
  font-family: 'Press Start 2P'; font-size: 8px; padding: 10px;
  cursor: pointer; width: 100%; letter-spacing: 1px; transition: all 0.15s;
}
.btn-logout:hover { background: rgba(255,68,102,0.1); }