/* Original paperdoll art in a classic fantasy inventory frame. */
.hero-window {
  --hero-gold: #d9b35a; --hero-ink: #f3e3b2; --hero-muted: #cdb68e; --hero-frame: #7a5a2c;
  margin: 0 0 22px; padding: 12px; border: 3px double var(--hero-gold); border-radius: 4px;
  color: var(--hero-ink); background: radial-gradient(ellipse at 50% 25%, #65482c, #2c1e14 85%);
  box-shadow: inset 0 0 0 2px #24190e, 0 6px 18px #0005;
}
.hero-window button, .hero-button, #hero-button { font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.hero-window button:focus-visible, .hero-button:focus-visible { outline: 3px solid #fff1b5; outline-offset: 2px; }
.hero-window button:hover, .hero-button:hover { border-color: #ffe3a0; background-color: #553d23; }
.hero-window button:active, .hero-button:active { filter: brightness(1.2); }
.hero-plate { display: flex; align-items: center; gap: 10px; min-width: 0; margin-bottom: 8px; }
.hero-window .hero-face { width: 48px; height: 48px; object-fit: cover; border: 1px solid var(--hero-gold); border-radius: 2px; }
.hero-title { flex: 1; min-width: 0; }
.hero-window .hero-name { margin: 0; font: 22px/1.2 Georgia, serif; color: var(--hero-gold); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.hero-window .hero-class { margin: 3px 0 0; font-size: 12px; color: var(--hero-muted); }
.hero-button { min-height: 36px; padding: 6px 10px; border: 1px solid #a68649; border-radius: 3px; color: #f3e3b2; background: #302317; }
.hero-auto { font-size: 12px !important; }
.hero-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.hero-stat { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); justify-content: center; justify-items: center; align-items: center; gap: 0 4px; padding: 3px 2px; border: 1px solid #80613b; background: #21170f; }
.hero-stat.is-key { border-color: #c2a157; }
.hero-stat-icon { font-size: 17px; }
.hero-stat-value { font: 24px/1 Georgia, serif; color: #fff2cb; }
.hero-stat-name { grid-column: 1 / -1; width: 100%; min-width: 0; min-height: 24px; font-size: 11px; line-height: 12px; align-content: center; overflow-wrap: anywhere; text-align: center; color: var(--hero-muted); }
.doll-board { position: relative; display: grid; grid-template-columns: 76px minmax(0, 1fr) 76px; grid-template-rows: repeat(4, 1fr); align-items: center; gap: 7px; height: 424px; max-width: 560px; margin: 8px auto; isolation: isolate; }
.doll-stage { grid-column: 1 / -1; grid-row: 1 / -1; display: flex; align-items: center; justify-content: center; height: 100%; min-width: 0; z-index: -1; overflow: hidden; background: radial-gradient(ellipse at 50% 35%, #64716b55, #1c231b88 70%); border: 1px solid #97723b; box-shadow: inset 0 0 35px #0008; }
.doll-stage::after { content: ''; position: absolute; bottom: 3%; left: 30%; right: 30%; height: 3%; border-radius: 50%; background: #080a0888; filter: blur(4px); z-index: -1; }
.doll-model { --right-hand: 24%; --left-hand: 76%; --hand-y: 53.5%; --armor-x: 25%; --armor-y: 19%; --armor-w: 50%; --armor-h: 36%; position: relative; height: 100%; aspect-ratio: 2 / 3; flex: none; isolation: isolate; }
.doll-kin-elf { --right-hand: 22%; --left-hand: 78%; --hand-y: 52%; --armor-x: 28%; --armor-y: 15.5%; --armor-w: 44%; --armor-h: 34%; }
.doll-kin-half_elf { --hand-y: 52%; --armor-y: 18%; }
.doll-kin-dwarf { --right-hand: 15%; --left-hand: 85%; --hand-y: 55.5%; --armor-x: 17%; --armor-y: 21%; --armor-w: 66%; --armor-h: 38%; }
.doll-kin-halfling { --right-hand: 18%; --left-hand: 82%; --hand-y: 54%; --armor-x: 21%; --armor-y: 21%; --armor-w: 58%; }
.doll-kin-wolfkin { --right-hand: 20%; --left-hand: 80%; --hand-y: 53%; --armor-x: 22%; --armor-w: 56%; }
.doll-kin-orc { --right-hand: 21%; --left-hand: 79%; --hand-y: 53%; --armor-x: 22%; --armor-w: 56%; }
.doll-kin-goblin { --right-hand: 21%; --left-hand: 79%; --hand-y: 55%; --armor-y: 20%; --armor-x: 23%; --armor-w: 54%; }
.doll-base, .doll-grip { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.doll-base { z-index: 2; }
.doll-layer { position: absolute; display: block; pointer-events: none; z-index: 4; }
.doll-layer img { display: block; width: 100%; height: 100%; object-fit: contain; }
.doll-layer-head { left: 34%; top: .5%; width: 32%; height: 19%; z-index: 6; }
.doll-kin-dwarf .doll-layer-head { left: 32%; top: 2%; width: 36%; height: 18%; }
.doll-kin-halfling .doll-layer-head { left: 33%; top: 1.5%; width: 34%; height: 19%; }
.doll-kin-wolfkin .doll-layer-head { left: 31%; top: 0; width: 38%; height: 21%; }
.doll-layer-body { left: var(--armor-x); top: var(--armor-y); width: var(--armor-w); height: var(--armor-h); }
.doll-layer-neck { left: 39%; top: 17%; width: 22%; height: 19%; z-index: 5; }
.doll-layer-back { left: 54%; top: 22%; width: 42%; height: 39%; z-index: 1; transform: rotate(-8deg); }
.doll-layer-belt { left: 53%; top: 46%; width: 18%; height: 22%; z-index: 5; }
.doll-layer-ranged { left: 57%; top: 13%; width: 38%; height: 73%; z-index: 1; transform: rotate(17deg); }
.doll-weapon { left: var(--right-hand); top: var(--hand-y); height: 51%; width: auto; transform: translate(-50%, -78%); z-index: 7; }
.doll-weapon img { width: auto; height: 100%; max-width: none; }
.doll-layer-offHand.doll-weapon { left: var(--left-hand); }
.doll-weapon-long { height: 82%; transform: translate(-50%, -60%); }
.doll-weapon-large { height: 64%; }
.doll-weapon-small { height: 23%; }
.doll-weapon[data-item=rock] { height: 8%; transform: translate(-50%, -50%); }
.doll-weapon[data-item=sling] { transform: translate(-50%, -12%); }
.doll-weapon-bow { height: 67%; transform: translate(-50%, -50%); }
.doll-weapon-crossbow { height: 26%; }
.doll-shield { left: 66%; top: 38%; width: 34%; height: 36%; z-index: 8; }
.doll-grip { z-index: 8; }
.doll-grip-right { clip-path: inset(calc(var(--hand-y) - 5%) calc(95% - var(--right-hand)) calc(95% - var(--hand-y)) calc(var(--right-hand) - 5%)); }
.doll-grip-left { clip-path: inset(calc(var(--hand-y) - 5%) calc(95% - var(--left-hand)) calc(95% - var(--hand-y)) calc(var(--left-hand) - 5%)); }
.doll-slot { display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; width: 100%; height: 76px; min-width: 0; padding: 2px; border: 2px solid #a38346; border-radius: 2px; color: #f3e3b2; background: #281b11ed; box-shadow: inset 0 0 0 1px #160c06, 0 2px 5px #0008; }
.doll-slot img { width: 100%; min-height: 0; flex: 1; object-fit: contain; }
.doll-slot-label { flex: none; font-size: 10px; line-height: 1.3; text-align: center; }
.doll-slot-empty { flex: 1; display: grid; align-items: center; font: 30px Georgia, serif; color: #a38c62; opacity: .65; }
.hero-pack { border-top: 1px solid #896a3a; padding-top: 6px; }
.hero-pack-label { display: block; margin-bottom: 6px; font-size: 15px; color: var(--hero-muted); }
/* Рюкзак крупными плитками: все вещи видны сразу, без прокрутки вбок. */
.hero-pack-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; padding: 2px 2px 5px; }
.hero-pack-item { width: auto; height: 82px; padding: 0; border: 1px solid #a38346; background: #21170e; color: #f3e3b2; }
.hero-pack-item img { width: 100%; height: 100%; object-fit: contain; }
.hero-empty { display: block; padding: 10px 0; font-size: 12px; color: var(--hero-muted); }
.hero-pack-found { display: grid; place-items: center; align-content: center; gap: 2px; padding: 3px 4px; text-align: center; overflow: hidden; }
.hero-found-icon { font-size: 34px; line-height: 1; }
.hero-pack-found img { width: 50px; height: 50px; object-fit: contain; }
.hero-item-price { white-space: nowrap; }
.hero-sell { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 0 0 12px; padding-top: 10px; border-top: 1px solid #896a3a; }
.hero-sell-title { grid-column: 1 / -1; margin: 0; }
.hero-sell-field { display: flex; align-items: center; gap: 4px; }
.hero-sell-field input { width: 100%; min-width: 0; min-height: 44px; font: inherit; }
.hero-sell-button { grid-column: 1 / -1; min-height: 44px; }
.hero-found-name { font-size: 11px; line-height: 1.15; max-height: 2.3em; overflow: hidden; }
.hero-bottom { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 12px; }
.hero-bottom .hero-button { border: 0; background: transparent; padding-right: 0; font-size: 12px; }
.hero-skill-details { border-top: 1px solid #7c613a; padding-top: 5px; font-size: 12px; }
.hero-skill-details summary { min-height: 28px; padding: 4px 0; cursor: pointer; }
.hero-skill-list { display: grid; grid-template-columns: 1fr auto; gap: 5px 12px; margin: 8px 0; }
.hero-skill-list dd { margin: 0; color: #ffe3a0; }
.hero-sheet-open { overflow: hidden; }
/* Окно героя на всю страницу; закрывает простой крестик вверху. */
.hero-sheet-dialog { position: fixed; inset: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 6px; border: 0; background: #211a13; color: #f3e3b2; overflow: auto; overscroll-behavior: contain; }
.hero-sheet-dialog::backdrop, .hero-item-dialog::backdrop { background: #060b0be0; }
.hero-sheet-close { display: grid; place-items: center; width: 42px; height: 42px; margin: 0 0 4px auto; padding: 0; font-size: 22px; line-height: 1; }
.hero-sheet-dialog .hero-window { max-width: 660px; margin: 0 auto; }
.hero-sheet-dialog .doll-board { height: min(424px, calc(100dvh - 335px)); min-height: 250px; }
.hero-item-dialog { max-width: min(400px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 20px; border: 2px solid #c4a157; border-radius: 4px; background: #2e2217; color: #f3e3b2; }
.hero-item-dialog > img { display: block; width: 260px; height: 260px; max-width: 100%; object-fit: contain; margin: auto; }
.hero-item-emoji { font-size: 120px; line-height: 1.15; text-align: center; }
.hero-item-facts { margin: 8px 0 12px; padding-left: 1.2em; line-height: 1.4; }
.hero-item-dialog h2 { font: 24px Georgia, serif; color: #e5c579; }
.hero-item-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
@media (max-width: 600px) {
  #hero-button { min-height: 44px; }
  .hero-window { padding: 8px; }
  .hero-window .hero-name { font-size: 19px; }
  .hero-window .hero-face { width: 40px; height: 40px; }
  .doll-board { grid-template-columns: 62px minmax(0, 1fr) 62px; height: 330px; gap: 5px; }
  .doll-slot { height: 67px; }
  .hero-sheet-dialog { padding: 4px; }
  .hero-sheet-dialog .doll-board { height: min(390px, calc(100dvh - 338px)); min-height: 220px; }
  .hero-sheet-dialog .hero-skill-details { display: none; }
}
@media (max-height: 700px) and (max-width: 600px) {
  .hero-sheet-dialog .doll-slot { height: 52px; }
}
@media (max-height: 650px) and (min-width: 600px) {
  .hero-sheet-dialog .hero-window { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); column-gap: 10px; padding: 8px; }
  .hero-sheet-dialog .hero-plate { grid-column: 1; grid-row: 1; }
  .hero-sheet-dialog .hero-stats { grid-column: 1; grid-row: 2; }
  .hero-sheet-dialog .hero-pack { grid-column: 1; grid-row: 3; min-width: 0; }
  .hero-sheet-dialog .hero-bottom { grid-column: 1; grid-row: 4; }
  .hero-sheet-dialog .hero-skill-details { display: none; }
  .hero-sheet-dialog .hero-name { font-size: 18px; }
  .hero-sheet-dialog .hero-face { width: 38px; height: 38px; }
  .hero-sheet-dialog .hero-plate { gap: 5px; }
  .hero-sheet-dialog .hero-auto { padding: 4px; }
  .hero-sheet-dialog .hero-stat-name { font-size: 10px; }
  .hero-sheet-dialog .doll-board { grid-column: 2; grid-row: 1 / 5; height: min(280px, calc(100dvh - 104px)); min-height: 220px; margin: 0; grid-template-columns: 54px minmax(0, 1fr) 54px; }
  .hero-sheet-dialog .doll-slot { height: 55px; }
}
@media print { .hero-sheet-dialog, .hero-item-dialog, #hero-button { display: none !important; } }
