/*Reset*/
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

@font-face {
  font-family: "Papyrus";
  src: url("Papyrus-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
}

@font-face {
  font-family: "Papyrus";
  src: url("Papyrus-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
}

@font-face {
  font-family: "willow";
  src: url("Willow-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
}

@font-face {
  font-family: "willow";
  src: url("Willow-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
}


/*Page*/
body {
  background: #BAAFA0;
  background-image: ;
  min-height: 100vh;
  font-family: "papyrus", Georgia, serif;
  font-weight: 400;
  color: #4a4a4a;
  padding: 0 0 3rem;
}

/*Header*/
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 2rem;
  background: #ffd5b4;
  border-bottom: 2px solid #7a5a1a;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header h1 {
  font-family: "willow", serif;
  font-size: 2.5rem;
  font-weight: 700;
  color: #4a4a4a;
  letter-spacing: 0.06em;
  text-shadow: 0 0 20px rgba(212, 168, 75, 0.3);
}

.add-btn {
  font-family: "papyrus", Georgia, serif;
  font-size: 1.0rem;
  font-weight: 700;
  background: transparent;
  color: #4a4a4a;
  border: 1px solid #7a5a1a;
  padding: 0.4rem 1rem;
  cursor: pointer;
  border-radius: 3px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.add-btn:hover {
  background: rgba(200, 150, 60, 0.12);
  border-color: #c8963c;
  color: #e0b060;
}

/*Panels layout*/
#panels-container {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 2rem;
  align-items: flex-start;
}

/*Individual panel*/
.panel {
  flex: 1 1 580px;
  min-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/*Panel controls bar*/
.panel-controls {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.controls-row {
  display: flex;
  gap: 0.25rem;
  align-items: center;
  flex-wrap: wrap;
  row-gap: 0.5rem;
}

.panel-controls input[type="text"],
.panel-controls select {
    min-width: 0;
    padding: 0.45rem 0.75rem;
    font-family: "papyrus", Georgia, serif;
    font-weight: 700;
    font-size: 0.95rem;
    background: #E5D8CD;
    color: #4a4a4a;
    border: 1px solid #6a4e18;
    border-radius: 3px;
    transition: border-color 0.15s;
}

.controls-row-top .ctrl-type { flex: 0 0 calc(25% - 0.25rem); }
.controls-row-top .ctrl-search { flex: 1 1 200px; }
.controls-row-top .ctrl-habitat { flex: 0 0 160px; }

.controls-row-bottom {
  flex-wrap: wrap;
  row-gap: 0.5rem;
}

.ctrl-creature  { flex: 2 1 160px; }
.ctrl-sort      { flex: 1 1 100px; }
.ctrl-mask      { flex: 2 1 130px; }
.ctrl-mask-sort { flex: 1 1 100px; }
.remove-btn     { flex: 0 0 auto; }

.panel-controls input[type="text"]::placeholder {
  color: #6a5030;
}
.panel-controls input[type="text"]:focus {
  outline: none;
  border-color: #c8963c;
}

.panel-controls select {
  padding: 0.45rem 2.2rem 0.45rem 0.75rem;
  font-family: "papyrus", Georgia, serif;
  font-weight: 700;
  font-size: 0.95rem;
  background: #E5D8CD;
  color: #4a4a4a;
  border: 1px solid #6a4e18;
  border-radius: 3px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7' viewBox='0 0 10 7'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238a6a2a' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  cursor: pointer;
  transition: border-color 0.15s;
  min-width: 0;
}

.panel-controls select:focus {
  outline: none;
  border-color: #c8963c;
}

.dataset-select {
  width: 120px !important;
  min-width: unset;
  max-width: 150px;
}

.remove-btn {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid #4a2010;
  color: #8a4028;
  font-size: .95rem;
  line-height: 1;
  width: 30px;
  height: 30px;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.remove-btn:hover {
  background: rgba(180, 60, 30, 0.15);
  border-color: #c04030;
  color: #e05040;
}

.stat-block {
  background: #E5D8CD;
  padding: 2.5rem 5.5rem 2rem;
  position: relative;
  isolation: isolate; /* contains the z-index so ::before doesn't bleed behind the card */
}

.stat-block::before {
  content: "";
  position: absolute;
  inset: 0;
  background-color: #BAAFA0;
  background-image: url("border-frame.svg");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  pointer-events: none;
  z-index: -1;
}

/*Creature Name*/
.creature-name {
  font-family: "willow", serif;
  font-size: 2.0rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #4a4a4a;
  border-bottom: 2px solid #5a3e10;
  padding-bottom: 0.3rem;
  margin-bottom: 0.1rem;
}

/*Challenge*/
.challenge-line {
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
}

.challenge-line strong {
  font-weight: 700;
}

/*Stats*/
.stats-grid {
  display: grid;
  grid-template-columns: auto auto auto;
  gap: 0 0;
  margin-bottom: 0.35rem;
  border-bottom: 1.5px solid #5a3e10;
  padding-bottom: 0.35rem;
}

.stats-col {
  padding: 0 0.75rem;
}

.stats-col:first-child {
  padding-left: 0;
  border-right: 1px solid rgba(90, 62, 16, 0.35);
}

.stats-col:nth-child(2) {
  border-right: 1px solid rgba(90, 62, 16, 0.35);
}

.stats-col:last-child {
  padding-right: 0;
}

.stat-row {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
  line-height: 1.5;
  font-size: 1.05rem;
  white-space: nowrap;
}

.stat-row .lbl {
  font-weight: 700;
  font-size: 1.05rem;
  flex-shrink: 0;
}

.stat-row .val {
  font-weight: 400;
  font-size: .95rem
}

/*Movement & Actions*/
.movement-actions {
  font-size: 1.05rem;
  line-height: 1.55;
  border-bottom: 1.5px solid #5a3e10;
  padding-bottom: 0.35rem;
  margin-bottom: 0.1rem;
}

.movement-actions strong {
  font-weight: 700;
  font-size: .95rem
}

/*Section headers (Powers, Special Maneuvers)*/
.section-header {
  font-weight: 700;
  font-size: 1.5rem;
  margin-top: 0.55rem;
  margin-bottom: 0.05rem;
  text-decoration: underline;
}

/*Powers & Maneuvers*/
.entry {
  font-size: 1rem;
  line-height: 1.55;
  padding-left: 1.4rem;
  margin-bottom: 0.05rem;
}

.entry .ename {
  font-style: normal;
  font-weight: 700;
  font-size: 1.0rem
}

.entry .edesc {
  font-style: normal;
  font-weight: 400;
  font-size: .95rem
}

/*Loot*/
.loot-line {
  font-size: 0.95rem;
  font-weight: 400;
  margin-top: 0.5rem;
  padding-top: 0.3rem;
  border-top: 1.5px solid #5a3e10;
  font-style: normal;
}

.loot-line .lbl {
  font-weight: 700;
  font-style: normal;
}

/*Empty*/
.placeholder {
  color: #4a4a4a;
  font-style: italic;
  font-size: 0.95rem;
  padding: 2rem 0;
  text-align: center;
}

/*Responsive*/
@media (max-width: 640px) {
  #panels-container {
    padding: 1rem;
    gap: 1.5rem;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .stats-col {
    border-right: none !important;
    padding: 0 !important;
  }
  .stats-col:first-child {
    border-bottom: 1px solid rgba(90, 62, 16, 0.35);
    padding-bottom: 0.25rem !important;
    margin-bottom: 0.25rem;
  }
  .stats-col:nth-child(2) {
    border-bottom: 1px solid rgba(90, 62, 16, 0.35);
    padding-bottom: 0.25rem !important;
    margin-bottom: 0.25rem;
    border-right: none;
  }
}