:root{--olive:#41472d;--ink:#302b1f;--paper:#efe1c2;--border:#a58e60;--cream:#fbf1d8;--red:#8b4b37}*{box-sizing:border-box}html{background:#8d8066}body{margin:0;min-height:100dvh;color:var(--ink);font-family:Georgia,'Times New Roman',serif;background:linear-gradient(#4d48334d,#4d48334d),url('assets/historical-map.jpg') center/cover fixed}button,input{font:inherit}button{cursor:pointer;touch-action:manipulation}button:focus-visible,a:focus-visible,input:focus-visible{outline:3px solid #b74c2d;outline-offset:3px}.app{max-width:600px;min-height:100dvh;margin:0 auto;display:flex;flex-direction:column;background:linear-gradient(145deg,#f5e8cbf5,#e9d5a9f9);border-left:1px solid #b69d68;border-right:1px solid #b69d68;box-shadow:0 0 50px #18130699;overflow:hidden}.masthead{padding:calc(env(safe-area-inset-top) + 12px) 15px 12px;display:flex;justify-content:space-between;align-items:center;gap:10px;border-bottom:1px solid #b19b70}.mast-left{display:flex;align-items:center;gap:10px;min-width:0}.monogram{flex:none;width:43px;height:43px;border:2px double #75623c;border-radius:50%;display:grid;place-items:center;background:var(--olive);color:#f2dfb4;font-weight:bold;font-size:14px}.mast-text{min-width:0}.mast-text span{display:block;font:600 9px/1.25 system-ui,sans-serif;letter-spacing:.5px}.mast-text strong{display:block;font-size:clamp(14px,3.8vw,18px);line-height:1.15;margin-top:3px}.language{display:flex;gap:3px;flex:none}.language button{padding:8px 9px;border:1px solid #87724c;border-radius:4px;background:transparent;color:#55452e;font:700 12px system-ui}.language button.active{background:var(--olive);color:#fff}.progress{display:flex;gap:5px;padding:9px 16px 0}.progress span{height:4px;background:#b7a48180;flex:1;border-radius:8px}.progress span.on{background:#4d5935}main{width:100%;flex:1;display:flex;flex-direction:column}.screen{width:100%;flex:1;padding:15px 17px 16px;display:flex;flex-direction:column;gap:12px;animation:fade .15s ease-out}.screen[hidden]{display:none!important}@keyframes fade{from{opacity:.6;transform:translateY(5px)}to{opacity:1;transform:none}}.intro{text-align:center}.overline{font:700 11px/1.25 system-ui,sans-serif;letter-spacing:2px;color:var(--red);margin:0 0 7px}h1{font-size:clamp(23px,5.5vw,32px);line-height:1.12;margin:0 0 7px}p{line-height:1.45}.intro>p:last-child{font-size:14px;margin:4px auto 0;max-width:370px}.choices{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:13px;margin:4px 0 0}.portrait{display:flex;flex-direction:column;align-items:stretch;position:relative;min-width:0;padding:8px;background:#f9edcf;border:2px solid #ab9160;border-radius:7px;color:var(--ink);font-weight:bold;font-size:17px;box-shadow:0 4px 12px #58401b25}.portrait img{width:100%;height:min(52dvh,370px);object-fit:contain;object-position:center;background:#dbc89e}.portrait>span:not(.choice-arrow){padding:11px 2px 5px}.choice-arrow{position:absolute;bottom:10px;right:10px;font-size:20px;color:var(--red)}.privacy{text-align:center;font:12px/1.5 system-ui,sans-serif;color:#675d4b;margin:4px auto 0;max-width:400px}.photo-stage{position:relative;display:flex;justify-content:center;align-items:center;flex:1;min-height:150px;max-height:48dvh}.photo-stage img{max-height:100%;max-width:72%;width:auto;object-fit:contain;box-shadow:0 3px 16px #3a2c1d48}.photo-bubble{position:absolute;bottom:8px;left:0;right:0;max-width:270px;margin:auto;display:flex;align-items:center;gap:8px;background:#f8eacded;border:1px solid #ae9568;border-radius:6px;padding:9px 12px;font:12px/1.3 system-ui}.camera-symbol{font-size:28px}.bottom-actions{display:grid;gap:8px;margin-top:auto;padding-bottom:max(2px,env(safe-area-inset-bottom))}.primary,.secondary,.textbutton,.linkbutton{display:block;width:100%;text-align:center;text-decoration:none;border-radius:6px;padding:14px 12px;font:bold 16px/1.2 system-ui,sans-serif}.primary{background:var(--olive);color:#fff4dc;border:1px solid #333a26;box-shadow:0 3px 8px #302c2130}.secondary{background:#f9eac9;color:#413a28;border:1px solid #988359}.textbutton{border:0;background:transparent;color:#6c573b;padding:9px}.edit-screen{padding:9px 12px 10px;gap:8px}.edit-title{display:flex;justify-content:space-between;align-items:center;gap:8px}.edit-title h1{font-size:clamp(17px,4.4vw,23px);margin:0}.edit-title .overline{margin-bottom:4px}.small-button{flex:none;padding:8px;border:1px solid #9a845d;border-radius:4px;background:#f8ebce;color:#4e402c;font:700 12px system-ui}.zoom-wrap{position:relative;width:min(100%,430px);margin:0 auto;flex:1;min-height:0;display:flex;align-items:center;justify-content:center}.zoom-wrap canvas{display:block;width:auto;max-width:100%;max-height:min(54dvh,530px);height:auto;aspect-ratio:516/612;object-fit:contain;box-shadow:0 5px 19px #35271b66;border:2px solid #a18a5f;touch-action:none;user-select:none;-webkit-user-select:none}.zoom-tag{position:absolute;bottom:8px;left:50%;transform:translateX(-50%);white-space:nowrap;max-width:96%;background:#332e24db;color:#fff7df;border-radius:20px;padding:7px 12px;font:11px system-ui;pointer-events:none}.edit-controls{border-top:1px solid #b8a278;padding:8px 6px 0}.edit-controls label{display:flex;justify-content:space-between;font:700 13px system-ui}.edit-controls input{width:100%;height:26px;accent-color:var(--olive)}.fine-row{display:grid;grid-template-columns:1fr 1fr 1fr;gap:6px}.fine-row button{border:1px solid #a89165;background:#f7e8c7;color:#4c3b29;border-radius:4px;padding:9px 3px;font:600 12px system-ui}.edit-bottom{margin:0}.result-title h1{font-size:24px}.result-preview{display:flex;justify-content:center;align-items:center;flex:1;min-height:180px;max-height:59dvh}.result-preview canvas{display:block;max-height:100%;max-width:100%;width:auto;height:auto;box-shadow:0 5px 18px #30221566}.thanks-screen{text-align:center;justify-content:center;align-items:center;gap:14px}.seal{border:3px double #914637;color:#914637;border-radius:50%;height:108px;width:108px;display:grid;align-content:center;transform:rotate(-9deg);font:bold 16px/1.3 Georgia}.seal b{font-size:23px}.thanks-copy{font-size:17px;max-width:420px;margin:0}.thanks-screen .linkbutton{max-width:410px}.thanks-screen .secondary{max-width:410px}.toast{position:fixed;bottom:25px;left:50%;transform:translateX(-50%);width:min(90vw,440px);background:#302d22;color:#fff;padding:13px 16px;border-radius:7px;box-shadow:0 4px 22px #0005;font:14px/1.4 system-ui;z-index:30}.toast[hidden]{display:none}footer{text-align:center;border-top:1px solid #b4a27e;padding:9px 6px calc(9px + env(safe-area-inset-bottom));font:700 9px system-ui;letter-spacing:.9px;color:#685a43}@media(min-width:700px){.app{min-height:100dvh}.screen{padding:23px 25px}.edit-screen{padding:12px 20px}.choices{max-width:490px;margin:10px auto;width:100%}}@media(max-height:690px){.edit-screen{gap:5px}.edit-title h1{font-size:17px}.zoom-wrap canvas{max-height:48dvh}.zoom-tag{font-size:10px}.edit-controls{padding-top:4px}.fine-row button{padding:6px 3px}.edit-bottom .primary{padding:11px}}@media(prefers-reduced-motion:reduce){.screen{animation:none}}

/* 5.0.1 — Step 2: mobile-safe preview, no overlapping instructions/actions. */
#step2{flex:1 0 auto;gap:10px;align-items:stretch}
#step2 .intro{flex:0 0 auto}
#step2 .photo-stage{flex:0 0 auto;min-height:0;height:min(42dvh,390px);max-height:none;width:100%;overflow:hidden}
#step2 .photo-stage img{display:block;width:auto;height:100%;max-height:100%;max-width:100%;object-fit:contain}
#step2 .photo-bubble{position:static;flex:0 0 auto;transform:none;left:auto;right:auto;bottom:auto;width:100%;max-width:390px;margin:0 auto;justify-content:center;padding:9px 12px;font-size:12px}
#step2 .camera-symbol{flex:none;font-size:22px}
#step2 .bottom-actions{flex:0 0 auto;margin-top:0}
@media(max-height:740px){#step2 .photo-stage{height:min(35dvh,300px)}#step2{gap:8px}#step2 .primary,#step2 .secondary{padding:11px 12px}}
@media(min-width:700px){#step2 .photo-stage{height:min(48dvh,480px)}}

/* 5.0.2 - Manual photo fallback for restricted in-app browsers */
.browser-help{background:#fff4d8;border:1px solid #ad9461;border-radius:6px;padding:10px;font:12px/1.45 system-ui;margin:0}
.preview-dialog[hidden],#browser-help[hidden],#app-url[hidden]{display:none!important}
.preview-dialog{position:fixed;inset:0;z-index:100;background:#17140deb;overflow-y:auto;padding:12px;display:flex;align-items:flex-start;justify-content:center}
.preview-panel{background:#efe1c2;border-radius:8px;max-width:600px;width:100%;padding:12px;display:flex;flex-direction:column;gap:10px;text-align:center}
.preview-panel p{margin:0;font:14px/1.45 system-ui}
.preview-panel img{width:100%;height:auto;max-width:500px;align-self:center;object-fit:contain;-webkit-touch-callout:default;user-select:auto;-webkit-user-select:auto}
.preview-panel #app-url{width:100%;padding:12px}
body.preview-open{overflow:hidden}
