@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;700;900&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #0b0a0c;
  --bg-panel: #151317;
  --bg-panel-2: #1c191e;
  --border: #322a2e;
  --border-strong: #4a3a3e;
  --ink: #d9d2c9;
  --ink-dim: #948a83;
  --ink-faint: #635b57;
  --blood: #7a1620;
  --blood-bright: #b3202c;
  --gold: #b3893c;
  --gold-bright: #d4ac5c;
  --good: #4c7a5a;
  --bad: #b3202c;
  --shadow: 0 10px 30px rgba(0,0,0,.55);
  --radius: 6px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(ellipse at top, #14111330 0%, var(--bg) 55%), var(--bg);
  color: var(--ink);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(0deg, rgba(255,255,255,.012) 0px, transparent 1px, transparent 2px),
    repeating-linear-gradient(90deg, rgba(255,255,255,.012) 0px, transparent 1px, transparent 2px);
  z-index: 0;
}

h1, h2, h3, .gothic {
  font-family: 'Cinzel', serif;
  letter-spacing: .03em;
  color: var(--gold-bright);
  text-shadow: 0 2px 8px rgba(0,0,0,.6);
}

h1 { font-weight: 900; font-size: 2rem; margin: 0 0 .3rem; }
h2 { font-weight: 700; font-size: 1.3rem; margin: 0 0 .6rem; }
h3 { font-weight: 700; font-size: 1rem; margin: 0 0 .4rem; color: var(--ink); text-transform: uppercase; letter-spacing: .08em; font-size: .85rem; }

.eyebrow {
  font-family: 'Cinzel', serif;
  font-size: .72rem;
  letter-spacing: .25em;
  text-transform: uppercase;
  color: var(--blood-bright);
  margin: 0 0 .4rem;
}

a { color: var(--gold-bright); }

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
  position: relative;
  z-index: 1;
}

.container.wide { max-width: 1300px; }

.panel {
  background: linear-gradient(180deg, var(--bg-panel) 0%, var(--bg-panel-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.4rem;
  margin-bottom: 1.2rem;
  position: relative;
}

.panel::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: .5;
}

label { display: block; font-size: .8rem; color: var(--ink-dim); margin: .8rem 0 .3rem; text-transform: uppercase; letter-spacing: .06em; }
label:first-child { margin-top: 0; }

input[type="text"], input[type="number"], select, textarea {
  width: 100%;
  background: #0e0c0e;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--ink);
  padding: .6rem .7rem;
  font-family: 'Inter', sans-serif;
  font-size: .95rem;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold);
}

textarea { resize: vertical; min-height: 80px; }

button, .btn {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: .85rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #241c1e, #171314);
  color: var(--gold-bright);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: .65rem 1.1rem;
  cursor: pointer;
  transition: border-color .15s, transform .05s, background .15s;
}

button:hover:not(:disabled) { border-color: var(--gold); background: linear-gradient(180deg, #2c2224, #1c1618); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .4; cursor: not-allowed; }

button.primary, .btn.primary {
  background: linear-gradient(180deg, var(--blood-bright), var(--blood));
  color: #f3e6c8;
  border-color: #5c1219;
}
button.primary:hover:not(:disabled), .btn.primary:hover { filter: brightness(1.1); }

.danger-zone { border-color: var(--bad); }
.danger-zone h3 { color: var(--bad); }
button.danger {
  background: transparent;
  color: var(--bad);
  border-color: var(--bad);
}
button.danger:hover:not(:disabled) { background: var(--bad); color: #fff; }
button.danger:disabled { opacity: .35; }

.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.row > * { flex: 1; }
.row.tight > * { flex: none; }

.archetype-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: .7rem;
}

.archetype-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .8rem;
  cursor: pointer;
  background: #100e10;
  transition: border-color .15s, background .15s;
}
.archetype-card:hover { border-color: var(--border-strong); }
.archetype-card.selected {
  border-color: var(--gold);
  background: #1a1512;
  box-shadow: inset 0 0 0 1px var(--gold);
}
.archetype-card .name { font-family: 'Cinzel', serif; color: var(--gold-bright); font-weight: 700; font-size: .95rem; }
.archetype-card .desc { font-size: .78rem; color: var(--ink-dim); margin-top: .3rem; line-height: 1.4; }

.attr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.attr-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #100e10;
  padding: .7rem .8rem;
}
.attr-row { display: flex; align-items: center; gap: .6rem; }
.attr-row .attr-label { width: 90px; font-size: .82rem; color: var(--ink-dim); }
.attr-row input[type="range"] { flex: 1; accent-color: var(--gold); }
.attr-row .attr-value { width: 2.2rem; text-align: right; font-family: 'Cinzel', serif; color: var(--gold-bright); font-weight: 700; }
.attr-desc { font-size: .78rem; color: var(--ink-dim); line-height: 1.4; margin: .5rem 0 .25rem; }
.attr-governs { font-size: .7rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .04em; margin: 0; }

.codex {
  margin-top: 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #100e10;
  padding: .7rem .9rem;
}
.codex summary {
  cursor: pointer;
  font-family: 'Cinzel', serif;
  color: var(--gold-bright);
  font-size: .85rem;
  letter-spacing: .02em;
}
.codex summary:hover { color: var(--gold); }
.codex-body { margin-top: .7rem; font-size: .82rem; line-height: 1.55; color: var(--ink-dim); }
.codex-body p { margin: 0 0 .6rem; }
.codex-body p:last-child { margin-bottom: 0; }
.codex-body strong { color: var(--ink); }

