@font-face { font-family: Manrope; src: url('assets/manrope.woff2'); }
* { box-sizing: border-box; }
body { margin: 0; background: #071a20; color: #eaf3eb; font-family: Manrope, Arial, sans-serif; overflow: hidden; }

header { position: absolute; z-index: 5; left: 0; right: 0; height: 64px; display: flex; align-items: center; gap: 10px; padding: 0 24px; background: linear-gradient(#071a20, transparent); }
.brand { font-size: 25px; color: #f4efda; text-decoration: none; letter-spacing: -1px; }
.brand small { display: block; font-size: 9px; letter-spacing: 2px; }
#mode { margin-left: auto; color: #91b6b5; font-size: 10px; letter-spacing: 2px; }

button { font: 600 12px Manrope, Arial; border: 1px solid #477477; border-radius: 9px; padding: 10px 14px; cursor: pointer; background: #17393e; color: #fff; }
button:hover { background: #28585a; }
button:focus-visible { outline: 2px solid #e5c48b; outline-offset: 2px; }
button:disabled { opacity: .5; cursor: wait; }
#simulate { background: #d8b783; color: #132a2c; border: 0; }

#stage { position: absolute; inset: 0; }
#stage canvas { display: block; width: 100%; height: 100%; touch-action: none; }

#simbar { position: absolute; z-index: 10; bottom: 42px; left: 20px; right: 20px; display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid #3b6268; border-radius: 12px; background: #0c262df2; }
#simbar[hidden] { display: none; }
#simbar strong { font-size: 10px; max-width: 130px; color: #e1bd83; }
#simbar span { flex: 1; font-size: 11px; color: #c2d6d3; }
#simbar button { padding: 8px; font-size: 10px; }

#status { position: absolute; z-index: 6; bottom: 15px; left: 24px; font-size: 11px; color: #b0d5c9; pointer-events: none; }
#credits { position: absolute; z-index: 11; right: 24px; bottom: 12px; max-width: 420px; padding: 8px; border-radius: 6px; background: #0b252deb; font-size: 10px; }
#credits p { margin: 8px 0 0; font-size: 11px; line-height: 1.6; color: #bbd0d0; }

/* In sessione simulata la tela XR copre la pagina: i comandi restano sopra. */
body.xr header, body.xr #simbar, body.xr #status, body.xr #credits { z-index: 2000; }
body.native header, body.native #credits, body.native #status { display: none; }

@media (max-width: 850px) {
  #mode, #language { display: none; }
  header { padding: 0 12px; gap: 6px; }
  #credits { max-width: 170px; }
}

/* Domanda scritta al tutor: solo durante la lezione col libro, fuori dal visore. */
#ask { display: none; position: absolute; z-index: 7; top: 62px; left: 50%; transform: translateX(-50%); gap: 8px; width: min(560px, 80vw); }
body[data-book] #ask { display: flex; }
body.xr #ask, body.native #ask { display: none; }
#ask input { flex: 1; padding: 10px 14px; border-radius: 10px; border: 1px solid #3c6a70; background: #0b1f27ee; color: #f2f6ee; font: 15px Manrope, Arial, sans-serif; }
#ask button { padding: 10px 16px; border-radius: 10px; border: 0; background: #ffd27a; color: #10232a; font: 600 14px Manrope, Arial, sans-serif; cursor: pointer; }

body { background: #060d0c; }
header { background: linear-gradient(#060d0c, transparent); }
#ask { display: flex; }
body[data-phase="loading"] #ask, body[data-phase="start"] #ask, body[data-phase="scan"] #ask, body[data-phase="ocr"] #ask, body[data-phase="pair"] #ask, body[data-phase="reading"] #ask, body.xr #ask, body.native #ask { display: none; }
body.xr #upload { display: none; }
/* Fuori dal visore la domanda scritta sta in basso a sinistra, lontano dal sottotitolo del tutor. */
#ask { top: auto; bottom: 44px; left: 24px; transform: none; width: min(400px, 60vw); }
#ask button { background: #d3efec; color: #143942; border-radius: 8px; }
#ask input { border-color: #9cc3ca66; background: #12323bee; border-radius: 8px; }
