.paper-card,.printed-face{position:relative}
.runtime-art{display:contents}.runtime-art img{width:100%;height:100%;object-fit:contain}
.runtime-surface{position:absolute;inset:0;z-index:4;display:block;pointer-events:none;border-radius:inherit;overflow:hidden}
.runtime-surface[hidden]{display:none!important}.runtime-surface img{display:block;width:100%;height:100%;object-fit:contain}
.runtime-surface:has(img[data-load-state="loaded"]){background:#143331}
.card-tile>.runtime-surface{bottom:22px}.card-tile .card-count{position:relative;z-index:5}.card-tile.unowned>.runtime-surface img{opacity:.55}
.detail-card .card-tile.unowned>.runtime-surface img{opacity:1}
.card-variant-controls{display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin:8px 0;font-size:12px;line-height:1.4}
.card-variant-controls button{min-height:44px;min-width:56px;font-size:12px;padding:5px 8px}.card-variant-controls button[aria-pressed="true"]{border-color:#f0d591;background:#47614c;color:#fff7dd}
.card-variant-controls small{color:#c9d6c8}.runtime-surface .art-load-fallback{display:none}

/* r15 UIR14-LIVE-01: a loaded complete print owns row 1; ownership owns row 2. */
.card-tile.runtime-print,.detail-card .card-tile.runtime-print,.opened-slot .card-tile.runtime-print{grid-template-rows:minmax(0,1fr) 22px;grid-template-columns:minmax(0,1fr);aspect-ratio:5/7;height:auto;min-height:0;padding:0;border:0;border-radius:0;background:transparent;box-shadow:none;overflow:visible}
.card-tile.runtime-print:hover{background:transparent;border:0;box-shadow:none}
.card-tile.runtime-print>*:not(.runtime-surface):not(.card-count):not(.new-tag){display:none}
.card-tile.runtime-print>.runtime-surface{position:relative;grid-row:1;grid-column:1;inset:auto;top:auto;right:auto;bottom:auto;left:auto;width:100%;height:100%;min-height:0;z-index:auto;border:0;border-radius:8px;background:transparent!important;overflow:hidden}
.card-tile.runtime-print>.card-count{position:static;grid-row:2;grid-column:1;display:flex;align-items:center;justify-content:flex-start;align-self:stretch;min-height:22px;height:22px;min-width:0;width:100%;margin:0;padding:2px 4px;top:auto;right:auto;bottom:auto;left:auto;z-index:auto;border:0;border-radius:0;background:transparent;font-size:10px;line-height:1.2}
.card-tile.runtime-print>.new-tag{position:static;grid-row:2;grid-column:1;justify-self:end;align-self:center;inset:auto;margin:0;padding:1px 4px;z-index:1}
.card-tile>.runtime-surface img:not([data-load-state="loaded"]){visibility:hidden}

/* r16: full-print loan/CPU print spans and reading cards lose only old print decoration. */
.full-card .paper-card.runtime-print-frame,.battle-v05 .printed-face.runtime-print-frame,.paper-card.runtime-print-frame,.printed-face.runtime-print-frame{padding:0;border:0;background:transparent;box-shadow:none}
.runtime-print-frame>*:not(.runtime-surface){display:none}
.runtime-print-frame>.runtime-surface{background:transparent!important;border:0;box-shadow:none}
.playing-card.full-card.runtime-print-detail,.battle-v05 .playing-card.runtime-print-detail,.playing-card.runtime-print-detail{padding:0;border:0;background:transparent;box-shadow:none}
.runtime-surface img:not([data-load-state="loaded"]){visibility:hidden}

.normal-placeholder{display:grid;place-items:center;min-height:2rem;font:600 .75rem/1.4 sans-serif;color:#334b47;background:#e9e2cd;padding:.35rem;text-align:center}

/* Explicit precheck prototype marker; no game controls changed. */
.prototype-state-badge{position:fixed;top:4px;right:8px;z-index:2147483000;padding:2px 6px;border:1px solid #b99c66;border-radius:4px;background:#fff6dcee;color:#3d3528;font:600 10px/1.3 sans-serif;pointer-events:none}

/* r3: readable card detail, separate reading and deck actions */
#borrowed-detail{width:min(650px,calc(100% - 32px));max-width:none;max-height:calc(100svh - 32px);padding:0}
#borrowed-detail-body{padding:24px;display:grid;gap:18px;min-width:0}
.borrowed-detail-header{display:flex;align-items:flex-start;justify-content:space-between;gap:20px}
#borrowed-detail-title{font-size:clamp(21px,3vw,26px);font-weight:800;line-height:1.5;overflow-wrap:anywhere;padding-top:3px}
.borrowed-detail-header>button{flex:none}
#borrowed-detail .borrowed-detail-face{width:min(360px,100%,max(228px,calc((100svh - 390px)*5/7)));max-width:100%;margin:0 auto}
#borrowed-detail .borrowed-detail-text{margin:0;max-width:none;font-size:16px;font-weight:700;line-height:1.85;overflow-wrap:anywhere}
.borrowed-detail-meta{margin:0;font-size:15px;font-weight:600;line-height:1.8}
.borrowed-detail-actions{display:flex;flex-wrap:wrap;gap:12px;padding-top:4px}
#modal-title{font-weight:800}#modal .effect-text{font-weight:700}
@media(max-width:600px){#borrowed-detail{width:calc(100% - 24px);max-height:calc(100svh - 24px)}#borrowed-detail-body{padding:16px;gap:16px}.borrowed-detail-header{gap:12px}}

/* Shared 300px print is read at its intended size in card lists. */
#borrowed-library,#main .cards-grid{grid-template-columns:repeat(auto-fill,minmax(min(100%,300px),300px));justify-content:center;align-items:start;gap:24px}
#borrowed-library>.borrowed-slot,#main .cards-grid>.card-tile{width:100%;min-width:0;max-width:300px;justify-self:center}
#main .cards-grid>.card-tile.runtime-print{aspect-ratio:auto;grid-template-rows:auto 24px}
#main .cards-grid>.card-tile.runtime-print>.runtime-surface{height:auto;aspect-ratio:5/7}
#main .cards-grid>.card-tile.runtime-print>.card-count{height:24px;min-height:24px;font-size:13px}
#main .cards-grid>.card-tile.unowned>.runtime-surface img{opacity:1}
#modal .detail-layout{grid-template-columns:minmax(0,1fr);gap:20px}
#modal .detail-card{width:min(360px,100%);margin:0 auto}
#modal .detail-card>.card-tile.runtime-print{aspect-ratio:auto;grid-template-rows:auto 24px}
#modal .detail-card>.card-tile.runtime-print>.runtime-surface{height:auto;aspect-ratio:5/7}

/* Original textures stay behind the unchanged selected artwork. */
.runtime-material-window{position:absolute;overflow:hidden;visibility:hidden;pointer-events:none}
.runtime-surface:has(>img[data-load-state="loaded"])>.runtime-material-window.ready{visibility:visible}
.runtime-material-window>.runtime-material-background{position:absolute;inset:0;display:block;width:100%;height:100%;object-fit:cover}
.runtime-material-window>.runtime-material-portrait{position:absolute;display:block;max-width:none;object-fit:fill}
.runtime-material-rim{position:absolute;inset:0;pointer-events:none;mask-size:100% 100%;mask-repeat:no-repeat;-webkit-mask-size:100% 100%;-webkit-mask-repeat:no-repeat}
.runtime-material-rim>img{position:absolute;inset:0;width:100%;height:100%;object-fit:fill}
.runtime-surface:not(:has(>img[data-load-state="loaded"]))>.runtime-material-rim{visibility:hidden}
.borrowed-card.card-tile.runtime-print{padding:0;border:0;background:transparent;box-shadow:none;aspect-ratio:5/7}
.borrowed-detail-reading{display:flex;align-items:flex-start;justify-content:center;gap:16px;min-width:0}
.borrowed-detail-reading>.borrowed-detail-face{flex:0 1 auto;margin:0}
.borrowed-detail-reading>.card-variant-controls{flex:0 0 112px;flex-direction:column;align-items:stretch;margin:0;gap:8px}
@media(max-width:560px){.borrowed-detail-reading{flex-direction:column;align-items:center}.borrowed-detail-reading>.borrowed-detail-face{flex-basis:auto}.borrowed-detail-reading>.card-variant-controls{flex:0 0 auto;flex-direction:row;justify-content:center;width:100%;flex-wrap:wrap}}

.card-kind-group{display:grid;gap:12px}.borrowed-kind-heading{grid-column:1/-1;margin:8px 0 0;font-size:20px;color:#f1dfac}
#modal .detail-reading{display:flex;align-items:flex-start;justify-content:center;gap:16px;min-width:0}
#modal .detail-reading>.detail-card{flex:0 1 360px;width:360px;max-width:100%;margin:0}
#modal .detail-reading>.card-variant-controls{flex:0 0 112px;flex-direction:column;align-items:stretch;margin:0;gap:8px}
@media(max-width:560px){#modal .detail-reading{flex-direction:column;align-items:center}#modal .detail-reading>.detail-card{flex-basis:auto}#modal .detail-reading>.card-variant-controls{flex:0 0 auto;flex-direction:row;justify-content:center;width:100%;flex-wrap:wrap}}
.detail-presentation-controls{flex:0 0 148px;display:grid;gap:12px;align-content:start;min-width:0}
.detail-presentation-controls>.card-variant-controls{display:flex;flex-direction:column;align-items:stretch;gap:8px;margin:0}
.pilot-picker{display:grid;gap:6px;font-size:13px;font-weight:700}
.pilot-picker>select{width:100%;min-width:0;max-width:100%;font-size:14px;padding:7px}
.pilot-source-note{font-size:12px;line-height:1.5;color:#e4d5b4}
@media(max-width:560px){.detail-presentation-controls{flex:0 0 auto;width:100%}.detail-presentation-controls>.card-variant-controls{flex-direction:row;justify-content:center;flex-wrap:wrap}}
