.paperdoll-panel.character-sheet {
  width: min(620px, calc(100vw - 20px));
  height: min(976px, calc(100dvh - 24px));
  max-height: calc(100dvh - 24px);
  grid-template-rows: auto auto minmax(0, 1fr);
  border: 4px double #967747;
  border-radius: 4px;
  padding: 30px 28px 34px;
  color: #211b12;
  background: #d6c096 url("../public/assets/ui/character-sheet-parchment.png") center / 100% 100%;
  box-shadow: 0 12px 80px #000b, inset 0 0 20px #4a321b66;
  font-family: Georgia, "Times New Roman", serif;
  color-scheme: light;
}
.character-sheet > header { position: relative; min-height: 68px; padding: 0 42px 8px; border: 0; text-align: center; justify-content: center; }
.character-sheet > header small { color: #554021; font-size: 17px; }
.character-sheet #paperdollName { font-size: 30px; overflow-wrap: anywhere; line-height: 1.1; }
.character-sheet #closePaperdollButton { position: absolute; top: 3px; right: 0; }
.character-sheet button { color: #2a2015; border-color: #806239; background: #d8c198; border-radius: 3px; }
.character-sheet button:hover { background: #efdcaf; }
.character-sheet button:focus-visible { outline: 3px solid #226d79; outline-offset: 2px; }
.sheet-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding-bottom: 12px; }
.sheet-tabs button { min-height: 38px; font-size: 15px; font-weight: bold; padding: 6px; }
.sheet-tabs button[aria-selected="true"] { background: #493e2d; color: #fff2cf; border-color: #a98544; box-shadow: inset 0 0 0 2px #201d17; }
.sheet-overview { min-height: 0; overflow-y: auto; scrollbar-color: #8a7148 transparent; padding: 2px 9px 5px; touch-action: pan-y; }
.sheet-portrait-frame { position: relative; width: 86%; aspect-ratio: 4 / 3; margin: 3px auto 16px; border: 4px double #af8b47; outline: 2px solid #413421; background: #302e29; box-shadow: 0 3px 7px #38251470; }
.character-sheet .sheet-portrait { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; border-radius: 0; background: transparent; overflow: hidden; }
.character-sheet .sheet-portrait:hover { background: transparent; }
.sheet-portrait img { display: block; width: 100%; height: 100%; object-fit: cover; image-rendering: auto; }
.sheet-portrait:not(.has-portrait) img { visibility: hidden; }
.sheet-portrait #playerPortraitPlaceholder { position: absolute; bottom: 8px; left: 0; right: 0; color: #f5e3bb; font-size: 16px; }
.sheet-portrait-fallback { position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden; }
.sheet-portrait-fallback .preview-body { transform: scale(.95); }
#sheetStats h3 { display: flex; align-items: center; gap: 14px; margin: 16px 0 10px; font-size: 24px; }
#sheetStats h3::after { content: ""; flex: 1; height: 3px; border-block: 1px solid #907446; }
.sheet-stat { display: grid; grid-template-columns: 38px 96px minmax(0, 1fr); align-items: center; gap: 10px; min-height: 47px; }
.sheet-stat-icon { display: grid; place-items: center; width: 36px; height: 36px; border: 3px double #b3955f; outline: 1px solid #463a25; border-radius: 3px; background: #292821; color: #d7be86; box-shadow: 1px 2px 3px #3f2e2750; }
.sheet-stat-icon svg { width: 23px; height: 23px; stroke-width: 1.8; }
.sheet-stat-label { font-size: 18px; font-weight: bold; }
.sheet-stat-track { height: 23px; position: relative; background: #242724; border: 3px double #b79b63; border-radius: 3px; box-shadow: 0 1px 2px #3c2a1d; }
.sheet-stat-track > span { display: block; width: var(--fill); height: 100%; background: #97712e; box-shadow: inset 0 2px 3px #ffffff44, inset 0 -2px 3px #0007; }
.sheet-stat-track > b { position: absolute; inset: 0; text-align: center; color: #fff7e4; font: bold 12px/17px system-ui, sans-serif; text-shadow: 0 1px 2px #000, 1px 0 2px #000; }
.sheet-stat.hits .sheet-stat-icon { color: #dd6760; }
.sheet-stat.hits .sheet-stat-track > span { background: #9e3832; }
.sheet-stat.stamina .sheet-stat-icon { color: #9bbd69; }
.sheet-stat.stamina .sheet-stat-track > span { background: #5a7d32; }
.sheet-stat.mana .sheet-stat-icon { color: #74a7de; }
.sheet-stat.mana .sheet-stat-track > span { background: #315e92; }
.sheet-stat.armor .sheet-stat-icon { color: #d6d5cd; }
.sheet-stat.armor .sheet-stat-track > span { background: #7a817f; }
.sheet-armor { margin-top: 15px; padding-top: 12px; border-top: 1px solid #8f764e; }
.sheet-gold { display: flex; justify-content: flex-end; gap: 12px; padding: 8px 0; font-size: 15px; }
.character-sheet .paperdoll-content { grid-template-columns: 170px minmax(0, 1fr); overflow: auto; touch-action: pan-y; }
.character-sheet .paperdoll-figure { min-height: 320px; overflow: hidden; border-color: #967e59; }
.character-sheet .paperdoll-figure .preview-body { transform: scale(.8); }
.character-sheet .paperdoll-inventory { padding: 8px; overflow: visible; }
.character-sheet .inventory-row { grid-template-columns: 30px minmax(0, 1fr); gap: 6px; border-color: #9d845e; }
.character-sheet .inventory-row > button { grid-column: 2; min-height: 36px; }
.character-sheet .inventory-row small, .character-sheet .inventory-empty { color: #584b37; }
.character-sheet .inventory-row strong { overflow-wrap: anywhere; }
.character-sheet .inventory-heading h3 { font-size: 17px; }
@media (max-width: 520px) {
  .paperdoll-panel.character-sheet { padding: 27px 20px 40px; height: min(976px, calc(100dvh - 12px)); max-height: calc(100dvh - 12px); }
  .character-sheet > header { min-height: 57px; }
  .character-sheet #paperdollName { font-size: 25px; }
  .sheet-overview { padding-inline: 4px; }
  .sheet-portrait-frame { width: 90%; margin-bottom: 12px; }
  #sheetStats h3 { font-size: 21px; margin-block: 12px 6px; }
  .sheet-stat { grid-template-columns: 30px 80px minmax(0, 1fr); gap: 7px; min-height: 42px; }
  .sheet-stat-icon { width: 29px; height: 29px; }
  .sheet-stat-icon svg { width: 20px; height: 20px; }
  .sheet-stat-label { font-size: 16px; }
  .sheet-tabs { gap: 6px; padding-bottom: 9px; }
  .sheet-tabs button { font-size: 13px; }
  .character-sheet .paperdoll-content { grid-template-columns: 1fr; }
  .character-sheet .paperdoll-figure { min-height: 220px; max-height: 240px; }
  .character-sheet .inventory-row { grid-template-columns: 32px minmax(0, 1fr) auto; }
  .character-sheet .inventory-row > button { grid-column: auto; }
}
