:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #142638;
  --muted: #627386;
  --border: #dee5ee;
  --accent: #365dff;
  --teal: #10b8a6;
  --error: #c8424b;
}
* { box-sizing: border-box; }
html { min-width: 280px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
main { width: 100%; max-width: 1200px; margin: auto; padding: 32px; }
header { display: flex; justify-content: space-between; align-items: center; gap: 24px; color: var(--muted); font-size: 13px; margin: 0 0 28px; }
.brand { display: inline-flex; align-items: center; gap: 16px; color: var(--ink); font-size: 23px; font-weight: 700; letter-spacing: -0.5px; line-height: 1.4; }
.brand::before { content: ""; display: block; width: 23px; height: 28px; margin: 5px 5px 0 0; border: 3px solid var(--accent); border-radius: 6px; background: var(--panel); box-shadow: 7px -6px 0 -1px var(--teal); }
h1 { font-size: 28px; font-weight: 600; line-height: 1.25; letter-spacing: -0.7px; margin: 0 0 16px; }
h2 { font-size: 16px; line-height: 1.4; font-weight: 600; margin: 0; overflow-wrap: anywhere; }
p { max-width: 76ch; margin: 0 0 20px; }
section { background: var(--panel); border: 1px solid var(--border); border-radius: 20px; padding: 28px; margin: 20px 0; box-shadow: 0 4px 20px #14263804; }
#welcome { background: radial-gradient(ellipse at 100% 0, #10b8a608, transparent 60%), var(--panel); }
#welcome > p:first-of-type { color: var(--muted); max-width: 67ch; margin-bottom: 28px; }
label { display: inline-flex; flex-direction: column; gap: 7px; max-width: 100%; color: var(--muted); font-size: 13px; font-weight: 600; margin: 0 12px 0 0; vertical-align: bottom; }
input, select, button { font: 14px/1.4 "Segoe UI", system-ui, sans-serif; border: 1px solid var(--border); background: var(--panel); color: var(--ink); border-radius: 10px; min-height: 44px; padding: 11px 14px; transition: background-color 120ms, border-color 120ms, box-shadow 120ms; }
input { min-width: 220px; max-width: 100%; font-weight: 400; }
input[readonly] { color: #43566d; background: #f8faff; }
select { min-width: 88px; cursor: pointer; }
#inviteLink { width: 650px; font-size: 13px; text-overflow: ellipsis; }
button { cursor: pointer; font-weight: 600; margin: 6px 8px 6px 0; }
button:hover:not(:disabled) { border-color: #aab7ce; background: #f5f7fb; }
button:active:not(:disabled) { background: #eaf0f8; }
button:disabled { color: #8895a4; background: #f4f6f9; border-color: #e7ebf1; cursor: default; }
input:focus-visible, select:focus-visible, button:focus-visible, summary:focus-visible { outline: 3px solid #365dff45; outline-offset: 3px; border-color: var(--accent); }
.primary { background: var(--accent); border-color: var(--accent); color: #fff; padding-inline: 22px; }
.primary:hover:not(:disabled) { background: #294de4; border-color: #294de4; }
.primary:active:not(:disabled) { background: #2142cc; }
button.active { background: #e6f8f4; border-color: #93dcd2; color: #106c61; }
button.active:hover:not(:disabled) { background: #d8f2ed; border-color: var(--teal); }
.danger { color: #b6333e; border-color: #ebd2d5; }
.danger:hover:not(:disabled) { background: #fff1f2; border-color: #d89ca3; }
.small, footer { font-size: 13px; color: var(--muted); line-height: 1.65; }
#welcome > .small { margin: 24px 0 0; }
#guestJoin { margin-top: 24px; }
#guestJoin p { margin-bottom: 8px; }
#status { max-width: none; padding: 13px 16px; border: 1px solid #cde9e4; border-left: 3px solid var(--teal); border-radius: 10px; background: #edf9f6; color: #25574e; min-height: 48px; font-size: 14px; margin: 0 0 20px; overflow-wrap: anywhere; }
#status.error { border-color: #efcdd0; border-left-color: var(--error); background: #fff1f2; color: #9f2f39; }
.roomhead { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; }
.roomhead h1 { margin: 0; overflow-wrap: anywhere; }
.roomhead button { flex-shrink: 0; margin-right: 0; }
#invitation { padding: 20px; background: #f8faff; border: 1px solid var(--border); border-radius: 12px; }
#invitation > .small:last-child { margin-bottom: 0; }
.toolbar { display: flex; align-items: end; gap: 8px; flex-wrap: wrap; margin: 24px 0 16px; }
.toolbar button { margin: 0; }
.toolbar label { margin: 0; }
#mediaHelp:empty { display: none; }
.request { border: 1px solid #a4ded6; background: #f0fbf8; padding: 14px 18px; border-radius: 12px; margin-top: 16px; }
.request span { display: inline; margin-right: 16px; overflow-wrap: anywhere; }
.request button:first-of-type { color: #fff; background: var(--accent); border-color: var(--accent); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 20px; margin-bottom: 24px; }
article { min-width: 0; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 16px; }
article video { display: block; background: var(--ink); width: 100%; max-height: 500px; min-height: 180px; margin: 14px 0; object-fit: contain; border-radius: 8px; }
article .state { display: block; color: var(--muted); font-size: 13px; margin: 4px 0 0; }
article .small { margin: 16px 0; padding: 24px 16px; background: var(--bg); border-radius: 8px; text-align: center; }
article button { font-size: 13px; min-height: 40px; padding: 9px 11px; margin-bottom: 0; }
footer { padding: 4px 2px 16px; overflow-wrap: anywhere; }
details { margin: 16px 0; }
summary { cursor: pointer; color: var(--accent); font-size: 14px; font-weight: 600; width: fit-content; padding: 4px 0; border-radius: 4px; }
.invite-layout { display: flex; align-items: center; gap: 28px; }
.invite-layout p { color: var(--muted); margin: 8px 0; }
#inviteQr { flex: 0 0 240px; display: block; width: 240px; max-width: 100%; height: auto; margin: 12px 0; image-rendering: pixelated; background: #fff; border: 1px solid var(--border); border-radius: 8px; }
[hidden] { display: none !important; }
@media (max-width: 900px) {
  main { padding: 24px; }
  #invitation label { width: calc(100% - 130px); }
  #inviteLink { width: 100%; min-width: 0; }
}
@media (max-width: 640px) {
  main { padding: 20px 16px; }
  header { display: block; margin-bottom: 24px; }
  header > span:last-child { display: block; margin-top: 10px; }
  .brand { font-size: 21px; }
  h1 { font-size: 25px; }
  section { padding: 20px; border-radius: 16px; margin: 16px 0; }
  .roomhead { align-items: flex-start; flex-wrap: wrap; gap: 8px; }
  .roomhead button { margin-top: 0; }
  #welcome label, #invitation label { display: flex; width: 100%; margin: 12px 0; }
  #inviteLink, input { width: 100%; min-width: 0; }
  #welcome .primary { margin-top: 12px; }
  #invitation { padding: 16px; }
  .invite-layout { flex-direction: column; align-items: flex-start; gap: 12px; }
  .toolbar { gap: 10px; }
  .grid { grid-template-columns: 1fr; gap: 16px; }
  article { padding: 14px; }
  article video { min-height: 140px; }
}
@media (prefers-reduced-motion: reduce) { input, select, button { transition: none; } }
/* Desktop home: keep requests and video, without the full browser interface. */
html.specchio-home body { background: #10151e; color: #e9edf5; }
html.specchio-home main { max-width: none; padding: 20px; }
html.specchio-home header, html.specchio-home footer, html.specchio-home .roomhead,
html.specchio-home #mediaHelp, html.specchio-home #room > p,
html.specchio-home .invite-layout .small { display: none !important; }
html.specchio-home section, html.specchio-home #invitation { background: transparent; border: 0; box-shadow: none; padding: 0; margin: 0; }
html.specchio-home #status { margin: 0 0 12px; }
html.specchio-home #status:not(.error) { display: none; }
html.specchio-home #room { display: flex; flex-direction: column; }
html.specchio-home #requests { order: 0; }
html.specchio-home #invitation { order: 1; }
html.specchio-home .toolbar { order: 2; display: none; }
html.specchio-home body:has(#videos article:not([hidden])) .toolbar { display: flex; }
html.specchio-home .toolbar > *:not(#playAudio) { display: none !important; }
html.specchio-home #videos { order: 3; margin-top: 16px; }
html.specchio-home body:has(#videos article:not([hidden])) #videos { order: 1; }
html.specchio-home body:has(#videos article:not([hidden])) #invitation { order: 3; margin-top: 20px; }
html.specchio-home article, html.specchio-home #requests .request { color: #142638; }
html.specchio-home .invite-layout { display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 8px; }
html.specchio-home #inviteQr { width: 230px; flex: 0 0 auto; margin: 8px auto; background: white; border: 10px solid white; border-radius: 12px; }
html.specchio-home .invite-layout h2 { color: #e9edf5; font-size: 19px; }
html.specchio-home .invite-layout p { color: #a8b5c9; margin: 8px auto; max-width: 42ch; }
@media (max-width: 640px) { html.specchio-home main { padding: 16px; } html.specchio-home #inviteQr { width: 200px; } }

html.specchio-home .invite-layout > div { width: 100%; max-width: 480px; }
html.specchio-home .invite-layout details { margin: 12px auto 0; text-align: left; }
html.specchio-home .invite-layout summary { color: #a9baff; }
html.specchio-home .invite-layout label { display: flex; width: 100%; margin: 8px 0 0; color: #c7d1e1; }
html.specchio-home #inviteLink { width: 100%; min-width: 0; }
html.specchio-home #copy { margin-top: 10px; }
