/* V6.1: portrait anatomy, arena and compact ranking. */
.avatar-portrait>.paperdoll{inset:0;width:100%;height:100%;left:0;top:0}
.portrait-pose .doll-head{left:11%;top:2%;width:78%;height:78%;aspect-ratio:1}
.portrait-uniform{position:absolute;inset:0;width:100%;height:100%;z-index:1}
.duel-pose .doll-head{top:2%;left:24%;width:37%}
.avatar-body{overflow:hidden}
.arena{height:200px!important;background:linear-gradient(#10152420,#0a0c1255),url('assets/hall-v4.webp') center 65%/cover!important;border:1px solid var(--border);border-radius:12px}
.arena-ribbon{display:none}.duel-characters{inset:17px 0 25px;justify-content:space-between;padding:0 8%}
.duel-character{width:34%;filter:drop-shadow(0 3px 2px #0007)}.duel-spark{display:none}
.arena-bottom{background:linear-gradient(transparent,#080b12d9);left:0;right:0;bottom:0;padding:12px 10px 7px;font-size:8px;gap:8px}
.character-preview{height:160px;width:100%;display:flex;align-items:center;justify-content:center;gap:3px}
.character-preview>.avatar-body{position:relative;left:auto;top:auto;width:86px;height:144px;flex-shrink:0}
.character-preview>.avatar-portrait{position:relative;top:auto;right:auto;width:45px;height:45px;flex-shrink:0;align-self:flex-start;margin-top:10px}
.avatar-choice{padding:14px 9px}.avatar-choice h3{margin:8px 0 4px}.avatar-choice p{margin:6px 0 13px;line-height:1.55}
.in-duel .confirm-action{position:static;margin:16px 0 22px;box-shadow:none!important}
.ranking-description{font-size:12px;line-height:1.6;color:var(--muted);margin:14px 0 18px}
.ranking-list{border:1px solid var(--border);border-radius:14px;overflow:hidden;background:var(--panel)}
.ranking-row{display:grid;grid-template-columns:25px 24px minmax(0,1fr) 60px;gap:10px;align-items:center;width:100%;padding:16px 12px;background:none;border:0;border-bottom:1px solid var(--border);text-align:left;color:var(--text);min-height:92px}
.ranking-row:last-child{border-bottom:0}.ranking-row:hover{background:var(--panel2)}
.ranking-position{font-size:14px;text-align:center;color:var(--muted);font-variant-numeric:tabular-nums}.podium-1{color:var(--gold);font-weight:700}.podium-2{color:#9eafbb}.podium-3{color:#b79170}
.ranking-house .club-crest{width:23px;height:31px}
.ranking-person{min-width:0}.ranking-person strong{display:block;font-size:14px;overflow-wrap:anywhere;line-height:1.45}.ranking-person>span{display:block;font-size:10px;color:var(--muted);margin-top:3px}.ranking-person>small{display:block;font-size:10px;color:var(--muted);margin-top:5px}
.ranking-score{text-align:right;min-width:0}.ranking-score strong{display:block;font-size:18px;color:var(--gold);font-variant-numeric:tabular-nums;overflow-wrap:anywhere}.ranking-score small{display:block;font-size:9px;color:var(--muted);margin-top:3px}
@media(max-width:370px){.character-preview{gap:0}.character-preview>.avatar-body{width:72px;height:120px}.character-preview>.avatar-portrait{width:38px;height:38px}.ranking-row{gap:7px;padding:13px 9px;grid-template-columns:20px 21px minmax(0,1fr) 51px}}
@media(min-width:750px){.arena{height:260px!important}.duel-characters{padding:0 15%}.ranking-row{grid-template-columns:32px 28px minmax(0,1fr) 85px;padding:16px 20px}}
/* V6.2: align neck anchors and preserve each complete outfit in portraits. */
.paperdoll .doll-head{left:var(--head-left,31%);top:4.7%;width:32%;height:auto;aspect-ratio:1;z-index:5}
.paperdoll .doll-collar{z-index:6;clip-path:polygon(39% 0,54% 0,60% 13%,37% 13%)}
.avatar-portrait>.paperdoll{width:230%;height:383.333%;left:-58%;top:-8%;inset:-8% auto auto -58%}
.character-preview{height:158px;display:flex;justify-content:center;align-items:center}
.character-preview>.avatar-body{width:92px;height:153px}
.house-gallery{display:flex;gap:12px;align-items:center;border-top:1px solid var(--border);border-bottom:1px solid var(--border);padding:12px 0;margin:0 0 18px}
.school-emblem{display:flex;flex-direction:column;align-items:center;gap:3px;min-width:57px;padding-right:12px;border-right:1px solid var(--border)}
.school-emblem .club-crest{width:38px;height:52px}.school-emblem strong{font-size:9px;font-weight:500;color:var(--gold)}
.four-houses{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px;flex:1}.four-houses>div{display:flex;flex-direction:column;align-items:center;gap:5px;min-width:0}
.four-houses .club-crest{width:30px;height:42px}.four-houses span:not(.club-crest){font-size:8px;color:var(--muted)}
.hero-art{right:4px;bottom:5px;width:51%;height:95%;opacity:.65}.hero-copy{width:80%}.hero-copy p{max-width:190px}.hero-copy .btn{position:relative;z-index:1}.hero-art .scene{width:100%;height:100%}
/* Keep choices close together; touch controls remain at least 44px high. */
.in-duel .top,.in-duel .demo-strip{display:none}
.in-duel .shell{max-width:650px;padding:0 14px 30px}
.compact-duel .page-head{margin:5px 0;min-height:40px;gap:6px}.compact-duel .page-head h1{font:600 15px ClubText,system-ui,sans-serif!important;margin:0!important}
.compact-duel .page-head .btn{min-height:36px;padding:7px 10px;font-size:11px}
.compact-duel>.notice{font-size:10px;padding:4px 8px;margin:3px 0;line-height:1.4;border-radius:6px}
.compact-duel>.card{padding:7px 10px;margin:4px 0}.compact-duel .player-bar{margin:7px 0;gap:7px}
.compact-duel .fighter-avatar .avatar{width:30px;height:30px}.compact-duel .fighter-name{font-size:11px;gap:3px}.compact-duel .fighter-small{font-size:9px}.compact-duel .health{height:5px;margin:5px 0}.compact-duel .health-text{font-size:9px}.compact-duel .energy-private{font-size:9px}.compact-duel .energy-private .icon{width:10px;height:10px}
.compact-duel .round-badge{width:26px;height:26px;font-size:12px}
.compact-duel .scene-toolbar{margin:0;height:24px}.compact-duel .scene-toolbar .btn{min-height:24px;font-size:10px;padding:2px 4px}
.compact-duel .arena{height:128px!important;background-position:center 53%!important}.compact-duel .duel-characters{inset:10px 0 17px;padding:0 9%}.compact-duel .arena-bottom{padding:8px 8px 4px;font-size:7px}
.compact-duel .turn-header{margin:9px 0 7px;min-height:33px}.compact-duel .turn-header h2{font:600 18px ClubText,system-ui,sans-serif!important;margin:0}.compact-duel .turn-header p{font-size:10px;margin:2px 0}.compact-duel .timer{height:32px;min-height:32px;padding:5px 8px;font-size:15px;gap:5px}.compact-duel .timer .icon{width:16px;height:16px}
.compact-duel .zone-label{font-size:10px;margin:0 0 5px}.compact-duel .zones{gap:7px}
.compact-duel .zone{min-height:67px;padding:6px 3px;border-radius:9px;gap:3px}.compact-duel .zone>.icon{display:none}.compact-duel .zone strong{font-size:11px;line-height:1.25}.compact-duel .zone small{font-size:10px;line-height:1.3}.compact-duel .zone .cost{font-size:10px;line-height:1.3}.compact-duel .cost .icon{width:11px;height:11px}
.compact-duel .spell-label{font-size:10px;margin:6px 0 5px;min-height:24px;gap:4px}.compact-duel .spell-label .btn{font-size:10px;min-height:24px;padding:2px 4px}
.compact-duel .spells{gap:7px;margin:6px 0}.compact-duel .spell{min-height:51px;padding:7px 9px!important;gap:2px;border-radius:9px;justify-content:center}.compact-duel .spell strong{font-size:11px;line-height:1.3}.compact-duel .spell small{font-size:10px;line-height:1.35}
.compact-duel .confirm-action{min-height:44px;position:sticky;bottom:max(8px,env(safe-area-inset-bottom));z-index:8;margin:9px 0 12px;box-shadow:0 0 0 5px var(--bg)!important;font-size:12px}
.compact-duel .duel-reference{margin-top:4px}.compact-duel .duel-reference>details{margin:5px 0;border-radius:9px}.compact-duel .duel-reference summary{padding:8px 10px;font-size:10px;line-height:1.4}
.compact-duel .item-activation{padding:6px 9px;margin:6px 0;font-size:10px}.compact-duel .item-activation>div{display:grid;grid-template-columns:1fr auto;gap:2px 8px;align-items:center}.compact-duel .item-activation strong{font-size:11px}.compact-duel .item-activation p{grid-column:1;font-size:10px;margin:0;line-height:1.35}.compact-duel .item-activation .btn{grid-column:2;grid-row:1/3;min-height:44px;padding:7px 9px;font-size:10px}
.compact-duel .duel-stage>.result-round{min-height:128px}.compact-duel .log{margin:10px 0}.compact-duel .spells .spell:last-child:nth-child(odd){grid-column:1/-1}
@media(max-height:700px){.compact-duel .arena{height:96px!important}.compact-duel .scene-toolbar{height:22px}.compact-duel .page-head{min-height:36px}.compact-duel .zone{min-height:61px}.compact-duel .turn-header{margin:6px 0}.compact-duel .spell{min-height:48px}}
@media(max-width:350px){.four-houses{gap:2px}.four-houses span:not(.club-crest){font-size:7px}.school-emblem{min-width:49px;padding-right:8px}.compact-duel .fighter-name{font-size:10px}.compact-duel .duelist-code{font-size:8px}.compact-duel .zone strong{font-size:10px}.compact-duel .spell strong{font-size:10px}}

.arena{background-image:linear-gradient(#10152410,#0a0c1225),url('assets/hall-v62.webp')!important}
body .compact-duel .arena{background-image:linear-gradient(#10152410,#0a0c1225),url('assets/hall-v62.webp')!important}
body .compact-duel .arena{background-size:100% 100%!important;background-position:center!important}
.hero .hero-copy{width:65%;padding:24px 22px}.hero .hero-copy h2{font-size:28px;line-height:1.2;max-width:175px}.hero .hero-copy p{max-width:170px;font-size:12px}
.hero .hero-art{width:43%;height:235px;right:0;top:6px;bottom:auto;opacity:.65}
@media(max-width:350px){.hero .hero-copy{padding:20px 16px;width:68%}.hero .hero-copy h2{font-size:25px}.hero .hero-art{width:40%}.hero .hero-copy p{max-width:145px}}
/* A separate footer reserves space: confirmation never covers a spell. */
.in-duel .shell{padding-bottom:0}
.compact-duel.duel-ready{height:100dvh;height:var(--tg-viewport-stable-height,100dvh);display:flex;flex-direction:column;overflow:hidden}
.duel-ready>.duel-scroll{min-height:0;flex:1;overflow-y:auto;overscroll-behavior:contain;padding-bottom:3px}
.duel-ready>.duel-dock{flex-shrink:0;padding:6px 0 max(8px,env(safe-area-inset-bottom));background:var(--bg);border-top:1px solid var(--border)}
.compact-duel .duel-dock .confirm-action{position:static;margin:0;box-shadow:none!important;width:100%;min-height:44px}
.compact-duel .duel-scroll>.notice{font-size:10px;padding:4px 8px;margin:3px 0;line-height:1.4;border-radius:6px}
.compact-duel .duel-scroll>.card{padding:7px 10px;margin:4px 0}
