/* Graftlings — aged vellum, engraved-plate line art, verdigris and bone. */
:root {
  --paper: #e8dfc8;
  --paper2: #d8cdb8;
  --ink: #2a2320;
  --verdigris: #4a7a6a;
  --rust: #9a5a3a;
  --bone: #f2ecd8;
  --err: #8a3a2a;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
/* manipulation kills iOS double-tap zoom (rapid taps are game input here);
   pinch-zoom still works */
html { touch-action: manipulation; }
html, body { height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  background-image: radial-gradient(ellipse at 50% 0%, rgba(255,255,255,.35), transparent 60%),
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(120,100,70,.03) 3px 4px);
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}
h1, h2, h3 { font-variant: small-caps; letter-spacing: .06em; font-weight: 600; }
h2 { margin: 14px 0 6px; }
h3 { margin: 10px 0 4px; }
button {
  font: inherit; font-variant: small-caps; letter-spacing: .05em;
  background: var(--bone); color: var(--ink);
  border: 2px solid var(--ink); border-radius: 3px;
  padding: 8px 18px; cursor: pointer;
  box-shadow: 2px 2px 0 rgba(42,35,32,.35);
  touch-action: manipulation;
}
button:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 rgba(42,35,32,.35); }
button:disabled { opacity: .5; }
input {
  font: inherit; width: 100%; padding: 10px; margin: 6px 0;
  background: var(--bone); border: 2px solid var(--ink); border-radius: 3px; color: var(--ink);
}
.linkish { background: none; border: none; box-shadow: none; text-decoration: underline; padding: 4px; }
.muted { color: #6a5f50; font-style: italic; }
.err { color: var(--err); font-weight: bold; min-height: 1.2em; }
.done { color: var(--verdigris); font-weight: bold; }
.center { text-align: center; }
.hidden { display: none; }

/* gate */
.gate { max-width: 720px; margin: 0 auto; padding: 32px 16px; text-align: center; }
.title { font-size: clamp(1.5rem, 8vw, 2.6rem); letter-spacing: .22em;
  padding-left: .22em; /* rebalance the phantom trailing letter-space */
  margin: 18px 0 8px; text-shadow: 2px 2px 0 rgba(120,100,70,.25); }
.tagline { max-width: 52ch; margin: 0 auto 24px; font-style: italic; }
.gate-forms { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; }
.gate-forms form { flex: 1 1 280px; max-width: 340px; text-align: left; }

/* shell */
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-bottom: 3px double var(--ink);
  background: var(--paper2); position: sticky; top: 0; z-index: 5;
}
.brand { font-variant: small-caps; letter-spacing: .2em; font-weight: bold; }
.who { margin-left: auto; font-style: italic; }
#main { max-width: 860px; margin: 0 auto; padding: 14px; }
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; display: flex; z-index: 5;
  background: var(--paper2); border-top: 3px double var(--ink);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab { flex: 1; border: none; box-shadow: none; border-radius: 0; padding: 12px 2px;
  background: none; font-size: .82rem; }
.tab.active { background: var(--ink); color: var(--bone); }

.panel {
  background: var(--bone); border: 2px solid var(--ink); border-radius: 4px;
  padding: 14px; margin: 10px 0;
  box-shadow: 3px 3px 0 rgba(42,35,32,.25);
}

/* beast sheet */
.sheet { display: flex; flex-wrap: wrap; gap: 16px; }
.portrait {
  flex: 1 1 300px; max-width: 420px; margin: 0 auto;
  background: var(--paper2); border: 2px solid var(--ink); border-radius: 4px;
}
.portrait svg { width: 100%; height: auto; display: block; }
.sheet-info { flex: 1 1 300px; }
.pentagon { width: 220px; display: block; margin: 6px auto; }
.pent-outer { fill: none; stroke: var(--ink); stroke-width: 1.5; opacity: .5; }
.pent-inner { fill: rgba(74,122,106,.45); stroke: var(--verdigris); stroke-width: 2; }
.pent-label { font-size: 11px; fill: var(--ink); font-family: Georgia, serif; }
.moves { list-style: none; }
.moves li { padding: 4px 0; border-bottom: 1px dotted rgba(42,35,32,.4); }
details summary { cursor: pointer; padding: 4px 0; font-variant: small-caps; }
details p { padding: 4px 0 8px; font-style: italic; }

