:root {
  --bg: #16130f;
  --panel: #211c16;
  --panel-2: #2a241c;
  --line: #3a3127;
  --text: #ece4d4;
  --muted: #a89a83;
  --gold: #d4a94f;
  --success: #e3c26a;
  --fate: #8fb3c9;
  --danger: #d9785f;
  --radius: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(88px + env(safe-area-inset-bottom));
}

h1, h2, h3, h4 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-weight: 600; }
.title { font-size: 1.5rem; margin: 8px 0 16px; }
.en { color: var(--muted); font-family: system-ui, sans-serif; font-size: .8em; font-weight: 400; }
.meta { color: var(--muted); font-size: .9rem; margin: 4px 0; }
.fine { color: var(--muted); font-size: .78rem; margin-top: 20px; }
.warn { color: var(--danger); font-size: .9rem; }
.link { display: inline-block; margin-top: 12px; color: var(--gold); text-decoration: none; font-weight: 600; }
a { color: var(--gold); }

/* nav */
.nav {
  position: fixed; inset: auto 0 0 0;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(22, 19, 15, .96);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  backdrop-filter: blur(8px);
}
.nav a {
  padding: 14px 0; text-align: center; text-decoration: none;
  color: var(--muted); font-size: .9rem; font-weight: 600;
}
.nav a.on { color: var(--gold); box-shadow: inset 0 2px 0 var(--gold); }

/* buttons */
button { font: inherit; color: inherit; cursor: pointer; }
.ghost { background: none; border: 0; color: var(--gold); padding: 8px 0; font-weight: 600; }
.ghost.small { font-size: .85rem; }
.topline { display: flex; justify-content: space-between; align-items: center; color: var(--muted); }

.choices { display: grid; gap: 10px; }
.choice {
  display: grid; gap: 2px; text-align: left;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px;
}
.choice b { font-size: 1.1rem; }
.choice span { color: var(--muted); font-size: .88rem; }
.choice.on { border-color: var(--gold); }
.mini-stats { font-variant-numeric: tabular-nums; }

/* hero sheet */
.hero-head { display: flex; gap: 14px; align-items: center; margin: 8px 0 16px; }
.hero-head h2 { font-size: 1.7rem; }
.sigil {
  flex: none; width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-items: center;
  border: 2px solid var(--gold); color: var(--gold);
  font: 600 1.6rem Georgia, serif;
  background: radial-gradient(circle at 30% 30%, #3a3020, var(--panel));
}

.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  text-align: center; padding: 8px 2px;
}
.stat-v { display: block; font: 700 1.6rem Georgia, serif; color: var(--gold); }
.stat-n { display: block; font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }

.limits { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 6px; }
.limits div {
  background: var(--panel-2); border-radius: 10px; padding: 8px;
  font-size: .72rem; color: var(--muted); text-align: center;
}
.limits span { display: block; font: 700 1.25rem Georgia, serif; color: var(--text); }

.block { margin-top: 22px; }
.block h3 { font-size: 1.05rem; margin-bottom: 10px; color: var(--gold); }
.ability p { margin: 0; background: var(--panel); border-left: 3px solid var(--gold); padding: 12px 14px; border-radius: 0 var(--radius) var(--radius) 0; }
.tip { font-size: .9rem; color: var(--muted); }
.tip b { color: var(--text); }
.count { color: var(--muted); font-size: .85rem; font-weight: 400; }

.role-pick { display: grid; gap: 6px; font-weight: 600; color: var(--gold); font-family: Georgia, serif; }
.role-pick select {
  font: 1rem system-ui, sans-serif; color: var(--text);
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px;
}

/* skill cards */
.skills { display: grid; gap: 8px; }
.skill { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.skill header { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.skill h4 { font-size: 1rem; }
.badges { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.badge { font-size: .72rem; padding: 2px 7px; border-radius: 99px; background: var(--panel-2); color: var(--muted); white-space: nowrap; }
.badge.success { color: var(--success); }
.badge.fate { color: var(--fate); }
.badge.xp { color: var(--text); border: 1px solid var(--line); }
.types { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-top: 2px; }
.skill-text p { margin: 6px 0 0; font-size: .92rem; }
.skill-text p.kw { color: var(--muted); font-size: .82rem; font-style: italic; }

/* team / roles lists */
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 4px; }
.tab {
  flex: none; padding: 7px 12px; border-radius: 99px; text-decoration: none;
  background: var(--panel); color: var(--muted); border: 1px solid var(--line); font-size: .88rem;
}
.tab.on { color: var(--bg); background: var(--gold); border-color: var(--gold); }
.team { display: grid; gap: 8px; }
.team-row {
  display: block; text-decoration: none; color: var(--text);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
}
.team-row.mine { border-color: var(--gold); }
.team-row p { margin: 4px 0 0; font-size: .88rem; color: var(--muted); }
.row-head { display: flex; justify-content: space-between; align-items: baseline; }

/* rules */
.phases { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.phases li { background: var(--panel); border-radius: var(--radius); padding: 12px 14px; }
.phases b { display: block; font-family: Georgia, serif; }
.phases p { margin: 4px 0 0; font-size: .9rem; }
details { background: var(--panel); border-radius: var(--radius); margin-bottom: 8px; }
summary { padding: 12px 14px; font-weight: 600; cursor: pointer; }
details p { margin: 0; padding: 0 14px 12px; font-size: .92rem; }
.facts { margin: 0; }
.facts dt { font-weight: 700; margin-top: 10px; }
.facts dd { margin: 2px 0 0; color: var(--muted); font-size: .92rem; }
.sources { padding-left: 18px; }
.sources li { margin: 6px 0; }
