Fix issue #64: More modifications to the character sheet
Some checks failed
Test / test (push) Failing after 2s

This commit is contained in:
Gitea OpenCode Agent
2026-10-15 15:01:35 +00:00
parent cdafd1f53a
commit 8418b5c254
8 changed files with 400 additions and 133 deletions

View File

@@ -34,6 +34,11 @@ const tabs = [
];
const activeTab = ref('abilities');
// Les pestanyes pengen del marc de la finestra, per fora del contingent (vegeu .sheet-tabs). La
// finestra es fa més estreta perquè el marge que la centra sigui prou ample per aguantar-les;
// per sota de 760px el marc les fa estar a dins i el marge deixa de fer falta.
const TAB_RAIL_WIDTH = 150;
function normalizeActor(actor) {
return {
name: actor?.name ?? '',
@@ -44,6 +49,16 @@ function normalizeActor(actor) {
abilityScores: Object.fromEntries(abilityStats.map(({ key }) => [key, Number(actor?.abilityScores?.[key] ?? 10)])),
armorClass: Number(actor?.armorClass ?? 10),
speed: Number(actor?.speed ?? 30),
// Les barres sota la imatge: `current` de `max`. Un personatge que encara no en té
// rep un dau de cop per nivell, que és el que D&D compta.
hitPoints: {
current: Number(actor?.hitPoints?.current ?? actor?.hitPoints?.max ?? 10),
max: Number(actor?.hitPoints?.max ?? actor?.hitPoints?.current ?? 10)
},
hitDice: {
current: Number(actor?.hitDice?.current ?? actor?.level ?? 1),
max: Number(actor?.hitDice?.max ?? actor?.level ?? 1)
},
proficiencies: actor?.proficiencies ?? '',
inventory: (actor?.inventory ?? []).map((item) => ({
name: item.name ?? '', quantity: Number(item.quantity ?? 1), weight: Number(item.weight ?? 0)
@@ -60,8 +75,11 @@ original.value = normalizeActor(props.data.actor);
onMounted(() => {
Top(wrapper);
SetupHandle(id, handle);
// Les pestanyes pengen del marc per fora del cos: com que la finestra es centra, el marge que
// li queda a la dreta és la meitat del que li sobra, i cal reservar-nos el doble.
const railRoom = window.innerWidth > 760 ? 2 * TAB_RAIL_WIDTH : 0;
SetSize(id, {
width: Math.max(320, Math.min(900, window.innerWidth - 24)),
width: Math.max(320, Math.min(900, window.innerWidth - 24 - railRoom)),
height: Math.max(360, Math.min(700, window.innerHeight - 32))
});
ResetPosition(id, 'center');
@@ -79,6 +97,15 @@ onMounted(() => emitter.on('campaign-entry-updated', handleActorSync));
onBeforeUnmount(() => emitter.off('campaign-entry-updated', handleActorSync));
const proficiencyBonus = computed(() => Math.ceil(form.value.level / 4) + 1);
// La iniciativa és el modificador de DESTÀ, que és el que D&D compta quan el personatge no
// porta cap do extra que l'augmenti.
const initiativeBonus = computed(() => abilityModifier(form.value.abilityScores.dex));
// Quina part del màxim representa la barra; buida (màxim 0) o per sobre, tot tallat.
function barPercent(current, max) {
return max > 0 ? Math.min(100, Math.max(0, ((Number(current) || 0) / max) * 100)) : 0;
}
const hitPointsPercent = computed(() => barPercent(form.value.hitPoints.current, form.value.hitPoints.max));
const hitDicePercent = computed(() => barPercent(form.value.hitDice.current, form.value.hitDice.max));
const carryingCapacity = computed(() => form.value.abilityScores.str * 15);
const carriedWeight = computed(() => form.value.inventory.reduce((total, item) => total + (Number(item.quantity) || 0) * (Number(item.weight) || 0), 0));
const carryPercent = computed(() => Math.min(100, carryingCapacity.value ? (carriedWeight.value / carryingCapacity.value) * 100 : 0));
@@ -179,6 +206,21 @@ async function saveSheet() {
<template>
<div class="window-wrapper sheet-window" :id="'window-wrapper-' + id" ref="wrapper">
<WindowHandle :window="id" ref="handle" />
<!-- Pestilletes del marc de la finestra: pengen del cantó dret, per fora del
contingent, i no s'enrolen quan la fitxa desfila. -->
<nav class="sheet-tabs" role="tablist" aria-orientation="vertical">
<button
v-for="tab in tabs"
:key="tab.key"
class="sheet-tab"
:class="{ active: activeTab === tab.key }"
type="button"
role="tab"
:aria-selected="activeTab === tab.key"
@click="activeTab = tab.key"
>{{ $t(tab.label) }}</button>
</nav>
<div class="sheet-body">
<header class="sheet-hero">
<div class="character-mark" aria-hidden="true">{{ form.name.slice(0, 1).toUpperCase() }}</div>
@@ -217,124 +259,143 @@ async function saveSheet() {
<div v-if="error" class="sheet-error">{{ error }}</div>
<div class="sheet-layout">
<div class="sheet-content">
<main v-show="activeTab === 'abilities'" class="sheet-grid">
<div v-if="form.image || editing" class="sheet-portrait" :class="{ empty: !form.image }">
<img v-if="form.image" :src="imageUrl" :alt="$t('campaigns.character-sheet.photo')">
<button v-if="editing && !form.image" class="portrait-upload" type="button" :disabled="uploadingPhoto" @click="pickPhoto">
{{ uploadingPhoto ? $t('campaigns.character-sheet.uploading-photo') : $t('campaigns.character-sheet.upload-photo') }}
<main v-show="activeTab === 'abilities'" class="sheet-grid">
<div class="character-column">
<div v-if="form.image || editing" class="sheet-portrait" :class="{ empty: !form.image }">
<img v-if="form.image" :src="imageUrl" :alt="$t('campaigns.character-sheet.photo')">
<button v-if="editing && !form.image" class="portrait-upload" type="button" :disabled="uploadingPhoto" @click="pickPhoto">
{{ uploadingPhoto ? $t('campaigns.character-sheet.uploading-photo') : $t('campaigns.character-sheet.upload-photo') }}
</button>
<div v-if="editing && form.image" class="portrait-controls">
<button type="button" :disabled="uploadingPhoto" @click="pickPhoto">
{{ uploadingPhoto ? $t('campaigns.character-sheet.uploading-photo') : $t('campaigns.character-sheet.change-photo') }}
</button>
<div v-if="editing && form.image" class="portrait-controls">
<button type="button" :disabled="uploadingPhoto" @click="pickPhoto">
{{ uploadingPhoto ? $t('campaigns.character-sheet.uploading-photo') : $t('campaigns.character-sheet.change-photo') }}
</button>
<button type="button" :disabled="uploadingPhoto" :aria-label="$t('campaigns.character-sheet.remove-photo')" @click="removePhoto">×</button>
</div>
<input ref="photoInput" class="photo-input" type="file" accept="image/*" @change="onPhotoSelected">
<button type="button" :disabled="uploadingPhoto" :aria-label="$t('campaigns.character-sheet.remove-photo')" @click="removePhoto">×</button>
</div>
<input ref="photoInput" class="photo-input" type="file" accept="image/*" @change="onPhotoSelected">
</div>
<section class="sheet-panel abilities-panel">
<h2>{{ $t('campaigns.character-sheet.ability-scores') }}</h2>
<div class="ability-grid">
<div v-for="stat in abilityStats" :key="stat.key" class="ability-card">
<span class="ability-label">{{ stat.label }}</span>
<input v-if="editing" v-model.number="form.abilityScores[stat.key]" type="number" min="1" max="30" :aria-label="stat.label">
<strong v-else class="ability-score">{{ form.abilityScores[stat.key] }}</strong>
<span class="ability-modifier">{{ abilityModifier(form.abilityScores[stat.key]) }}</span>
</div>
<!-- El que es mira primer: classe d'armadura, velocitat i els bonificadors
que acompanyen els cops, tot just sota la imatge. -->
<section class="sheet-panel vitals-panel">
<div class="vital-stats">
<div class="vital-stat">
<span>{{ $t('campaigns.character-sheet.armor-class') }}</span>
<input v-if="editing" v-model.number="form.armorClass" type="number" min="0" :aria-label="$t('campaigns.character-sheet.armor-class')">
<strong v-else>{{ form.armorClass }}</strong>
</div>
<div class="proficiency-badge">
<div class="vital-stat">
<span>{{ $t('campaigns.character-sheet.speed') }}</span>
<label v-if="editing" class="number-with-unit"><input v-model.number="form.speed" type="number" min="0" :aria-label="$t('campaigns.character-sheet.speed')"><small>ft</small></label>
<strong v-else>{{ form.speed }} <small>ft</small></strong>
</div>
<div class="vital-stat">
<span>{{ $t('campaigns.character-sheet.proficiency-bonus') }}</span>
<strong>+{{ proficiencyBonus }}</strong>
</div>
</section>
<section class="sheet-panel combat-panel">
<h2>{{ $t('campaigns.character-sheet.combat') }}</h2>
<div class="combat-stats">
<div class="combat-stat">
<span>{{ $t('campaigns.character-sheet.armor-class') }}</span>
<input v-if="editing" v-model.number="form.armorClass" type="number" min="0">
<strong v-else>{{ form.armorClass }}</strong>
</div>
<div class="combat-stat">
<span>{{ $t('campaigns.character-sheet.speed') }}</span>
<label v-if="editing" class="number-with-unit"><input v-model.number="form.speed" type="number" min="0"><small>ft</small></label>
<strong v-else>{{ form.speed }} <small>ft</small></strong>
</div>
<div class="vital-stat">
<span>{{ $t('campaigns.character-sheet.initiative') }}</span>
<strong>{{ initiativeBonus }}</strong>
</div>
<h3>{{ $t('campaigns.character-sheet.proficiencies') }}</h3>
<textarea v-if="editing" v-model="form.proficiencies" rows="5" :placeholder="$t('campaigns.character-sheet.proficiencies-placeholder')" />
<p v-else class="sheet-copy">{{ form.proficiencies || $t('campaigns.character-sheet.empty-proficiencies') }}</p>
</section>
</main>
</div>
<main v-show="activeTab === 'inventory'" class="sheet-tab-body">
<section class="sheet-panel inventory-panel">
<div class="panel-title-row">
<h2>{{ $t('campaigns.character-sheet.inventory') }}</h2>
<button v-if="editing" class="sheet-button secondary compact" type="button" @click="addInventoryItem">{{ $t('campaigns.character-sheet.add-item') }}</button>
<div class="vital-bar hit-points-bar">
<div class="vital-bar-head">
<span>{{ $t('campaigns.character-sheet.hit-points') }}</span>
<strong v-if="!editing">{{ form.hitPoints.current }} / {{ form.hitPoints.max }}</strong>
<label v-else class="vital-bar-inputs">
<input v-model.number="form.hitPoints.current" type="number" min="0" :aria-label="$t('campaigns.character-sheet.hit-points')">
<span>/</span>
<input v-model.number="form.hitPoints.max" type="number" min="0" :aria-label="$t('campaigns.character-sheet.max-hit-points')">
</label>
</div>
<div class="weight-summary">
<span>{{ $t('campaigns.character-sheet.carried-weight') }}</span>
<strong>{{ carriedWeight.toFixed(1) }} / {{ carryingCapacity }} lb</strong>
</div>
<div class="weight-track"><div class="weight-fill" :style="{ width: `${carryPercent}%` }" /></div>
<div class="inventory-table-wrap">
<table class="inventory-table">
<thead><tr>
<th>{{ $t('campaigns.character-sheet.item-name') }}</th>
<th>{{ $t('campaigns.character-sheet.quantity') }}</th>
<th>{{ $t('campaigns.character-sheet.weight-each') }}</th>
<th>{{ $t('campaigns.character-sheet.total-weight') }}</th>
<th v-if="editing"><span class="sr-only">{{ $t('campaigns.character-sheet.actions') }}</span></th>
</tr></thead>
<tbody>
<tr v-for="(item, index) in form.inventory" :key="index">
<td><input v-if="editing" v-model="item.name" :aria-label="$t('campaigns.character-sheet.item-name')"><span v-else>{{ item.name }}</span></td>
<td><input v-if="editing" v-model.number="item.quantity" type="number" min="1" :aria-label="$t('campaigns.character-sheet.quantity')"><span v-else>{{ item.quantity }}</span></td>
<td><input v-if="editing" v-model.number="item.weight" type="number" min="0" step="0.1" :aria-label="$t('campaigns.character-sheet.weight-each')"><span v-else>{{ Number(item.weight).toFixed(1) }} lb</span></td>
<td>{{ ((Number(item.quantity) || 0) * (Number(item.weight) || 0)).toFixed(1) }} lb</td>
<td v-if="editing"><button class="remove-item" type="button" @click="removeInventoryItem(index)">×</button></td>
</tr>
<tr v-if="form.inventory.length === 0"><td :colspan="editing ? 5 : 4" class="empty-inventory">{{ $t('campaigns.character-sheet.empty-inventory') }}</td></tr>
</tbody>
</table>
</div>
</section>
</main>
<div class="vital-bar-track"><div class="vital-bar-fill" :style="{ width: `${hitPointsPercent}%` }" /></div>
</div>
<main v-show="activeTab === 'traits'" class="sheet-tab-body">
<section class="sheet-panel traits-panel">
<h2>{{ $t('campaigns.character-sheet.traits') }}</h2>
<textarea v-if="editing" v-model="form.traits" rows="12" :placeholder="$t('campaigns.character-sheet.traits-placeholder')" />
<p v-else class="sheet-copy">{{ form.traits || $t('campaigns.character-sheet.empty-traits') }}</p>
</section>
</main>
<main v-show="activeTab === 'spells'" class="sheet-tab-body">
<section class="sheet-panel spells-panel">
<h2>{{ $t('campaigns.character-sheet.spells') }}</h2>
<textarea v-if="editing" v-model="form.spells" rows="12" :placeholder="$t('campaigns.character-sheet.spells-placeholder')" />
<p v-else class="sheet-copy">{{ form.spells || $t('campaigns.character-sheet.empty-spells') }}</p>
</section>
</main>
<div class="vital-bar hit-dice-bar">
<div class="vital-bar-head">
<span>{{ $t('campaigns.character-sheet.hit-dice') }}</span>
<strong v-if="!editing">{{ form.hitDice.current }} / {{ form.hitDice.max }}</strong>
<label v-else class="vital-bar-inputs">
<input v-model.number="form.hitDice.current" type="number" min="0" :aria-label="$t('campaigns.character-sheet.hit-dice')">
<span>/</span>
<input v-model.number="form.hitDice.max" type="number" min="0" :aria-label="$t('campaigns.character-sheet.max-hit-dice')">
</label>
</div>
<div class="vital-bar-track"><div class="vital-bar-fill" :style="{ width: `${hitDicePercent}%` }" /></div>
</div>
</section>
</div>
<nav class="sheet-tabs" role="tablist" aria-orientation="vertical">
<button
v-for="tab in tabs"
:key="tab.key"
class="sheet-tab"
:class="{ active: activeTab === tab.key }"
type="button"
role="tab"
:aria-selected="activeTab === tab.key"
@click="activeTab = tab.key"
>{{ $t(tab.label) }}</button>
</nav>
</div>
<section class="sheet-panel abilities-panel">
<h2>{{ $t('campaigns.character-sheet.ability-scores') }}</h2>
<div class="ability-grid">
<div v-for="stat in abilityStats" :key="stat.key" class="ability-card">
<span class="ability-label">{{ stat.label }}</span>
<input v-if="editing" v-model.number="form.abilityScores[stat.key]" type="number" min="1" max="30" :aria-label="stat.label">
<strong v-else class="ability-score">{{ form.abilityScores[stat.key] }}</strong>
<span class="ability-modifier">{{ abilityModifier(form.abilityScores[stat.key]) }}</span>
</div>
</div>
</section>
<section class="sheet-panel proficiencies-panel">
<h2>{{ $t('campaigns.character-sheet.proficiencies') }}</h2>
<textarea v-if="editing" v-model="form.proficiencies" rows="7" :placeholder="$t('campaigns.character-sheet.proficiencies-placeholder')" />
<p v-else class="sheet-copy">{{ form.proficiencies || $t('campaigns.character-sheet.empty-proficiencies') }}</p>
</section>
</main>
<main v-show="activeTab === 'inventory'" class="sheet-tab-body">
<section class="sheet-panel inventory-panel">
<div class="panel-title-row">
<h2>{{ $t('campaigns.character-sheet.inventory') }}</h2>
<button v-if="editing" class="sheet-button secondary compact" type="button" @click="addInventoryItem">{{ $t('campaigns.character-sheet.add-item') }}</button>
</div>
<div class="weight-summary">
<span>{{ $t('campaigns.character-sheet.carried-weight') }}</span>
<strong>{{ carriedWeight.toFixed(1) }} / {{ carryingCapacity }} lb</strong>
</div>
<div class="weight-track"><div class="weight-fill" :style="{ width: `${carryPercent}%` }" /></div>
<div class="inventory-table-wrap">
<table class="inventory-table">
<thead><tr>
<th>{{ $t('campaigns.character-sheet.item-name') }}</th>
<th>{{ $t('campaigns.character-sheet.quantity') }}</th>
<th>{{ $t('campaigns.character-sheet.weight-each') }}</th>
<th>{{ $t('campaigns.character-sheet.total-weight') }}</th>
<th v-if="editing"><span class="sr-only">{{ $t('campaigns.character-sheet.actions') }}</span></th>
</tr></thead>
<tbody>
<tr v-for="(item, index) in form.inventory" :key="index">
<td><input v-if="editing" v-model="item.name" :aria-label="$t('campaigns.character-sheet.item-name')"><span v-else>{{ item.name }}</span></td>
<td><input v-if="editing" v-model.number="item.quantity" type="number" min="1" :aria-label="$t('campaigns.character-sheet.quantity')"><span v-else>{{ item.quantity }}</span></td>
<td><input v-if="editing" v-model.number="item.weight" type="number" min="0" step="0.1" :aria-label="$t('campaigns.character-sheet.weight-each')"><span v-else>{{ Number(item.weight).toFixed(1) }} lb</span></td>
<td>{{ ((Number(item.quantity) || 0) * (Number(item.weight) || 0)).toFixed(1) }} lb</td>
<td v-if="editing"><button class="remove-item" type="button" @click="removeInventoryItem(index)">×</button></td>
</tr>
<tr v-if="form.inventory.length === 0"><td :colspan="editing ? 5 : 4" class="empty-inventory">{{ $t('campaigns.character-sheet.empty-inventory') }}</td></tr>
</tbody>
</table>
</div>
</section>
</main>
<main v-show="activeTab === 'traits'" class="sheet-tab-body">
<section class="sheet-panel traits-panel">
<h2>{{ $t('campaigns.character-sheet.traits') }}</h2>
<textarea v-if="editing" v-model="form.traits" rows="12" :placeholder="$t('campaigns.character-sheet.traits-placeholder')" />
<p v-else class="sheet-copy">{{ form.traits || $t('campaigns.character-sheet.empty-traits') }}</p>
</section>
</main>
<main v-show="activeTab === 'spells'" class="sheet-tab-body">
<section class="sheet-panel spells-panel">
<h2>{{ $t('campaigns.character-sheet.spells') }}</h2>
<textarea v-if="editing" v-model="form.spells" rows="12" :placeholder="$t('campaigns.character-sheet.spells-placeholder')" />
<p v-else class="sheet-copy">{{ form.spells || $t('campaigns.character-sheet.empty-spells') }}</p>
</section>
</main>
</div>
</div>
</template>
@@ -359,15 +420,15 @@ async function saveSheet() {
.sheet-button:disabled { opacity: .55; cursor: wait; }
.sheet-button.compact { padding: 5px 9px; font-size: 12px; }
.sheet-grid { display: grid; grid-template-columns: minmax(200px, 34%) minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto auto; gap: 11px; align-items: start; }
.sheet-layout { display: flex; align-items: flex-start; gap: 10px; }
.sheet-content { flex: 1 1 auto; min-width: 0; }
.sheet-tab-body { display: block; }
.sheet-tabs { flex: 0 0 auto; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; align-self: flex-start; }
/* Pestilletes del marc: arrencen del cantó dret de la finestra, per fora del cos, i queden
fora del contingent que desfila. Per sota de 760px no hi ha lloc fora (vegeu a sota). */
.sheet-tabs { position: absolute; left: 100%; top: 34px; display: flex; flex-direction: column; align-items: flex-start; gap: 5px; padding-top: 6px; }
.sheet-tab {
text-align: left;
padding: 9px 14px 9px 11px;
border: 1px solid var(--color-border);
border-left-width: 3px;
border-left: 0;
border-radius: 0 9px 9px 0;
background: var(--color-background-soft);
color: var(--color-text);
@@ -378,11 +439,11 @@ async function saveSheet() {
transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.sheet-tab:hover { background: var(--color-button-hover); }
.sheet-tab.active { background: var(--color-background-light); color: var(--color-link); border-left-color: var(--color-link); box-shadow: 0 3px 12px var(--color-window-shadow); }
.sheet-tab.active { background: var(--color-background-light); color: var(--color-link); border-color: var(--color-link); box-shadow: 0 3px 12px var(--color-window-shadow); }
.sheet-panel { min-width: 0; padding: 13px; border: 1px solid var(--color-border); border-radius: 10px; background: var(--color-background-light); box-shadow: 0 3px 12px var(--color-window-shadow); }
.sheet-panel h2 { margin: 0 0 12px; padding-bottom: 7px; border-bottom: 1px solid var(--color-border); font: 17px MrEavesRemake; letter-spacing: .03em; }
.sheet-panel h3 { margin: 13px 0 7px; font: 14px MrEavesRemake; }
.sheet-portrait { grid-column: 1; grid-row: 1 / -1; position: relative; overflow: hidden; border: 1px solid var(--color-border); border-radius: 10px; background: var(--color-background-soft); }
.sheet-portrait { position: relative; overflow: hidden; border: 1px solid var(--color-border); border-radius: 10px; background: var(--color-background-soft); }
.sheet-portrait.empty { display: grid; place-items: center; min-height: 220px; border-style: dashed; }
.sheet-portrait img { display: block; width: 100%; height: auto; }
.portrait-upload { border: 0; padding: 8px 10px; background: transparent; color: var(--color-link); font-size: 12px; cursor: pointer; }
@@ -392,21 +453,34 @@ async function saveSheet() {
.portrait-controls button:hover { background: var(--color-button-hover); }
.portrait-controls button:disabled { opacity: .55; cursor: wait; }
.photo-input { display: none; }
/* La columna de la fitxa: la imatge dalt i, just a sota, el que es consulta d'anada i
tornada — classe d'armadura, velocitat, bonificadors i les barres de cops. */
.character-column { grid-column: 1; grid-row: 1 / -1; display: flex; flex-direction: column; gap: 11px; min-width: 0; }
.abilities-panel { grid-column: 2 / -1; grid-row: 1; }
.combat-panel { grid-column: 2 / -1; grid-row: 2; }
.proficiencies-panel { grid-column: 2 / -1; grid-row: 2; }
.ability-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 7px; }
.ability-card { min-height: 83px; padding: 8px 5px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 1px solid var(--color-border); border-radius: 8px; background: var(--color-background-soft); }
.ability-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; opacity: .75; }
.ability-score { font: 25px MrEavesRemake; }
.ability-modifier { min-width: 33px; text-align: center; padding: 2px 5px; border-radius: 999px; background: var(--color-background); font-size: 12px; }
.ability-card input { width: 55px; text-align: center; font-size: 21px; }
.proficiency-badge { display: flex; justify-content: space-between; align-items: center; margin-top: 9px; padding: 8px; border-radius: 8px; background: var(--color-background-soft); font-size: 12px; }
.proficiency-badge strong { font-size: 15px; color: var(--color-link); }
.combat-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.combat-stat { min-height: 72px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; border: 1px solid var(--color-border); border-radius: 8px; background: var(--color-background-soft); }
.combat-stat > span { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; opacity: .72; }
.combat-stat > strong { font: 25px MrEavesRemake; }
.combat-stat small { font-size: 11px; opacity: .7; }
.vitals-panel { display: flex; flex-direction: column; gap: 11px; }
.vital-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.vital-stat { min-height: 68px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 6px 4px; border: 1px solid var(--color-border); border-radius: 8px; background: var(--color-background-soft); text-align: center; }
.vital-stat > span { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; opacity: .72; }
.vital-stat > strong { font: 25px MrEavesRemake; }
.vital-stat small { font-size: 11px; opacity: .7; }
.vital-stat input { width: 57px; text-align: center; }
/* Les dues barres: punts de cop i daus de cop, plenes fins on arriben. */
.vital-bar-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.vital-bar-head > span { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; opacity: .72; }
.vital-bar-head > strong { font: 15px MrEavesRemake; white-space: nowrap; }
.vital-bar-inputs { display: flex; align-items: center; gap: 4px; }
.vital-bar-inputs input { width: 52px; text-align: center; }
.vital-bar-track { height: 8px; margin-top: 5px; overflow: hidden; border-radius: 999px; background: var(--color-background); }
.vital-bar-fill { height: 100%; border-radius: inherit; transition: width .2s ease; }
.hit-points-bar .vital-bar-fill { background: var(--color-red); }
.hit-dice-bar .vital-bar-fill { background: var(--color-link); }
.number-with-unit { display: flex; align-items: center; gap: 4px; }
.number-with-unit input { width: 57px; }
.sheet-copy { min-height: 74px; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.45; opacity: .85; }
@@ -434,16 +508,16 @@ textarea { resize: vertical; width: 100%; min-height: 88px; font-size: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@media (max-width: 760px) {
.sheet-grid { grid-template-columns: 1fr; grid-template-rows: none; }
.sheet-portrait, .abilities-panel, .combat-panel { grid-column: 1 / -1; grid-row: auto; }
.character-column, .abilities-panel, .proficiencies-panel { grid-column: 1 / -1; grid-row: auto; }
/* El cantó dret no dona prou per penjar-hi les pestanyes: llavors es queden al marc, per
dins, en una filera sota la barra de la finestra. */
.sheet-tabs { position: static; align-self: stretch; flex-direction: row; flex-wrap: wrap; gap: 4px; padding: 6px 8px 0; }
.sheet-tab { flex: 1 1 auto; text-align: center; border-left: 1px solid var(--color-border); border-radius: 8px 8px 0 0; }
}
@media (max-width: 520px) {
.sheet-body { padding: 10px; }
.sheet-hero { align-items: flex-start; flex-wrap: wrap; }
.sheet-actions { margin-left: auto; }
.ability-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sheet-layout { flex-direction: column; }
.sheet-tabs { flex-direction: row; flex-wrap: wrap; order: -1; }
.sheet-tab { flex: 1 1 auto; text-align: center; border-radius: 7px; border-left-width: 1px; border-top-width: 3px; }
.sheet-tab.active { border-left-color: var(--color-border); border-top-color: var(--color-link); }
}
</style>