/* ==========================================================================
   RPG UI, HUD, BOTOES E MODAIS — CRONONAUTAS DO NOVO MUNDO
   ========================================================================== */

/* --------------------------------------------------------------------------
   HUD Superior Fixo
   -------------------------------------------------------------------------- */
.hud-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 68px;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1.5px solid rgba(245, 158, 11, 0.3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.hud-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.avatar-badge {
  position: relative;
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 2px solid var(--gold-bright);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.avatar-badge:hover {
  transform: scale(1.08);
}

.avatar-icon {
  font-size: 1.6rem;
}

.level-pill {
  position: absolute;
  bottom: -6px;
  background: var(--gold-bright);
  color: #0f172a;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.agent-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.agent-name-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.agent-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
}

.agent-class-badge {
  font-size: 0.75rem;
  background: rgba(56, 189, 248, 0.15);
  color: var(--cyan-temporal);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.xp-bar-container {
  width: 140px;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.xp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-primary), var(--gold-bright));
  transition: width 0.4s ease;
}

.xp-label {
  display: none; /* acessível via tooltip */
}

/* Status Chips no HUD Central */
.hud-center {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.stat-chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  color: #e2e8f0;
}

.stat-chip .stat-icon {
  font-size: 1rem;
}

.stat-chip .stat-val {
  color: var(--gold-bright);
}

/* Ações no HUD Direito */
.hud-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.hud-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, #1e293b, #334155);
  border: 1.5px solid rgba(245, 158, 11, 0.4);
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.hud-action-btn:hover {
  background: linear-gradient(135deg, #334155, #475569);
  border-color: var(--gold-bright);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.hud-icon-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  color: #fff;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all var(--transition-fast);
}

.hud-icon-btn:hover {
  background: rgba(51, 65, 85, 0.9);
  border-color: var(--gold-bright);
}

.badge-counter {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--crimson-tordesilhas);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --------------------------------------------------------------------------
   Botões Estilo RPG
   -------------------------------------------------------------------------- */
.rpg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.85rem 1.6rem;
  border-radius: var(--radius-md);
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  text-decoration: none;
  letter-spacing: 0.03em;
}

.rpg-btn.primary {
  background: linear-gradient(135deg, #d97706, #f59e0b);
  color: #0f172a;
  border: 1.5px solid #fbbf24;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
}

.rpg-btn.primary:hover {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.6);
}

.rpg-btn.secondary {
  background: rgba(30, 41, 59, 0.85);
  color: #f1f5f9;
  border: 1.5px solid rgba(245, 158, 11, 0.4);
}

.rpg-btn.secondary:hover {
  background: rgba(51, 65, 85, 0.95);
  border-color: var(--gold-bright);
  transform: translateY(-2px);
}

.rpg-btn.subtle {
  background: transparent;
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.rpg-btn.subtle:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}

.glow-pulse {
  animation: buttonGlow 2s infinite alternate;
}

@keyframes buttonGlow {
  from { box-shadow: 0 4px 14px rgba(245, 158, 11, 0.3); }
  to { box-shadow: 0 6px 24px rgba(245, 158, 11, 0.7); }
}

/* --------------------------------------------------------------------------
   TELA DE CRIAÇÃO DO CRONONAUTA (PERSONAGEM)
   -------------------------------------------------------------------------- */
#screen-character-creator {
  padding: 4rem 1.5rem 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
  overflow-y: auto;
}

.creator-wrapper {
  max-width: 1020px;
  width: 100%;
  background: rgba(15, 23, 42, 0.9);
  border: 1.5px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
}

.creator-header {
  text-align: center;
  margin-bottom: 2rem;
}

.step-pill {
  display: inline-block;
  background: rgba(245, 158, 11, 0.15);
  color: var(--gold-bright);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: var(--radius-full);
  margin-bottom: 0.5rem;
}

.section-title {
  font-family: var(--font-title);
  font-size: 2rem;
  color: #fff;
}

.section-desc {
  color: #94a3b8;
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

.creator-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 2rem;
}

@media (max-width: 860px) {
  .creator-grid {
    grid-template-columns: 1fr;
  }
}

.creator-card {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 1.5rem;
}

.creator-card h3 {
  font-size: 1.1rem;
  color: var(--gold-bright);
  margin-bottom: 1.25rem;
  font-family: var(--font-title);
}

.input-group {
  margin-bottom: 1.25rem;
}

.input-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 0.4rem;
}

.input-group input[type="text"] {
  width: 100%;
  padding: 0.75rem 1rem;
  background: #0f172a;
  border: 1.5px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 1rem;
  font-family: var(--font-ui);
  outline: none;
  transition: border-color var(--transition-fast);
}

.input-group input[type="text"]:focus {
  border-color: var(--gold-bright);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.25);
}

.avatar-picker-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
}

.avatar-opt-btn {
  background: #0f172a;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  padding: 0;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  /* Enquadramento vertical: preserva cabelo e testa dos retratos adolescentes. */
  aspect-ratio: 4 / 5;
  position: relative;
}

