/* Bounded character screen: only reading and item panels scroll. */
#modal[data-kind=hero-sheet],#modal[data-kind=hero-inspect]{width:100vw;max-width:none;height:100dvh;max-height:none;margin:0;border:0;border-radius:0;overflow:hidden;box-shadow:none;color:var(--ink);background:radial-gradient(ellipse at 53% 48%,color-mix(in srgb,var(--gold) 10%,var(--paper)),var(--paper) 68%);display:flex;flex-direction:column}
#modal[data-kind=hero-sheet]:not([open]),#modal[data-kind=hero-inspect]:not([open]){display:none}
#modal[data-kind=hero-sheet]>.modal-head,#modal[data-kind=hero-inspect]>.modal-head{background:transparent;flex-shrink:0;padding:14px clamp(16px,2.5vw,40px);border-bottom:1px solid var(--line)}
#modal[data-kind=hero-sheet]>.modal-body,#modal[data-kind=hero-inspect]>.modal-body{background:transparent;padding:0;flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}
#modal[data-kind=hero-sheet] #modal-error:empty,#modal[data-kind=hero-inspect] #modal-error:empty{display:none}
.sheet-topline{display:flex;align-items:center;justify-content:space-between;gap:16px;min-height:62px;padding:10px clamp(16px,2.5vw,40px);flex-shrink:0}
.sheet-role{font-size:14px;min-width:0;overflow-wrap:anywhere}.sheet-role small{display:block;font-size:11px;color:var(--muted);margin-top:4px}.sheet-primary{display:flex;gap:8px;align-items:center;flex-shrink:0}.sheet-primary .btn{white-space:normal;word-break:normal;overflow-wrap:normal;font-size:12px;min-height:36px;padding:8px 12px}
.sheet-management{position:relative;z-index:5}.sheet-management summary{padding:10px 12px;border:1px solid var(--line);border-radius:10px;cursor:pointer;font-size:12px;list-style:none}.sheet-management summary::-webkit-details-marker{display:none}.sheet-management[open] summary{border-color:var(--gold)}.sheet-management>.stack{position:absolute;right:0;top:calc(100% + 8px);width:250px;max-height:65dvh;overflow:auto;background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:12px;box-shadow:var(--shadow-soft)}
.sheet-layout{display:grid;grid-template-columns:minmax(230px,1fr) minmax(300px,1.45fr) minmax(250px,1fr);gap:clamp(14px,2vw,30px);padding:8px clamp(16px,2.5vw,40px) 22px;flex:1;min-height:0;isolation:isolate}
.sheet-story,.sheet-bag{min-width:0;min-height:0;display:flex;flex-direction:column;overflow:hidden}.sheet-story{gap:18px}.sheet-reading{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;padding-right:12px;outline-offset:-2px}.sheet-reading h3{font-family:var(--serif);font-size:25px;margin:10px 0 18px}.sheet-reading p{white-space:pre-wrap;overflow-wrap:anywhere;font-size:clamp(16px,1.2vw,19px);line-height:1.85}.sheet-reading section[hidden]{display:none}
.sheet-story-tabs{display:flex;gap:24px;border-bottom:1px solid var(--line);flex-shrink:0}.sheet-story-tabs button{background:transparent;color:var(--muted);border:0;border-bottom:2px solid transparent;border-radius:0;padding:12px 0;font-size:12px;letter-spacing:1px;text-transform:uppercase;cursor:pointer}.sheet-story-tabs button[aria-pressed=true]{color:var(--ink);border-color:var(--gold)}.sheet-story-tabs button:hover{color:var(--gold)}
.sheet-attributes{flex-shrink:0;padding-top:14px;border-top:1px solid var(--line)}.sheet-attributes .ability-summary{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px;margin:12px 0 0}.sheet-attributes .ability-summary>div{display:flex;flex-direction:column;align-items:center;gap:5px;padding:10px 2px;min-width:0;background:color-mix(in srgb,var(--surface) 65%,transparent);border:1px solid var(--line);border-radius:12px}.sheet-attributes .ability-summary small{font-size:9px;letter-spacing:0}.sheet-attributes .ability-summary strong{font-size:27px;line-height:1.2}.sheet-attributes .ability-summary span{font-size:11px;color:var(--muted)}
.sheet-stage{min-width:0;min-height:0;position:relative;isolation:isolate;overflow:hidden}.sheet-halo{position:absolute;inset:12% 4% 17%;border:1px solid color-mix(in srgb,var(--gold) 20%,transparent);border-radius:50%;pointer-events:none;transform:rotate(-12deg)}.sheet-halo:after{content:'';position:absolute;inset:16px;border:1px dashed color-mix(in srgb,var(--gold) 14%,transparent);border-radius:50%}
.sheet-figure{position:absolute;inset:0 68px 66px;padding:0;display:flex;align-items:center;justify-content:center;background:transparent;border:0;cursor:zoom-in;border-radius:0;color:var(--muted);overflow:visible}.sheet-figure:hover{background:transparent}.sheet-figure img{width:100%;height:100%;object-fit:contain;filter:drop-shadow(0 12px 15px #0002)}.sheet-figure.has-backdrop img{border-radius:20px;filter:none}.sheet-figure:focus-visible{outline:2px solid var(--gold);outline-offset:2px}.sheet-silhouette{width:70%;opacity:.25}.sheet-silhouette svg{width:100%;height:auto}
.sheet-slots{position:absolute;top:9%;bottom:20%;display:flex;flex-direction:column;justify-content:space-evenly;gap:18px;width:64px;z-index:1}.sheet-slots.left{left:2px}.sheet-slots.right{right:2px}.sheet-slot{position:relative;display:grid;place-items:center;width:64px;height:64px;flex-shrink:0;padding:5px;background:color-mix(in srgb,var(--surface) 75%,transparent);border:1px solid color-mix(in srgb,var(--gold) 40%,var(--line));border-radius:10px;color:var(--ink);cursor:pointer;transition:transform .18s,border-color .18s,background .18s}.sheet-slot:after{content:'';position:absolute;inset:3px;border:1px solid var(--line);border-radius:6px;pointer-events:none}.sheet-slot:hover:not(:disabled){transform:translateY(-3px);background:var(--surface);border-color:var(--gold)}.sheet-slot:focus-visible{outline:2px solid var(--gold);outline-offset:3px}.sheet-slot:disabled{opacity:1;cursor:default}.sheet-slot-label{position:absolute;top:calc(100% + 5px);left:-12px;right:-12px;font-size:9px;color:var(--muted);text-align:center;pointer-events:none}.sheet-slot-empty{width:26px;height:26px;opacity:.45}.sheet-slot-empty svg{width:100%;height:100%}.sheet-slot .item-art{width:44px;height:44px;border:0;background:transparent}
.sheet-image-actions{position:absolute;bottom:4px;left:0;right:0;display:flex;align-items:center;justify-content:center;gap:8px;flex-wrap:wrap}.sheet-image-actions .btn{font-size:11px;min-height:34px;padding:8px 10px}
.sheet-bag-heading{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:8px 0 16px;flex-shrink:0}.sheet-bag-heading h3{font:24px var(--serif);margin:5px 0 0}.sheet-bag-heading .btn{font-size:12px;padding:8px 10px}
.sheet-inventory-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(66px,1fr));align-content:start;gap:8px;overflow:auto;max-height:42%;min-height:86px;flex-shrink:0;padding:3px 4px 12px;scrollbar-width:thin}.sheet-inventory-cell{position:relative;min-width:0;height:88px;background:color-mix(in srgb,var(--surface) 65%,transparent);border:1px solid var(--line);border-radius:9px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;cursor:pointer;padding:7px;color:var(--ink);transition:border-color .16s,background .16s}.sheet-inventory-cell:hover,.sheet-inventory-cell[aria-pressed=true]{border-color:var(--gold);background:var(--surface)}.sheet-inventory-cell[aria-pressed=true]{box-shadow:inset 0 -2px var(--gold)}.sheet-inventory-cell .item-art{width:34px;height:34px;background:transparent;border:0}.sheet-inventory-cell strong{font-size:10px;font-weight:400;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sheet-item-quantity{position:absolute;top:4px;right:7px;font-size:10px;color:var(--muted)}.sheet-worn{position:absolute;top:4px;left:5px;font-size:8px;color:var(--gold)}
.sheet-item-inspector{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;margin-top:14px;padding:20px 0 0;border-top:1px solid var(--line)}.sheet-item-inspector h3{font:24px var(--serif);margin:8px 0 14px}.sheet-item-inspector p{font-size:15px;line-height:1.8;white-space:pre-wrap;overflow-wrap:anywhere}.sheet-item-inspector h4{font-size:11px;color:var(--gold);letter-spacing:1px;text-transform:uppercase;margin:18px 0 10px}.sheet-item-inspector .btn{font-size:12px;word-break:normal;overflow-wrap:normal;white-space:normal}.sheet-mobile-tabs{display:none}
.sheet-inspect-view{flex:1;min-height:0;display:flex;flex-direction:column}.sheet-inspect-viewport{flex:1;min-height:0;overflow:hidden;position:relative;touch-action:none;cursor:grab;outline-offset:-4px}.sheet-inspect-viewport:active{cursor:grabbing}.sheet-inspect-plane{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;will-change:transform;transform-origin:center;pointer-events:none}.sheet-inspect-plane img{height:96%;width:96%;object-fit:contain}.sheet-inspect-controls{display:flex;align-items:center;justify-content:center;gap:12px;padding:14px max(12px,env(safe-area-inset-bottom));flex-wrap:wrap;flex-shrink:0;border-top:1px solid var(--line)}.sheet-zoom-value{font-size:12px;min-width:42px;text-align:center}
.sheet-roster-tabs{display:flex;gap:10px;flex-wrap:wrap;margin:24px 0 12px}.sheet-roster-tabs [aria-pressed=true]{background:var(--green);color:var(--paper);border-color:var(--green)}.sheet-roster-tabs .btn{gap:10px}.sheet-card-image{display:block;width:100%;padding:0;border:0;background:transparent;cursor:pointer}.sheet-card-image:focus-visible{outline:3px solid var(--gold);outline-offset:-4px}.human-card-body .btn{white-space:normal;word-break:normal;overflow-wrap:normal;min-height:38px}.sheet-particles{position:fixed;inset:0;width:100%;height:100%;pointer-events:none;z-index:1000}.sheet-effects-setting{margin-top:24px;padding-top:20px;border-top:1px solid var(--line)}
@media(max-width:1100px) and (min-width:761px){.sheet-layout{grid-template-columns:minmax(205px,1fr) minmax(250px,1.2fr) minmax(210px,1fr);gap:16px;padding:8px 16px 18px}.sheet-slots,.sheet-slot{width:52px}.sheet-slot{height:52px}.sheet-slot .item-art{width:36px;height:36px}.sheet-figure{inset:0 48px 78px}.sheet-attributes .ability-summary{grid-template-columns:repeat(2,minmax(0,1fr))}.sheet-attributes .ability-summary>div{display:grid;grid-template-columns:1fr auto;padding:8px}.sheet-attributes .ability-summary small{grid-column:1/-1}}
@media(max-width:760px){#modal[data-kind=hero-sheet]>.modal-head,#modal[data-kind=hero-inspect]>.modal-head{padding:10px 14px}#modal[data-kind=hero-sheet] .modal-head h2{font-size:24px}#modal[data-kind=hero-sheet] .modal-emblem{display:none}.sheet-topline{padding:9px 14px;gap:8px;align-items:center;min-height:58px}.sheet-role{font-size:11px;max-width:40%}.sheet-role small{font-size:10px}.sheet-primary{gap:5px;flex-wrap:wrap;justify-content:flex-end;max-width:60%}.sheet-primary .btn,.sheet-management summary{font-size:11px;padding:7px 9px;min-height:32px}.sheet-management>.stack{max-height:58dvh}.sheet-layout{display:block;position:relative;padding:0 16px 12px;flex:1;min-height:0}.sheet-layout>.sheet-story,.sheet-layout>.sheet-bag,.sheet-layout>.sheet-stage{height:100%;display:none}.sheet-layout[data-mobile-panel=history]>.sheet-story{display:flex}.sheet-layout[data-mobile-panel=bag]>.sheet-bag{display:flex}.sheet-layout[data-mobile-panel=figure]>.sheet-stage{display:block}.sheet-reading{padding-right:8px}.sheet-reading h3{font-size:27px}.sheet-reading p{font-size:17px;line-height:1.85}.sheet-attributes .ability-summary strong{font-size:25px}.sheet-story{gap:12px}.sheet-mobile-tabs{display:flex;gap:8px;justify-content:space-around;padding:8px 12px max(10px,env(safe-area-inset-bottom));border-top:1px solid var(--line);flex-shrink:0}.sheet-mobile-tabs button{background:transparent;color:var(--muted);padding:10px 12px;font-size:12px;border-radius:10px;border:1px solid transparent;flex:1;cursor:pointer}.sheet-mobile-tabs [aria-pressed=true]{border-color:var(--line);background:var(--surface);color:var(--ink)}.sheet-inspect-controls{gap:7px;padding:10px 8px}.sheet-inspect-controls .btn{font-size:11px;padding:8px 10px}.sheet-figure{inset:0 56px 52px}.sheet-slots,.sheet-slot{width:52px}.sheet-slot{height:52px}.sheet-slot .item-art{width:36px;height:36px}.sheet-slot-label{font-size:8px}.sheet-image-actions .btn{font-size:11px}.sheet-image-actions{bottom:0}.sheet-inventory-grid{max-height:38%;grid-template-columns:repeat(auto-fill,minmax(63px,1fr))}.sheet-bag-heading{padding-top:12px}.sheet-roster-tabs{gap:6px}.sheet-roster-tabs .btn{font-size:12px;padding:8px 10px}}
@media(max-height:550px){.sheet-topline{min-height:44px;padding-top:5px;padding-bottom:5px}#modal[data-kind=hero-sheet]>.modal-head{padding-top:8px;padding-bottom:8px}.sheet-layout{padding-bottom:8px;gap:12px}.sheet-slots{top:0;bottom:52px;gap:12px}.sheet-slot-label{display:none}.sheet-reading h3{font-size:20px;margin:6px 0 10px}.sheet-attributes{padding-top:8px}.sheet-attributes .ability-summary>div{padding:6px}.sheet-attributes .ability-summary{grid-template-columns:repeat(4,minmax(0,1fr));margin-top:8px}.sheet-attributes .ability-summary small{font-size:8px}.sheet-attributes .ability-summary strong{font-size:19px}.sheet-story-tabs button{padding:8px 0}.sheet-bag-heading{padding:4px 0 8px}.sheet-bag-heading h3{font-size:20px}.sheet-item-inspector{padding-top:10px;margin-top:8px}.sheet-inventory-grid{min-height:72px}.sheet-inventory-cell{height:70px}.sheet-inventory-cell .item-art{width:28px;height:28px}}
@media(prefers-reduced-motion:reduce){.sheet-slot,.sheet-inventory-cell{transition:none}.sheet-inspect-plane{will-change:auto}}
.sheet-inventory-cell .item-art:before,.sheet-slot .item-art:before{inset:3px}
.sheet-story-tabs [data-sheet=reading-focus]{margin-left:auto;font-size:16px;padding:8px}
@media(min-width:761px){.sheet-layout.reading-expanded{grid-template-columns:minmax(0,1fr)}.sheet-layout.reading-expanded>.sheet-stage,.sheet-layout.reading-expanded>.sheet-bag{display:none}.reading-expanded .sheet-reading{width:min(100%,1000px);margin:0 auto}.reading-expanded .sheet-attributes{width:min(100%,680px);margin:0 auto}}
@media(max-width:760px){.sheet-story-tabs [data-sheet=reading-focus]{display:none}}
@media(max-width:760px){#modal[data-kind=hero-sheet]>.modal-head{grid-template-columns:minmax(0,1fr) auto}.sheet-management>.stack{max-width:calc(100vw - 28px)}}

/* Comfortable desktop reading and controls without scaling the whole screen. */
@media(min-width:761px) and (min-height:600px){
  #modal[data-kind=hero-sheet] .eyebrow{font-size:13px;letter-spacing:1px}
  #modal[data-kind=hero-sheet] .btn,
  #modal[data-kind=hero-inspect] .btn,
  .sheet-management summary{font-size:16px;line-height:1.4;min-height:44px;padding:10px 16px}
  .sheet-role{font-size:18px}.sheet-role small{font-size:14px;margin-top:6px}
  .sheet-topline{padding-top:14px;padding-bottom:14px}
  .sheet-management>.stack{width:300px}
  .sheet-story-tabs{gap:12px;align-items:center}
  .sheet-story-tabs button{font-size:15px;letter-spacing:.3px;text-transform:none;min-height:44px}
  .sheet-story-tabs [data-sheet=reading-focus]{font-size:22px;min-width:40px}
  .sheet-reading h3,.sheet-bag-heading h3,.sheet-item-inspector h3{font-size:30px}
  .sheet-reading p{font-size:clamp(19px,1.35vw,22px);line-height:1.75}
  .sheet-item-inspector p{font-size:18px;line-height:1.7}
  .sheet-item-inspector h4{font-size:14px;letter-spacing:.5px}
  .sheet-attributes .ability-summary{gap:10px}
  .sheet-attributes .ability-summary small{font-size:14px}
  .sheet-attributes .ability-summary strong{font-size:32px}
  .sheet-attributes .ability-summary span{font-size:15px}
  .sheet-attributes .ability-summary>div{padding:12px 8px}
  .sheet-slots,.sheet-slot{width:72px}.sheet-slot{height:72px}
  .sheet-slot .item-art{width:50px;height:50px}
  .sheet-slot-label{font-size:13px;line-height:1.3;left:-8px;right:-8px}
  .sheet-figure{inset:0 80px 108px}
  .sheet-slots{bottom:26%;gap:34px}
  .sheet-image-actions{gap:10px}
  .sheet-inventory-grid{grid-template-columns:repeat(auto-fill,minmax(88px,1fr));gap:10px;min-height:112px}
  .sheet-inventory-cell{height:108px;padding:10px;gap:8px}
  .sheet-inventory-cell .item-art{width:42px;height:42px}
  .sheet-inventory-cell strong{font-size:14px}
  .sheet-item-quantity{font-size:13px}.sheet-worn{font-size:11px}
  .sheet-zoom-value{font-size:16px;min-width:50px}
}
@media(min-width:761px) and (max-width:1599px) and (min-height:600px){
  .sheet-attributes .ability-summary{grid-template-columns:repeat(2,minmax(0,1fr))}
  .sheet-attributes .ability-summary>div{display:grid;grid-template-columns:1fr auto;gap:4px;padding:8px 12px}
  .sheet-attributes .ability-summary small{grid-column:1/-1;text-align:left}
}
@media(min-width:761px) and (max-width:1100px) and (min-height:600px){
  .sheet-story-tabs{gap:8px}.sheet-story-tabs button{font-size:14px;letter-spacing:0}
  .sheet-slots,.sheet-slot{width:60px}.sheet-slot{height:60px}
  .sheet-slot .item-art{width:42px;height:42px}
  .sheet-slot-label{font-size:12px}
  .sheet-figure{left:66px;right:66px}
  .sheet-bag-heading{flex-wrap:wrap}
}

/* Item artwork has the same visual footprint as the equipment slot buttons. */
.sheet-inventory-cell .item-art{width:64px;height:64px;flex-shrink:0}
.sheet-inventory-cell{height:114px}
.sheet-inventory-grid{grid-template-columns:repeat(auto-fill,minmax(82px,1fr))}
@media(min-width:761px) and (min-height:600px){
  .sheet-inventory-cell .item-art{width:72px;height:72px}
  .sheet-inventory-cell{height:134px}
  .sheet-inventory-grid{grid-template-columns:repeat(auto-fill,minmax(102px,1fr))}
}
@media(min-width:761px) and (max-width:1100px) and (min-height:600px){
  .sheet-inventory-cell .item-art{width:60px;height:60px}
  .sheet-inventory-cell{height:122px}
}
@media(max-width:760px){
  .sheet-inventory-cell .item-art{width:52px;height:52px}
  .sheet-inventory-cell{height:100px}
}
@media(max-height:550px){
  .sheet-inventory-cell .item-art{width:44px;height:44px}
  .sheet-inventory-cell{height:88px}
}
