:root {
  --bg: #f4efe6;
  --card: #fffdf8;
  --ink: #2b2117;
  --muted: #7a6f5f;
  --accent: #7c2d2d;
  --accent-dark: #5a1f1f;
  --line: #d8cdb8;
  --gold: #b08d3a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Palatino Linotype", Palatino, Georgia, serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

header {
  background: var(--accent-dark);
  color: #f4efe6;
  padding: 0.7rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-size: 1.4rem;
  font-weight: bold;
  letter-spacing: 0.08em;
  color: #f4efe6;
  text-decoration: none;
}

main {
  max-width: 880px;
  margin: 1.5rem auto;
  padding: 0 1rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.centered { max-width: 420px; margin: 3rem auto; text-align: center; }

h1 { margin: 0 0 0.5rem; }
h2 { margin: 0 0 0.75rem; color: var(--accent); border-bottom: 2px solid var(--line);
     padding-bottom: 0.3rem; }

.subtitle, .muted { color: var(--muted); }
.muted { font-size: 0.92rem; }

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

/* forms */
input, select, textarea, button {
  font-family: inherit;
  font-size: 1rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
}
textarea { width: 100%; resize: vertical; }

button {
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  padding: 0.55rem 1rem;
}
button:hover { background: var(--accent-dark); }
button:disabled { background: #b6ab98; cursor: not-allowed; }

.link-btn {
  background: none;
  color: #f4efe6;
  padding: 0.2rem 0.3rem;
  font-size: 0.95rem;
}
.link-btn:hover { background: none; text-decoration: underline; }

.code-form { display: flex; flex-direction: column; gap: 0.7rem; margin-top: 1rem; }
.code-form input { text-align: center; letter-spacing: 0.12em; }

.inline-form { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.8rem; }
.inline-form input, .inline-form select { flex: 1; min-width: 160px; }

.field-form { display: flex; flex-wrap: wrap; gap: 0.8rem; }
.field-form label { display: flex; flex-direction: column; gap: 0.25rem;
  font-size: 0.85rem; color: var(--muted); flex: 1; min-width: 200px; }
.field-form label.wide { flex-basis: 100%; }
.field-form button { align-self: flex-end; }

.nav-form { display: inline; }
.award-row { display: flex; flex-wrap: wrap; gap: 1.5rem; }

hr { border: none; border-top: 1px solid var(--line); margin: 1.4rem 0; }

/* flashes */
.flashes { margin-bottom: 1rem; }
.flash {
  background: #fef6e0;
  border: 1px solid var(--gold);
  border-left: 4px solid var(--gold);
  padding: 0.6rem 0.9rem;
  border-radius: 5px;
  margin-bottom: 0.5rem;
}

/* code chip */
.code-chip {
  display: inline-block;
  background: var(--accent-dark);
  color: #f4efe6;
  font-family: "Courier New", monospace;
  letter-spacing: 0.1em;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  font-size: 0.95rem;
}

/* character sheet */
.persona-head { display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 0.5rem; }

.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem;
  margin: 1rem 0; }
.fields .wide { grid-column: 1 / -1; }
.fields .label, .label {
  display: block; font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted);
}

.resources { display: flex; gap: 1rem; flex-wrap: wrap; }
.resource {
  flex: 1; min-width: 130px; text-align: center;
  background: #f4efe6; border-radius: 6px; padding: 0.7rem;
}
.resource strong { display: block; font-size: 1.8rem; color: var(--accent); }
.denarii-icon { width: 1.6rem; height: 1.6rem; vertical-align: -0.3rem;
  margin-right: 0.3rem; object-fit: contain; }
.resource span { font-size: 0.8rem; color: var(--muted); }

/* traits */
.trait { border: 1px solid var(--line); border-radius: 6px;
  padding: 0.8rem 1rem; margin-bottom: 0.8rem; }
.trait-top { display: flex; justify-content: space-between; align-items: baseline; }
.trait-name { font-size: 1.2rem; font-weight: bold; color: var(--accent); }
.rank-badge { background: var(--gold); color: #fff; padding: 0.15rem 0.6rem;
  border-radius: 12px; font-size: 0.85rem; }
.ability { margin: 0.5rem 0; }
.definition { font-size: 0.85rem; color: var(--muted); font-style: italic; }
.trait-foot { display: flex; justify-content: space-between; align-items: center;
  margin-top: 0.6rem; flex-wrap: wrap; gap: 0.5rem; }
.maxed { color: var(--gold); font-weight: bold; }

/* gear */
.gear-list { list-style: none; padding: 0; margin: 0; }
.gear-list li { display: flex; gap: 0.8rem; padding: 0.7rem 0;
  border-bottom: 1px solid var(--line); }
.gear-icon { width: 48px; height: 48px; object-fit: contain; }
.gear-list p { margin: 0.2rem 0; font-size: 0.9rem; }
.slot { font-size: 0.75rem; background: #f4efe6; padding: 0.1rem 0.4rem;
  border-radius: 3px; color: var(--muted); }
.phrase { color: var(--accent); font-style: italic; }

/* memoratio */
.memo-grid { display: flex; flex-direction: column; gap: 0.5rem; margin: 0.8rem 0; }
.memo-row { display: grid; grid-template-columns: 110px 1fr 1fr 1fr; gap: 0.4rem;
  align-items: start; }
.memo-mission { font-size: 0.85rem; font-weight: bold; padding-top: 0.4rem; }

/* tables / lists */
.list { list-style: none; padding: 0; margin: 0.5rem 0; }
.list li { display: flex; justify-content: space-between; align-items: center;
  padding: 0.5rem 0; border-bottom: 1px solid var(--line); }

.roster { width: 100%; border-collapse: collapse; margin-top: 0.5rem; }
.roster th, .roster td { text-align: left; padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--line); }
.roster th { font-size: 0.78rem; text-transform: uppercase; color: var(--muted);
  letter-spacing: 0.05em; }

@media (max-width: 600px) {
  .fields { grid-template-columns: 1fr; }
  .memo-row { grid-template-columns: 1fr; }
}