.avatar-opt-btn img { width: 100%; height: 100%; object-fit: contain; object-position: center; background: #17233a; display: block; }

@media (max-width: 680px) {
  .avatar-picker-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.avatar-opt-btn:hover {
  background: #1e293b;
  border-color: rgba(245, 158, 11, 0.5);
}

.avatar-opt-btn.selected {
  background: rgba(245, 158, 11, 0.15);
  border-color: var(--gold-bright);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}

.avatar-preview-box {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  margin-top: 1rem;
}

.preview-avatar-large {
  font-size: 2.5rem;
  width: 54px;
  height: 54px;
  background: #1e293b;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--gold-bright);
  overflow: hidden;
}

.preview-avatar-large img { width:100%; height:100%; object-fit:cover; }

.avatar-icon img { width:100%; height:100%; object-fit:cover; border-radius:50%; }

.preview-text {
  display: flex;
  flex-direction: column;
}

.preview-text strong {
  font-size: 1.05rem;
  color: #fff;
}

.preview-text span {
  font-size: 0.85rem;
  color: var(--cyan-temporal);
}

.preview-text small {
  color: #cbd5e1;
  font-size: 0.75rem;
  margin: 0.1rem 0;
}

.creator-validation {
  color: #fecaca;
  background: rgba(127, 29, 29, .35);
  border: 1px solid rgba(248, 113, 113, .6);
  border-radius: var(--radius-sm);
  padding: .65rem .85rem;
  font-size: .82rem;
  font-weight: 700;
  margin-right: auto;
}

.agent-class-group {
  color: #cbd5e1;
  font-size: .72rem;
  font-weight: 700;
  padding: 2px 7px;
  border: 1px solid rgba(148, 163, 184, .3);
  border-radius: var(--radius-full);
}

@media (max-width: 560px) {
  .avatar-picker-grid { grid-template-columns: repeat(2, 1fr); }
  .creator-footer { flex-wrap: wrap; gap: .75rem; }
  .creator-validation { flex-basis: 100%; }
}

/* Lista de Cards de Classes */
.class-help-text {
  font-size: 0.85rem;
  color: #94a3b8;
  margin-bottom: 1rem;
}

.class-cards-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.class-select-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}

.class-select-card:hover {
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(30, 41, 59, 0.8);
}

.class-select-card.selected {
  border-color: var(--gold-bright);
  background: rgba(245, 158, 11, 0.12);
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.25);
}

.class-card-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.class-card-content h4 {
  font-size: 0.95rem;
  color: #fff;
  margin-bottom: 0.2rem;
}

.class-card-content p {
  font-size: 0.8rem;
  color: #cbd5e1;
  line-height: 1.4;
}

.class-bonus-pill {
  display: inline-block;
  margin-top: 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gold-bright);
}

.creator-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* --------------------------------------------------------------------------
   CAIXA DE DIÁLOGO HISTÓRICO & INTERAÇÃO DE CAMPO
   -------------------------------------------------------------------------- */
.dialogue-box-container {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 3rem);
  max-width: 960px;
  z-index: 50;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from { opacity: 0; transform: translate(-50%, 20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.dialogue-card {
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(14px);
  border: 2px solid var(--gold-bright);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7), var(--shadow-gold);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.dialogue-speaker-banner {
  background: linear-gradient(90deg, #1e293b, #0f172a);
  border-bottom: 1.5px solid rgba(245, 158, 11, 0.3);
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.speaker-portrait {
  width: 58px;
  height: 58px;
  background: #334155;
  border: 2.5px solid var(--gold-bright);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  overflow: hidden;
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.45);
  flex-shrink: 0;
}

.speaker-portrait-img {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-full);
  object-fit: cover;
  display: block;
}

.speaker-meta {
  flex: 1;
}

.speaker-name {
  font-family: var(--font-title);
  font-size: 1.05rem;
  color: var(--gold-bright);
}

.speaker-role {
  font-size: 0.8rem;
  color: #94a3b8;
}

.btn-close-dialogue {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  transition: color var(--transition-fast);
}

.btn-close-dialogue:hover {
  color: #fff;
}

.dialogue-body {
  padding: 1.25rem 1.5rem;
}

.dialogue-text {
  font-size: 1.05rem;
  line-height: 1.65;
  color: #f1f5f9;
  min-height: 52px;
}

.historian-insight-box {
  margin-top: 1rem;
  background: rgba(56, 189, 248, 0.1);
  border-left: 3px solid var(--cyan-temporal);
  padding: 0.75rem 1rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  animation: fadeIn 0.3s ease;
}

.insight-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--cyan-temporal);
  margin-bottom: 0.2rem;
}

.historian-insight-box p {
  font-size: 0.9rem;
  color: #e2e8f0;
}

.dialogue-choices-container {
  padding: 0.75rem 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.dialogue-reading-lock {
  padding: 0.9rem 1rem;
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.72);
  border: 1px dashed rgba(56, 189, 248, 0.45);
  border-radius: var(--radius-md);
  text-align: center;
  font-size: 0.9rem;
}

.dialogue-choice-btn {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  color: #fff;
  font-size: 0.95rem;
  font-family: var(--font-ui);
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.dialogue-choice-btn:hover {
  background: rgba(245, 158, 11, 0.15);
  border-color: var(--gold-bright);
  transform: translateX(4px);
}

.dialogue-choice-btn .choice-bullet {
  color: var(--gold-bright);
  font-weight: bold;
}

/* --------------------------------------------------------------------------
   MODAL DE RECOMPENSA / FEEDBACK DIDÁTICO
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1.5rem;
}

.reward-modal-card {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 2px solid var(--gold-bright);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg), var(--shadow-gold);
  animation: scaleUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes scaleUp {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

.reward-sparkles {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.reward-title {
  font-family: var(--font-title);
  font-size: 1.5rem;
  color: var(--gold-bright);
}

.reward-icon-large {
  font-size: 4rem;
  margin: 1.25rem 0;
  filter: drop-shadow(0 0 15px rgba(245, 158, 11, 0.5));
}

.reward-message {
  font-size: 1rem;
  color: #cbd5e1;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.reward-xp-gain {
  display: inline-block;
  background: rgba(245, 158, 11, 0.15);
  color: var(--gold-bright);
  font-weight: 800;
  font-size: 1.1rem;
  padding: 0.4rem 1.2rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--gold-bright);
  margin-bottom: 1.5rem;
}
