/* MettiPlay web: blu notte, giallo "play" solo per le azioni principali. Prima il telefono, poi lo schermo grande. */

:root {
  --notte: #10162c;
  --carta: #171f3d;
  --tasto: #232c4d;
  --tasto-su: #2d3860;
  --bordo: rgba(255, 255, 255, 0.1);
  --testo: #f2f0fb;
  --piano: #a7aecb;
  --play: #ffc83d;
  --play-scuro: #3a2a00;
  --pronto: #5be3a8;
  --errore: #ff8fa3;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--notte); color: var(--testo); }
body {
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
a { color: var(--play); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--play); outline-offset: 2px; }
.boot { padding: 24px; color: var(--piano); }

/* ---------- testata ---------- */
.top { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--bordo); }
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; color: var(--testo); text-decoration: none; }
.logo .dot { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--play); color: var(--notte); font-size: 13px; padding-left: 2px; }
.chip { padding: 2px 10px; border-radius: 999px; background: var(--tasto); font: 600 14px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0.08em; }
.grow { flex: 1; }
.conn { width: 10px; height: 10px; border-radius: 50%; background: var(--errore); }
.conn.wait { background: var(--play); }
.conn.on { background: var(--pronto); }

/* ---------- blocchi ---------- */
main.narrow { max-width: 560px; margin: 0 auto; padding: 20px 16px 48px; }
h1 { font-size: clamp(28px, 7vw, 40px); line-height: 1.15; margin: 12px 0; }
h2 { font-size: 20px; margin: 0 0 10px; }
h3 { font-size: 16px; margin: 0 0 8px; color: var(--piano); }
.lead { color: var(--piano); margin: 0 0 20px; }
.card { background: var(--carta); border: 1px solid var(--bordo); border-radius: 16px; padding: 18px; margin: 0 0 14px; display: flex; flex-direction: column; gap: 10px; }
.card p { margin: 0; }
.who { color: var(--piano); margin: 0; }
.note { color: var(--piano); font-size: 14px; }
.err { color: var(--errore); margin: 0; min-height: 0; }
.err:empty { display: none; }
.found { color: var(--pronto); font-size: 14px; margin: 0; overflow-wrap: anywhere; }
.found:empty { display: none; }
.how ol, .card ul, .steps { padding-left: 22px; margin: 0; display: grid; gap: 10px; }
.steps li { padding-left: 4px; }
code { background: var(--tasto); padding: 1px 6px; border-radius: 6px; }

input[type="text"], input[type="url"] {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 12px;
  border: 1px solid var(--bordo); background: var(--notte); font-size: 16px; /* 16px: iPhone non ingrandisce */
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 10px 18px; border-radius: 12px; border: 1px solid var(--bordo);
  background: var(--tasto); font-weight: 600; text-decoration: none; color: var(--testo);
}
.btn:hover { background: var(--tasto-su); }
.btn.main { background: var(--play); color: var(--play-scuro); border-color: transparent; }
.btn.main:hover { filter: brightness(1.06); }
.btn.big { min-height: 56px; font-size: 18px; }
.btn.small { min-height: 40px; padding: 6px 14px; font-size: 15px; }
.btn.ghost { background: transparent; }
.row { display: flex; gap: 8px; }
.row input { flex: 1; min-width: 0; }
.extra:empty { display: none; }
.extra { display: flex; flex-direction: column; gap: 10px; }

/* ---------- stanza ---------- */
main.room { display: grid; gap: 14px; padding: 12px; max-width: 1400px; margin: 0 auto; }
@media (min-width: 980px) {
  main.room { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
  main.room .banner, main.room .change { grid-column: 1 / -1; }
  main.room .stage { grid-column: 1; }
  main.room .side { grid-column: 2; grid-row: 2; }
}
.stage .card { margin: 0; }
.screen { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 14px; overflow: hidden; }
.screen video, .screen .yt, .screen iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.banner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; background: var(--play-scuro); color: var(--play); }
.banner[hidden] { display: none; }
.side { background: var(--carta); border: 1px solid var(--bordo); border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.people { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.people li { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--tasto); font-size: 14px; }
.people .what { color: var(--piano); font-size: 12px; }
.st { width: 8px; height: 8px; border-radius: 50%; background: var(--pronto); }
.st.loading, .st.ad { background: var(--play); }
.st.away { background: var(--piano); }
.reacts { display: flex; flex-wrap: wrap; gap: 4px; }
.react { border: 0; background: var(--tasto); border-radius: 10px; font-size: 20px; width: 40px; height: 40px; }
.chat { list-style: none; margin: 0; padding: 0; max-height: 240px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; font-size: 15px; }
.chat li { padding: 4px 8px; border-radius: 8px; background: var(--notte); overflow-wrap: anywhere; }
.chat li.mine { background: var(--tasto); }
.change { background: var(--carta); border: 1px solid var(--bordo); border-radius: 16px; padding: 14px; display: grid; gap: 8px; }
.change p { margin: 0; }
.change [hidden] { display: none; }

/* ---------- telecomando ---------- */
.remote { align-items: center; text-align: center; }
.remote h2 { overflow-wrap: anywhere; }
.remote .site { color: var(--piano); font-weight: 400; }
.remote .steps { text-align: left; margin: 0; padding-left: 22px; display: grid; gap: 4px; color: var(--piano); font-size: 15px; }
.time { font: 700 clamp(56px, 18vw, 96px)/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: -0.02em; margin: 6px 0; }
.state { color: var(--piano); min-height: 1.5em; }
.keys { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 8px 0; }
.round { width: 64px; height: 64px; border-radius: 50%; border: 1px solid var(--bordo); background: var(--tasto); font-weight: 700; font-size: 16px; }
.round.main { width: 96px; height: 96px; font-size: 36px; background: var(--play); color: var(--play-scuro); border: 0; }
.switch { display: flex; align-items: center; gap: 8px; color: var(--piano); font-size: 14px; text-align: left; }
.switch input { width: 22px; height: 22px; accent-color: var(--play); }

/* ---------- avvisi ---------- */
.flash {
  position: fixed; inset: 0; display: grid; place-items: center; z-index: 50; pointer-events: none;
  font: 800 clamp(44px, 14vw, 120px)/1.1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; text-align: center; padding: 20px;
  background: rgba(16, 22, 44, 0.86); animation: pop 1.6s ease-out forwards;
}
.flash[hidden] { display: none; }
.flash.pause { color: var(--errore); }
.flash.play { color: var(--pronto); }
.flash.seek { color: var(--play); }
@keyframes pop { 0% { opacity: 0; transform: scale(0.9); } 12% { opacity: 1; transform: scale(1); } 75% { opacity: 1; } 100% { opacity: 0; } }
.toast {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60;
  max-width: min(92vw, 520px); padding: 10px 16px; border-radius: 12px; background: var(--tasto-su); box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  white-space: pre-line; overflow-wrap: anywhere;
}
.toast[hidden] { display: none; }
.fly { position: fixed; bottom: 80px; font-size: 40px; z-index: 40; pointer-events: none; animation: fly 2.2s ease-out forwards; }
@keyframes fly { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-60vh); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .flash, .fly { animation-duration: 0.01s; } }
