/* ==========================================================
   REGLAS — CÓDEX DE KAIRÁN
   Estilo claro integrado con codex.css
========================================================== */

.cronica-rpg-page {
  width: 100%;
  color: var(--text);
}

/* ==========================================================
   BARRA SUPERIOR
========================================================== */

.cronica-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.cr-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

/* ==========================================================
   CABECERA
========================================================== */

.cronica-hero {
  margin-bottom: 20px;
  padding: 22px 24px;
  background: var(--paper-soft-strong);
  border: 1px solid rgba(125, 25, 25, .12);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .06);
}

.cronica-title {
  margin: 0 0 6px !important;
  color: var(--kairan) !important;
  font-size: 30px;
  font-weight: 900;
  line-height: 1.15;
  text-align: left !important;
}

.cronica-subtitle {
  color: #554b4b;
  font-size: .96rem;
  font-weight: 600;
  line-height: 1.55;
}

/* ==========================================================
   CONTENIDO
========================================================== */

.cronica-full,
.cronica-main {
  width: 100%;
}

.cronica-main {
  display: grid;
  gap: 18px;
}

/* Antes era "dark". Se mantiene el nombre de clase para no
   tener que cambiar toda la lógica HTML, pero ahora es claro. */
.cr-panel-dark {
  padding: 18px;
  color: var(--text);
  background: var(--paper-soft-strong);
  border: 1px solid rgba(125, 25, 25, .12);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .05);
}

.cr-panel-title {
  margin-bottom: 14px;
  color: var(--kairan);
  font-size: 1.08rem;
  font-weight: 900;
}

.cr-panel-text {
  color: var(--muted);
  line-height: 1.55;
}

/* ==========================================================
   SECCIONES
========================================================== */

.cr-historia-card {
  padding: 18px;
  background: rgba(255, 255, 255, .52);
  border: 1px solid rgba(125, 25, 25, .14);
  border-radius: 14px;
}

.cr-historia-card + .cr-historia-card {
  margin-top: 16px;
}

.cr-historia-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(125, 25, 25, .10);
}

.cr-historia-title {
  color: var(--kairan);
  font-size: 1.13rem;
  font-weight: 900;
}

.cr-historia-desc {
  margin-top: 4px;
  color: #5f5555;
  font-size: .9rem;
  font-weight: 600;
  line-height: 1.5;
}

/* ==========================================================
   REGLAS
========================================================== */

.cr-mision-card {
  position: relative;
  padding: 18px 18px 18px 20px;
  color: var(--text);
  background: #fff;
  border: 1px solid rgba(125, 25, 25, .13);
  border-left: 4px solid var(--kairan);
  border-radius: 13px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .045);
}

.cr-mision-card + .cr-mision-card {
  margin-top: 14px;
}

.cr-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.cr-tag {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 4px 9px;
  color: #fff;
  background: var(--kairan);
  border: 1px solid var(--kairan);
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 900;
  line-height: 1.2;
}

.cr-tag-muted {
  color: var(--kairan);
  background: var(--kairan-soft);
  border-color: rgba(125, 25, 25, .18);
}

.cr-mision-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  color: #2b2020;
  font-size: 1.15rem;
  font-weight: 900;
  line-height: 1.35;
}

/* Compatibilidad por si alguna plantilla vieja aún usa esta clase */
.cr-mision-desc {
  color: #403737 !important;
  font-size: .94rem;
  line-height: 1.65;
}

/* ==========================================================
   RESUMEN / DESCRIPCIÓN / EJEMPLO
========================================================== */

.cr-summary-block,
.cr-story-block {
  width: 100%;
  padding: 14px 16px;
  color: var(--text);
  background: #f8f4f4;
  border: 1px solid rgba(125, 25, 25, .12);
  border-radius: 11px;
}

.cr-summary-block {
  background: rgba(125, 25, 25, .055);
  border-left: 3px solid rgba(125, 25, 25, .50);
}

.cr-story-block-dark {
  color: var(--text);
  background: #f2f2f2;
  border-color: rgba(17, 24, 39, .10);
}

.cr-story-title {
  margin-bottom: 8px;
  color: var(--kairan);
  font-size: .88rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .35px;
}

