:root{--screen-left:0px;--screen-right:0px;--screen-top:0px;--screen-bottom:0px;--screen-safe-top:max(0px,calc(env(safe-area-inset-top,0px) - var(--screen-top)));--screen-safe-bottom:max(0px,calc(env(safe-area-inset-bottom,0px) - var(--screen-bottom)));--safe-top:var(--screen-safe-top);--safe-bottom:var(--screen-safe-bottom)}
/* Calibrator is an overlay, deliberately outside the calibrated game frame. */
body>dialog.screen-calibration{position:fixed;inset:0;width:100%;max-width:none;height:var(--game-overlay-height,auto);max-height:none;margin:0;padding:0;border:0;border-radius:0;background:transparent;color:#fff0d0;overflow:hidden}
/* The gold frame marks the GAME boundary, not the safe content boundary.
   Safe-area padding belongs to controls only; subtracting it here hid the bottom. */
body>dialog.screen-calibration::backdrop{background:#00101e33;backdrop-filter:none;-webkit-backdrop-filter:none}
.screen-calibration-frame{position:fixed;inset:var(--screen-top) var(--screen-right) var(--game-frame-bottom,var(--screen-bottom)) var(--screen-left);height:var(--game-frame-height,auto);border:2px solid #e9c26e;box-sizing:border-box;pointer-events:none}
.screen-calibration-frame i{position:absolute;width:23px;height:23px;border:4px solid #ffe0a0}
.screen-calibration-frame i:nth-child(1){left:0;top:0;border-right:0;border-bottom:0}.screen-calibration-frame i:nth-child(2){right:0;top:0;border-left:0;border-bottom:0}.screen-calibration-frame i:nth-child(3){left:0;bottom:0;border-right:0;border-top:0}.screen-calibration-frame i:nth-child(4){right:0;bottom:0;border-left:0;border-top:0}
body>dialog.screen-calibration .screen-calibration-panel{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);bottom:auto;width:min(340px,calc(100% - 48px));max-height:calc(100% - 64px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px));overflow:auto;box-sizing:border-box;padding:10px;border:1px solid #d8b56c;border-radius:12px;background:linear-gradient(#143d57fa,#041c2ffa);box-shadow:0 6px 24px #0008}
.screen-calibration-panel h2{font-size:20px;line-height:1.1;margin:0}.screen-calibration-panel p{font-size:11px;line-height:1.25;margin:5px 0}.screen-calibration-row{display:grid;grid-template-columns:54px 36px minmax(40px,1fr) 36px;gap:5px;align-items:center;margin:4px 0}.screen-calibration-row label{font-size:12px}.screen-calibration-row output{display:block;color:#e7c882;font-size:10px}.screen-calibration-row button{height:36px;min-height:36px;padding:0;border:1px solid #b79859;border-radius:5px;background:#123a51;color:#ffecb9;font-size:20px}.screen-calibration-row input{width:100%;min-width:0;accent-color:#e4be6a}
.screen-calibration-actions{display:grid;grid-template-columns:1fr 1fr;gap:7px}.screen-calibration-actions .btn{min-height:40px;padding:6px;font-size:14px;margin:0}.screen-calibration-panel>.text-btn{min-height:32px;font-size:12px;background:transparent;color:#ffecb9;border:0;padding:3px 0;text-decoration:underline}
.screen-calibration-preview{position:absolute;left:50%;transform:translateX(-50%);bottom:calc(max(12px,env(safe-area-inset-bottom,0px)) + 30px);max-width:calc(100% - 64px);min-height:40px;padding:7px 12px;border:1px solid #d8b56c;border-radius:8px;background:#092c44;color:#ffecbf;font-size:13px}
.screen-calibration.preview-only .screen-calibration-panel{display:none}
.screen-calibration-offer{position:fixed;z-index:1200;right:calc(10px + var(--screen-right));bottom:calc(90px + max(var(--screen-bottom),env(safe-area-inset-bottom,0px)));width:min(310px,calc(100vw - 20px - var(--screen-left) - var(--screen-right)));padding:12px;border:1px solid #c5a465;border-radius:10px;color:#fff0d0;background:#092c44f5;box-shadow:0 5px 20px #0006}.screen-calibration-offer p{font-size:12px;line-height:1.3;margin:5px 0}.screen-calibration-offer button{min-height:36px;padding:6px 10px;margin:4px;border:1px solid #c2a365;border-radius:5px;background:#163e54;color:#ffecbf}
/* The existing modal stays a small confirmation over the current screen. */
body>#modal.compact-confirmation{position:fixed;inset:calc(var(--screen-top) + max(12px,env(safe-area-inset-top,0px))) calc(var(--screen-right) + 12px) calc(var(--screen-bottom) + max(12px,env(safe-area-inset-bottom,0px))) calc(var(--screen-left) + 12px);width:min(400px,calc(100vw - var(--screen-left) - var(--screen-right) - 24px));height:fit-content;max-width:400px;max-height:calc(100dvh - var(--screen-top) - var(--screen-bottom) - 24px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px));margin:auto;padding:14px;border:1px solid #d2ac64;border-radius:13px;background:linear-gradient(#153c55,#061c2e);color:#fff0d2;overflow:auto;box-shadow:0 10px 35px #0009}#modal.compact-confirmation h2{font-size:22px;line-height:1.1;margin:0}#modal.compact-confirmation p{font-size:13px;margin:8px 0}.compact-reward-summary{max-height:160px;overflow:auto;padding:7px 0}.compact-reward-summary ul{margin:4px 0;padding-left:18px;font-size:13px}.compact-confirm-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px}.compact-confirm-actions .btn{min-height:42px;font-size:14px;padding:8px}.compact-reward-total{font-size:20px;color:#f4ce7e}.compact-reward-details{max-height:100px;overflow:auto;font-size:12px}.display-calibration-card{padding:12px;border:1px solid #b89655;border-radius:9px;background:#123047;color:#fff0cf}.display-calibration-card p{font-size:13px}

#modal.compact-confirmation .transaction-lines{max-height:140px;overflow:auto}#modal.compact-confirmation .sale-detail-art{max-width:90px}#modal.compact-confirmation .sale-detail .image-wrap{max-height:125px;aspect-ratio:5/7}#modal.compact-confirmation .price-note{font-size:11px}body>.context-bubble{max-width:calc(100vw - var(--screen-left) - var(--screen-right) - 20px);max-height:calc(100dvh - var(--screen-top) - var(--screen-bottom) - 150px)}
