/* ================================================
   sheet.css — Ficha RPG girlie ✨
   ================================================ */

.rpg-sheet {
  background: var(--surface-1);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  animation: bounceIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* ── Cabecera ── */
.sheet-head {
  background: linear-gradient(135deg, #fce4f0 0%, #ede0f8 50%, #dff0f4 100%);
  border-bottom: 2px solid var(--border);
  padding: 28px 28px 22px;
  position: relative;
  overflow: hidden;
}

.sheet-head::before {
  content: '🌸';
  position: absolute;
  right: 28px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 64px;
  opacity: 0.18;
  pointer-events: none;
  animation: sparkle 4s ease-in-out infinite;
}

.sheet-archetype {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--rose);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.sheet-name {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
  margin-bottom: 6px;
}

.sheet-motto {
  font-family: var(--font-display);
  font-size: 14px;
  font-style: italic;
  color: var(--text-dim);
  padding-top: 10px;
  border-top: 1px solid var(--border);
  margin-top: 10px;
}
.sheet-motto::before { content: '"'; color: var(--rose); }
.sheet-motto::after  { content: '"'; color: var(--rose); }

/* ── Stats ── */
.sheet-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-bottom: 1px solid var(--border);
}

.stat-cell {
  padding: 14px 12px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-align: center;
  transition: background var(--transition-fast);
}
.stat-cell:hover { background: var(--surface-2); }
.stat-cell:nth-child(3n) { border-right: none; }

.stat-name {
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-mute);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 6px;
}