/* essence tags */
.tag { font-size: .72rem; padding: 1px 7px; border-radius: 8px; border: 1px solid var(--ink);
  font-variant: small-caps; letter-spacing: .04em; white-space: nowrap; }
.tag.caloric { background: #d9663d33; } .tag.brumal { background: #7fb4c933; }
.tag.voltaic { background: #c9b44a33; } .tag.pelagic { background: #4a7a9a33; }
.tag.chthonic { background: #8a7a5e44; } .tag.verdant { background: #8fae4e33; }
.tag.umbral { background: #8a6fae33; } .tag.aetheric { background: #b8a8d833; }

/* builder */
.builder .portrait { position: sticky; top: 56px; z-index: 4; max-height: 34vh; }
.builder .portrait svg { max-height: 34vh; }
.slot-row h3 { margin-top: 14px; }
.slot-opts { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0; }
.slot-opt {
  flex: 0 0 auto; display: flex; flex-direction: column; gap: 3px; align-items: flex-start;
  min-width: 150px; padding: 8px 10px; text-align: left; font-variant: normal;
}
.slot-opt .opt-name { font-variant: small-caps; font-weight: bold; }
.slot-opt .opt-stats { font-size: .74rem; color: #6a5f50; }
.slot-opt .opt-trait { font-size: .74rem; color: var(--verdigris); }
.slot-opt.selected { background: var(--ink); color: var(--bone); }
.slot-opt.selected .opt-stats, .slot-opt.selected .opt-trait { color: var(--paper2); }
.slot-desc { font-style: italic; font-size: .86rem; min-height: 2.2em; padding: 2px 0; }
.tint-row { display: flex; gap: 12px; padding: 6px 0; }
.tint-swatch { width: 46px; height: 46px; border-radius: 50%; padding: 0; }
.tint-swatch.selected { outline: 3px solid var(--ink); outline-offset: 3px; }

/* trials */
.trial-card button { margin-top: 6px; }
.game-blurb { font-style: italic; margin: 8px 0 14px; }
.lex-board { display: flex; flex-direction: column; gap: 5px; align-items: center; }
.lex-row { display: flex; gap: 5px; }
.lex-tile {
  width: 52px; height: 52px; border: 2px solid var(--ink); border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; font-variant: small-caps; background: var(--paper2);
}
.lex-tile.hit { background: var(--verdigris); color: var(--bone); }
.lex-tile.near { background: #c9b44a; }
.lex-tile.cold { background: #8a7a5e; color: var(--bone); }
.lex-kbd { margin-top: 14px; }
.lex-kbd-row { display: flex; gap: 4px; justify-content: center; margin: 4px 0; }
.lex-key { padding: 10px 6px; min-width: 30px; font-size: .95rem; }
.lex-key.wide { min-width: 46px; }
.lex-key.hit { background: var(--verdigris); color: var(--bone); }
.lex-key.near { background: #c9b44a; }
.lex-key.cold { background: #8a7a5e; color: var(--bone); }
.lex-msg { margin-top: 12px; font-style: italic; min-height: 1.4em; }
canvas.shaft { width: min(100%, 440px, 46vh); display: block; margin: 0 auto;
  border: 2px solid var(--ink); border-radius: 4px; touch-action: manipulation; }
.sim-status { font-variant: small-caps; text-align: center; margin: 8px 0; min-height: 1.3em; }
.sim-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; max-width: 340px; margin: 0 auto; }
.sim-glyph { font-size: 1.8rem; padding: 16px 0; }
.sim-glyph.lit { background: var(--verdigris); color: var(--bone); }

.sluice-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  max-width: 340px; margin: 0 auto; }
.sluice-cell { font-size: 1.6rem; padding: 14px 0; background: #8a7a5e; color: var(--bone); }
.sluice-cell.open { background: var(--verdigris); }

/* battles / pandect */
.chron.won { border-left: 6px solid var(--verdigris); }
.chron.lost { border-left: 6px solid var(--rust); }
.chron-text p { margin: 8px 0; font-style: italic; }
.pandect-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.pandect-thumb { flex: 0 0 90px; }
.pandect-thumb svg { width: 90px; height: 90px; }
.chal-out { flex: 1 1 100%; }
