450 lines
27 KiB
Vue
450 lines
27 KiB
Vue
<script setup>
|
||
import { computed, onBeforeUnmount, onMounted, ref } from 'vue';
|
||
import { SetupHandle, SetSize, ResetPosition, ClearWindow, Top } from '@/services/Windows';
|
||
import WindowHandle from './partials/WindowHandle.vue';
|
||
import Server, { getBaseUrl } from '~/services/Server';
|
||
import { emitter } from '~/services/Emitter';
|
||
import { useI18n } from 'vue-i18n';
|
||
|
||
const props = defineProps(['data']);
|
||
const id = props.data.id;
|
||
const actorId = props.data.actor?._id;
|
||
const handle = ref(null);
|
||
const wrapper = ref(null);
|
||
const editing = ref(false);
|
||
const saving = ref(false);
|
||
const error = ref('');
|
||
const original = ref(null);
|
||
const photoInput = ref(null);
|
||
const uploadingPhoto = ref(false);
|
||
const { t } = useI18n();
|
||
|
||
const abilityStats = [
|
||
{ key: 'str', label: 'STR' }, { key: 'dex', label: 'DEX' }, { key: 'con', label: 'CON' },
|
||
{ key: 'int', label: 'INT' }, { key: 'wis', label: 'WIS' }, { key: 'cha', label: 'CHA' }
|
||
];
|
||
|
||
// Les pestanyes del lateral dret reparteixen la fitxa: característiques i combat,
|
||
// inventari, trets i conjurs. Són pestanyes de marcadors, no una pàgina nova.
|
||
const tabs = [
|
||
{ key: 'abilities', label: 'campaigns.character-sheet.tabs.abilities' },
|
||
{ key: 'inventory', label: 'campaigns.character-sheet.tabs.inventory' },
|
||
{ key: 'traits', label: 'campaigns.character-sheet.tabs.traits' },
|
||
{ key: 'spells', label: 'campaigns.character-sheet.tabs.spells' }
|
||
];
|
||
const activeTab = ref('abilities');
|
||
|
||
function normalizeActor(actor) {
|
||
return {
|
||
name: actor?.name ?? '',
|
||
species: actor?.species ?? '',
|
||
className: actor?.className ?? '',
|
||
subclass: actor?.subclass ?? '',
|
||
level: Number(actor?.level ?? 1),
|
||
abilityScores: Object.fromEntries(abilityStats.map(({ key }) => [key, Number(actor?.abilityScores?.[key] ?? 10)])),
|
||
armorClass: Number(actor?.armorClass ?? 10),
|
||
speed: Number(actor?.speed ?? 30),
|
||
proficiencies: actor?.proficiencies ?? '',
|
||
inventory: (actor?.inventory ?? []).map((item) => ({
|
||
name: item.name ?? '', quantity: Number(item.quantity ?? 1), weight: Number(item.weight ?? 0)
|
||
})),
|
||
traits: actor?.traits ?? '',
|
||
spells: actor?.spells ?? '',
|
||
image: actor?.image ?? ''
|
||
};
|
||
}
|
||
|
||
const form = ref(normalizeActor(props.data.actor));
|
||
original.value = normalizeActor(props.data.actor);
|
||
|
||
onMounted(() => {
|
||
Top(wrapper);
|
||
SetupHandle(id, handle);
|
||
SetSize(id, {
|
||
width: Math.max(320, Math.min(900, window.innerWidth - 24)),
|
||
height: Math.max(360, Math.min(700, window.innerHeight - 32))
|
||
});
|
||
ResetPosition(id, 'center');
|
||
});
|
||
|
||
onBeforeUnmount(() => ClearWindow({ type: 'character_sheet' }));
|
||
|
||
function handleActorSync({ entityType, entry }) {
|
||
if (entityType !== 'actor' || entry?._id !== actorId || editing.value) return;
|
||
form.value = normalizeActor(entry);
|
||
original.value = normalizeActor(entry);
|
||
}
|
||
|
||
onMounted(() => emitter.on('campaign-entry-updated', handleActorSync));
|
||
onBeforeUnmount(() => emitter.off('campaign-entry-updated', handleActorSync));
|
||
|
||
const proficiencyBonus = computed(() => Math.ceil(form.value.level / 4) + 1);
|
||
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));
|
||
|
||
function abilityModifier(score) {
|
||
const modifier = Math.floor((Number(score) - 10) / 2);
|
||
return modifier >= 0 ? `+${modifier}` : String(modifier);
|
||
}
|
||
|
||
const imageUrl = computed(() => {
|
||
if (!form.value.image) return '';
|
||
return /^(https?:|data:|\/\/)/i.test(form.value.image)
|
||
? form.value.image
|
||
: `${getBaseUrl()}/public/${form.value.image}`;
|
||
});
|
||
|
||
function pickPhoto() {
|
||
photoInput.value?.click();
|
||
}
|
||
|
||
async function onPhotoSelected(event) {
|
||
const file = event.target.files?.[0];
|
||
event.target.value = '';
|
||
if (!file || uploadingPhoto.value) return;
|
||
uploadingPhoto.value = true;
|
||
error.value = '';
|
||
try {
|
||
const formData = new FormData();
|
||
formData.append('image', file);
|
||
const response = await Server().post(`/actor/upload-image?actor=${actorId}`, formData, {
|
||
headers: { "Content-Type": "multipart/form-data" }
|
||
});
|
||
if (response.data.status !== 'ok') {
|
||
error.value = t('campaigns.character-sheet.photo-error');
|
||
return;
|
||
}
|
||
// La foto es desa immediatament: manté original intacte perquè cancel·lar no la perdi
|
||
form.value.image = response.data.actor?.image ?? form.value.image;
|
||
original.value.image = form.value.image;
|
||
emitter.emit('campaign-entry-updated', { entityType: 'actor', entry: response.data.actor });
|
||
} catch (requestError) {
|
||
error.value = t('campaigns.character-sheet.photo-error');
|
||
} finally {
|
||
uploadingPhoto.value = false;
|
||
}
|
||
}
|
||
|
||
function removePhoto() {
|
||
form.value.image = '';
|
||
}
|
||
|
||
function startEditing() {
|
||
editing.value = true;
|
||
error.value = '';
|
||
}
|
||
|
||
function cancelEditing() {
|
||
form.value = normalizeActor(original.value);
|
||
editing.value = false;
|
||
error.value = '';
|
||
}
|
||
|
||
function addInventoryItem() {
|
||
form.value.inventory.push({ name: '', quantity: 1, weight: 0 });
|
||
}
|
||
|
||
function removeInventoryItem(index) {
|
||
form.value.inventory.splice(index, 1);
|
||
}
|
||
|
||
async function saveSheet() {
|
||
if (!form.value.name.trim() || saving.value) return;
|
||
saving.value = true;
|
||
error.value = '';
|
||
try {
|
||
const payload = {
|
||
id: actorId,
|
||
...form.value,
|
||
inventory: form.value.inventory.filter((item) => item.name.trim())
|
||
};
|
||
const response = await Server().post('/actor/update', payload);
|
||
if (response.data.status !== 'ok') {
|
||
error.value = t('campaigns.character-sheet.save-error');
|
||
return;
|
||
}
|
||
original.value = normalizeActor(response.data.actor);
|
||
form.value = normalizeActor(response.data.actor);
|
||
editing.value = false;
|
||
emitter.emit('campaign-entry-updated', { entityType: 'actor', entry: response.data.actor });
|
||
} catch (requestError) {
|
||
error.value = t('campaigns.character-sheet.save-error');
|
||
} finally {
|
||
saving.value = false;
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<template>
|
||
<div class="window-wrapper sheet-window" :id="'window-wrapper-' + id" ref="wrapper">
|
||
<WindowHandle :window="id" ref="handle" />
|
||
<div class="sheet-body">
|
||
<header class="sheet-hero">
|
||
<div class="character-mark" aria-hidden="true">{{ form.name.slice(0, 1).toUpperCase() }}</div>
|
||
<div class="character-identity">
|
||
<input v-if="editing" v-model="form.name" class="character-name-input" required :aria-label="$t('campaigns.character-sheet.name')">
|
||
<h1 v-else>{{ form.name }}</h1>
|
||
<div class="identity-fields">
|
||
<label v-if="editing" class="identity-field">
|
||
<span>{{ $t('campaigns.character-sheet.class') }}</span><input v-model="form.className">
|
||
</label>
|
||
<span v-else class="identity-tag">{{ form.className || $t('campaigns.character-sheet.unset-class') }}</span>
|
||
<label v-if="editing" class="identity-field">
|
||
<span>{{ $t('campaigns.character-sheet.subclass') }}</span><input v-model="form.subclass">
|
||
</label>
|
||
<span v-else-if="form.subclass" class="identity-tag">{{ form.subclass }}</span>
|
||
<label v-if="editing" class="identity-field level-field">
|
||
<span>{{ $t('campaigns.character-sheet.level') }}</span><input v-model.number="form.level" type="number" min="1" max="20">
|
||
</label>
|
||
<span v-else class="identity-tag">{{ $t('campaigns.character-sheet.level') }} {{ form.level }}</span>
|
||
<label v-if="editing" class="identity-field">
|
||
<span>{{ $t('campaigns.character-sheet.species') }}</span><input v-model="form.species">
|
||
</label>
|
||
<span v-else class="identity-tag">{{ form.species || $t('campaigns.character-sheet.unset-species') }}</span>
|
||
</div>
|
||
</div>
|
||
<div class="sheet-actions">
|
||
<button v-if="!editing" class="sheet-button" type="button" @click="startEditing">{{ $t('campaigns.character-sheet.edit') }}</button>
|
||
<template v-else>
|
||
<button class="sheet-button secondary" type="button" @click="cancelEditing">{{ $t('campaigns.character-sheet.cancel') }}</button>
|
||
<button class="sheet-button primary" type="button" :disabled="saving" @click="saveSheet">
|
||
{{ saving ? $t('campaigns.character-sheet.saving') : $t('campaigns.character-sheet.save') }}
|
||
</button>
|
||
</template>
|
||
</div>
|
||
</header>
|
||
|
||
<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') }}
|
||
</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">
|
||
</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>
|
||
<div class="proficiency-badge">
|
||
<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>
|
||
<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>
|
||
|
||
<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>
|
||
|
||
<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>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
|
||
<style scoped>
|
||
.sheet-window { min-width: 0; min-height: 0; }
|
||
.sheet-body { width: 100%; min-height: 0; flex: 1; overflow: auto; padding: 16px; box-sizing: border-box; }
|
||
.sheet-hero { display: flex; align-items: center; gap: 14px; padding: 4px 2px 16px; margin-bottom: 12px; border-bottom: 1px solid var(--color-border); }
|
||
.character-mark { width: 56px; height: 56px; flex: 0 0 56px; display: grid; place-items: center; border-radius: 12px; background: var(--color-background-soft); color: var(--color-link); border: 1px solid var(--color-border); font: 28px MrEavesRemake; }
|
||
.character-identity { flex: 1; min-width: 0; }
|
||
.character-identity h1 { margin: 0 0 7px; font: 28px MrEavesRemake; overflow-wrap: anywhere; }
|
||
.character-name-input { width: min(100%, 440px); font-size: 24px !important; font-family: MrEavesRemake !important; }
|
||
.identity-fields { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
|
||
.identity-tag { padding: 4px 9px; border: 1px solid var(--color-border); border-radius: 999px; background: var(--color-background-soft); font-size: 12px; opacity: .9; }
|
||
.identity-field { display: flex; align-items: center; gap: 5px; font-size: 11px; opacity: .8; }
|
||
.identity-field input { width: 106px; }
|
||
.identity-field.level-field input { width: 58px; }
|
||
.sheet-actions { display: flex; align-items: center; gap: 7px; }
|
||
.sheet-button { border: 1px solid var(--color-border); border-radius: 7px; padding: 7px 12px; background: var(--color-background-soft); color: var(--color-text); cursor: pointer; white-space: nowrap; }
|
||
.sheet-button:hover { background: var(--color-button-hover); }
|
||
.sheet-button.primary { background: var(--color-link); color: var(--color-background); border-color: var(--color-link); }
|
||
.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; }
|
||
.sheet-tab {
|
||
text-align: left;
|
||
padding: 9px 14px 9px 11px;
|
||
border: 1px solid var(--color-border);
|
||
border-left-width: 3px;
|
||
border-radius: 0 9px 9px 0;
|
||
background: var(--color-background-soft);
|
||
color: var(--color-text);
|
||
font: 13px MrEavesRemake;
|
||
letter-spacing: .02em;
|
||
white-space: nowrap;
|
||
cursor: pointer;
|
||
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-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.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; }
|
||
.portrait-controls { position: absolute; inset: auto 0 0 0; display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 6px 7px; background: var(--color-background-soft); border-top: 1px solid var(--color-border); }
|
||
.portrait-controls button { border: 1px solid var(--color-border); border-radius: 6px; padding: 4px 9px; background: var(--color-background-light); color: var(--color-text); font-size: 11px; cursor: pointer; }
|
||
.portrait-controls button:last-child { flex: 0 0 auto; padding: 3px 8px; font-size: 15px; line-height: 1; }
|
||
.portrait-controls button:hover { background: var(--color-button-hover); }
|
||
.portrait-controls button:disabled { opacity: .55; cursor: wait; }
|
||
.photo-input { display: none; }
|
||
.abilities-panel { grid-column: 2 / -1; grid-row: 1; }
|
||
.combat-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; }
|
||
.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; }
|
||
input, textarea { box-sizing: border-box; max-width: 100%; padding: 6px 7px; border: 1px solid var(--color-border); border-radius: 6px; background: var(--color-background-soft); color: var(--color-text); font: inherit; }
|
||
input:focus, textarea:focus { outline: none; border-color: var(--color-link); }
|
||
textarea { resize: vertical; width: 100%; min-height: 88px; font-size: 12px; }
|
||
.traits-panel, .spells-panel { min-height: 175px; }
|
||
.panel-title-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
|
||
.panel-title-row h2 { flex: 1; }
|
||
.weight-summary { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 1px 0 7px; font-size: 12px; }
|
||
.weight-summary strong { white-space: nowrap; }
|
||
.weight-track { height: 5px; margin-bottom: 10px; overflow: hidden; border-radius: 999px; background: var(--color-background-soft); }
|
||
.weight-fill { height: 100%; border-radius: inherit; background: var(--color-link); transition: width .2s ease; }
|
||
.inventory-table-wrap { overflow-x: auto; }
|
||
.inventory-table { width: 100%; border-collapse: collapse; font-size: 12px; }
|
||
.inventory-table th { padding: 6px 7px; text-align: left; font-weight: 600; opacity: .7; }
|
||
.inventory-table td { padding: 5px 7px; border-top: 1px solid var(--color-border); }
|
||
.inventory-table td input { width: 100%; min-width: 54px; }
|
||
.inventory-table td:first-child input { min-width: 100px; }
|
||
.inventory-table th:not(:first-child), .inventory-table td:not(:first-child) { text-align: center; }
|
||
.empty-inventory { text-align: center !important; opacity: .65; }
|
||
.remove-item { width: 24px; height: 24px; border: 0; border-radius: 5px; background: transparent; color: var(--color-text); font-size: 20px; cursor: pointer; }
|
||
.remove-item:hover { background: var(--color-button-hover); }
|
||
.sheet-error { padding: 7px 10px; margin-bottom: 10px; border-radius: 6px; color: var(--color-red); background: var(--color-background-soft); 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; }
|
||
}
|
||
@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>
|