/* The standalone release uses one portrait canvas. Extra monitor space is a preview gutter. */
html[data-layout=portrait]{
  --phone-width:500px;
  background:#091513;
  color-scheme:dark;
  overscroll-behavior:none;
}
[data-layout=portrait] body{margin:0;background:#091513;}
[data-layout=portrait] #app{max-width:var(--phone-width);margin:auto;}
[data-layout=portrait] .phone-shell{
  height:100dvh;min-height:0;width:100%;padding:max(0px,env(safe-area-inset-top)) 0 0;
  grid-template-rows:auto minmax(0,1fr) auto;
  background:radial-gradient(ellipse at 47% 2%,#25443b,#101e1c 58%);
}
[data-layout=portrait] .phone-shell .mast{
  min-height:55px;padding:5px max(12px,env(safe-area-inset-right)) 5px max(12px,env(safe-area-inset-left));gap:8px;
}
.phone-shell .mast .brand{gap:6px;min-width:0;}
[data-layout=portrait] .phone-shell .brand strong{font-size:17px;white-space:nowrap;}
[data-layout=portrait] .phone-shell .brand .seal{width:29px;height:32px;font-size:20px;}
[data-layout=portrait] .phone-shell .mast-right{gap:7px;}
[data-layout=portrait] .phone-shell .r1-date{font-size:11px;display:grid;max-width:none;text-align:right}
.phone-shell .r1-date>span+span::before{content:none;}
[data-layout=portrait] .phone-shell .mast-right button{border-radius:9px;padding:0 7px;min-height:44px;font:600 12px var(--sans);}
.phone-shell .mast-right .final-money{display:none;}
[data-layout=portrait] .phone-shell .stage{
  height:auto;overflow:auto;scrollbar-width:none;overscroll-behavior-y:contain;
  scroll-padding-block:8px 18px;background:#10231f;
}
[data-layout=portrait] .phone-shell .rail{
  grid-template-columns:repeat(5,minmax(0,1fr));
  width:100%;margin:0;padding:4px 6px max(5px,var(--r1-safe-bottom));border-radius:0;min-height:60px;
  background:#142925;box-shadow:0 -8px 22px #08100d62;
}
.phone-shell .rail::before,.phone-shell .rail::after{display:none;}
[data-layout=portrait] .phone-shell .rail button{min-height:50px;display:flex;flex-direction:column;gap:4px;}
[data-layout=portrait] .phone-shell .rail b{font:650 12px var(--sans);}
[data-layout=portrait] .phone-shell .rail svg{width:22px;height:22px;}
[data-layout=portrait] :is(.phone-shell button,.phone-sheet button,.phone-sheet select) {
  min-height:44px;touch-action:manipulation;
}
[data-layout=portrait] :is(.phone-shell select,.phone-sheet select){font-size:16px;min-height:44px;}
[data-layout=portrait] :is(.phone-shell p,.phone-sheet p){overflow-wrap:anywhere}
[data-layout=portrait] :is(.phone-shell .game-feedback,.phone-sheet .game-feedback){border-radius:9px;padding:8px 10px;}

.phone-shell .r1-vista.phone-vista{display:block;min-height:0;padding:0;}
.phone-scene-art{position:relative;isolation:isolate;height:clamp(230px,39svh,350px);overflow:hidden;}
[data-layout=portrait] .phone-shell .phone-scene-art .scene-image{background-position:35% center;}
.phone-scene-art .scene-shade{background:linear-gradient(0deg,#10231fff,transparent 70%),linear-gradient(90deg,#0c191a6d,transparent 72%);}
[data-layout=portrait] .phone-shell .final-vitals{
  position:absolute;top:10px;left:12px;margin:0;padding:5px 9px;background:#122823d9;min-width:146px;max-width:calc(100% - 24px);
}
.phone-vista .final-vitals .final-headshot{width:37px;height:37px;}
.phone-scene-title{position:absolute;left:14px;right:14px;bottom:12px;}
.phone-scene-title small{color:#eed398;font-weight:700;}
.phone-scene-title h1{font:750 clamp(35px,10vw,46px)/1.2 var(--serif);color:#fae1b1;letter-spacing:.04em;}
.phone-scene-title p{font:15px/1.5 var(--sans);color:#fbefd9;margin-top:4px;max-width:36ch;}
.phone-nearby,.phone-routes{padding:0 12px 10px;background:#10231f;}
.phone-nearby h2{color:#e8ca90;font:700 17px var(--serif);margin:0 0 8px;}
.phone-pins,.phone-routes{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;}
[data-layout=portrait] .phone-shell .r1-pin{position:relative;inset:auto;transform:none;max-width:none;box-shadow:none;margin:0;min-height:51px;padding:5px 6px;gap:6px;}
.phone-shell .r1-pin::after{display:none;}
.phone-routes>.card{grid-column:1/-1;}
.phone-routes>button{background:#253e35;border:1px solid #b99a60a8;border-radius:8px;padding:7px;color:#f4dcab;}
.phone-routes>button:only-child{grid-column:1/-1;}
[data-layout=portrait] .phone-shell .r1-explore{margin:0 10px 13px;padding:12px;}
.phone-shell .r1-explore h2{font-size:23px;}
.phone-shell .r1-explore .r1-list{display:grid;grid-template-columns:1fr;}

[data-layout=portrait] .phone-shell .final-conversation{display:grid;align-content:end;height:100%;padding:10px;overflow:hidden;}
.phone-shell .final-speaking{width:100%;max-height:73%;align-self:end;grid-template-rows:auto auto minmax(0,1fr) auto;}
[data-layout=portrait] .phone-shell .final-speaker{inset:2.5% 8% auto auto;}
.phone-shell .final-speaker .avatar{width:min(64vw,295px);}
.phone-shell .final-person-name{padding:8px 12px;}
.phone-shell .final-person-name h1{font-size:30px;}
.phone-shell .final-speaking blockquote{font:650 20px/1.64 var(--serif);}
.phone-shell .final-speaking .r1-dialogue-scroll{padding:9px 12px;max-height:min(32dvh,285px);overscroll-behavior-y:contain;}
.phone-shell .final-speaking .r1-responses{display:grid;max-height:28dvh;padding:6px 10px;gap:5px;}
.phone-shell .final-speaking .r1-responses>*{width:100%;}

[data-layout=portrait] .phone-shell :is(.final-screen,.final-duel){padding:10px;}
.phone-shell .final-page-head h1,.phone-shell .r1-tool-top h1{font-size:29px;}
.phone-shell .final-page-head p{font-size:13px;}
.phone-shell .final-catalog,.phone-shell .final-trade{grid-template-columns:minmax(0,1fr);}
.phone-shell .final-item-scroll{max-height:none;overflow:visible;}
.phone-shell .final-index{padding:9px;}
.phone-shell .final-index .final-filters{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;padding:2px;}
.phone-shell .final-index .final-filters button{flex:0 0 auto;white-space:nowrap;}
.phone-shell .final-goods{grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;}
.phone-shell .final-good{padding:5px;min-height:123px;line-height:1.2;}
.phone-shell .final-good b{font-size:14px;}
.phone-shell .final-good .final-token{height:43px;}
.phone-shell .final-good .final-token .final-sprite{width:42px;}
.phone-shell .final-profile{padding:clamp(135px,24svh,220px) 0 0;}
.phone-shell .final-profile-sheet{width:100%;padding:14px;}
.phone-shell .final-hero{background-size:auto,100% auto;background-position:center,center 13%;}
.phone-shell .final-node,.phone-shell .node{line-height:1.5;}
.phone-shell .r1-tool-body .cards{grid-template-columns:minmax(0,1fr);}
.phone-shell .r1-tool-top .actions{margin:0;}
.phone-shell .r1-list{grid-template-columns:minmax(0,1fr);}

[data-layout=portrait] .phone-sheet{
  width:min(100%,var(--phone-width));max-width:none;max-height:84dvh;padding:0;
  margin:auto auto 0;bottom:0;top:auto;border-radius:22px 22px 0 0;
  border:1px solid #bca36a99;background:#172d28;color:#f6e7c9;
}
[data-layout=portrait] .phone-sheet[open]{display:grid;grid-template-rows:auto minmax(0,1fr);}
.phone-sheet::backdrop{background:#08130fc4;}
.phone-sheet header{display:flex;justify-content:end;padding:6px 12px;border-bottom:1px solid #a98e5b60;}
.phone-sheet button{font:inherit;background:#223e35;border:1px solid #b59a63;border-radius:8px;color:#ffe7b0;padding:6px 12px;}
.phone-sheet .primary{background:#e6c282;color:#241b0e;}
.phone-sheet .phone-sheet-content{overflow:auto;overscroll-behavior:contain;padding:10px 14px max(12px,env(safe-area-inset-bottom));}
.phone-sheet h2{font:700 27px var(--serif);color:#f4d195;margin:8px 0;}
.phone-sheet p,.phone-sheet dl{margin:8px 0;}
.phone-sheet .final-item-hero{min-height:70px;}
.phone-sheet .final-item-hero .final-sprite{width:74px;}
.phone-sheet dt,.phone-sheet dd{display:inline;margin:0 10px 0 0;}
.phone-sheet .actions{display:flex;flex-wrap:wrap;gap:7px;}

[data-layout=portrait] .phone-shell .final-screen.final-practice{height:100%;min-height:0;display:grid;grid-template-rows:auto minmax(0,1fr);}
.phone-shell .final-practice-layout{height:100%;min-height:0;grid-template-rows:minmax(0,1fr) auto;}
.phone-shell .final-practice-view{min-height:0;padding-top:min(9dvh,70px);}
.phone-shell .final-training-record{max-height:100%;width:100%;overflow:auto;}
.phone-shell .final-training-art{background-position:25% 45%;}
.phone-shell .final-practice-dock{align-self:end;align-items:stretch;flex-direction:column;gap:5px;padding:9px;}
.phone-shell .final-train-controls{flex-wrap:wrap;gap:6px;}
.phone-shell .final-train-controls .actions{flex:1;justify-content:flex-end;}

.phone-shell .final-duel{grid-template-rows:auto auto minmax(106px,1fr) auto;min-height:100%;gap:5px;}
.phone-shell .final-duel-heading h1{font-size:31px;}
.phone-shell .final-duel .fighter{width:48%;padding:7px;}
.phone-shell .final-duel .fighter .avatar{width:32px;height:32px;}
.phone-shell .final-duel .fighter h2{font-size:16px;}
.phone-shell .final-battle-art{
  background-size:100% 100%,auto clamp(175px,29dvh,262px);background-position:center,center 146px;
  background-repeat:no-repeat;background-color:#132721;
}
.phone-shell .final-duel-controls{padding:7px;}
.phone-shell .final-duel-controls .battle-actions{grid-template-columns:1fr;}
.phone-shell .final-duel-controls .pill{font-size:13px;min-height:45px;}
.phone-shell .final-after .folio-actions{position:sticky;bottom:0;}
[data-layout=portrait] #notice{bottom:calc(67px + env(safe-area-inset-bottom));}
[data-layout=portrait] .engine-loading{
  background:#10241f;color:#f4d6a0;padding:26px;
}
[data-layout=portrait] .engine-loading small,[data-layout=portrait] .engine-loading .engine-help{color:#d2bd91;}
.phone-sheet small{color:#ddc596;}
.phone-sheet .phone-sheet-content{padding-bottom:max(12px,var(--r1-safe-bottom),env(safe-area-inset-bottom));}
.phone-shell .final-duel-controls .game-feedback{min-height:44px;}
