/* ===========================================================================
   Dark fantasy / grimoire thema — mobile-first
   =========================================================================== */

:root {
  --bg: #0e0b14;
  --bg-2: #171122;
  --panel: #1c1526;
  --panel-2: #241a30;
  --panel-3: #2c2038;
  --border: #3a2c4a;
  --border-gold: #6c5324;
  --gold: #d4af37;
  --gold-soft: #e8cf7a;
  --purple: #a679d6;
  --purple-soft: #c9a8ef;
  --text: #ece6f5;
  --text-dim: #a598b8;
  --text-faint: #6f6383;
  --red: #d9534f;
  --green: #5cb85c;
  --blue: #5aa9e6;
  --radius: 12px;
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  --glow-gold: 0 0 14px rgba(212, 175, 55, 0.35);
  --glow-purple: 0 0 14px rgba(166, 121, 214, 0.4);
  --serif: 'Cinzel', 'Trajan Pro', Georgia, 'Times New Roman', serif;
  --body: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(1200px 600px at 50% -10%, #1e1430 0%, transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, #0a0810 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--body);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.45;
}

h1, h2, h3, .serif { font-family: var(--serif); letter-spacing: 0.5px; }

button { font-family: var(--body); cursor: pointer; }

.hidden { display: none !important; }

/* ---- App-lagen -------------------------------------------------------- */
#app { max-width: 560px; margin: 0 auto; min-height: 100vh; position: relative; }

/* ===========================================================================
   Profielkeuze-scherm
   =========================================================================== */
.home {
  padding: 28px 18px 60px;
}
.home__title {
  text-align: center;
  color: var(--gold);
  font-size: 1.8rem;
  margin: 10px 0 2px;
  text-shadow: var(--glow-gold);
}
.home__subtitle {
  text-align: center;
  color: var(--text-dim);
  margin: 0 0 26px;
  font-size: 0.9rem;
}
.char-grid { display: grid; gap: 14px; }
.char-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: linear-gradient(145deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.12s ease, box-shadow 0.15s ease, border-color 0.15s;
}
.char-card:hover { transform: translateY(-2px); box-shadow: var(--shadow), var(--glow-gold); border-color: var(--border-gold); }
.char-card__avatar {
  width: 54px; height: 54px; flex: 0 0 54px;
  display: grid; place-items: center;
  font-size: 30px;
  background: radial-gradient(circle at 30% 30%, var(--panel-3), #120d1a);
  border: 1px solid var(--border-gold);
  border-radius: 50%;
  box-shadow: var(--glow-purple);
}
.char-card__body { flex: 1; min-width: 0; }
.char-card__name { font-family: var(--serif); font-size: 1.15rem; color: var(--gold-soft); }
.char-card__meta { color: var(--text-dim); font-size: 0.85rem; }
.char-card__open { color: var(--purple-soft); font-size: 1.4rem; }
.char-card__del {
  background: none; border: none; color: var(--text-faint);
  font-size: 1.1rem; padding: 6px; border-radius: 8px;
}
.char-card__del:hover { color: var(--red); background: rgba(217, 83, 79, 0.1); }

.home__actions { margin-top: 24px; display: grid; gap: 10px; }
.home__warn {
  margin: -2px 0 4px; padding: 10px 12px;
  background: rgba(200, 120, 40, 0.12);
  border: 1px solid var(--border-gold);
  border-radius: 10px;
  color: var(--gold-soft); font-size: 0.78rem; line-height: 1.45; text-align: left;
}

/* ---- Profielkeuze (Netflix-stijl) ------------------------------------- */
.profiles {
  padding: 40px 18px 60px;
  display: flex; flex-direction: column; align-items: center;
  min-height: 82vh; justify-content: center;
}
.profiles__title {
  text-align: center; color: var(--gold);
  font-size: 1.7rem; margin: 0 0 4px; text-shadow: var(--glow-gold);
}
.profiles__sub { text-align: center; color: var(--text-dim); margin: 0 0 30px; font-size: 0.9rem; }
.profile-grid { display: flex; flex-wrap: wrap; gap: 20px; justify-content: center; max-width: 460px; }
.profile-tile {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  width: 108px; background: none; border: none; padding: 6px;
}
.profile-tile__avatar {
  width: 92px; height: 92px; display: grid; place-items: center; font-size: 44px;
  background: linear-gradient(145deg, var(--panel-2), var(--panel));
  border: 2px solid var(--border); border-radius: 16px; box-shadow: var(--shadow);
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}
.profile-tile__name { color: var(--text-dim); font-size: 0.95rem; }
.profile-tile:hover .profile-tile__avatar,
.profile-tile:focus-visible .profile-tile__avatar {
  border-color: var(--gold); transform: scale(1.06); box-shadow: var(--shadow), var(--glow-gold);
}
.profile-tile:hover .profile-tile__name { color: var(--gold-soft); }
.profile-tile--add .profile-tile__avatar { border-style: dashed; color: var(--text-faint); background: transparent; }
.profile-tile--add:hover .profile-tile__avatar { color: var(--gold); }
.profile-tile--current .profile-tile__avatar { border-color: var(--gold); box-shadow: var(--shadow), var(--glow-gold); }
.profile-tile--current .profile-tile__name { color: var(--gold-soft); }
.profiles__foot { margin-top: 26px; }

/* ---- Home: profielbalk + grijs voorbeeld ------------------------------ */
.home__profilebar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.home__switch { background: none; border: none; color: var(--gold); font-size: 0.9rem; padding: 4px 0; }
.home__who { display: flex; align-items: center; gap: 7px; color: var(--text-dim); font-size: 0.9rem; }
.home__who-av { font-size: 1.2rem; }
.home__campaignbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; margin-bottom: 16px; padding: 10px 14px; text-align: left;
  background: linear-gradient(145deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border); border-radius: 12px; cursor: pointer;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
.home__campaignbar:hover { border-color: var(--gold); box-shadow: var(--glow-gold); }
.home__campaign { display: flex; align-items: center; gap: 9px; color: var(--text-dim); font-size: 0.9rem; }
.home__campaign b { color: var(--text); }
.home__campaign-ic { font-size: 1.3rem; }
.home__campswitch { color: var(--gold); font-size: 0.82rem; white-space: nowrap; }

/* ---- Campagne-tab ----------------------------------------------------- */
.camp-head { display: flex; align-items: center; gap: 14px; }
.camp-head__ic {
  width: 54px; height: 54px; flex: 0 0 54px; display: grid; place-items: center; font-size: 30px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px;
}
.camp-head__name { color: var(--gold); font-size: 1.15rem; font-weight: 600; }
.camp-head__sub { color: var(--text-faint); font-size: 0.78rem; margin-top: 2px; }

.char-card--example { opacity: 0.5; border-left-color: var(--text-faint); filter: grayscale(0.4); }
.char-card--example:hover { opacity: 0.85; border-color: var(--border-gold); filter: none; }
.char-card__badge {
  display: inline-block; font-family: var(--body);
  font-size: 0.62rem; letter-spacing: 0.5px; text-transform: uppercase;
  color: var(--text-faint); border: 1px solid var(--border); border-radius: 6px;
  padding: 1px 6px; margin-left: 6px; vertical-align: middle;
}

/* ===========================================================================
   Sheet-schil: sticky header + tabs + content
   =========================================================================== */
.sheet { display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(180deg, rgba(23, 17, 34, 0.98), rgba(20, 15, 30, 0.96));
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border-gold);
  padding: 10px 14px;
}
.topbar__row { display: flex; align-items: center; gap: 10px; }
.topbar__back {
  background: none; border: none; color: var(--gold);
  font-size: 1.4rem; padding: 2px 8px 2px 0;
}
.topbar__avatar { font-size: 24px; }
.topbar__id { flex: 1; min-width: 0; }
.topbar__name { font-family: var(--serif); color: var(--gold-soft); font-size: 1.1rem; line-height: 1.1; }
.topbar__sub { color: var(--text-dim); font-size: 0.78rem; }
.topbar__stats { display: flex; gap: 8px; }
.mini-stat {
  text-align: center; min-width: 46px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; padding: 4px 6px;
}
.mini-stat__val { font-family: var(--serif); font-size: 1.05rem; color: var(--text); line-height: 1; }
.mini-stat__lbl { font-size: 0.6rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.5px; }
.mini-stat--hp .mini-stat__val { color: var(--green); }
.mini-stat--hp.low .mini-stat__val { color: var(--red); }

.conc-banner {
  margin-top: 8px;
  display: flex; align-items: center; gap: 8px;
  background: linear-gradient(90deg, rgba(166, 121, 214, 0.18), transparent);
  border: 1px solid var(--purple);
  border-radius: 8px; padding: 5px 10px;
  font-size: 0.82rem; color: var(--purple-soft);
  box-shadow: var(--glow-purple);
}
.conc-banner button {
  margin-left: auto; background: none; border: 1px solid var(--purple);
  color: var(--purple-soft); border-radius: 6px; padding: 2px 8px; font-size: 0.75rem;
}

.rollmode {
  display: flex; gap: 4px; margin-top: 8px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px;
}
.rollmode .rm {
  flex: 1; background: none; border: none; color: var(--text-dim);
  padding: 6px 4px; border-radius: 8px; font-size: 0.74rem; font-weight: 600;
  transition: background 0.13s, color 0.13s;
}
.rollmode .rm.active { background: linear-gradient(180deg, var(--panel-3), var(--panel-2)); color: var(--gold-soft); box-shadow: var(--glow-gold); }
.rollmode .rm[data-mode="disadvantage"].active { color: #f0b3b0; box-shadow: 0 0 10px rgba(217, 83, 79, 0.35); }
.rollmode .rm[data-mode="advantage"].active { color: #a6e0a6; box-shadow: 0 0 10px rgba(127, 224, 160, 0.35); }

.rollbar { margin-bottom: 14px; }
.rollbar__lbl {
  font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-faint); margin: 0 2px 2px;
}
.rollbar__auto {
  margin-top: 6px; font-size: 0.72rem; line-height: 1.35; color: #f0b3b0;
  background: rgba(217, 83, 79, 0.1); border: 1px solid rgba(217, 83, 79, 0.35);
  border-radius: 8px; padding: 6px 10px;
}

.content { flex: 1; padding: 14px 14px 90px; }

/* ---- Bottom tabs ------------------------------------------------------ */
.tabbar {
  position: sticky; bottom: 0; z-index: 20;
  display: flex;
  background: linear-gradient(0deg, rgba(14, 11, 20, 0.99), rgba(20, 15, 30, 0.95));
  border-top: 1px solid var(--border-gold);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
}
.tab {
  flex: 1; background: none; border: none; color: var(--text-faint);
  padding: 6px 2px; border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.4px;
  transition: color 0.15s, background 0.15s;
}
.tab .tab__icon { font-size: 1.15rem; }
.tab.active { color: var(--gold); }
.tab.active { background: rgba(212, 175, 55, 0.08); }

/* ===========================================================================
   Panelen & bouwstenen
   =========================================================================== */
.panel {
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.panel__title {
  font-family: var(--serif);
  color: var(--gold);
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: linear-gradient(180deg, var(--panel-3), var(--panel-2));
  color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 14px; font-size: 0.9rem; font-weight: 600;
  transition: transform 0.1s, border-color 0.15s, box-shadow 0.15s;
}
.btn:hover { border-color: var(--border-gold); box-shadow: var(--glow-gold); }
.btn:active { transform: scale(0.97); }
.btn--gold { border-color: var(--border-gold); color: var(--gold-soft); }
.btn--purple { border-color: var(--purple); color: var(--purple-soft); }
.btn--danger { border-color: #6c2727; color: #e79a97; }
.btn--subtle { opacity: 0.7; font-size: 0.82rem; }
.btn--subtle:hover { opacity: 1; }
.btn--block { width: 100%; }
.btn--sm { padding: 6px 10px; font-size: 0.78rem; border-radius: 8px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- Ability scores --------------------------------------------------- */
.abilities { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ability {
  text-align: center;
  background: radial-gradient(circle at 50% 0%, var(--panel-3), var(--panel));
  border: 1px solid var(--border-gold);
  border-radius: 12px; padding: 10px 4px 8px;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.1s;
}
.ability:hover { box-shadow: var(--glow-gold); }
.ability:active { transform: scale(0.97); }
.ability__lbl { font-size: 0.62rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.5px; }
.ability__mod { font-family: var(--serif); font-size: 1.7rem; color: var(--gold-soft); line-height: 1.1; }
.ability__score { font-size: 0.78rem; color: var(--text-dim); }

/* ---- Lijsten (skills, saves) ----------------------------------------- */
.stat-list { display: grid; gap: 2px; }
.stat-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text); text-align: left; width: 100%;
  transition: background 0.12s, border-color 0.12s;
}
.stat-row:hover { background: var(--panel-3); border-color: var(--border); }
.stat-row__dot {
  width: 10px; height: 10px; border-radius: 50%;
  border: 1px solid var(--border-gold); flex: 0 0 10px;
}
.stat-row__dot.prof { background: var(--gold); box-shadow: var(--glow-gold); }
.stat-row__name { flex: 1; font-size: 0.88rem; }
.stat-row__abil { font-size: 0.66rem; color: var(--text-faint); text-transform: uppercase; }
.stat-row__mod { font-family: var(--serif); font-size: 1rem; color: var(--gold-soft); min-width: 34px; text-align: right; }
.stat-row__mod--adv { color: #7fe0a0; text-shadow: 0 0 10px rgba(127, 224, 160, 0.35); }
.stat-row__adv {
  font-family: var(--serif); font-size: 0.58rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; color: #7fe0a0;
  border: 1px solid rgba(127, 224, 160, 0.5); border-radius: 6px;
  padding: 1px 5px; margin-right: 6px;
}

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 420px) { .two-col { grid-template-columns: 1fr; } }

.passives { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 4px; }
.passive { text-align: center; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 6px 2px; }
.passive__val { font-family: var(--serif); font-size: 1.2rem; color: var(--text); }
.passive__lbl { font-size: 0.58rem; color: var(--text-faint); text-transform: uppercase; }

/* ---- HP-tracker ------------------------------------------------------- */
.hp-box { text-align: center; }
.hp-numbers { display: flex; justify-content: center; align-items: baseline; gap: 6px; margin-bottom: 4px; }
.hp-current { font-family: var(--serif); font-size: 2.6rem; color: var(--green); line-height: 1; }
.hp-current.low { color: var(--red); }
.hp-sep { color: var(--text-faint); font-size: 1.4rem; }
.hp-max { font-family: var(--serif); font-size: 1.6rem; color: var(--text-dim); }
.hp-temp { color: var(--blue); font-size: 0.85rem; margin-bottom: 8px; }
.hp-bar { height: 10px; background: #2a1a1a; border-radius: 6px; overflow: hidden; border: 1px solid var(--border); margin-bottom: 12px; }
.hp-bar__fill { height: 100%; background: linear-gradient(90deg, #3a7d3a, var(--green)); transition: width 0.3s ease; }
.hp-bar__fill.low { background: linear-gradient(90deg, #7d2a2a, var(--red)); }
.hp-controls { display: flex; gap: 8px; align-items: stretch; }
.hp-input {
  flex: 1; min-width: 0; text-align: center;
  background: var(--bg-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; font-size: 1.1rem; padding: 8px; font-family: var(--serif);
}
.hp-input:focus { outline: none; border-color: var(--gold); }

/* ---- Slot / resource pips -------------------------------------------- */
.pips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pip {
  width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid var(--border-gold);
  background: radial-gradient(circle at 35% 30%, var(--panel-3), #120d1a);
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
}
.pip.filled { background: radial-gradient(circle at 35% 30%, var(--gold-soft), var(--gold)); box-shadow: var(--glow-gold); }
.pip:active { transform: scale(0.9); }

.resource-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.resource-row__name { flex: 1; font-size: 0.88rem; }

/* ---- Death saves ------------------------------------------------------ */
.death-saves { display: flex; justify-content: space-between; gap: 10px; }
.death-col { flex: 1; text-align: center; }
.death-col__lbl { font-size: 0.66rem; color: var(--text-faint); text-transform: uppercase; margin-bottom: 4px; }
.death-pips { display: flex; gap: 6px; justify-content: center; }
.death-pip { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border); }
.death-pip.on-success { background: var(--green); border-color: var(--green); }
.death-pip.on-fail { background: var(--red); border-color: var(--red); }

/* ---- Attacks ---------------------------------------------------------- */
.attack {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border: 1px solid var(--border); border-radius: 10px;
  margin-bottom: 8px; background: var(--panel);
}
.attack__body { flex: 1; min-width: 0; }
.attack__name { font-weight: 600; color: var(--gold-soft); }
.attack__meta { font-size: 0.76rem; color: var(--text-dim); }
.attack__btns { display: flex; flex-direction: column; gap: 4px; }

/* ---- Inventory items -------------------------------------------------- */
.item {
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px;
  margin-bottom: 8px; background: var(--panel);
}
.item__body { min-width: 0; }
.item__name { font-weight: 600; color: var(--gold-soft); }
.item__qty { color: var(--text-faint); font-weight: 400; font-size: 0.85rem; }
.item__meta { font-size: 0.76rem; color: var(--text-dim); margin-top: 2px; }
.item--edit {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; text-align: left; cursor: pointer;
  color: inherit; font: inherit;
}
.item--edit:hover { border-color: var(--gold-soft); }
.item__edit { color: var(--text-faint); font-size: 0.95rem; flex-shrink: 0; }

/* ---- Small panel-title action button ---------------------------------- */
.panel__action {
  margin-left: auto; padding: 3px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: transparent;
  color: var(--text-dim); font-size: 0.72rem; cursor: pointer;
}
.panel__action:hover { border-color: var(--gold-soft); color: var(--gold-soft); }

/* ---- Conditions ------------------------------------------------------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 7px 12px; border-radius: 20px;
  border: 1px solid var(--border); background: var(--panel);
  color: var(--text-dim); font-size: 0.8rem;
  transition: all 0.13s;
}
.chip.active { background: linear-gradient(180deg, #4a2a2a, #3a1f1f); border-color: var(--red); color: #f0b3b0; box-shadow: 0 0 10px rgba(217, 83, 79, 0.3); }
.chip.immune { opacity: 0.45; border-style: dashed; cursor: not-allowed; }
.condition-reminders { margin-top: 12px; display: grid; gap: 8px; }
.reminder {
  border-left: 3px solid var(--red); background: rgba(217, 83, 79, 0.08);
  padding: 8px 10px; border-radius: 0 8px 8px 0; font-size: 0.82rem;
}
.reminder b { color: #f0b3b0; }
.reminder__ends {
  font-size: 0.72rem; color: var(--text-faint); margin-top: 3px;
}

/* ---- Spells ----------------------------------------------------------- */
.spell {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border: 1px solid var(--border); border-radius: 10px;
  margin-bottom: 8px; background: var(--panel);
  width: 100%; text-align: left; color: var(--text);
  transition: border-color 0.13s, box-shadow 0.13s, transform 0.1s;
}
.spell:hover { border-color: var(--border-gold); box-shadow: var(--glow-gold); }
.spell:active { transform: scale(0.99); }
.spell.concentrating { border-color: var(--purple); box-shadow: var(--glow-purple); }
.spell__body { flex: 1; min-width: 0; }
.spell__name { font-weight: 600; color: var(--gold-soft); }
.spell__meta { font-size: 0.74rem; color: var(--text-dim); }
.spell__tag {
  font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.4px;
  padding: 2px 6px; border-radius: 6px; border: 1px solid var(--purple);
  color: var(--purple-soft); white-space: nowrap;
}
.spell-level-hdr {
  font-family: var(--serif); color: var(--gold); font-size: 0.8rem;
  text-transform: uppercase; letter-spacing: 1px; margin: 14px 0 8px;
}

/* ---- Features / bio --------------------------------------------------- */
.feature { padding: 10px 0; border-bottom: 1px solid var(--border); }
.feature:last-child { border-bottom: none; }
.feature__name { font-weight: 600; color: var(--gold-soft); font-size: 0.9rem; }
.feature__text { color: var(--text-dim); font-size: 0.84rem; margin-top: 2px; }
.bio-block { margin-bottom: 12px; }
.bio-block__lbl { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.6px; color: var(--gold); margin-bottom: 3px; }
.bio-block__text { color: var(--text); font-size: 0.86rem; white-space: pre-wrap; }

/* ===========================================================================
   Modal & toast
   =========================================================================== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(6, 4, 10, 0.72); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.modal {
  width: 100%; max-width: 460px; max-height: 88vh; overflow-y: auto;
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border-gold); border-radius: var(--radius);
  box-shadow: var(--shadow), var(--glow-gold); padding: 18px;
}
.modal__title { font-family: var(--serif); color: var(--gold); font-size: 1.3rem; margin: 0 0 2px; }
.modal__sub { color: var(--text-dim); font-size: 0.82rem; margin-bottom: 12px; }
.modal__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.modal__cell { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; }
.modal__cell b { display: block; font-size: 0.6rem; color: var(--text-faint); text-transform: uppercase; }
.modal__body { color: var(--text); font-size: 0.9rem; line-height: 1.5; }
.modal__note { margin-top: 10px; padding: 8px 10px; border-left: 3px solid var(--purple); background: rgba(166, 121, 214, 0.08); border-radius: 0 8px 8px 0; font-size: 0.82rem; color: var(--purple-soft); }
.modal__actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.modal__close { float: right; background: none; border: none; color: var(--text-faint); font-size: 1.4rem; line-height: 1; }

.save-result {
  text-align: center; font-family: var(--serif);
  padding: 14px; border-radius: 10px; margin: 12px 0;
  border: 1px solid var(--border);
}
.save-result.pass { border-color: var(--green); background: rgba(92, 184, 92, 0.1); }
.save-result.fail { border-color: var(--red); background: rgba(217, 83, 79, 0.1); }
.save-result__big { font-size: 2rem; }
.save-result__dice { font-size: 0.8rem; color: var(--text-dim); font-family: var(--body); margin-top: 4px; }

.toast-wrap { position: fixed; bottom: 84px; left: 0; right: 0; z-index: 90; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  pointer-events: auto;
  background: linear-gradient(160deg, var(--panel-3), var(--panel));
  border: 1px solid var(--border-gold); border-radius: 12px;
  padding: 10px 16px; box-shadow: var(--shadow), var(--glow-gold);
  max-width: 90%; animation: toast-in 0.2s ease;
}
.toast__title { font-family: var(--serif); color: var(--gold-soft); font-size: 0.85rem; }
.toast__result { font-family: var(--serif); font-size: 1.5rem; color: var(--text); }
.toast__detail { font-size: 0.72rem; color: var(--text-dim); }
.toast.crit .toast__result { color: var(--green); text-shadow: var(--glow-gold); }
.toast.fail1 .toast__result { color: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ---- Rollende dobbelsteen (BG3-stijl) --------------------------------- */
.dice-overlay {
  position: fixed; inset: 0; z-index: 120;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px;
  background: radial-gradient(600px 420px at 50% 40%, rgba(30, 20, 48, 0.6), rgba(6, 4, 12, 0.82));
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  animation: dice-fade 0.16s ease;
}
.dice-overlay.out { opacity: 0; transition: opacity 0.3s ease; }
@keyframes dice-fade { from { opacity: 0; } to { opacity: 1; } }

.dice-scene { perspective: 820px; }
.die {
  width: 128px; height: 128px; border-radius: 24px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-weight: 700; font-size: 3.6rem; color: var(--gold-soft);
  background: radial-gradient(circle at 32% 26%, #3a2c57 0%, #211634 55%, #140d22 100%);
  border: 2px solid var(--border-gold);
  box-shadow: inset 0 2px 10px rgba(255, 255, 255, 0.06), inset 0 -8px 20px rgba(0, 0, 0, 0.5), 0 18px 44px rgba(0, 0, 0, 0.55);
  transform-style: preserve-3d; will-change: transform; user-select: none;
}
.die.rolling { animation: die-roll 0.42s ease-in-out infinite; }
.die.land { animation: die-drop 0.6s cubic-bezier(0.2, 1.35, 0.35, 1); }
@keyframes die-roll {
  0%   { transform: rotate(-14deg) rotateX(18deg) scale(1); }
  25%  { transform: rotate(13deg) rotateX(-14deg) scale(1.05); }
  50%  { transform: rotate(-10deg) rotateY(16deg) scale(1); }
  75%  { transform: rotate(14deg) rotateY(-16deg) scale(1.05); }
  100% { transform: rotate(-14deg) rotateX(18deg) scale(1); }
}
@keyframes die-drop {
  0%   { transform: rotate(150deg) scale(1.5); }
  55%  { transform: rotate(0deg) scale(1.16); }
  78%  { transform: rotate(0deg) scale(0.95); }
  100% { transform: rotate(0deg) scale(1); }
}
.die.crit {
  color: #ffe08a; border-color: var(--gold-soft);
  box-shadow: inset 0 2px 10px rgba(255, 255, 255, 0.1), 0 0 50px rgba(232, 207, 122, 0.8), 0 18px 44px rgba(0, 0, 0, 0.55);
}
.die.fail {
  color: #f2aca8; border-color: var(--red);
  box-shadow: inset 0 2px 10px rgba(255, 255, 255, 0.06), 0 0 50px rgba(217, 83, 79, 0.72), 0 18px 44px rgba(0, 0, 0, 0.55);
}
.dice-scene--multi { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; justify-content: center; max-width: 92vw; }
.dice-scene--multi .die { width: 92px; height: 92px; font-size: 2.6rem; border-radius: 18px; }
.die.die--dim { opacity: 0.4; filter: grayscale(0.5); }
.dice-caption { text-align: center; opacity: 0; transform: translateY(6px); transition: opacity 0.25s ease, transform 0.25s ease; }
.dice-caption.show { opacity: 1; transform: translateY(0); }
.dice-caption__badge { font-family: var(--serif); font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; font-size: 0.95rem; margin-bottom: 6px; }
.dice-caption__badge.crit { color: #ffe08a; text-shadow: var(--glow-gold); }
.dice-caption__badge.fail { color: #f2aca8; }
.dice-caption__title { color: var(--text-dim); font-size: 0.85rem; letter-spacing: 0.03em; }
.dice-caption__total { font-family: var(--serif); font-weight: 700; font-size: 1.6rem; color: var(--text); margin-top: 2px; }
.dice-caption__detail { color: var(--text-faint); font-size: 0.78rem; margin-top: 3px; }
.dice-hint { color: var(--text-faint); font-size: 0.7rem; letter-spacing: 0.04em; }

/* ---- Losse dobbelsteen-bak (Combat) ----------------------------------- */
.dice-tray { display: flex; flex-wrap: wrap; gap: 8px; }
.dice-btn {
  flex: 1 1 auto; min-width: 58px;
  padding: 12px 10px; border-radius: 12px;
  background: linear-gradient(160deg, var(--panel-3), var(--panel));
  border: 1px solid var(--border-gold); color: var(--gold-soft);
  font-family: var(--serif); font-weight: 700; font-size: 1.05rem;
  transition: transform 0.08s ease, box-shadow 0.15s ease;
}
.dice-btn:hover { box-shadow: var(--glow-gold); }
.dice-btn:active { transform: scale(0.94); }

/* ---- Notities --------------------------------------------------------- */
.notes-text { white-space: pre-wrap; color: var(--text); font-size: 0.9rem; line-height: 1.5; }

/* ---- Dobbelstenen-pool (Combat) --------------------------------------- */
.dice-pool { margin-top: 12px; }
.dice-pool__chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.dice-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 10px;
  background: linear-gradient(160deg, var(--panel-3), var(--panel));
  border: 1px solid var(--border-gold); color: var(--gold-soft);
  font-family: var(--serif); font-size: 0.9rem; cursor: pointer;
}
.dice-chip:active { transform: scale(0.94); }
.dice-chip b { color: var(--text); }
.dice-chip__x { color: var(--text-faint); font-size: 0.75rem; }
.dice-pool__actions { display: flex; gap: 8px; align-items: stretch; }

/* ---- Forms (nieuw personage / edit) ---------------------------------- */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--gold); margin-bottom: 4px; }
.field input, .field textarea, .field select {
  width: 100%; background: var(--bg-2); border: 1px solid var(--border);
  color: var(--text); border-radius: 8px; padding: 9px 10px; font-size: 0.92rem;
  font-family: var(--body);
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--gold); }
.field-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.check {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
  font-size: 0.82rem; color: var(--text-dim);
}
.check input { width: auto; accent-color: var(--gold); }
.hint { font-size: 0.75rem; color: var(--text-faint); margin-top: 4px; }
