/* An illuminated chronicle: warm gold, dark ink, clear formation silhouettes. */
#screen-legends{height:100%;min-height:0;overflow:hidden;grid-column:1/-1;padding:8px 16px 12px;box-sizing:border-box}
#screen-result.run-summary-mode .outcome-card{overflow-y:auto!important;max-height:100%!important}
#screen-home .home-actions button{min-height:57px;padding-top:7px;padding-bottom:7px}
.legends-shell{height:100%;min-height:0;display:flex;flex-direction:column;gap:8px;max-width:1220px;margin:auto}
.legends-heading{display:flex;flex:0 0 auto;min-height:58px;align-items:center;justify-content:space-between;gap:20px;padding:8px 0 12px;border-bottom:1px solid #d9b36e50}
.legends-heading>div:first-child{min-width:0}
.legends-controls{display:flex;flex:0 0 auto;align-items:center;justify-content:flex-end;gap:8px}
.legends-controls button.secondary{position:static;flex:0 0 auto;min-height:36px;margin:0;padding:8px 13px;font-size:12px;line-height:18px;white-space:nowrap}
.legends-controls button:focus-visible{outline:2px solid #f3d18d;outline-offset:3px}
.legends-heading h2{font-family:Georgia,serif;font-variant:small-caps;font-size:32px;letter-spacing:.09em;margin:4px 0;color:#f4d798}
.legends-heading p{margin:0;font-size:12px;color:#adb7ba}.legends-heading .label{font-size:9px;letter-spacing:.2em}
.legends-toolbar{display:flex;justify-content:space-between;align-items:center;gap:12px;color:#cdb991;font-size:10px;letter-spacing:.12em}.legends-toolbar{flex:0 0 auto;min-height:18px}
#legendsStatus{font-size:12px;color:#e7ce9d;margin:0;min-height:15px;flex-shrink:0}
#legendsList{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-color:#8e7651 #101c25;padding-right:6px}
.legend-entry{display:grid;grid-template-columns:48px minmax(150px,1fr) minmax(270px,1.5fr) 125px;align-items:center;gap:12px;padding:12px 15px;margin-bottom:7px;border:1px solid #afa07c30;border-radius:9px;background:linear-gradient(110deg,#20313bce,#14212be8);box-shadow:0 3px 10px #0002}
.legend-entry.legend-champion{border-color:#d8b57999;background:linear-gradient(110deg,#55442b77,#25323cdd 55%,#222b32);box-shadow:inset 3px 0 #ecc77e,0 4px 18px #0003}
.legend-rank{text-align:center;color:#c9b68f;font:22px Georgia,serif}.legend-champion .legend-rank{color:#f7d992;font-size:32px}
.legend-identity{min-width:0;display:flex;flex-direction:column;gap:4px}.legend-identity strong{color:#f3dba9;font:18px Georgia,serif;overflow-wrap:anywhere}.legend-identity small{font-size:12px;color:#d1d8da;overflow-wrap:anywhere}.legend-identity>span{font-size:10px;color:#a3b1b6;line-height:1.4}
.legend-formation{display:flex;justify-content:center;gap:8px;align-items:center}.legend-unit{position:relative;width:45px;height:45px;flex:0 0 45px;background:#172730;border:1px solid #bb9b62;border-radius:50%;padding:0;box-shadow:0 2px 7px #0006}.legend-unit:nth-child(2){margin-right:12px}.legend-portrait{width:100%;height:100%;object-fit:cover;border-radius:50%}.legend-unit:hover,.legend-unit:focus-visible{outline:2px solid #f2d18b;outline-offset:3px;transform:translateY(-2px)}
.legend-level{position:absolute;bottom:-5px;left:-3px;font:10px Georgia,serif;color:#f9e9ba;background:#12222b;border:1px solid #957b4e;border-radius:4px;min-width:15px;padding:2px 3px;text-align:center}.legend-item{position:absolute;right:-7px;bottom:-5px;background:#17232b;border:1px solid #d1b47a;width:21px;height:21px;border-radius:50%;display:grid;place-items:center}.legend-item .equipment-art{width:19px;height:19px;border-radius:50%;object-fit:cover}
.legend-relic{width:34px;height:34px;flex:0 0 34px;margin-left:9px;border:1px solid #bfa16988;border-radius:6px;background:#1e2d35;padding:3px;display:grid;place-items:center}.legend-relic .equipment-art{width:26px;height:26px;object-fit:contain}.legend-empty{display:grid;place-items:center;color:#73808a;border-color:#54606b66;background:#14212a77}
.legend-score{text-align:right}.legend-score strong{font:22px Georgia,serif;color:#efce87;display:block;white-space:nowrap}.legend-score small{font-size:8px;letter-spacing:.2em;color:#99a7ad}
.legend-breakdown{grid-column:2/-1;font-size:11px;color:#aebdc4}.legend-breakdown summary{cursor:pointer;width:max-content}.legend-detail-copy{margin-top:6px;line-height:1.5;color:#c5ced0}.legend-inspection{grid-column:2/-1;font-size:12px;line-height:1.5;margin:0;padding:9px 12px;border-left:2px solid #c4a568;background:#0c18277a;color:#e1d9c4}
.legends-footer{font-size:10px;color:#9aa9b0;display:flex;justify-content:space-between;gap:16px;flex-wrap:wrap;position:relative;padding-top:5px}.legends-footer summary{color:#ddc590;cursor:pointer}.legends-footer details[open] p{position:absolute;bottom:18px;right:0;max-width:570px;margin:0;padding:15px;background:#13232b;border:1px solid #bda06c;border-radius:8px;color:#e0d5bd;box-shadow:0 5px 30px #0009;font-size:12px;line-height:1.6;z-index:5}
.legends-empty{text-align:center;margin:30px auto;color:#9bafb8}.legends-empty>span{font-size:34px;color:#d2b276}.legends-empty h3{font:24px Georgia,serif;color:#e7d0a4}.legends-empty p{line-height:1.8}
#legendForm{flex-shrink:0;display:flex;justify-content:space-between;align-items:center;gap:20px;padding:12px 16px;border:1px solid #d0af76;border-radius:8px;background:linear-gradient(110deg,#493d2c77,#1b2b36)}#legendForm[hidden]{display:none}#legendForm>div:first-child{flex:1;display:grid;grid-template-columns:130px 1fr;gap:6px 12px;align-items:center}#legendPreview{grid-column:1/-1;color:#f0d59f;font-size:13px}#legendForm label{font-size:12px}#legendForm input{min-width:0;padding:8px 10px;border:1px solid #b59a70;background:#0d1e29;border-radius:5px;color:#f7e5bd;font-size:16px}#legendForm small{grid-column:1/-1;font-size:10px;color:#b1bdc2}#legendForm>.legend-form-actions{display:flex;gap:8px}#legendForm button{white-space:nowrap;font-size:12px;padding:10px 13px}
.legend-run-result{text-align:center;padding:8px 15px 15px;border-bottom:1px solid #bda47650;margin-bottom:14px}.legend-run-result>small{font-size:9px;letter-spacing:.18em;color:#b8a582;display:block}.legend-run-result>strong{font:30px Georgia,serif;color:#f6d998;display:block;margin:8px}.legend-run-result>strong span{font-size:14px}.legend-run-result button{display:block;margin:8px auto 0}
@media(max-height:650px){.legends-heading{padding:0 0 6px}.legends-heading h2{font-size:26px}.legends-heading p{display:none}.legend-entry{padding:8px 12px;gap:7px}.legend-breakdown{margin-top:2px}#screen-legends{padding-top:0}.legend-run-result>strong{font-size:25px;margin:5px}.legend-run-result{padding:4px 10px 8px;margin-bottom:7px}}
@media(max-width:950px){.legend-entry{grid-template-columns:35px minmax(130px,1fr) minmax(245px,1.3fr) 115px;gap:8px}.legend-formation{gap:6px}.legend-unit{width:39px;height:39px;flex-basis:39px}.legend-unit:nth-child(2){margin-right:7px}.legend-relic{margin-left:3px;width:29px;height:29px;flex-basis:29px}.legend-relic .equipment-art{width:23px;height:23px}.legend-score strong{font-size:20px}.legend-identity strong{font-size:16px}}
@media(prefers-reduced-motion:reduce){.legend-unit:hover{transform:none}}

/* Name entry remains readable when a phone keyboard reduces the viewport. */
#legendForm{position:fixed;z-index:1000;left:max(8px,env(safe-area-inset-left));right:max(8px,env(safe-area-inset-right));top:8px;width:auto;box-sizing:border-box;overflow-y:auto;overscroll-behavior:contain;background:linear-gradient(110deg,#29322f,#142630);box-shadow:0 0 0 150vmax #030b16d9,0 12px 45px #000a}
#legendForm label{color:#f2d9ac}#legendForm>div{min-width:0}
@media(max-width:700px){#legendForm{gap:12px;padding:10px 12px}#legendForm>div:first-child{grid-template-columns:100px 1fr}#legendForm>.legend-form-actions{flex-direction:column}#legendForm button{padding:8px 10px}}

/* A clear invitation, followed by a deliberate public submission. */
.legend-run-result h3{font:21px Georgia,serif;color:#f3dcac;margin:8px 0 5px}.legend-run-result>p{font-size:12px;color:#bdc9cd;margin:0 0 7px}
#screen-result #legendEndSubmit{min-height:44px;max-width:350px;width:100%;font-size:15px;background:linear-gradient(#f0d49b,#c49b59);border:1px solid #f4d9a1;box-shadow:0 3px 13px #0005}
#battleResultActions .legend-share-primary{background:linear-gradient(#efcf91,#bd9455);color:#17232a;border:1px solid #f5d89e;font-weight:800;min-height:42px;font-size:13px;box-shadow:0 2px 10px #0004}
#battleResultActions:has(.legend-share-primary) #battleNextRound{background:#243743;color:#d4dfdf;border-color:#70818a}
.legend-battle-invite{color:#d9d1be;font:12px/1.5 system-ui;margin:8px 12px 2px;text-align:center}
#legendForm{flex-wrap:wrap}#legendForm>.legend-form-copy{min-width:260px}#legendFormTitle{grid-column:1/-1;font:24px Georgia,serif;color:#f0d8a6;margin:0 0 3px}
#legendTeamPreview{grid-column:1/-1;justify-content:flex-start;margin:5px 0 9px;padding:4px 0 5px}
#legendFormStatus{flex:0 0 100%;font-size:12px;color:#ebd3a5;margin:0}#legendFormStatus:empty{display:none}
#legendForm[data-complete="true"]>.legend-form-copy,#legendForm[data-complete="true"]>.legend-form-actions{display:none}
#legendConfirmation{flex:1;text-align:center;padding:12px}#legendConfirmation[hidden]{display:none}#legendConfirmation h2{font:26px Georgia,serif;color:#f4d99c;margin:4px 0 9px}#legendConfirmation p{font-size:14px;color:#d2dcdb;margin:6px 0 16px}.legend-success-mark{font-size:32px;color:#ebc777}#legendConfirmation button{min-height:44px}
@media(max-height:300px){#legendFormTitle{font-size:19px}#legendTeamPreview{display:none}#legendConfirmation{padding:3px}#legendConfirmation .legend-success-mark{display:none}}

#secureRunStatus{position:absolute;z-index:70;bottom:9px;left:50%;transform:translateX(-50%);padding:7px 16px;border:1px solid #b69765;border-radius:6px;background:#142531;color:#f0dab1;font-size:12px}body[data-secure-pending=true] #screen-setup button{pointer-events:none;opacity:.65}
.legend-pages{display:flex;gap:8px;margin-left:auto}.legend-pages button{min-height:36px;padding:5px 12px}body[data-reroll-pending=true] #reroll{opacity:1;color:#ffe2a6;box-shadow:0 0 16px #caa15b40}body[data-reroll-pending=true] #offers{animation:summon-wait211 1s ease-in-out infinite}@keyframes summon-wait211{50%{filter:brightness(1.13)}}@media(prefers-reduced-motion:reduce){body[data-reroll-pending=true] #offers{animation:none}}
