/* AnySurface mobile: display, phone and agent pages. Bead anysurface-mobile 4dfd1123. */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #000; color: #e8e8e8; font: 14px/1.35 system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
button, select, input { font: inherit; color: #eee; background: #222; border: 1px solid #444; border-radius: 6px; padding: 4px 10px; }
button:disabled, select:disabled { opacity: .45; }
button:not(:disabled):hover { background: #333; cursor: pointer; }
.dim { color: #999; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 10px; background: #1b1b1b; border: 1px solid #333; font-size: 12px; }
.chip.ok { border-color: #2a7; color: #8fd; }
.chip.warn { border-color: #a72; color: #fc8; }

/* display */
body.display { overflow: hidden; cursor: default; }
body.display.capturing { cursor: none; }
#pattern, #overlay { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
#overlay { pointer-events: none; }
#ui { position: fixed; left: 10px; top: 10px; right: 140px; z-index: 5; }
#bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: rgba(10,10,10,.82); padding: 8px 10px; border-radius: 8px; border: 1px solid #333; width: fit-content; }
#status { margin: 6px 4px; font-size: 12px; max-width: 70ch; text-shadow: 0 0 4px #000; }
body.capturing #ui, body.capturing #qr, body.capturing #qr-show, body.capturing #qr-tools, body.capturing #qr-handles, body.ui-hidden #ui { display: none !important; }
/* Hide UI: header, status and QR tools go; the QR itself goes too once a phone is connected (qr-optional) */
body.ui-hidden #qr-tools, body.ui-hidden #qr-show, body.ui-hidden #qr-handles, body.ui-hidden.qr-optional #qr { display: none !important; }
/* startup frame: a 20 px border so the projected edge is easy to see; only while idle */
#frame { position: fixed; inset: 0; border: 20px solid #fff; pointer-events: none; z-index: 4; display: none; }
body.startup #frame { display: block; }
#hot { position: fixed; left: 0; top: 0; width: 90px; height: 90px; z-index: 9; display: none; }
body.ui-hidden:not(.capturing) #hot { display: block; }
#hot button { position: absolute; left: 28px; top: 28px; opacity: 0; transition: opacity .2s; white-space: nowrap; }
#hot:hover button { opacity: 1; }
#qr { position: fixed; z-index: 6; background: #fff; color: #111; text-align: center; }
#qr[hidden], #qr-tools[hidden], #qr-handles[hidden] { display: none; }
/* large: centred, unwarped, with a caption */
#qr.large { right: 50%; bottom: 50%; transform: translate(50%, 50%); padding: 18px; border-radius: 8px; box-shadow: 0 2px 12px rgba(0,0,0,.6); }
#qr.large #qr-code { width: min(60vh, 60vw); height: min(60vh, 60vw); }
#qr.large .qr-cap { font-size: 18px; margin-top: 6px; }
/* warp: a 200 px square (white quiet zone included) mapped onto four corners by a matrix3d set in display.mjs */
#qr.warp { left: 0; top: 0; width: 200px; height: 200px; padding: 12px; transform-origin: 0 0; }
#qr.warp #qr-code { width: 100%; height: 100%; }
#qr.warp .qr-cap { display: none; }
#qr.warp.editing { outline: 3px dashed #0af; cursor: move; touch-action: none; }
#qr-code svg, #qr-code img { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
#qr-tools { position: fixed; z-index: 7; display: flex; gap: 4px; }
#qr-tools button { width: 26px; height: 26px; padding: 0; border-radius: 50%; background: #333; font-size: 13px; line-height: 24px; }
#qr-tools button.on { background: #0af; color: #000; border-color: #0af; }
#qr-handles i { position: fixed; z-index: 8; width: 28px; height: 28px; margin: -14px 0 0 -14px; border-radius: 50%; border: 2px solid #0af; background: rgba(0,170,255,.3); cursor: grab; touch-action: none; }
#qr-show { position: fixed; right: 28px; bottom: 28px; z-index: 6; }

/* phone */
body.phone { display: flex; flex-direction: column; }
body.phone header { padding: 10px 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
body.phone main { flex: 1; position: relative; min-height: 0; }
body.phone video, body.phone #ph-overlay { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
body.phone #ph-msg { padding: 10px 12px; font-size: 15px; }
body.phone .big { font-size: 18px; padding: 12px 18px; }
#ph-progress { height: 4px; background: #2a7; width: 0; transition: width .15s; }

/* agent */
body.agent { padding: 10px; overflow: auto; }
body.agent .grid { display: grid; grid-template-columns: minmax(320px, 1fr) minmax(320px, 1fr); gap: 10px; }
body.agent video, body.agent img, body.agent canvas.view { width: 100%; background: #111; border: 1px solid #333; border-radius: 6px; }
body.agent pre { background: #0d0d0d; border: 1px solid #333; padding: 8px; border-radius: 6px; max-height: 50vh; overflow: auto; font-size: 12px; white-space: pre-wrap; }

/* settings gear (v0.2.0): version and everything not needed at a glance */
.gear-btn { font-size: 16px; line-height: 1; padding: 4px 8px; }
.gear { position: fixed; z-index: 10; top: 64px; left: 10px; width: min(420px, calc(100vw - 20px)); max-height: calc(100vh - 80px); overflow: auto;
  background: rgba(14,14,14,.96); border: 1px solid #444; border-radius: 10px; padding: 10px 14px; font-size: 14px; }
.gear[hidden] { display: none; }
.gear-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.gear-head button { margin-left: auto; padding: 0 8px; }
.gear h4 { margin: 12px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: #aaa; }
.gear label { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 6px 0; }
.gear dl { display: grid; grid-template-columns: max-content 1fr; gap: 3px 12px; margin: 0; font-size: 13px; }
.gear dt { color: #999; } .gear dd { margin: 0; word-break: break-all; }
.gear a { color: #6cf; }
body.ui-hidden .gear, body.capturing .gear { display: none !important; }
body.phone .gear { top: 54px; left: 8px; right: 8px; width: auto; }
.gear label.check { justify-content: flex-start; }

/* captions from Claude on the display (v0.4.0): bottom-centre, large, survives Hide UI, hidden while capturing */
#say { position: fixed; left: 50%; bottom: 6vh; transform: translateX(-50%); z-index: 12; max-width: min(90vw, 1100px); padding: 14px 22px; border-radius: 12px;
  background: rgba(8,8,8,.82); border: 1px solid #555; color: #fff; font-size: max(28px, 2.2vw); line-height: 1.3; cursor: pointer; text-align: left; }
#say[hidden] { display: none; }
#say b { display: block; font-size: .5em; letter-spacing: .1em; text-transform: uppercase; color: #6cf; margin-bottom: 2px; }
body.capturing #say { display: none !important; }

/* listening indicator (v0.4.4): a pulsing dot and the words being heard, so the person knows they are being heard */
#hear { position: fixed; left: 50%; bottom: 1.6vh; transform: translateX(-50%); z-index: 12; display: flex; align-items: center; gap: 10px;
  max-width: 80vw; padding: 6px 14px; border-radius: 20px; background: rgba(0,0,0,.6); color: #cfe; font-size: 20px; }
#hear[hidden] { display: none; }
#hear i { width: 14px; height: 14px; border-radius: 50%; background: #3f9; box-shadow: 0 0 0 0 #3f9a; animation: hearpulse 1s infinite; flex: none; }
#hear.final i { background: #6cf; animation: none; }
@keyframes hearpulse { 0% { box-shadow: 0 0 0 0 #3f9a; } 70% { box-shadow: 0 0 0 14px #3f90; } 100% { box-shadow: 0 0 0 0 #3f90; } }
body.capturing #hear { display: none !important; }
/* answered captions evaporate: blur, rise, shrink into the distance, fade */
#say.evaporate { animation: evaporate 1.1s ease-in forwards; pointer-events: none; }
@keyframes evaporate { 0% { opacity: 1; filter: blur(0); } 100% { opacity: 0; filter: blur(14px); transform: translate(var(--tx, 0), -90px) scale(.55); letter-spacing: .4em; } }

/* what Claude sees (v0.4.5): one small panel per camera, tracked points only */
#seen { position: fixed; right: 14px; top: 14px; z-index: 11; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
#seen figure { margin: 0; background: rgba(0,0,0,.72); border: 1px solid #345; border-radius: 8px; padding: 4px; }
#seen canvas { display: block; width: 220px; height: 165px; }
#seen figcaption { font-size: 12px; color: #9bd; padding: 2px 4px 0; }
body.capturing #seen, body.panels-off #seen { display: none !important; }

/* v0.4.6: bigger captions and live words (Stephen: make them bigger on the wall) */
#say { font-size: 40px !important; max-width: min(80vw, 1200px); }
#say b { font-size: 16px; }
#hear { font-size: 30px; bottom: 2vh; padding: 8px 18px; }
#hear i { width: 18px; height: 18px; }
#seen { top: 14px; right: 14px; }

/* v0.4.7: camera panels sized for a wall */
#seen canvas { width: 380px; height: 285px; }
#seen figcaption { font-size: 18px; }

body.capturing #fishcv { display: none !important; }

/* photos taken by voice (v0.5.1) */
#photo { position: fixed; z-index: 11; margin: 0; padding: 6px; background: rgba(0,0,0,.8); border: 1px solid #456; border-radius: 8px; }
#photo[hidden] { display: none; }
#photo img { display: block; max-height: 62vh; max-width: 40vw; }
#photo figcaption { color: #9bd; font-size: 18px; padding: 4px 2px 0; }
body.capturing #photo { display: none !important; }
:root { --say-scale: 1; }
#say { font-size: calc(40px * var(--say-scale)) !important; }

body.ui-hidden.qr-forced #qr:not([hidden]) { display: block !important; }
