/* Tersea RoomKiosk — KIOSK display (dark, large format, readable at distance) */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500;600&display=swap');

:root {
  --k-bg:     #0a1322;
  --k-bg-2:   #0c1626;
  --k-panel:  #121f37;
  --k-panel-2:#16294a;
  --k-line:   rgba(255,255,255,.09);
  --k-line-2: rgba(255,255,255,.06);
  --k-text:   #eef3fb;
  --k-muted:  #93a4c2;
  --k-dim:    #66789a;
  --k-free:   #3ad27f;
  --k-busy:   #ff5b5b;
  --k-soon:   #f5b63d;
  --k-blue:   #57a0ff;
  --font: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font);
  background:
    radial-gradient(1200px 700px at 78% -10%, rgba(40,80,150,.20), transparent 60%),
    radial-gradient(900px 600px at 10% 110%, rgba(20,60,120,.16), transparent 55%),
    var(--k-bg);
  color: var(--k-text);
  overflow: hidden;
}
h1,h2,h3,h4,p { margin: 0; }

.kiosk {
  height: 100vh; width: 100vw;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: clamp(20px, 2.6vh, 40px) clamp(24px, 3vw, 56px);
  gap: clamp(16px, 2.4vh, 32px);
}

/* ---------- Header ---------- */
.k-head { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.k-brand { display: flex; align-items: center; gap: 13px; }
.k-logo { width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(160deg,#2a64bf,#133a78); display: grid; place-items: center; flex: none; box-shadow: inset 0 0 0 1px rgba(255,255,255,.14); }
.k-logo i { width: 14px; height: 14px; border-radius: 4px; background: #fff; position: relative; }
.k-logo i::after { content:""; position:absolute; right:-6px; bottom:-6px; width:8px; height:8px; border-radius:50%; background: var(--k-free); box-shadow: 0 0 0 2px rgba(10,19,34,.6); }
.k-brand b { font-size: 18px; font-weight: 700; letter-spacing: .01em; }
.k-brand small { display: block; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--k-dim); font-weight: 600; }

.k-head-right { display: flex; align-items: center; gap: clamp(16px, 2vw, 30px); }
.k-conn { display: inline-flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 600; color: var(--k-muted); padding: 8px 14px; border: 1px solid var(--k-line); border-radius: 999px; background: rgba(255,255,255,.03); }
.k-conn .d { width: 9px; height: 9px; border-radius: 50%; background: var(--k-free); position: relative; }
.k-conn .d::after { content:""; position:absolute; inset:-4px; border-radius:50%; border:1.5px solid var(--k-free); opacity:.5; animation: kping 2s ease-out infinite; }
.k-conn.off { color: #ffb0b0; }
.k-conn.off .d { background: var(--k-busy); }
.k-conn.off .d::after { border-color: var(--k-busy); animation: none; opacity:.3; }
@keyframes kping { 0%{transform:scale(.7);opacity:.6} 80%,100%{transform:scale(1.7);opacity:0} }
.k-clock { text-align: right; }
.k-clock .time { font-family: var(--mono); font-size: clamp(26px, 3vw, 40px); font-weight: 600; line-height: 1; letter-spacing: .02em; }
.k-clock .date { font-size: 13px; color: var(--k-muted); text-transform: capitalize; margin-top: 4px; }

/* ---------- Main ---------- */
.k-main { display: grid; grid-template-columns: 1.35fr 1fr; gap: clamp(18px, 2vw, 30px); min-height: 0; }

/* Status hero */
.k-status {
  position: relative; overflow: hidden;
  border-radius: 26px; padding: clamp(28px, 4vh, 52px);
  background: linear-gradient(160deg, var(--k-panel-2), var(--k-panel));
  border: 1px solid var(--k-line);
  display: flex; flex-direction: column; justify-content: space-between;
}
.k-status::before {
  content:""; position:absolute; left:0; top:0; bottom:0; width:8px;
  background: var(--accent, var(--k-free));
}
.k-status .s-glow { position:absolute; right:-140px; top:-140px; width:420px; height:420px; border-radius:50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent,#3ad27f) 30%, transparent), transparent 65%); pointer-events:none; }

.k-room-eyebrow { display:flex; align-items:center; gap:12px; font-size: clamp(15px,1.6vw,19px); color: var(--k-muted); font-weight:600; }
.k-room-eyebrow .b-tag { font-size:13px; color: var(--k-dim); border:1px solid var(--k-line); padding:3px 10px; border-radius:999px; }
.k-room-name { font-size: clamp(40px, 6vw, 84px); font-weight: 700; letter-spacing: -.02em; line-height: .98; margin: 14px 0 0; }

.k-statusline { display: flex; align-items: center; gap: 18px; margin-top: clamp(20px,3vh,34px); }
.k-status-dot { width: clamp(20px,2.4vw,30px); height: clamp(20px,2.4vw,30px); border-radius: 50%; background: var(--accent,var(--k-free)); box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent,#3ad27f) 22%, transparent), 0 0 40px color-mix(in srgb, var(--accent,#3ad27f) 55%, transparent); flex:none; }
#status-title { font-size: clamp(30px, 4.4vw, 60px); font-weight: 700; letter-spacing: -.01em; line-height: 1; }
#status-subtitle { font-size: clamp(16px, 1.9vw, 24px); color: var(--k-muted); margin-top: 16px; max-width: 90%; }

.k-status-foot { margin-top: auto; padding-top: clamp(20px,3vh,30px); display: flex; gap: 14px; align-items: center; color: var(--k-dim); font-size: 14px; }

/* Agenda */
.k-agenda { border-radius: 26px; background: rgba(255,255,255,.02); border: 1px solid var(--k-line); padding: clamp(22px,3vh,32px); display: flex; flex-direction: column; min-height: 0; }
.k-agenda h2 { font-size: clamp(16px,1.7vw,20px); font-weight: 600; display:flex; align-items:center; justify-content:space-between; margin: 0 0 6px; }
.k-agenda h2 .count { font-size: 13px; color: var(--k-dim); font-weight: 500; }
.k-agenda .a-sub { font-size: 13px; color: var(--k-dim); margin-bottom: 18px; }
#meeting-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; overflow: hidden; flex: 1; }
#meeting-list li { display: grid; grid-template-columns: auto 1fr; gap: 16px; padding: 14px 16px; border-radius: 14px; background: rgba(255,255,255,.03); border: 1px solid var(--k-line-2); align-items: center; }
#meeting-list li strong { font-family: var(--mono); font-size: clamp(15px,1.5vw,18px); font-weight: 600; color: var(--k-text); white-space: nowrap; }
#meeting-list li span { font-size: clamp(14px,1.4vw,17px); color: var(--k-muted); }
#meeting-list li.now { background: rgba(255,91,91,.12); border-color: rgba(255,91,91,.35); }
#meeting-list li.now strong { color: #ffd9d9; }
#meeting-list li.now span { color: #ffeaea; }
#meeting-list li.done { opacity: .42; }

/* ---------- Footer: pairing / projection CTA ---------- */
.k-foot { border-radius: 22px; background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.015)); border: 1px solid var(--k-line); padding: clamp(18px,2.4vh,26px) clamp(22px,3vw,40px); display: flex; align-items: center; justify-content: space-between; gap: 30px; }
.k-foot .pf-left { display: flex; align-items: center; gap: 22px; }
.k-foot .pf-ico { width: 54px; height: 54px; border-radius: 14px; background: rgba(87,160,255,.14); color: var(--k-blue); display: grid; place-items: center; flex: none; }
.k-foot .pf-ico svg { width: 27px; height: 27px; }
.k-foot .pf-title { font-size: clamp(17px,1.8vw,22px); font-weight: 600; }
.k-foot .pf-sub { font-size: clamp(13px,1.4vw,16px); color: var(--k-muted); margin-top: 3px; }
.k-foot .pf-sub b { color: var(--k-text); font-family: var(--mono); }

.k-code { text-align: right; }
.k-code .code-label { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--k-dim); font-weight: 600; }
#pairing-code { font-family: var(--mono); font-size: clamp(40px, 5vw, 68px); font-weight: 600; letter-spacing: clamp(.06em,.4vw,.14em); line-height: 1; margin: 6px 0 4px; color: #fff; }
#pairing-code.idle { color: var(--k-dim); letter-spacing: .12em; }
#pairing-countdown { font-size: 14px; color: var(--k-muted); }
#pairing-countdown.live { color: var(--k-soon); font-weight: 600; }

/* ---------- Projection user line (hidden helper) ---------- */
#projection-user { position: absolute; left:-9999px; }

/* ---------- Projection stage (fullscreen diffusion) ---------- */
#projection-stage { position: fixed; inset: 0; z-index: 40; background: #000; }
#projection-stage::before { content:""; position:absolute; left:0; right:0; top:0; height:160px; background:linear-gradient(180deg, rgba(0,0,0,.75), transparent); z-index:1; pointer-events:none; }
#projection-stage::after  { content:""; position:absolute; left:0; right:0; bottom:0; height:200px; background:linear-gradient(0deg,  rgba(0,0,0,.7), transparent); z-index:1; pointer-events:none; }

/* Video and canvas fill the stage */
#projection-video {
    display: block; position: absolute; inset: 0;
    width: 100%; height: 100%;
    background: #000; z-index: 0;
    object-fit: contain;
}
/* Canvas: maintain 16:9 aspect ratio centered (object-fit doesn't apply to canvas) */
#kiosk-canvas {
    display: block;
    position: absolute;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    width: auto; height: auto;
    max-width: 100%; max-height: 100%;
    aspect-ratio: 16 / 9;
    background: #fff; z-index: 0;
}

/* Top bar: live badge + mode tag + room tag */
.ps-top { position:absolute; top:clamp(18px,2.5vh,32px); left:clamp(22px,3vw,44px); right:clamp(22px,3vw,44px); z-index:2; display:flex; align-items:center; justify-content:space-between; gap:16px; }
.ps-top-center { flex:1; display:flex; justify-content:center; }

.ps-live-badge { display:inline-flex; align-items:center; gap:10px; padding:9px 16px; border-radius:999px; background:rgba(10,18,32,.7); backdrop-filter:blur(12px); border:1px solid rgba(255,255,255,.14); font-size:clamp(14px,1.6vw,19px); font-weight:600; }
.ps-live-badge .d { width:9px; height:9px; border-radius:50%; background:var(--k-busy); flex:none; position:relative; }
.ps-live-badge .d::after { content:""; position:absolute; inset:-4px; border-radius:50%; border:1.5px solid var(--k-busy); opacity:.5; animation:kping 1.8s ease-out infinite; }
.ps-live-badge .tagword { color:#ff9a9a; font-weight:700; letter-spacing:.09em; text-transform:uppercase; font-size:.62em; }

/* Mode tag (shown when blank/diagram) */
.ps-mode-tag { display:none; align-items:center; gap:8px; padding:8px 16px; border-radius:999px; background:rgba(87,160,255,.18); border:1px solid rgba(87,160,255,.35); color:var(--k-blue); font-size:clamp(13px,1.4vw,16px); font-weight:600; }
.ps-mode-tag.visible { display:inline-flex; }

.ps-room-tag { font-size:clamp(13px,1.4vw,16px); color:var(--k-muted); padding:9px 16px; border-radius:999px; background:rgba(10,18,32,.6); backdrop-filter:blur(10px); border:1px solid rgba(255,255,255,.1); }

/* Bottom bar: roster left, pairing code right */
.ps-bottom-bar { position:absolute; bottom:0; left:0; right:0; z-index:2; display:flex; align-items:flex-end; justify-content:space-between; padding:0 clamp(22px,3vw,44px) clamp(18px,2.5vh,30px); gap:24px; }
.ps-bottom { display:flex; align-items:center; gap:clamp(8px,1vw,12px); padding:10px 20px; border-radius:999px; background:rgba(10,18,32,.65); backdrop-filter:blur(10px); border:1px solid rgba(255,255,255,.13); white-space:nowrap; flex-wrap:nowrap; min-height:0; }
.ps-bottom .pr-label { font-size:13px; color:var(--k-muted); font-weight:600; padding-right:4px; }
.ps-av { width:clamp(36px,3vw,44px); height:clamp(36px,3vw,44px); border-radius:50%; display:grid; place-items:center; font-size:clamp(12px,1.2vw,15px); font-weight:700; color:#fff; flex:none; position:relative; opacity:.55; transition:opacity .2s; }
.ps-av.on { opacity:1; box-shadow:0 0 0 3px #080d17, 0 0 0 5px var(--k-busy); }
.ps-av .on-pill { position:absolute; bottom:-9px; left:50%; transform:translateX(-50%); font-size:8px; font-weight:700; letter-spacing:.04em; text-transform:uppercase; background:var(--k-busy); color:#fff; padding:1px 5px; border-radius:999px; white-space:nowrap; }

/* Pairing code overlay */
.ps-pairing { text-align:right; padding:10px 16px; border-radius:14px; background:rgba(10,18,32,.65); backdrop-filter:blur(10px); border:1px solid rgba(255,255,255,.13); }
.ps-pairing .ps-pair-label { font-size:11px; letter-spacing:.14em; text-transform:uppercase; color:var(--k-dim); font-weight:600; }
.ps-pairing #ps-code { font-family:var(--mono); font-size:clamp(22px,2.6vw,34px); font-weight:600; letter-spacing:.12em; line-height:1.1; color:#fff; margin:4px 0 2px; }
.ps-pairing #ps-code-cd { font-size:12px; color:var(--k-soon); font-weight:600; }

#projection-frame-status { position:absolute; bottom:8px; right:14px; z-index:2; font-size:11px; color:rgba(255,255,255,.25); font-family:var(--mono); pointer-events:none; }

/* ---------- Enrollment / setup overlay ---------- */
#setup-card { position: fixed; inset: 0; z-index: 50; background: rgba(7,12,22,.86); backdrop-filter: blur(10px); display: grid; place-items: center; padding: 24px; }
.setup-inner { width: min(640px, 100%); background: var(--k-panel); border: 1px solid var(--k-line); border-radius: 22px; padding: clamp(28px,4vh,42px); box-shadow: 0 40px 100px rgba(0,0,0,.6); }
.setup-inner .s-eyebrow { font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--k-blue); font-weight: 700; }
.setup-inner h1 { font-size: clamp(26px,3.2vw,36px); font-weight: 700; margin: 10px 0 8px; letter-spacing: -.01em; }
.setup-inner p.lede { color: var(--k-muted); font-size: 15px; margin: 0 0 24px; }
.s-field { display: grid; gap: 8px; margin-bottom: 16px; }
.s-field label { font-size: 13px; font-weight: 600; color: var(--k-muted); }
.s-field select, .s-field input { height: 52px; border-radius: 12px; border: 1px solid var(--k-line); background: rgba(255,255,255,.04); color: var(--k-text); font-family: inherit; font-size: 16px; padding: 0 16px; }
.s-field input { font-family: var(--mono); letter-spacing: .04em; }
.s-field select:focus, .s-field input:focus { outline: none; border-color: var(--k-blue); box-shadow: 0 0 0 3px rgba(87,160,255,.25); }
.s-field select option { background: var(--k-panel); }
.setup-actions { display: flex; gap: 12px; margin-top: 22px; align-items: center; flex-wrap: wrap; }
#setup-button { height: 52px; padding: 0 26px; border: 0; border-radius: 12px; background: linear-gradient(160deg,#2a64bf,#1a4f9c); color: #fff; font-size: 16px; font-weight: 600; cursor: pointer; font-family: inherit; }
#setup-button:hover { filter: brightness(1.08); }
#reset-kiosk-button { height: 44px; padding: 0 18px; border: 1px solid var(--k-line); border-radius: 10px; background: transparent; color: var(--k-muted); cursor: pointer; font-family: inherit; font-size: 14px; font-weight: 500; }
#reset-kiosk-button:hover { background: rgba(255,255,255,.05); color: var(--k-text); }
#setup-feedback { min-height: 20px; margin: 16px 0 0; font-size: 14px; color: var(--k-muted); }
#setup-feedback.error { color: #ff9b9b; }

.hidden { display: none !important; }

@media (max-width: 1000px) {
  .k-main { grid-template-columns: 1fr; }
  .k-agenda { display: none; }
}
@media (max-width: 640px) {
  .k-foot { flex-direction: column; align-items: flex-start; gap: 16px; }
  .k-code { text-align: left; }
  .k-head-right .k-clock .date { display:none; }
}
