/* ===== Base / Paper look ===== */
body {
  font-family: ui-serif, "Georgia", "Times New Roman", serif;
  margin: 0;
  padding: 16px;
  color: #111;

  /* Paper feel */
  background: #f7f6f2;
  background-image:
    linear-gradient(rgba(0,0,0,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,0,0.02) 1px, transparent 1px);
  background-size: 24px 24px;
  overflow: hidden; /* evita scroll de página */
}

h1 {
  margin: 0 0 8px 0;
  font-size: 22px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#status {
  margin-bottom: 12px;
  display: inline-block;
  padding: 6px 10px;
  border: 2px solid #111;
  background: #fffdfa;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
  height: calc(100vh - 110px); /* título + status */
}

.panel {
  background: #fffdfa;
  border: 2px solid #111;
  padding: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* el scroll irá al contenido interno */
  min-height: 0;
  box-shadow: 4px 4px 0 #111;
  max-height: calc(100vh - 132px);
}

.panel h2 {
  margin: 0 0 8px 0;
  font-size: 16px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 2px solid #111;
  padding-bottom: 4px;
  display: flex;
  align-items: baseline;
}
@media (max-width: 900px) {
  .row {
    grid-template-columns: 1fr;
    height: calc(100vh - 110px);
    gap: 12px;
  }

  /* Cada panel ocupa como máximo la mitad de la altura disponible */
  .panel {
    max-height: calc((100vh - 110px - 12px) / 2);
  }

  /* El contenido interno sigue scrolleando */
  .list {
    overflow-y: auto;
  }
}
/* ===== Lists & Cards ===== */
.list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  padding-right: 4px; /* espacio para scrollbar */
}

.list::-webkit-scrollbar {
  width: 10px;
}
.list::-webkit-scrollbar-thumb {
  background: #111;
  border: 3px solid #fffdfa;
}
.list::-webkit-scrollbar-track {
  background: #fffdfa;
  border-left: 2px solid #111;
}

.item {
  position: relative;
  display: block;
  padding: 10px 12px 12px 12px;
  border: 2px solid #111;
  background: #fff;
  box-shadow: 2px 2px 0 #111;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.item:hover {
  transform: translateY(-1px);
  box-shadow: 3px 3px 0 #111;
}

.item strong {
  font-weight: 700;
}

/* ===== Muted / Labels ===== */
.muted {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.85;
}

/* ===== Buttons ===== */
.btn {
  font-family: inherit;
  cursor: pointer;
  border: 2px solid #111;
  background: #fff;
  padding: 4px 8px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: background 120ms ease, color 120ms ease, transform 120ms ease;
}

.btn:active {
  background: #111;
  color: #fff;
}

.btn:hover {
  background: #111;
  color: #fff;
}

/* Botón + (estilo ficha) */
.btn-add {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 0;
  font-size: 18px;
  line-height: 1;
  font-weight: bold;
}

/* ===== HP / Combat controls ===== */
.hp {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 6px;
}

input[type="number"],
input[type="text"] {
  font-family: inherit;
  border: 2px solid #111;
  padding: 4px 6px;
  width: 60px;
  background: #fff;
}

#search {
  width: 100%;
  box-sizing: border-box;
}

input:focus {
  outline: none;
  box-shadow: 3px 3px 0 #111;
}

.btn:focus {
  outline: none;
  box-shadow: 3px 3px 0 #111;
}

/* ===== Details (Bestiary full info) ===== */
details {
  margin-top: 8px;
}

details summary {
  cursor: pointer;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 2px solid #111;
  padding: 3px 6px;
  display: inline-block;
}

details[open] summary {
  background: #111;
  color: #fff;
}

ul {
  margin: 6px 0 0 16px;
  padding: 0;
}

li {
  margin-bottom: 4px;
}

/* ===== Errors ===== */
.error {
  border: 2px solid #111;
  padding: 6px;
  background: #fff;
}

/* Botón dado (pequeño, inline) */
.btn-dice {
  padding: 2px 6px;
  font-size: 14px;
  line-height: 1;
}

.combat-roller {
  border: 2px solid #111;
  background: #fff;
  padding: 10px 12px;
  margin-bottom: 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

#combat-dice-result { grid-column: 1 / -1; }
#combat-dice-expr { width: 100%; }

/* ===== Key/Value inline (stats en horizontal, compacto) ===== */
.kv-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: baseline;
}

.kv {
  font-size: 11px;
  letter-spacing: 0.02em;
  text-transform: none; /* evita que todo vaya en mayúsculas */
}

.kv strong {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kv-sep {
  opacity: 0.65;
}

/* Resultado de tiradas: que no descuadre */
#combat-dice-result,
[id^="combat-rollout-"] {
  white-space: normal;
  word-break: break-word;
}

/* Botón eliminar (X) en combate */
.btn-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  line-height: 1;
}

@media (max-width: 900px) {
  .row {
    grid-template-columns: 1fr;
    height: calc(100vh - 110px);
  }
}
