/*
 * Terra Life -- shared parchment UI.
 *
 * Reusable building blocks:
 *   .parchment-panel   a torn-paper card for narrative/UI text
 *   .btn / .btn-*      medieval-styled buttons
 *   .stat-bar          a labeled meter (health, money, etc.)
 * These are meant to be reused everywhere, not redefined per page.
 */

:root {
  --parchment-bg: #ecdcb8;
  --parchment-bg-dark: #d9c290;
  --parchment-edge: #8a6a3d;
  --ink: #3a2a17;
  --ink-faint: #6b5636;
  --accent: #7a2e2e;
  --accent-dark: #5c2020;
  --gold: #a9791f;
  --panel-shadow: 0 4px 0 rgba(58, 42, 23, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #2c2013 0%, #1c140c 100%);
  color: var(--ink);
  font-family: "IM Fell English", Georgia, "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.5;
}

h1,
h2,
h3,
.title-font {
  font-family: "Cinzel Decorative", "Cinzel", Georgia, serif;
  color: var(--accent-dark);
  letter-spacing: 0.02em;
  margin: 0 0 0.5em;
}

a {
  color: var(--accent);
}

.wrapper {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

/* --- Top nav / status bar --- */

.status-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 18px;
  margin-bottom: 20px;
  background: var(--parchment-bg-dark);
  border: 2px solid var(--parchment-edge);
  border-radius: 4px;
  box-shadow: var(--panel-shadow);
  font-size: 15px;
}

.status-bar .game-title {
  font-family: "Cinzel Decorative", "Cinzel", Georgia, serif;
  font-size: 18px;
  color: var(--accent-dark);
}

.status-bar .status-links {
  display: flex;
  gap: 14px;
  align-items: center;
}

.status-bar .money {
  color: var(--gold);
  font-weight: bold;
}

/* --- Parchment panel: the core narrative/text container --- */

.parchment-panel {
  position: relative;
  background: var(--parchment-bg);
  border: 3px solid var(--parchment-edge);
  border-radius: 6px;
  box-shadow: var(--panel-shadow), inset 0 0 40px rgba(138, 106, 61, 0.25);
  padding: 24px 28px;
  margin-bottom: 20px;
  background-image:
    radial-gradient(rgba(138, 106, 61, 0.12) 1px, transparent 1px);
  background-size: 6px 6px;
}

.parchment-panel > *:last-child {
  margin-bottom: 0;
}

.parchment-panel p {
  color: var(--ink);
}

.parchment-panel .meta {
  color: var(--ink-faint);
  font-size: 14px;
  font-style: italic;
}

/* --- Buttons --- */

.btn {
  display: inline-block;
  font-family: "Cinzel", Georgia, serif;
  font-size: 14px;
  letter-spacing: 0.03em;
  text-decoration: none;
  color: var(--parchment-bg);
  background: var(--accent);
  border: 2px solid var(--accent-dark);
  border-radius: 3px;
  padding: 8px 16px;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--accent-dark);
}

.btn:hover {
  filter: brightness(1.08);
}

.btn:active {
  transform: translateY(2px);
  box-shadow: none;
}

.btn-secondary {
  background: var(--parchment-bg-dark);
  color: var(--ink);
  border-color: var(--parchment-edge);
  box-shadow: 0 3px 0 var(--parchment-edge);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

/* --- Forms --- */

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-weight: bold;
  margin-bottom: 4px;
  color: var(--ink);
}

.field input[type="text"],
.field textarea,
.field input[type="number"] {
  width: 100%;
  font-family: inherit;
  font-size: 16px;
  padding: 8px 10px;
  border: 2px solid var(--parchment-edge);
  border-radius: 3px;
  background: #f6ecd6;
  color: var(--ink);
}

.field .errors {
  color: var(--accent);
  font-size: 13px;
  margin-top: 4px;
}

/* --- Flash messages --- */

.flash-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
}

.flash {
  padding: 10px 14px;
  border-radius: 3px;
  margin-bottom: 8px;
  font-size: 15px;
  border: 2px solid var(--parchment-edge);
}

.flash-success {
  background: #dfead0;
  border-color: #5f7a3d;
}

.flash-error {
  background: #ecd0d0;
  border-color: var(--accent);
}

/* --- Building / NPC lists --- */

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

/* --- Character creation attributes --- */

.attribute-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.attribute-grid .field {
  margin-bottom: 0;
}

.tile {
  display: block;
  background: var(--parchment-bg);
  border: 2px solid var(--parchment-edge);
  border-radius: 4px;
  padding: 14px;
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--panel-shadow);
}

.tile:hover {
  filter: brightness(1.04);
}

.tile .tile-type {
  color: var(--ink-faint);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.empty-state {
  color: var(--ink-faint);
  font-style: italic;
  padding: 12px 0;
}