.cr-story-text {
  display: block !important;
  width: 100%;
  max-width: 100%;
  max-height: none !important;
  overflow: visible !important;
  color: #332b2b !important;
  font-size: .94rem;
  font-weight: 500;
  line-height: 1.7;
  white-space: normal;
  word-break: normal;
  overflow-wrap: anywhere;

  /* Evita truncados heredados de cronicas.css */
  -webkit-line-clamp: unset !important;
  -webkit-box-orient: initial !important;
  text-overflow: clip !important;
}

/* ==========================================================
   INFORMACIÓN DE CATEGORÍA
========================================================== */

.cr-info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.cr-info-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 13px 14px;
  background: rgba(255, 255, 255, .55);
  border: 1px solid rgba(125, 25, 25, .10);
  border-radius: 11px;
}

.cr-info-box span {
  color: var(--muted);
  font-size: .75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .35px;
}

.cr-info-box b {
  color: #302727;
  font-size: .95rem;
}

/* ==========================================================
   LISTA DE CATEGORÍAS
========================================================== */

.cronica-list-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.cronica-list-card {
  display: flex;
  flex-direction: column;
  min-height: 180px;
  padding: 19px;
  color: var(--text);
  background: var(--paper-soft-strong);
  border: 1px solid rgba(125, 25, 25, .12);
  border-radius: 15px;
  box-shadow: 0 7px 22px rgba(0, 0, 0, .05);
  text-decoration: none;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.cronica-list-card:hover {
  color: var(--text);
  transform: translateY(-2px);
  border-color: rgba(125, 25, 25, .28);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .08);
}

.cronica-list-title {
  color: var(--kairan);
  font-size: 1.08rem;
  font-weight: 900;
}

.cronica-list-desc {
  flex: 1;
  margin-top: 9px;
  color: #544a4a;
  font-size: .9rem;
  font-weight: 600;
  line-height: 1.55;
}

.cronica-list-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
  padding-top: 12px;
  color: var(--muted);
  border-top: 1px solid rgba(125, 25, 25, .09);
  font-size: .78rem;
  font-weight: 800;
}

/* ==========================================================
   FORMULARIOS
========================================================== */

.cr-form-panel {
  padding: 22px;
  background: var(--paper-soft-strong);
  border: 1px solid rgba(125, 25, 25, .12);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .05);
}

.cr-form-panel .form-label {
  color: #392f2f;
  font-size: .85rem;
  font-weight: 900;
}

.cr-form-panel .form-control,
.cr-form-panel .form-select {
  color: var(--text);
  background: rgba(255, 255, 255, .82);
  border: 1px solid rgba(17, 24, 39, .16);
  border-radius: 10px;
}

.cr-form-panel .form-control:focus,
.cr-form-panel .form-select:focus {
  background: #fff;
  border-color: var(--kairan);
  box-shadow: 0 0 0 .2rem var(--ring-kairan);
}

.cr-form-panel textarea.form-control {
  min-height: 110px;
  resize: vertical;
}

.cr-checkbox-line {
  padding: 11px 12px 11px 38px;
  background: rgba(255, 255, 255, .50);
  border: 1px solid rgba(125, 25, 25, .10);
  border-radius: 10px;
}

.cr-form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(125, 25, 25, .10);
}

/* ==========================================================
   BOTONES DE REGRESO
========================================================== */

.cronica-rpg-page .btn-outline-light {
  color: var(--kairan) !important;
  background: transparent;
  border-color: var(--kairan);
}

.cronica-rpg-page .btn-outline-light:hover {
  color: var(--kairan) !important;
  background: var(--kairan-soft);
}

/* ==========================================================
   RESPONSIVE
========================================================== */

@media (max-width: 991.98px) {
  .cronica-list-grid {
    grid-template-columns: 1fr;
  }

  .cr-info-grid {
    grid-template-columns: 1fr;
  }

  .cr-historia-head {
    flex-direction: column;
  }
}

@media (max-width: 575.98px) {
  .cronica-topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .cronica-topbar > .btn,
  .cronica-topbar > a,
  .cr-actions,
  .cr-actions .btn {
    width: 100%;
  }

  .cr-actions {
    flex-direction: column;
  }

  .cronica-hero,
  .cr-panel-dark,
  .cr-form-panel,
  .cr-historia-card,
  .cr-mision-card {
    padding: 15px;
  }

  .cronica-title {
    font-size: 25px;
  }

  .cr-mision-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .cr-form-actions {
    flex-direction: column;
  }

  .cr-form-actions .btn {
    width: 100%;
  }
}