.points-remaining {
  font-size: .85rem; color: var(--ink-dim); margin-top: .5rem;
}
.points-remaining.over { color: var(--bad); font-weight: 600; }

.char-card {
  display: flex; gap: 1rem; align-items: flex-start;
}
.portrait {
  width: 140px; height: 140px; flex: none;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: #0e0c0e center/cover no-repeat;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-faint); font-size: .75rem; text-align: center; padding: .5rem;
}
.portrait.large { width: 100%; max-width: 320px; height: 320px; }

.scene-map-box {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: #0e0c0e center/cover no-repeat;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.scene-map-box img { width: 100%; height: 100%; object-fit: cover; }

.badge {
  display: inline-block;
  font-size: .68rem;
  padding: .15rem .5rem;
  border-radius: 3px;
  border: 1px solid var(--border-strong);
  color: var(--ink-dim);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.badge.ok { color: var(--good); border-color: var(--good); }
.badge.down { color: var(--bad); border-color: var(--bad); }

.bar { height: 8px; border-radius: 4px; background: #1a1517; border: 1px solid var(--border); overflow: hidden; }
.bar-fill { height: 100%; }
.bar-fill.wounds { background: linear-gradient(90deg, var(--blood), var(--blood-bright)); }
.bar-fill.corruption { background: linear-gradient(90deg, #4a2f6a, #7a4fb0); }
.bar-fill.xp { background: linear-gradient(90deg, var(--gold), var(--gold-bright)); }

.fate-dots { display: flex; gap: .25rem; }
.fate-dot { width: 12px; height: 12px; border-radius: 50%; border: 1px solid var(--gold); }
.fate-dot.filled { background: var(--gold-bright); box-shadow: 0 0 6px var(--gold); }

/* --- Vue table (grand ecran) --- */
.table-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.player-tile { display: flex; gap: .8rem; }
.player-tile .portrait { width: 70px; height: 70px; }
.player-tile .info { flex: 1; min-width: 0; }
.player-tile .name { font-family: 'Cinzel', serif; color: var(--gold-bright); font-weight: 700; }
.player-tile .archetype { font-size: .75rem; color: var(--ink-dim); margin-bottom: .35rem; }

.feed { max-height: 60vh; overflow-y: auto; display: flex; flex-direction: column; gap: .7rem; padding-right: .3rem; }
.feed::-webkit-scrollbar { width: 8px; }
.feed::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }

.feed-entry { padding: .6rem .8rem; border-radius: var(--radius); border: 1px solid var(--border); background: #100e10; }
.feed-entry.gm { border-left: 3px solid var(--blood-bright); background: #150f10; }
.feed-entry.player { border-left: 3px solid var(--gold); }
.feed-entry.check { border-left: 3px solid #4a2f6a; font-size: .85rem; }
.feed-entry.roll { border-left: 3px solid var(--ink-dim); font-size: .85rem; }
.feed-entry.system { border-left: 3px solid var(--ink-faint); font-size: .8rem; color: var(--ink-dim); font-style: italic; }
.feed-entry .who { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-dim); margin-bottom: .2rem; }
.feed-entry .check-result.success { color: var(--good); }
.feed-entry .check-result.fail { color: var(--bad); }
.feed-entry .check-result.rolling {
  color: var(--gold-bright);
  font-family: 'Cinzel', serif;
  letter-spacing: .02em;
  animation: dice-pulse .12s ease-in-out infinite alternate;
}
@keyframes dice-pulse {
  from { opacity: .6; }
  to { opacity: 1; }
}

.lore-term {
  border-bottom: 1px dotted var(--gold);
  cursor: help;
  color: var(--gold-bright);
}
.lore-popover {
  display: block;
  margin: .5rem 0 .2rem;
  padding: .6rem .8rem;
  background: #1a1512;
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  font-size: .82rem;
  line-height: 1.5;
}
.lore-popover strong {
  font-family: 'Cinzel', serif;
  color: var(--gold-bright);
  display: block;
  margin-bottom: .3rem;
}
.lore-popover p { margin: 0; color: var(--ink-dim); }

.status-line { display: flex; gap: .5rem; align-items: center; font-size: .8rem; color: var(--ink-dim); margin-bottom: 1rem; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-faint); }
.dot.on { background: var(--good); box-shadow: 0 0 6px var(--good); }
.dot.off { background: var(--bad); }

.skills-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .4rem .8rem; font-size: .85rem; }
.skills-list .skill { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px dotted var(--border); padding-bottom: .15rem; }
.skills-list .skill .val { color: var(--gold-bright); font-family: 'Cinzel', serif; }

.spend-btn {
  padding: .15rem .5rem;
  font-size: .75rem;
  line-height: 1.2;
  margin-left: .4rem;
}

.action-bar { display: flex; gap: .5rem; position: sticky; bottom: 0; padding-top: .8rem; background: linear-gradient(180deg, transparent, var(--bg) 30%); }
.action-bar input { flex: 1; }

.dice-quick { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .5rem; }
.dice-quick button { padding: .4rem .7rem; font-size: .75rem; }

.empty-state { text-align: center; color: var(--ink-faint); padding: 2rem 1rem; font-size: .9rem; }

.top-nav { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 1rem; }
.top-nav a { font-size: .8rem; color: var(--ink-dim); text-decoration: none; }
.top-nav a:hover { color: var(--gold-bright); }

@media (max-width: 640px) {
  .container { padding: 1rem .8rem 5rem; }
  .char-card { flex-direction: column; }
  .portrait.large { max-width: 100%; height: 240px; }
}
