* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: #0a0f24; color: #e9ecf5;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; font-size: 14px;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }

/* pasek górny */
.bar { display: flex; align-items: center; gap: 12px; height: 52px; padding: 0 14px; padding-top: env(safe-area-inset-top);
  background: #111937; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.brand { display: flex; align-items: center; gap: 8px; font-size: 13px; color: rgba(255, 255, 255, .8); white-space: nowrap; }
.brand img { height: 18px; }
.spacer { flex: 1; }
.pill { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, .08); white-space: nowrap; display: flex; align-items: center; gap: 6px; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; }
.pill.live { background: rgba(255, 59, 59, .16); color: #ff8080; font-weight: 700; letter-spacing: .06em; }
.pill.live i { width: 8px; height: 8px; border-radius: 50%; background: #ff3b3b; animation: pulse 1.6s infinite; }
.pill.warn { background: rgba(255, 184, 28, .15); color: #ffc94d; }
.pill.idle { color: rgba(255, 255, 255, .7); }
@keyframes pulse { 50% { opacity: .3; } }

.langs { display: flex; background: rgba(255, 255, 255, .06); border-radius: 8px; padding: 3px; gap: 2px; }
.langs button { border: 0; background: none; padding: 5px 9px; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; color: rgba(255, 255, 255, .7); }
.langs button:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.langs button.on { background: #12abdb; color: #fff; }
.icon-btn { border: 0; background: rgba(255, 255, 255, .06); width: 36px; height: 34px; border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.icon-btn svg { width: 18px; height: 18px; }
.btn { border: 1px solid rgba(255, 255, 255, .15); background: rgba(255, 255, 255, .06); color: #fff; border-radius: 8px; padding: 8px 14px; cursor: pointer; font-size: 13px; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, .12); }
.btn:disabled { opacity: .35; cursor: default; }
.btn-primary { background: #0070ad; border-color: #0070ad; font-weight: 600; padding: 11px 16px; }
.btn-primary:hover { background: #0a82c5 !important; }
.btn-live { background: #e5383b; border-color: #e5383b; font-weight: 600; }
.btn-live:hover { background: #f04c4f !important; }
.link-btn { border: 0; background: none; color: #7fd3f0; cursor: pointer; font-size: 12px; padding: 4px; }
.counter { font-size: 12px; color: rgba(255, 255, 255, .6); font-variant-numeric: tabular-nums; }

/* widz */
body.viewer { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }
.main-stage { flex: 1; background: #000; }

@keyframes fadein { from { opacity: .25; } }
.vfoot { display: flex; align-items: center; gap: 14px; height: 46px; padding: 0 14px; padding-bottom: env(safe-area-inset-bottom); background: #111937; border-top: 1px solid rgba(255, 255, 255, .08); }
.mode { font-size: 12px; color: rgba(255, 255, 255, .55); flex: 1; }
:fullscreen .bar, :fullscreen .vfoot { position: fixed; left: 0; right: 0; z-index: 5; opacity: 0; transition: opacity .3s; }
:fullscreen .bar { top: 0; } :fullscreen .vfoot { bottom: 0; }
:fullscreen .bar:hover, :fullscreen .vfoot:hover { opacity: 1; }
:fullscreen .vfoot:has(.btn-live:not([hidden])) { opacity: 1; }

.overlay { position: fixed; inset: 0; z-index: 20; background: rgba(6, 10, 28, .86); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 20px; }
.picker-card { background: #fff; color: #111937; border-radius: 14px; padding: 28px; width: min(460px, 100%); box-shadow: 0 30px 80px rgba(0, 0, 0, .5); }
.picker-logo { height: 26px; margin-bottom: 18px; }
.picker-card h1 { font-size: 21px; margin: 0 0 6px; font-weight: 600; }
.picker-card p { margin: 0 0 18px; color: #4a5368; line-height: 1.45; }
.pick-list { display: grid; gap: 8px; }
.pick-list button { display: flex; align-items: center; gap: 14px; border: 1px solid #dfe3ec; background: #fff; border-radius: 10px; padding: 12px 14px; cursor: pointer; font-size: 16px; text-align: left; color: #111937; }
.pick-list button:hover { border-color: #12abdb; background: #f1fafe; }
.pick-list b { width: 34px; height: 26px; border-radius: 6px; background: #111937; color: #fff; font-size: 12px; display: grid; place-items: center; }

/* prezenter */
.login-card label { display: block; font-weight: 600; margin: 8px 0 6px; font-size: 13px; }
.login-card input { width: 100%; font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid #cfd5e1; border-radius: 8px; }
.login-card .hint { font-size: 12px; margin: 8px 0 12px; }
.login-card .err { color: #c62828; font-weight: 600; margin: 0 0 12px; }
.login-card .btn-primary { width: 100%; margin-top: 14px; }
.login-langs { background: #eef1f6; width: max-content; }
.login-langs button { color: #3a4252; }
.login-langs button:hover { color: #111937; background: #e0e5ee; }

body.presenter { min-height: 100vh; }
.p-app { display: flex; flex-direction: column; height: 100vh; }
.timer { font-size: 12px; color: rgba(255, 255, 255, .7); white-space: nowrap; }
.timer b { font-size: 16px; color: #fff; font-variant-numeric: tabular-nums; margin-left: 4px; }
.p-grid { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; padding: 16px; min-height: 0; }
.p-current { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.p-label { display: flex; justify-content: space-between; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: rgba(255, 255, 255, .55); margin: 0 0 6px; }
.p-stage { flex: 1; min-height: 200px; border-radius: 8px; background: #000; }
.p-stage.laser-on { cursor: crosshair; }
.p-stage:fullscreen { border-radius: 0; }
.p-controls { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.nav-btn { font-size: 26px; width: 56px; height: 44px; padding: 0; line-height: 1; }
.dots { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.dots button { width: 30px; height: 30px; border-radius: 6px; border: 1px solid rgba(255, 255, 255, .12); background: none; cursor: pointer; font-size: 12px; color: rgba(255, 255, 255, .7); }
.dots button.on { background: #12abdb; border-color: #12abdb; color: #fff; font-weight: 700; }
.toggle { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; user-select: none; }
.keys { font-size: 11px; color: rgba(255, 255, 255, .4); margin-top: 8px; }
.p-side { overflow-y: auto; min-height: 0; padding-right: 4px; }
.p-side .p-label { margin-top: 16px; }
.p-side .p-label:first-child { margin-top: 0; }
.p-next { aspect-ratio: 16 / 9; border-radius: 6px; background: #000; opacity: .92; }
.end-box { aspect-ratio: 16 / 9; border-radius: 6px; border: 1px dashed rgba(255, 255, 255, .2); display: grid; place-items: center; color: rgba(255, 255, 255, .5); }
.notes { background: #151d3d; border-radius: 8px; padding: 12px 14px; font-size: 14.5px; line-height: 1.5; max-height: 34vh; overflow-y: auto; }
.notes ul { margin: 0; padding-left: 18px; } .notes li + li { margin-top: 6px; }
.notes .muted { color: rgba(255, 255, 255, .45); margin: 0; }
.aud { background: #151d3d; border-radius: 8px; padding: 12px 14px; }
.aud-total { font-size: 13px; color: rgba(255, 255, 255, .7); margin-bottom: 8px; }
.aud-total b { font-size: 24px; color: #fff; margin-right: 4px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: flex; gap: 6px; align-items: center; background: rgba(18, 171, 219, .18); border-radius: 6px; padding: 4px 8px; font-variant-numeric: tabular-nums; }
.chip b { font-size: 11px; color: #7fd3f0; }
.chip.zero { opacity: .4; }
.share { display: flex; gap: 12px; background: #151d3d; border-radius: 8px; padding: 12px; }
.qr { width: 112px; flex: 0 0 112px; background: #fff; border-radius: 6px; padding: 4px; }
.qr svg { display: block; width: 100%; height: auto; }
.share-r { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.share-r input { width: 100%; background: #0a0f24; color: #fff; border: 1px solid rgba(255, 255, 255, .15); border-radius: 6px; padding: 8px; font: inherit; font-size: 12px; }
.share-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.share-btns .btn { padding: 6px 10px; font-size: 12px; }

@media (max-width: 900px) {
  .p-grid { grid-template-columns: 1fr; overflow-y: auto; }
  .p-stage { flex: none; aspect-ratio: 16 / 9; }
  .p-app { height: auto; min-height: 100vh; }
  .timer, .keys { display: none; }
}
@media (max-width: 560px) {
  .brand span { display: none; }
  .bar { gap: 8px; padding: 0 10px; }
  .langs button { padding: 5px 6px; }
  .mode { display: none; }
}

/* czat AI */
.btn-ai { gap: 8px; background: linear-gradient(135deg, #0070ad, #12abdb); border: 0; font-weight: 600; }
.btn-ai svg { width: 18px; height: 18px; }
.chat { position: fixed; right: 0; top: 52px; bottom: 46px; width: 380px; z-index: 8; background: #f7f8fb; color: #111937; display: flex; flex-direction: column;
  box-shadow: -20px 0 50px rgba(0, 0, 0, .35); animation: chatIn .3s cubic-bezier(.2, .75, .2, 1); }
@keyframes chatIn { from { transform: translateX(40px); opacity: 0; } }
body.viewer.chat-open .main-stage { margin-right: 380px; transition: margin .3s; }
.chat-head { display: flex; justify-content: space-between; gap: 10px; padding: 14px 14px 12px 16px; background: #fff; border-bottom: 1px solid #e3e6ee; }
.chat-head b { display: block; font-size: 15px; }
.chat-head small { display: block; font-size: 12px; color: #5a6376; margin-top: 3px; line-height: 1.35; }
.chat-head .icon-btn { background: #eef1f6; color: #111937; flex: 0 0 auto; }
.chat-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 88%; padding: 9px 12px; border-radius: 14px; font-size: 14px; line-height: 1.45; animation: msgIn .25s ease; }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } }
.msg p { margin: 0; } .msg p + p { margin-top: 6px; }
.msg ul { margin: 4px 0; padding-left: 18px; }
.msg.user { align-self: flex-end; background: #0070ad; color: #fff; border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: #fff; border: 1px solid #e3e6ee; border-bottom-left-radius: 4px; }
.msg.unknown { background: #fff8e6; border-color: #f5d98a; }
.msg.error { background: #fdecec; border-color: #f3b4b4; color: #8a1c1c; }
.typing { display: flex; gap: 4px; padding: 12px 14px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: #9aa3b5; animation: dot2 1s infinite; }
.typing span:nth-child(2) { animation-delay: .15s; } .typing span:nth-child(3) { animation-delay: .3s; }
@keyframes dot2 { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
.chat-form { display: flex; gap: 8px; padding: 12px; background: #fff; border-top: 1px solid #e3e6ee; }
.chat-form input { flex: 1; min-width: 0; font: inherit; font-size: 15px; padding: 10px 12px; border: 1px solid #cfd5e1; border-radius: 10px; color: #111937; }
.chat-form input:focus { outline: 2px solid #12abdb; border-color: transparent; }
@media (max-width: 760px) {
  .chat { top: auto; left: 0; width: auto; height: 72dvh; border-radius: 16px 16px 0 0; bottom: 0; animation-name: chatUp; }
  @keyframes chatUp { from { transform: translateY(40px); opacity: 0; } }
  body.viewer.chat-open .main-stage { margin-right: 0; }
  .btn-ai span { display: none; }
}

/* prezenter: udostępnianie */
.opts { background: #151d3d; border-radius: 8px; padding: 12px 14px; display: grid; gap: 12px; font-size: 13px; }
.opts .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.opts select { background: #0a0f24; color: #fff; border: 1px solid rgba(255, 255, 255, .15); border-radius: 6px; padding: 6px 8px; font: inherit; font-size: 12.5px; }
.switch { position: relative; width: 40px; height: 22px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: rgba(255, 255, 255, .18); border-radius: 22px; cursor: pointer; transition: background .2s; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + span { background: #12abdb; }
.switch input:checked + span::after { transform: translateX(18px); }
.vis { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
.vis button { width: 34px; height: 30px; border-radius: 6px; border: 1px solid rgba(18, 171, 219, .5); background: rgba(18, 171, 219, .18); color: #fff; cursor: pointer; font-size: 12px; font-weight: 600; }
.vis button.off { background: none; border-color: rgba(255, 255, 255, .15); color: rgba(255, 255, 255, .4); text-decoration: line-through; }
.focus-hint { font-size: 12px; color: rgba(255, 255, 255, .55); line-height: 1.4; }
.dots button.hid { opacity: .45; text-decoration: line-through; }
.p-stage .fx { cursor: pointer; }
.p-stage .fx:hover { outline: 2px dashed rgba(18, 171, 219, .8); outline-offset: 3px; }
.hid-badge { font-size: 11px; color: #ffc94d; text-transform: none; letter-spacing: 0; }
