/* La Mesa del Dragón — estilo "fantasía nocturna con oro" */
:root {
  --bg: #0e0c14;
  --bg-2: #15121e;
  --panel: #1b1727;
  --panel-2: #231e33;
  --panel-3: #2c2640;
  --line: #3a3252;
  --line-gold: #6b5520;
  --text: #f1e9d6;
  --text-2: #c9bfa8;
  --muted: #8f86a3;
  --gold: #e2b84a;
  --gold-2: #c9962a;
  --gold-soft: rgba(226, 184, 74, .14);
  --red: #e0576a;
  --green: #5fca86;
  --blue: #5fb3e8;
  --purple: #a983f0;
  --parchment: #f3e6c4;
  --parchment-ink: #3b2a14;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --font-title: 'Cinzel', 'Georgia', serif;
  --font-body: 'Nunito', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(169, 131, 240, .13), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(226, 184, 74, .10), transparent 60%),
    radial-gradient(800px 600px at 50% 120%, rgba(95, 179, 232, .08), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--gold); }
h1, h2, h3, h4 { font-family: var(--font-title); letter-spacing: .02em; margin: 0 0 .4em; line-height: 1.2; }
h1 { font-size: 2rem; } h2 { font-size: 1.45rem; } h3 { font-size: 1.15rem; }
p { margin: 0 0 .8em; }
small, .muted { color: var(--muted); }
.hidden { display: none !important; }
::selection { background: rgba(226, 184, 74, .35); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #3a3252; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- botones y formularios ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45em;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  padding: .6em 1.05em; border-radius: 10px; font: 700 .95rem var(--font-body); cursor: pointer;
  transition: transform .12s ease, background .15s, border-color .15s, box-shadow .15s; white-space: nowrap;
  text-decoration: none;
}
.btn:hover { background: var(--panel-3); border-color: #51476f; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.gold {
  background: linear-gradient(180deg, #f0cb63, #c9962a); color: #2a1d05; border-color: #f4d67f;
  box-shadow: 0 4px 16px rgba(226, 184, 74, .25), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.btn.gold:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.danger { border-color: #6d2a37; color: #ffb3bf; }
.btn.danger:hover { background: #3a1820; }
.btn.small { padding: .35em .7em; font-size: .85rem; border-radius: 8px; }
.btn.icon { padding: .45em .6em; }
.btn.block { width: 100%; }
.btn.active { border-color: var(--gold); background: var(--gold-soft); color: var(--gold); }

label.field { display: block; margin-bottom: .9em; }
label.field > span { display: block; font-weight: 700; font-size: .85rem; color: var(--text-2); margin-bottom: .3em; }
input, textarea, select {
  width: 100%; background: #120f1b; color: var(--text); border: 1px solid var(--line); border-radius: 10px;
  padding: .65em .8em; font: 600 .95rem var(--font-body); transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 80px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--gold-2); box-shadow: 0 0 0 3px rgba(226, 184, 74, .15); }
.hint { font-size: .82rem; color: var(--muted); margin-top: .25em; }
.error-text { color: #ff9aa9; font-weight: 700; font-size: .9rem; min-height: 1.2em; }

.row { display: flex; gap: .6rem; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: .7rem; }

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .025), transparent 40%), var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; box-shadow: var(--shadow);
}
.badge {
  display: inline-flex; align-items: center; gap: .3em; font-size: .75rem; font-weight: 800; letter-spacing: .02em;
  padding: .18em .6em; border-radius: 99px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text-2);
}
.badge.gold { border-color: var(--line-gold); color: var(--gold); background: var(--gold-soft); }
.badge.ai { border-color: #4b3a7a; color: #cdb6ff; background: rgba(169, 131, 240, .14); }
.badge.green { border-color: #2e6a48; color: #9be7b8; background: rgba(95, 202, 134, .12); }
.badge.red { border-color: #6d2a37; color: #ffb3bf; background: rgba(224, 87, 106, .12); }

/* ---------- barra superior ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 1rem;
  padding: .6rem 1.2rem; background: rgba(14, 12, 20, .82); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--text); }
.brand img { width: 34px; height: 34px; }
.brand b { font-family: var(--font-title); font-size: 1.15rem; letter-spacing: .04em; }
.brand b span { color: var(--gold); }
.nav { display: flex; gap: .25rem; }
.nav a {
  color: var(--text-2); text-decoration: none; font-weight: 700; padding: .45em .85em; border-radius: 9px;
}
.nav a:hover { background: var(--panel-2); color: var(--text); }
.nav a.active { color: var(--gold); background: var(--gold-soft); }
.user-chip {
  display: flex; align-items: center; gap: .5rem; padding: .3em .4em .3em .8em; border-radius: 99px;
  border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-weight: 700;
}
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }

.page { max-width: 1180px; margin: 0 auto; padding: 1.6rem 1.2rem 4rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; flex-wrap: wrap; }
.page-head p { color: var(--text-2); margin: 0; }

/* ---------- autenticación ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; padding: 3rem;
  background:
    radial-gradient(600px 400px at 30% 30%, rgba(226, 184, 74, .25), transparent 60%),
    radial-gradient(500px 500px at 80% 80%, rgba(169, 131, 240, .25), transparent 60%),
    linear-gradient(160deg, #1d1630, #0d0b13);
  border-right: 1px solid var(--line);
}
.auth-hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.auth-hero .hero-text { position: relative; z-index: 2; max-width: 520px; }
.auth-hero h1 { font-size: clamp(2rem, 4vw, 3.2rem); font-weight: 900; text-shadow: 0 4px 24px rgba(0, 0, 0, .6); }
.auth-hero h1 span { color: var(--gold); }
.auth-hero p { color: var(--text-2); font-size: 1.08rem; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 2rem 1.2rem; }
.auth-box { width: 100%; max-width: 400px; }
.tabs { display: flex; gap: .3rem; background: var(--bg-2); border: 1px solid var(--line); padding: .3rem; border-radius: 12px; margin-bottom: 1.2rem; }
.tabs button {
  flex: 1; border: 0; background: transparent; color: var(--text-2); font: 800 .92rem var(--font-body);
  padding: .55em .6em; border-radius: 9px; cursor: pointer;
}
.tabs button.active { background: var(--panel-3); color: var(--gold); }

/* ---------- gestor de partidas ---------- */
.games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.1rem; }
.game-card {
  position: relative; display: flex; flex-direction: column; gap: .7rem; min-height: 220px; overflow: hidden;
  transition: transform .18s ease, border-color .18s, box-shadow .18s;
}
.game-card:hover { transform: translateY(-3px); border-color: #5b4d82; box-shadow: 0 16px 40px rgba(0, 0, 0, .55); }
.game-card .banner {
  margin: -1.1rem -1.1rem .2rem; height: 86px; position: relative;
  background-size: cover; background-position: center; border-bottom: 1px solid var(--line);
}
.game-card .banner::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 30%, rgba(27, 23, 39, .95)); }
.game-card h3 { margin: 0; }
.game-card .desc { color: var(--text-2); font-size: .9rem; flex: 1; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.game-card .meta { display: flex; flex-wrap: wrap; gap: .4rem; }
.game-card .actions { display: flex; gap: .5rem; align-items: center; }
.empty {
  text-align: center; padding: 3rem 1rem; border: 2px dashed var(--line); border-radius: var(--radius); color: var(--text-2);
}
.empty .big { font-size: 3rem; }

/* ---------- personajes ---------- */
.char-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.char-card { display: flex; gap: .9rem; align-items: center; }
.char-card canvas { width: 96px; height: 96px; border-radius: 50%; background: var(--bg-2); flex: none; }
.char-card h3 { margin: 0 0 .15em; }

/* ---------- creador ---------- */
.creator { display: grid; grid-template-columns: 300px 1fr; gap: 1.4rem; align-items: start; }
.creator-side { position: sticky; top: 80px; }
.creator-side > div { min-width: 0; }
.creator-side canvas { width: 100%; max-width: 100%; aspect-ratio: 1; border-radius: var(--radius); background: var(--bg-2); display: block; }
.steps { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: 1rem; }
.steps button {
  border: 1px solid var(--line); background: var(--panel); color: var(--text-2); border-radius: 99px;
  font: 800 .8rem var(--font-body); padding: .4em .8em; cursor: pointer;
}
.steps button.done { color: var(--green); border-color: #2e6a48; }
.steps button.current { color: #2a1d05; background: var(--gold); border-color: var(--gold); }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .8rem; }
.choice {
  text-align: left; border: 1px solid var(--line); background: var(--panel); color: var(--text);
  border-radius: var(--radius); padding: .9rem; cursor: pointer; transition: border-color .15s, transform .15s, background .15s;
  font: inherit;
}
.choice:hover { border-color: #5b4d82; transform: translateY(-2px); }
.choice.selected { border-color: var(--gold); background: linear-gradient(180deg, var(--gold-soft), transparent), var(--panel); box-shadow: 0 0 0 1px var(--gold) inset; }
.choice h4 { margin: 0 0 .25em; font-size: 1.02rem; display: flex; align-items: center; gap: .5em; }
.choice p { font-size: .86rem; color: var(--text-2); margin: 0; }
.choice .swatch { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.explain {
  background: linear-gradient(90deg, rgba(95, 179, 232, .12), transparent); border-left: 3px solid var(--blue);
  padding: .7rem .9rem; border-radius: 0 10px 10px 0; color: var(--text-2); margin-bottom: 1rem; font-size: .92rem;
}
.explain b { color: var(--text); }
.detail-box { margin-top: 1rem; }
.feature { padding: .55rem 0; border-bottom: 1px dashed var(--line); }
.feature:last-child { border-bottom: 0; }
.feature b { color: var(--gold); }
.ability-assign { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; }
.ability-box {
  border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem; background: var(--panel); text-align: center;
}
.ability-box .name { font-weight: 800; font-size: .85rem; color: var(--text-2); }
.ability-box .score { font: 900 2rem var(--font-title); color: var(--text); }
.ability-box .mod { font-weight: 800; color: var(--gold); }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--panel); color: var(--text-2); border-radius: 99px;
  padding: .35em .8em; cursor: pointer; font: 700 .85rem var(--font-body);
}
.chip.selected { border-color: var(--gold); color: var(--gold); background: var(--gold-soft); }
.chip:disabled { opacity: .4; cursor: not-allowed; }
.color-row { display: flex; gap: .35rem; flex-wrap: wrap; }
.color-row button { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.color-row button.selected { border-color: #fff; box-shadow: 0 0 0 2px var(--gold); }
.wizard-nav { display: flex; justify-content: space-between; margin-top: 1.4rem; gap: .6rem; }

/* ---------- mesa de juego ---------- */
.table-wrap { height: 100vh; display: grid; grid-template-rows: auto 1fr; overflow: hidden; }
.table-top {
  display: flex; align-items: center; gap: .8rem; padding: .5rem .8rem; border-bottom: 1px solid var(--line);
  background: rgba(14, 12, 20, .9); min-height: 54px;
}
.table-top h2 { margin: 0; font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.online { display: flex; align-items: center; }
.online .av {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: .8rem;
  color: #1a1424; border: 2px solid var(--bg); margin-left: -6px; position: relative;
}
.online .av.off { filter: grayscale(1) brightness(.5); }
.table-body { display: grid; grid-template-columns: 1fr 400px; min-height: 0; }
.map-area { position: relative; min-width: 0; min-height: 0; background: #07060b; overflow: hidden; }
.map-area > canvas.map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.map-toolbar {
  position: absolute; left: 12px; top: 12px; display: flex; gap: .35rem; z-index: 20; flex-wrap: wrap; max-width: calc(100% - 24px);
}
.map-toolbar .btn { background: rgba(27, 23, 39, .88); backdrop-filter: blur(6px); }
.emote-bar {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 20; display: flex; gap: .25rem;
  background: rgba(27, 23, 39, .88); border: 1px solid var(--line); border-radius: 99px; padding: .3rem .4rem; backdrop-filter: blur(6px);
}
.emote-bar button {
  border: 0; background: transparent; font-size: 1.25rem; width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
  transition: transform .12s, background .12s;
}
.emote-bar button:hover { transform: scale(1.18); background: var(--panel-3); }
.combat-strip {
  position: absolute; top: 12px; right: 12px; z-index: 20; display: flex; align-items: center; gap: .35rem;
  background: rgba(27, 23, 39, .9); border: 1px solid #6d2a37; border-radius: 12px; padding: .35rem .5rem; max-width: 60%;
  overflow-x: auto; backdrop-filter: blur(6px);
}
.combat-strip .ct {
  display: flex; flex-direction: column; align-items: center; min-width: 54px; padding: .2rem .3rem; border-radius: 8px;
  font-size: .72rem; font-weight: 800; color: var(--text-2); border: 1px solid transparent;
}
.combat-strip .ct .n { max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combat-strip .ct.now { border-color: var(--gold); color: var(--gold); background: var(--gold-soft); }
.combat-strip .ct.down { opacity: .45; text-decoration: line-through; }
.token-pop {
  position: absolute; z-index: 30; min-width: 220px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); padding: .7rem;
}
.ai-thinking {
  position: absolute; bottom: 70px; left: 50%; transform: translateX(-50%); z-index: 25; padding: .45rem .9rem;
  border-radius: 99px; background: rgba(43, 30, 72, .92); border: 1px solid #5c4791; color: #dccbff; font-weight: 800; font-size: .88rem;
  display: flex; align-items: center; gap: .5rem;
}
.ai-thinking i { width: 8px; height: 8px; border-radius: 50%; background: #cdb6ff; animation: blink 1.2s infinite; }
.ai-thinking i:nth-child(2) { animation-delay: .2s; } .ai-thinking i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2 } 40% { opacity: 1 } }

.target-banner {
  position: absolute; left: 50%; top: 64px; transform: translateX(-50%); z-index: 40; display: flex; align-items: center; gap: .6rem;
  padding: .55rem .9rem; border-radius: 12px; background: rgba(60, 20, 20, .92); border: 1px solid #e0576a; color: #ffe0e4;
  font-weight: 700; font-size: .9rem; box-shadow: var(--shadow); max-width: calc(100% - 24px); flex-wrap: wrap; justify-content: center;
  animation: pulse-border 1.4s ease-in-out infinite;
}
@keyframes pulse-border { 50% { box-shadow: 0 0 0 4px rgba(224, 87, 106, .25), var(--shadow); } }
.map-area.targeting canvas.map { cursor: crosshair; }
.fx-banner {
  position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%); z-index: 35; pointer-events: none;
  font: 900 1.6rem var(--font-title); color: #fff; text-shadow: 0 3px 14px rgba(0, 0, 0, .8), 0 0 2px #000;
  animation: fx-pop .35s ease-out; white-space: nowrap;
}
.fx-banner small { font: 800 1rem var(--font-body); color: #f1e9d6; }
@keyframes fx-pop { from { transform: translate(-50%, -50%) scale(.6); opacity: 0; } }

.side { display: grid; grid-template-rows: auto 1fr auto; min-height: 0; border-left: 1px solid var(--line); background: var(--bg-2); }
.side-tabs { display: flex; border-bottom: 1px solid var(--line); }
.side-tabs button {
  flex: 1; border: 0; background: transparent; color: var(--muted); font: 800 .85rem var(--font-body); padding: .75rem .3rem; cursor: pointer;
  border-bottom: 2px solid transparent; position: relative;
}
.side-tabs button.active { color: var(--gold); border-bottom-color: var(--gold); }
.side-tabs button .pip { position: absolute; top: 8px; right: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.side-body { overflow-y: auto; min-height: 0; padding: .8rem; }

/* chat */
.chat { display: flex; flex-direction: column; gap: .55rem; }
.msg { font-size: .93rem; animation: pop .25s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) } to { opacity: 1; transform: none } }
.msg .who { font-weight: 800; font-size: .8rem; }
.msg .time { font-size: .7rem; color: var(--muted); margin-left: .4em; }
.msg.ooc { color: var(--text-2); }
.msg.ooc .body { background: var(--panel); border-radius: 4px 12px 12px 12px; padding: .4rem .65rem; display: inline-block; max-width: 100%; }
.msg.ic .body {
  background: linear-gradient(180deg, rgba(95, 179, 232, .14), rgba(95, 179, 232, .06)); border: 1px solid rgba(95, 179, 232, .3);
  border-radius: 4px 12px 12px 12px; padding: .5rem .7rem; font-style: italic;
}
.msg.narr {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .25), transparent 30%),
    var(--parchment);
  color: var(--parchment-ink); border-radius: 6px; padding: .8rem .95rem; position: relative;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .35); font-family: 'Georgia', serif; font-size: .95rem; line-height: 1.55;
  border: 1px solid #d8c595;
}
.msg.narr .who { color: #7a4f10; font-family: var(--font-title); font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; }
.msg.narr.ai .who { color: #5b3b9a; }
.msg.narr p { margin: .35em 0; }
.msg.system { text-align: center; color: var(--muted); font-size: .82rem; font-weight: 700; }
.msg.roll {
  display: flex; gap: .6rem; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: .5rem .65rem;
  border-left: 4px solid var(--rc, var(--gold));
}
.msg.roll .total { font: 900 1.6rem var(--font-title); min-width: 2ch; text-align: center; }
.msg.roll.crit-hit { box-shadow: 0 0 0 1px var(--gold), 0 0 18px rgba(226, 184, 74, .35); }
.msg.roll.crit-hit .total { color: var(--gold); }
.msg.roll.crit-miss .total { color: var(--red); }
.msg.roll .dice { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 2px; }
.die-mini {
  font-size: .72rem; font-weight: 900; min-width: 22px; height: 22px; padding: 0 4px; display: grid; place-items: center; border-radius: 6px;
  background: var(--panel-3); border: 1px solid #4a4065;
}
.die-mini.dropped { opacity: .35; text-decoration: line-through; }
.outcome { font-weight: 900; font-size: .8rem; }
.outcome.success { color: var(--green); } .outcome.failure { color: var(--red); }
.check-req {
  border: 1px solid var(--line-gold); background: linear-gradient(180deg, var(--gold-soft), transparent); border-radius: 12px; padding: .6rem .7rem;
}
.composer { border-top: 1px solid var(--line); padding: .6rem; background: var(--panel); }
.composer textarea { min-height: 44px; max-height: 140px; resize: none; }
.mode-toggle { display: flex; gap: .3rem; margin-bottom: .45rem; }
.mode-toggle button {
  flex: 1; border: 1px solid var(--line); background: var(--bg-2); color: var(--text-2); border-radius: 9px; padding: .35em; cursor: pointer;
  font: 800 .8rem var(--font-body);
}
.mode-toggle button.active.ic { border-color: var(--blue); color: #bfe4ff; background: rgba(95, 179, 232, .14); }
.mode-toggle button.active.ooc { border-color: var(--muted); color: var(--text); background: var(--panel-3); }
.dice-tray { display: flex; gap: .3rem; flex-wrap: wrap; align-items: center; margin-top: .5rem; }
.dice-tray .dbtn {
  border: 1px solid var(--line); background: var(--bg-2); color: var(--text); border-radius: 9px; padding: .3em .5em; cursor: pointer;
  font: 900 .8rem var(--font-body); display: inline-flex; align-items: center; gap: .25em;
}
.dice-tray .dbtn:hover { border-color: var(--gold-2); color: var(--gold); }
.dice-tray .dbtn svg { width: 16px; height: 16px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg button { border: 0; background: var(--bg-2); color: var(--text-2); font: 800 .75rem var(--font-body); padding: .38em .55em; cursor: pointer; }
.seg button.active { background: var(--gold-soft); color: var(--gold); }

/* hoja */
.sheet-head { display: flex; gap: .8rem; align-items: center; margin-bottom: .8rem; }
.sheet-head canvas { width: 76px; height: 76px; border-radius: 50%; background: var(--panel); flex: none; }
.hpbar { height: 12px; border-radius: 99px; background: #2b1720; overflow: hidden; border: 1px solid #4a2633; }
.hpbar > i { display: block; height: 100%; background: linear-gradient(90deg, #d8445b, #f0687c); transition: width .4s; }
.hpbar.ok > i { background: linear-gradient(90deg, #3fae6a, #6fdb94); }
.hpbar.mid > i { background: linear-gradient(90deg, #d79b2c, #f3c457); }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; margin: .7rem 0; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; text-align: center; padding: .35rem .2rem;
}
.stat b { display: block; font: 900 1.15rem var(--font-title); }
.stat span { font-size: .68rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.abil-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
.abil {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; text-align: center; padding: .4rem .2rem; cursor: pointer;
  transition: border-color .12s, transform .12s; color: var(--text); font: inherit;
}
.abil:hover { border-color: var(--gold-2); transform: translateY(-1px); }
.abil .lbl { font-size: .7rem; font-weight: 900; color: var(--muted); }
.abil .m { font: 900 1.3rem var(--font-title); color: var(--gold); }
.abil .s { font-size: .75rem; color: var(--text-2); }
.section-title { font: 800 .74rem var(--font-body); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 1rem 0 .4rem; }
.list-rows { display: flex; flex-direction: column; }
.list-rows button.rowbtn {
  display: flex; align-items: center; gap: .5rem; border: 0; background: transparent; color: var(--text); text-align: left;
  padding: .32rem .4rem; border-radius: 8px; cursor: pointer; font: 600 .88rem var(--font-body);
}
.list-rows button.rowbtn:hover { background: var(--panel-2); }
.list-rows .mod { margin-left: auto; font-weight: 900; color: var(--gold); min-width: 2.5em; text-align: right; }
.prof-dot { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--muted); flex: none; }
.prof-dot.on { background: var(--gold); border-color: var(--gold); }
details.box { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: .5rem .7rem; margin-bottom: .4rem; }
details.box summary { cursor: pointer; font-weight: 800; }
details.box p { font-size: .87rem; color: var(--text-2); margin: .4em 0 0; }

/* modal y avisos */
.modal-back {
  position: fixed; inset: 0; background: rgba(5, 4, 9, .7); backdrop-filter: blur(4px); z-index: 200; display: grid; place-items: center; padding: 1rem;
  animation: fade .15s ease;
}
@keyframes fade { from { opacity: 0 } }
.modal { width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; animation: rise .2s ease; }
@keyframes rise { from { transform: translateY(12px); opacity: 0 } }
.modal .modal-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }
#toasts { position: fixed; bottom: 18px; right: 18px; z-index: 300; display: flex; flex-direction: column; gap: .5rem; }
.toast {
  background: var(--panel-2); border: 1px solid var(--line); border-left: 4px solid var(--gold); padding: .65rem .9rem; border-radius: 10px;
  box-shadow: var(--shadow); max-width: 360px; font-weight: 700; animation: rise .2s ease;
}
.toast.error { border-left-color: var(--red); }
.toast.ok { border-left-color: var(--green); }
.code-box {
  font: 900 1.6rem var(--font-title); letter-spacing: .2em; text-align: center; padding: .6rem; border-radius: 12px;
  background: var(--bg-2); border: 1px dashed var(--line-gold); color: var(--gold); user-select: all;
}
table.simple { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.simple th, table.simple td { text-align: left; padding: .5rem; border-bottom: 1px solid var(--line); }
table.simple th { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; }

.loading { display: grid; place-items: center; min-height: 60vh; color: var(--muted); font-weight: 800; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--gold); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto .8rem; }
@keyframes spin { to { transform: rotate(360deg) } }

/* ---------- adaptable ---------- */
@media (max-width: 1100px) {
  .table-body { grid-template-columns: 1fr 340px; }
}
@media (max-width: 900px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { min-height: 240px; padding: 1.6rem; border-right: 0; border-bottom: 1px solid var(--line); }
  .creator { grid-template-columns: 1fr; }
  .creator-side { position: static; display: grid; grid-template-columns: 140px 1fr; gap: 1rem; align-items: center; }
  .table-body { grid-template-columns: 1fr; grid-template-rows: 55vh 1fr; }
  .side { border-left: 0; border-top: 1px solid var(--line); }
  .combat-strip { top: auto; bottom: 12px; left: 12px; right: 12px; max-width: none; }
  .emote-bar { bottom: 74px; }
  .nav a { padding: .45em .55em; }
}
@media (max-width: 640px) {
  .topbar { gap: .5rem; padding: .5rem 1rem; flex-wrap: wrap; }
  .brand b { display: none; }
  .page { padding: 1.1rem 1rem 3rem; }
  .user-chip .uname { display: none; }
}
