#heroCreator{position:fixed;inset:0;z-index:100;display:grid;place-items:center;padding:calc(18px + env(safe-area-inset-top)) 14px calc(18px + env(safe-area-inset-bottom));overflow:auto;isolation:isolate;background:#050b18}
.hero-creator-bg{position:absolute;inset:0;z-index:-1;background:linear-gradient(100deg,#060c1cf0,#07182bd9 57%,#0d1427e8),url('/static/game/empire-rogue/art/lunar-arena-v1.webp') center/cover}
.hero-creator-panel{width:min(900px,100%);max-height:100%;overflow:auto;border:1px solid #d3bb8a73;border-radius:24px;background:linear-gradient(135deg,#172c3af5,#101c2bef);box-shadow:0 28px 90px #000b,inset 0 1px #fff2;color:#f8efd9}
.hero-creator-panel header{padding:22px 26px 14px;border-bottom:1px solid #d3bb8a30}
.hero-creator-panel header small{font-size:10px;letter-spacing:2px;color:#e0c38d}
.hero-creator-panel h1{font:normal 36px Georgia,serif;margin:5px 0;color:#fff2d5}
.hero-creator-panel header p{font-size:13px;color:#b9d1d4;margin:0}
.hero-creator-body{display:grid;grid-template-columns:minmax(210px,42%) minmax(0,1fr);gap:22px;padding:20px 26px 24px}
.hero-preview{position:relative;min-height:370px;display:flex;flex-direction:column;align-items:center;justify-content:center;border:1px solid #84b8c744;border-radius:20px;overflow:hidden;background:radial-gradient(circle at 50% 52%,color-mix(in srgb,var(--hero-color) 27%,transparent),transparent 43%),linear-gradient(180deg,#152c43,#0a1729)}
.hero-preview:after{content:'';position:absolute;left:17%;right:17%;bottom:58px;height:17px;border-radius:50%;background:#0009;filter:blur(10px)}
.hero-preview-halo{position:absolute;width:220px;height:220px;border:1px solid #d2c18b80;border-radius:50%;box-shadow:0 0 0 8px #d1b87410,0 0 40px color-mix(in srgb,var(--hero-color) 28%,transparent)}
.hero-preview canvas{position:relative;z-index:1;width:min(88%,280px);height:auto;aspect-ratio:1;object-fit:contain;filter:drop-shadow(0 16px 13px #0009);animation:hero-float 3s ease-in-out infinite}
.hero-preview strong{position:relative;z-index:2;font:normal 25px Georgia,serif;text-shadow:0 2px 6px #000}
.hero-preview>span{position:relative;z-index:2;font-size:12px;color:#c4d6dc;margin-top:4px}
.hero-options{min-width:0}.hero-name-label,.hero-options h2,.hero-color-head{display:block;font-size:13px;font-weight:700;color:#e7d5b4;margin:0 0 8px}
#heroName{width:100%;height:45px;border:1px solid #b6b28b88;border-radius:10px;background:#071726;color:#fff4df;padding:0 14px;font:16px system-ui;outline:none}
#heroName:focus{border-color:#8ee5f5;box-shadow:0 0 0 3px #8ee5f529}
.hero-color-head{display:flex;justify-content:space-between;align-items:center;margin:16px 0 8px}
.hero-hex{display:flex;align-items:center;gap:8px;font:12px ui-monospace,monospace;color:#d4e5e7}
.hero-hex input{width:38px;height:30px;padding:0;border:0;background:none;cursor:pointer}
.hero-rgb-row{display:grid;grid-template-columns:18px 1fr 32px;gap:10px;align-items:center;font:12px ui-monospace,monospace;margin:6px 0;color:#dde8e7}
.hero-rgb-row input{width:100%;height:26px;accent-color:var(--hero-color);cursor:pointer}
.hero-rgb-row output{text-align:right}.hero-options h2{margin:17px 0 9px}
.hero-class-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.hero-class{min-width:0;min-height:76px;display:flex;align-items:center;gap:5px;padding:7px;text-align:left;border:1px solid #8caaad57;border-radius:12px;background:#102534;color:#f5ecda;cursor:pointer}
.hero-class.selected{border-color:#f3cd84;background:linear-gradient(130deg,#315366,#193b4d);box-shadow:inset 0 0 0 1px #f3cd8455,0 0 18px #dcbf5433}
.hero-class img{width:50px;height:55px;object-fit:contain;flex:none}.hero-class span{min-width:0}.hero-class b{display:block;font-size:12px}.hero-class small{display:block;font-size:10px;line-height:1.2;color:#bed0d0;margin-top:3px}
#heroError{min-height:16px;color:#ff9e9e;font-size:12px;margin:8px 0 0}
.hero-actions{display:flex;gap:8px;margin-top:5px}.hero-actions button{min-height:45px;border-radius:11px;padding:10px 14px;font-weight:700;cursor:pointer}
#heroSave{flex:1;background:linear-gradient(#e8c98d,#b78747);color:#2b2130;box-shadow:inset 0 1px #fff8}
#heroCancel{background:#223744;border:1px solid #a5bdc366;color:#e6e5da}
.hero-nameplate{max-width:190px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:center;font:12px Georgia,serif;color:#ffe5b1;text-shadow:0 2px 5px #000;pointer-events:none}
#tableCompanion{height:calc(100% - 74px);max-height:195px}
@keyframes hero-float{50%{transform:translateY(-5px)}}
@media(max-width:650px){#heroCreator{padding:env(safe-area-inset-top) 0 env(safe-area-inset-bottom)}.hero-creator-panel{min-height:100%;max-height:none;border-radius:0;border-left:0;border-right:0}.hero-creator-panel header{padding:16px 18px 9px}.hero-creator-panel h1{font-size:29px}.hero-creator-panel header p{font-size:11px}.hero-creator-body{display:block;padding:10px 16px 20px}.hero-preview{min-height:210px;max-height:32dvh;margin-bottom:13px}.hero-preview canvas{width:min(50%,150px)}.hero-preview-halo{width:150px;height:150px}.hero-preview strong{font-size:20px}.hero-class{min-height:68px}.hero-class img{width:43px;height:46px}.hero-class small{font-size:9px}}
@media(max-height:700px) and (max-width:650px){.hero-preview{min-height:150px;max-height:25dvh}.hero-preview canvas{width:115px}.hero-preview-halo{width:125px;height:125px}}
@media(prefers-reduced-motion:reduce){.hero-preview canvas{animation:none}}

.hero-class-grid{max-height:350px;overflow-y:auto}.hero-options{min-height:0}.hero-class img{object-fit:contain}.hero-preview canvas{object-fit:contain}

.hero-preview canvas{aspect-ratio:auto}

.hero-preview canvas[data-full-sprite]{width:min(95%,380px)}@media(max-width:650px){.hero-preview canvas[data-full-sprite]{width:min(95%,300px)}}
