/*
 * base.css - shared look for every screen: the court's heraldic palette
 * (stone, limewash, gold, red, moss), buttons, panels and form controls.
 * Screen-specific styles live in css/<screen>.css.
 */
:root {
  --stone: #1d2330;
  --stone-2: #262d3d;
  --stone-3: #333b4e;
  --limewash: #e8e0c8;
  --limewash-dim: #b9b19b;
  --gold: #c8a24a;
  --gold-hi: #f2c94c;
  --red: #9e2b2f;
  --red-hi: #c23a3f;
  --moss: #4e6b3a;
  --ink: #0d0b14;
  --serif: 'IM Fell English', Georgia, 'Times New Roman', serif;
  --serif-sc: 'IM Fell English SC', 'IM Fell English', Georgia, serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--stone);
  background-image: radial-gradient(ellipse at 50% 0%, #2c3448 0%, var(--stone) 70%);
  color: var(--limewash);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.4;
}

.screen { min-height: 100%; padding: 24px 16px 40px; }
.loading { text-align: center; margin-top: 30vh; font-style: italic; color: var(--limewash-dim); }

h1, h2, h3 { font-family: var(--serif-sc); font-weight: normal; margin: 0 0 .4em; letter-spacing: .02em; }
h1 { color: var(--gold-hi); font-size: clamp(2rem, 6vw, 3.4rem); line-height: 1.05; }
h2 { color: var(--gold); font-size: 1.6rem; }
h3 { color: var(--gold); font-size: 1.15rem; }
p { margin: 0 0 .7em; }
.muted { color: var(--limewash-dim); }

/* layout helpers */
.wrap { max-width: 1060px; margin: 0 auto; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }
.screen-header { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; border-bottom: 1px solid var(--stone-3); padding-bottom: 10px; }
.screen-header h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); }

/* panels look like hung banners: stone with a gold edge */
.panel {
  background: var(--stone-2);
  border: 1px solid var(--stone-3);
  border-top: 3px solid var(--gold);
  border-radius: 4px;
  padding: 16px;
}

/* buttons */
.btn {
  font-family: var(--serif-sc); font-size: 1.05rem;
  color: var(--limewash); background: var(--stone-3);
  border: 1px solid #4a5369; border-radius: 3px;
  padding: 9px 18px; cursor: pointer; min-height: 44px;
  transition: background .12s, border-color .12s, transform .05s;
}
.btn:hover { background: #414a60; border-color: var(--gold); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 2px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; border-color: #4a5369; }
.btn-primary { background: var(--red); border-color: #c75055; color: #fff4dc; }
.btn-primary:hover { background: var(--red-hi); border-color: var(--gold-hi); }
.btn-small { font-size: .9rem; padding: 4px 10px; min-height: 32px; }

/* form bits */
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-family: var(--serif-sc); color: var(--gold); margin-bottom: 4px; }
input[type=text] {
  width: 100%; font: inherit; color: var(--ink); background: var(--limewash);
  border: 1px solid var(--gold); border-radius: 3px; padding: 8px 10px; min-height: 42px;
}
input[type=text]:focus { outline: 2px solid var(--gold-hi); }

/* colour swatches and choice chips, used by the creator and equipment */
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch {
  width: 34px; height: 34px; border-radius: 3px; cursor: pointer;
  border: 2px solid var(--stone-3); padding: 0;
}
.swatch[aria-pressed=true] { border-color: var(--gold-hi); box-shadow: 0 0 0 2px var(--ink) inset; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font: inherit; font-size: .95rem; color: var(--limewash); background: var(--stone-3);
  border: 1px solid #4a5369; border-radius: 3px; padding: 6px 10px; cursor: pointer; min-height: 40px;
  display: inline-flex; align-items: center; gap: 6px;
}
.chip[aria-pressed=true] { border-color: var(--gold-hi); background: #4a4030; }

/* knight preview canvases are pixel art: never smooth them */
canvas.preview { image-rendering: pixelated; display: block; max-width: 100%; }

/* stat bars */
.stat { display: grid; grid-template-columns: 120px 1fr 44px; gap: 8px; align-items: center; font-size: .95rem; margin: 4px 0; }
.stat .bar { height: 8px; background: var(--stone); border-radius: 2px; overflow: hidden; }
.stat .bar > i { display: block; height: 100%; background: var(--gold); }
.stat .bar > i.up { background: #6fbf5a; }
.stat .bar > i.down { background: var(--red-hi); }
.stat b { text-align: right; font-weight: normal; color: var(--limewash-dim); }

@media (max-width: 600px) {
  body { font-size: 16px; }
  .stat { grid-template-columns: 96px 1fr 40px; }
}