/* Colores por stat */
.stat-carisma      .stat-value { color: var(--rose); }
.stat-manipulacion .stat-value { color: var(--lavender); }
.stat-lealtad      .stat-value { color: var(--mint); }
.stat-ego          .stat-value { color: var(--peach); }
.stat-empatia      .stat-value { color: #f0a0d0; }
.stat-drama        .stat-value { color: var(--gold); }

.stat-bar {
  height: 4px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}

.stat-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.stat-carisma      .stat-fill { background: linear-gradient(90deg, var(--rose-light), var(--rose)); }
.stat-manipulacion .stat-fill { background: linear-gradient(90deg, var(--lavender-light), var(--lavender)); }
.stat-lealtad      .stat-fill { background: linear-gradient(90deg, var(--mint-light), var(--mint)); }
.stat-ego          .stat-fill { background: linear-gradient(90deg, var(--peach-light), var(--peach)); }
.stat-empatia      .stat-fill { background: linear-gradient(90deg, #f8c8e8, #f0a0d0); }
.stat-drama        .stat-fill { background: linear-gradient(90deg, var(--gold-light), var(--gold)); }

/* ── Secciones de info ── */
.sheet-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.sheet-section {
  padding: 18px 20px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  animation: floatUp 0.4s ease both;
}
.sheet-section:nth-child(2n) { border-right: none; }
.sheet-section:last-child,
.sheet-section:nth-last-child(2) { border-bottom: none; }

.sheet-section:nth-child(1) { animation-delay: 0.05s; }
.sheet-section:nth-child(2) { animation-delay: 0.10s; }
.sheet-section:nth-child(3) { animation-delay: 0.15s; }
.sheet-section:nth-child(4) { animation-delay: 0.20s; }

.section-label {
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text-mute);
  text-transform: uppercase;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.section-label::before {
  content: '';
  display: inline-block;
  width: 2px;
  height: 10px;
  background: linear-gradient(to bottom, var(--rose), var(--lavender));
  border-radius: 99px;
}

.section-text {
  font-size: 15px;
  color: var(--text);
  line-height: 1.55;
}

/* ── Misiones ── */
.sheet-missions {
  padding: 18px 20px;
  border-top: 1px solid var(--border);
  grid-column: 1 / -1;
}

.missions-title {
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text-mute);
  text-transform: uppercase;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.missions-title::before {
  content: '';
  display: inline-block;
  width: 2px;
  height: 10px;
  background: linear-gradient(to bottom, var(--rose), var(--lavender));
  border-radius: 99px;
}

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

.mission-entry {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  background: linear-gradient(135deg, var(--rose-pale), var(--lavender-pale));
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}
.mission-entry:hover {
  border-color: var(--rose-light);
  transform: translateX(3px);
}

.mission-entry-icon { font-size: 18px; flex-shrink: 0; }
.mission-entry-text { font-size: 14px; color: var(--text); line-height: 1.4; }

/* ── Cita ── */
.sheet-quote {
  padding: 20px 24px;
  background: linear-gradient(135deg, var(--rose-pale), var(--lavender-pale));
  border-top: 1px solid var(--border);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 16px;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.6;
}
.sheet-quote::before { content: '🌸 '; }
.sheet-quote::after  { content: ' 🌸'; }

/* ── Footer de la ficha ── */
.sheet-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  background: var(--surface-2);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* ── Botón sprite ── */
.btn-sprite {
  background: linear-gradient(135deg, var(--lavender), #9060c0);
  color: #fff;
  box-shadow: 0 4px 14px rgba(184, 153, 216, 0.4);
}
.btn-sprite:hover:not(:disabled) {
  box-shadow: 0 6px 20px rgba(184, 153, 216, 0.55);
  transform: translateY(-1px);
}

/* ── Editor de sprite ── */
.sprite-editor-panel {
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.sprite-editor {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.se-canvas-wrap {
  position: relative;
  flex-shrink: 0;
}

.se-canvas {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background:
    repeating-conic-gradient(var(--surface-2) 0% 25%, transparent 0% 50%)
    0 0 / 16px 16px;
}

.se-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-width: 180px;
}

.se-label {
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-mute);
  text-transform: uppercase;
  margin-bottom: 5px;
}

.se-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.swatch {
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  cursor: pointer;
  border-radius: 50%;
  transition: all var(--transition);
}
.swatch:hover    { transform: scale(1.15); border-color: var(--rose-light); }
.swatch.active   { border-color: var(--rose); box-shadow: 0 0 0 2px rgba(232,130,154,0.3); transform: scale(1.1); }

.se-opt-btn {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 99px;
  transition: all var(--transition-fast);
}
.se-opt-btn:hover  { border-color: var(--rose-light); color: var(--rose); background: var(--rose-pale); }
.se-opt-btn.active { background: linear-gradient(135deg, var(--rose), var(--lavender)); border-color: transparent; color: #fff; }

/* ── Galería — sprite en tarjeta ── */
.card-sprite {
  width: 40px;
  height: 40px;
  image-rendering: pixelated;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.card-sprite-empty {
  width: 40px;
  height: 40px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  opacity: 0.4;
}

/* ── Modal de historial ── */
.hist-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(60, 30, 70, 0.45);
  backdrop-filter: blur(6px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.hist-modal {
  background: var(--surface-1);
  border: 2px solid var(--border-lit);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 580px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: bounceIn 0.35s cubic-bezier(0.34,1.56,0.64,1) both;
}

.hist-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(135deg, var(--rose-pale), var(--lavender-pale));
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.hist-modal-name {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--text);
  margin-bottom: 2px;
}

.hist-modal-sub {
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
}

.hist-close {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-mute);
  font-size: 14px;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hist-close:hover { border-color: var(--rose-light); color: var(--rose); background: var(--rose-pale); }

.hist-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.hist-msg {
  display: flex;
  gap: 10px;
  font-size: 15px;
  line-height: 1.55;
  align-items: baseline;
}

.hist-who {
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  flex-shrink: 0;
  min-width: 48px;
}

.hist-msg.hist-user .hist-who { color: var(--mint); }
.hist-msg.hist-assistant .hist-who { color: var(--rose); }
.hist-text { color: var(--text); }

.hist-modal-foot {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* Botón historial en tarjeta */
.card-act.hist:hover { color: var(--lavender); background: var(--lavender-pale); }