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

body.body-bg {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background:
    radial-gradient(circle at top, #4b1d16 0, #1b1025 40%, #05020a 100%);
  color: #f9fafb;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.site-header {
  padding: 1.5rem 1rem;
  border-bottom: 1px solid rgba(248, 250, 252, 0.18);
  background: linear-gradient(
    to right,
    rgba(127, 29, 29, 0.8),
    rgba(127, 29, 29, 0.4),
    rgba(15, 23, 42, 0.8)
  );
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
}

.site-header h1 {
  font-size: clamp(1.8rem, 2.6vw, 2.6rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

.subtitle {
  margin-top: 0.35rem;
  font-size: 0.95rem;
  color: #fbbf24;
}

/* Main */
.page-content {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 2rem auto 2.5rem;
  padding: 0 1rem;
}

/* Builder layout */
.builder-layout {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 900px) {
  .builder-layout {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  }
}

/* Field cards */
.builder-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.section-title {
  margin-bottom: 0.5rem;
  font-size: 1.35rem;
}

.field-card {
  border-radius: 0.85rem;
  border: 1px solid rgba(248, 250, 252, 0.15);
  background: radial-gradient(circle at top left, #fef3c7, #f5deb3);
  color: #1f2933;
  padding: 0.9rem 0.95rem 1.1rem;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.6);
}

.field-card legend {
  padding: 0 0.4rem;
  margin-left: 0.6rem;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7f1d1d;
  font-weight: 600;
}

.field-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
  margin-top: 0.7rem;
}

.stats-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.combat-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

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

.field label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7f1d1d;
}

.field input,
.field textarea {
  border-radius: 0.5rem;
  border: 1px solid rgba(55, 65, 81, 0.4);
  padding: 0.45rem 0.6rem;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  background-color: rgba(255, 255, 255, 0.85);
}

.field input:focus,
.field textarea:focus {
  border-color: #991b1b;
  box-shadow: 0 0 0 1px rgba(153, 27, 27, 0.7);
}

/* Buttons */
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid #fbbf24;
  font-size: 0.9rem;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.2s ease;
}

.btn.primary {
  background: linear-gradient(to right, #b91c1c, #7f1d1d);
  color: #fef3c7;
  box-shadow: 0 10px 25px rgba(127, 29, 29, 0.7);
}

.btn.ghost {
  background: transparent;
  color: #fef3c7;
  border-color: #fef3c7;
}

.btn.small {
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.7);
}

.btn:active {
  transform: translateY(0);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.6);
}

/* Portrait panel */
.portrait-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.portrait-frame {
  border-radius: 0.9rem;
  padding: 0.8rem;
  background: radial-gradient(circle at top, #fef3c7, #facc15);
  border: 1px solid rgba(250, 204, 21, 0.9);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.7);
}

.portrait-inner {
  border-radius: 0.75rem;
  overflow: hidden;
  border: 2px solid #7f1d1d;
  background: #111827;
}

.portrait-inner img {
  display: block;
  width: 100%;
  height: auto;
}

.portrait-caption {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: #7f1d1d;
}

.hint-card {
  border-radius: 0.8rem;
  padding: 0.8rem 0.9rem;
  background: radial-gradient(circle at top left, #111827, #020617);
  border: 1px solid rgba(148, 163, 184, 0.5);
  color: #e5e7eb;
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.75);
}

.hint-card h3 {
  font-size: 1rem;
  margin-bottom: 0.4rem;
}

.hint-card ul {
  list-style: disc;
  padding-left: 1.1rem;
  font-size: 0.85rem;
}

.hint-card li + li {
  margin-top: 0.2rem;
}

/* Character sheet layout */
.sheet-hero {
  display: grid;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

@media (min-width: 720px) {
  .sheet-hero {
    grid-template-columns: 260px minmax(0, 1fr);
  }
}

.hero-portrait-frame {
  border-radius: 1rem;
  padding: 0.8rem;
  background: radial-gradient(circle at top, #fef3c7, #facc15);
  border: 1px solid rgba(250, 204, 21, 0.9);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.7);
}

.hero-portrait-frame img {
  display: block;
  width: 100%;
  border-radius: 0.8rem;
  border: 2px solid #7f1d1d;
}

.hero-summary {
  align-self: center;
}

.hero-summary h2 {
  font-size: 1.5rem;
  margin-bottom: 0.4rem;
}

.hero-meta {
  font-size: 0.95rem;
  color: #fee2e2;
}

.hero-meta + .hero-meta {
  margin-top: 0.2rem;
}

/* Cards */
.cards-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.1rem;
}

@media (min-width: 880px) {
  .cards-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .sheet-card.wide {
    grid-column: 1 / -1;
  }
}

.sheet-card {
  border-radius: 0.9rem;
  border: 1px solid rgba(248, 250, 252, 0.18);
  background: radial-gradient(circle at top left, #fef3c7, #f5deb3);
  color: #1f2933;
  padding: 0.9rem 1rem 1.1rem;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.7);
  position: relative;
}

.sheet-card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.4rem;
  color: #7f1d1d;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.card-subtitle {
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
}

/* Definition list grid */
.dl-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.4rem 1.2rem;
  font-size: 0.9rem;
}

@media (min-width: 620px) {
  .dl-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.dl-grid dt {
  font-weight: 600;
}

.dl-grid dd {
  margin-left: 0;
}

.dl-grid.compact {
  font-size: 0.85rem;
}

/* Stat blocks */
.stat-block {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  margin-bottom: 0.6rem;
}

.stat {
  border-radius: 0.65rem;
  padding: 0.35rem;
  background: radial-gradient(circle at top, #fef9c3, #fde68a);
  border: 1px solid rgba(127, 29, 29, 0.4);
  text-align: center;
}

.stat-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7f1d1d;
}

.stat-value {
  display: block;
  font-size: 1rem;
  font-weight: 700;
}

/* Text content */
.card-text {
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.backstory-text {
  font-size: 0.92rem;
}

.equip-section h4 {
  font-size: 0.9rem;
  color: #7f1d1d;
  margin-top: 0.45rem;
  margin-bottom: 0.2rem;
}

/* Empty state */
.empty-state {
  margin-top: 2rem;
  text-align: center;
  font-size: 0.95rem;
  display: none;
}

.empty-state a {
  color: #fbbf24;
}

/* Footer */
.site-footer {
  padding: 1rem;
  text-align: center;
  font-size: 0.8rem;
  color: #e5e7eb;
  border-top: 1px solid rgba(148, 163, 184, 0.4);
  background: #020617;
}

.site-footer a {
  color: #fbbf24;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}
