/* The traveller's phone: the banner for a reply, and the real text fields that lie on the glass of the 3D handset.
   passenger-phone.js publishes where the display is (--phone-left/top/width/height) and its unit (1/400 of its width). */
/* Both the handset canvas and its native input fields read this palette. */
:root{
 --phone-bg:#eeefe9;--phone-card:var(--rail-paper-raised);--phone-ink:var(--rail-ink);--phone-muted:var(--rail-muted);
 --phone-line:#c4cec5;--phone-accent:var(--rail-enamel);--phone-on-accent:var(--rail-cream);--phone-field:#dde5dd;
 --phone-faint:#586760;--phone-own:var(--rail-enamel);--phone-theirs:#dfe8df;--phone-warn:#834520;
 --phone-badge:var(--rail-stamp);--phone-paper:var(--rail-paper);
}
:root.phone-night{
 --phone-bg:#14201f;--phone-card:#20322f;--phone-ink:#edf1e9;--phone-muted:#b2c5b9;
 --phone-line:#52685e;--phone-accent:#a4d8be;--phone-on-accent:#142e24;--phone-field:#2a3e37;
 --phone-faint:#93a89c;--phone-own:#305f4e;--phone-theirs:#263b34;--phone-warn:var(--rail-brass);
 --phone-badge:#93422e;--phone-paper:#e5e1d4;
}

/* A reply arriving while the phone is put away. */
#handset-banner{position:absolute;z-index:9;top:max(.75rem,env(safe-area-inset-top));left:50%;transform:translateX(-50%);display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:.7rem;align-items:center;width:min(23rem,92%);min-height:3.6rem;box-sizing:border-box;padding:.6rem .85rem;text-align:left;color:#f5f2e8;background:#18221fee;border:1px solid #ffffff24;border-radius:1.15rem;box-shadow:0 .6rem 1.8rem #0009;font:500 .92rem/1.35 system-ui,"Segoe UI","Malgun Gothic",sans-serif;cursor:pointer;animation:handset-banner .34s cubic-bezier(.2,.9,.3,1)}
#handset-banner[hidden]{display:none}
#handset-banner .banner-app{position:relative;width:2.35rem;height:2.35rem;border-radius:.64rem;background:linear-gradient(#62d98d,#1fa055)}
#handset-banner .banner-app::before{content:"";position:absolute;left:23%;top:26%;width:54%;height:40%;border-radius:.42rem;background:#fff}
#handset-banner .banner-app::after{content:"";position:absolute;left:30%;top:56%;border:.3rem solid transparent;border-top-color:#fff;border-left-color:#fff}
#handset-banner[data-destination="info"] .banner-app{background:#3d594f}
#handset-banner[data-destination="info"] .banner-app::before{inset:20%;width:auto;height:auto;border-radius:0;background:#fff;mask:url("icons/bell-ringing.svg") center/contain no-repeat}
#handset-banner[data-destination="info"] .banner-app::after{display:none}
#handset-banner .banner-text{display:block;min-width:0}
#handset-banner b{display:block;font-weight:700}
#handset-banner .banner-text span{display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color:#dfe5da}
#handset-banner small{align-self:start;color:#aebbb2;font-size:.76rem}
@keyframes handset-banner{from{opacity:0;transform:translate(-50%,-120%)}}
@media(prefers-reduced-motion:reduce){#handset-banner{animation:none}}
:is(.looking-out,.boarding) #handset-banner,body:has(dialog[open]) #handset-banner{display:none}

/* With the handset in the hand its own glass is the control surface; only "put away" stays as a button. */
.scene:is(.handset-3d,:has(#handset-fallback:not([hidden]))) #handset-controls button:not([data-phone=close]):not(:focus-visible){position:absolute;width:1px;height:1px;clip-path:inset(50%);overflow:hidden;padding:0}
.scene:is(.handset-3d,:has(#handset-fallback:not([hidden]))) #handset-controls button[data-phone=close]{padding:.42rem 1rem;border-radius:1rem;border-color:#ffffff40;background:#141d1bd9;color:#f2eddd;font-size:.875rem}

/* Until the handset is held square to the eye the overlaid pages wait, so they never appear beside it. */
:root.phone-held:not(.phone-docked) :is(#handset-browser,#phone-translator){visibility:hidden}
:root.phone-held:not(.phone-docked) #handset-compose{opacity:0}

/* Browser: fills the display below the status bar and above the home bar. */
:root.phone-docked #handset-browser:not([hidden]){position:fixed;left:var(--phone-left);top:calc(var(--phone-top) + 48*var(--phone-unit));width:var(--phone-width);height:calc(var(--phone-height) - 76*var(--phone-unit));transform:none;border:0;border-radius:0;box-shadow:none;color:var(--phone-ink);background:var(--phone-bg);font-size:calc(15.5*var(--phone-unit));line-height:1.5}
:root.phone-docked #handset-browser :is(header,form){background:var(--phone-bg);color:var(--phone-ink);border-color:var(--phone-line)}
:root.phone-docked #handset-browser header{min-height:0;padding:calc(4*var(--phone-unit)) calc(12*var(--phone-unit)) 0;font-size:calc(13.5*var(--phone-unit))}
:root.phone-docked #handset-browser header :is(time,.web-signal){display:none}
:root.phone-docked #handset-browser header button{margin-left:auto;color:var(--phone-accent);font-weight:650}
:root.phone-docked #handset-browser form{gap:calc(6*var(--phone-unit));padding:calc(6*var(--phone-unit)) calc(12*var(--phone-unit)) calc(10*var(--phone-unit))}
:root.phone-docked #handset-browser form button{font-size:calc(21*var(--phone-unit));color:var(--phone-accent);padding:0 calc(5*var(--phone-unit))}
:root.phone-docked #handset-browser input{border:0;border-radius:calc(20*var(--phone-unit));background:var(--phone-field);color:var(--phone-ink);padding:calc(9*var(--phone-unit)) calc(15*var(--phone-unit));font-size:calc(15*var(--phone-unit))}
:root.phone-docked #handset-browser .web-content{padding:calc(16*var(--phone-unit)) calc(18*var(--phone-unit))}
:root.phone-docked #handset-browser h2{font-size:calc(23*var(--phone-unit));color:var(--phone-ink)}
:root.phone-docked #handset-browser :is(h3,p){color:var(--phone-ink)}
:root.phone-docked #handset-browser :is(small,.web-note,details){font-size:calc(12.5*var(--phone-unit));color:var(--phone-muted)}
:root.phone-docked #handset-browser .web-result{padding:calc(12*var(--phone-unit)) calc(2*var(--phone-unit));border-color:var(--phone-line);color:var(--phone-ink)}
:root.phone-docked #handset-browser .web-related{font-size:calc(13*var(--phone-unit));color:var(--phone-accent)}

/* Translator: the same place on the glass, in the phone's own colours. */
:root.phone-docked #phone-translator[open]{position:fixed;inset:auto;left:var(--phone-left);top:calc(var(--phone-top) + 48*var(--phone-unit));width:var(--phone-width);height:calc(var(--phone-height) - 76*var(--phone-unit));max-width:none;max-height:none;box-sizing:border-box;margin:0;padding:calc(10*var(--phone-unit)) calc(18*var(--phone-unit)) calc(14*var(--phone-unit));border:0;border-radius:0;box-shadow:none;color:var(--phone-ink);background:var(--phone-bg);font-size:calc(15*var(--phone-unit))}
:root.phone-docked #phone-translator::backdrop{background:transparent}
:root.phone-docked #phone-translator h2{font-size:calc(25*var(--phone-unit))}
:root.phone-docked #phone-translator h3{margin:calc(14*var(--phone-unit)) 0 calc(5*var(--phone-unit));font-size:calc(14*var(--phone-unit));color:var(--phone-accent)}
:root.phone-docked #phone-translator li{border-color:var(--phone-line)}
:root.phone-docked #phone-translator :is(small,.translator-note,.translator-own){color:var(--phone-muted)}
:root.phone-docked #phone-translator #translator-status{color:var(--phone-accent)}
:root.phone-docked #phone-translator button{min-height:calc(36*var(--phone-unit));padding:calc(4*var(--phone-unit)) calc(12*var(--phone-unit));color:var(--phone-accent);background:var(--phone-field);border:0;border-radius:calc(18*var(--phone-unit));font-weight:600}
:root.phone-docked #phone-translator select,:root.phone-docked #translator-find{color:var(--phone-ink);background:var(--phone-field);border:0;border-radius:calc(14*var(--phone-unit))}
:root.phone-docked #phone-translator :is(button,select,input):focus-visible{outline-color:var(--phone-accent)}

/* Writing a message: the field sits where the conversation's own input bar is drawn. */
@media(pointer:fine){
 :root.phone-docked #handset-compose:not([hidden]){position:fixed;left:var(--phone-left);top:auto;bottom:auto;transform:none;top:calc(var(--phone-top) + var(--phone-height) - 132*var(--phone-unit));width:var(--phone-width);height:calc(98*var(--phone-unit));padding:0 calc(14*var(--phone-unit));border:0;border-radius:0;background:var(--phone-bg);color:var(--phone-ink);font-size:calc(15*var(--phone-unit));display:flex;flex-direction:column-reverse;justify-content:flex-start;gap:calc(4*var(--phone-unit));box-shadow:0 -1px 0 var(--phone-line)}
 :root.phone-docked #handset-compose label{position:absolute;width:1px;height:1px;clip-path:inset(50%);overflow:hidden}
 :root.phone-docked #handset-compose div{gap:calc(6*var(--phone-unit));margin-top:calc(2*var(--phone-unit))}
 :root.phone-docked #handset-compose input{height:calc(50*var(--phone-unit));box-sizing:border-box;border:0;border-radius:calc(25*var(--phone-unit));background:var(--phone-field);color:var(--phone-ink);padding:0 calc(18*var(--phone-unit));font-size:calc(16*var(--phone-unit))}
 :root.phone-docked #handset-compose button[type=submit]{height:calc(50*var(--phone-unit));border-radius:calc(25*var(--phone-unit));padding:0 calc(15*var(--phone-unit));background:var(--phone-accent);color:var(--phone-on-accent);font-weight:650;font-size:calc(14.5*var(--phone-unit))}
 :root.phone-docked #handset-compose #handset-cancel{padding:0 calc(6*var(--phone-unit));color:var(--phone-muted);font-size:calc(13.5*var(--phone-unit))}
 :root.phone-docked #handset-hint{margin:calc(6*var(--phone-unit)) calc(6*var(--phone-unit)) 0;font-size:calc(12*var(--phone-unit));color:var(--phone-muted)}
}
/* On a touch screen the keyboard takes the lower half, so the field keeps its place at the foot of the page. */
@media(pointer:coarse){
 #handset-compose:not([hidden]){border-radius:1.2rem;border-color:var(--phone-line);background:var(--phone-card);color:var(--phone-ink)}
 #handset-compose input{border:0;border-radius:1.4rem;padding:.7rem 1rem;background:var(--phone-field);color:var(--phone-ink)}
 #handset-compose button[type=submit]{border-radius:1.4rem;padding:.7rem 1rem;background:var(--phone-accent);color:var(--phone-on-accent);font-weight:650}
 #handset-compose #handset-cancel{background:var(--phone-card);color:var(--phone-muted)}
 #handset-compose :is(label,#handset-hint){color:var(--phone-muted)}
 :root.phone-held:not(.phone-docked) #handset-compose{opacity:1}
}
/* Announcements and the "put away" button keep clear of the raised handset on a wide page. */
@media(min-width:701px){
 :root.phone-held #game :is(.rail-announcement,#speech-caption,#destination-cue){left:27%;max-width:44%}
 :root.phone-held #game .scene.handset-3d #handset-controls:not(:has(button:focus-visible)){position:fixed;left:calc(var(--phone-left,50vw) - 2.6rem);top:calc(var(--phone-top,40vh) + var(--phone-height,20vh) - 3rem);bottom:auto;transform:translateX(-50%)}
}
/* Without WebGL the phone is the flat picture of its display. */
#game .scene #handset-fallback:not([hidden]){top:47%;height:min(76%,38rem,78svh);max-height:none;border:.5rem solid #1b2022;border-radius:2rem;box-shadow:0 .8rem 2rem #0008;cursor:pointer}
