:root {
  --brand: #0a0a0a;
  --bg: #f5f5f7;
  --card: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: #e3e3e8;
  --live: #e5262a;
  --ok: #1f9d55;
  --radius: 18px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; line-height: 1.5; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- buttons & inputs ---------- */
.btn { appearance: none; border: 0; border-radius: 999px; padding: 13px 24px; background: var(--brand); color: #fff; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; white-space: nowrap; flex-shrink: 0; transition: transform .08s ease, opacity .2s; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.light { background: #fff; color: #111; }
.btn.block { width: 100%; }
.btn.sm { padding: 8px 14px; font-size: 14px; }
.btn.danger { background: #c62828; }
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=url], input[type=number], input[type=datetime-local], input[type=date], input[type=time], select, textarea {
  width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 12px 14px; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0,0,0,.06); }
textarea { min-height: 80px; resize: vertical; }

.lang-toggle { display: inline-flex; background: rgba(120,120,128,.14); border-radius: 999px; padding: 3px; }
.lang-toggle button { border: 0; background: transparent; padding: 5px 12px; border-radius: 999px; font-size: 13px; cursor: pointer; color: inherit; }
.lang-toggle button.on { background: #fff; color: #111; box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* ---------- registration page ---------- */
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 16px 22px; max-width: 1100px; margin: 0 auto; }
.topbar .logo { font-weight: 700; letter-spacing: -.01em; }
.reg-wrap { max-width: 1100px; margin: 0 auto; padding: 8px 22px 60px; display: grid; grid-template-columns: 1.15fr .85fr; gap: 40px; align-items: start; }
.reg-hero .eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.reg-hero h1 { font-size: clamp(30px, 4.6vw, 50px); line-height: 1.1; letter-spacing: -.025em; margin: 14px 0 18px; }
.reg-hero .desc { font-size: 17px; color: #3a3a3c; white-space: pre-line; }
.reg-hero .cover { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: var(--radius); margin: 8px 0 24px; background: #ddd; }
.presenter { display: flex; gap: 12px; align-items: center; margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); }
.presenter .av { width: 44px; height: 44px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; }
.card { background: var(--card); border-radius: 22px; padding: 26px; box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 10px 30px rgba(0,0,0,.06); }
.reg-card { position: sticky; top: 20px; }
.reg-card h2 { margin: 0 0 4px; font-size: 22px; letter-spacing: -.01em; }
.sessions { display: grid; gap: 8px; margin-bottom: 18px; max-height: 320px; overflow: auto; }
.session-opt { display: flex; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; cursor: pointer; transition: border-color .15s, background .15s; }
.session-opt input { accent-color: var(--brand); width: 18px; height: 18px; flex: none; }
.session-opt.on { border-color: var(--brand); background: rgba(0,0,0,.025); }
.session-opt .when { font-weight: 600; }
.session-opt .tag { margin-left: auto; font-size: 12px; background: rgba(229,38,42,.1); color: var(--live); padding: 3px 8px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.err { color: #c62828; font-size: 14px; min-height: 20px; margin: 6px 0; }
.dur-pill { display: inline-block; font-size: 13px; color: var(--muted); background: rgba(120,120,128,.12); padding: 3px 10px; border-radius: 999px; }

/* ---------- thanks ---------- */
.center-wrap { max-width: 620px; margin: 0 auto; padding: 30px 22px 60px; text-align: center; }
.check { width: 64px; height: 64px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; font-size: 32px; margin: 10px auto 18px; }
.countdown { display: flex; justify-content: center; gap: 10px; margin: 24px 0; }
.countdown .u { background: #fff; border-radius: 16px; min-width: 74px; padding: 12px 8px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.countdown .n { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.countdown .l { font-size: 12px; color: var(--muted); }
.actions { display: grid; gap: 10px; margin-top: 18px; }
.linkbox { display: flex; gap: 8px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px 8px 8px 14px; margin-top: 14px; }
.linkbox code { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; text-align: left; }

/* ---------- room ---------- */
body.room { background: #0b0b0c; color: #f2f2f2; }
body.room .lang-toggle { background: rgba(255,255,255,.12); }
.room-top { display: flex; align-items: center; gap: 14px; padding: 12px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.room-top .title { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge-live { display: inline-flex; align-items: center; gap: 6px; background: var(--live); color: #fff; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 6px; letter-spacing: .04em; }
.badge-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: pulse 1.4s infinite; }
.badge-replay { background: #444; }
.badge-replay::before { animation: none; }
@keyframes pulse { 50% { opacity: .25; } }
.viewers { font-size: 13px; color: #bbb; white-space: nowrap; }
.room-grid { display: grid; grid-template-columns: 1fr 360px; height: calc(100vh - 57px); height: calc(100dvh - 57px); }
.stage { overflow: auto; padding: 18px; }
.player { position: relative; width: 100%; aspect-ratio: 16/9; background: #000; border-radius: 14px; overflow: hidden; }
.player video { position: absolute; inset: 0; width: 100%; height: 100%; display: block; background: #000; }
.player .livebox { position: absolute; inset: 0; background: #000; }
.player .livebox iframe { width: 100%; height: 100%; border: 0; display: block; }
.player .slide { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; z-index: 1; }
.player.slides-on video, .player.slides-on .livebox { inset: auto 12px 12px auto; width: 28%; height: auto; aspect-ratio: 16/9; z-index: 2; border-radius: 10px; overflow: hidden; box-shadow: 0 6px 24px rgba(0,0,0,.5); }
.player.slides-on.swap video, .player.slides-on.swap .livebox { inset: 0; width: 100%; height: 100%; border-radius: 0; z-index: 1; box-shadow: none; }
.player.slides-on.swap .slide { inset: auto 12px 12px auto; width: 28%; height: auto; aspect-ratio: 16/9; z-index: 2; border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.5); }
.swap-btn { position: absolute; top: 12px; right: 12px; z-index: 4; background: rgba(0,0,0,.6); color: #fff; border: 0; border-radius: 999px; padding: 7px 12px; font-size: 13px; cursor: pointer; }
.player .ctrl { z-index: 5; }
.player .overlay { z-index: 6; }
.player .unmute-tip { z-index: 5; }
.overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 20px; background: radial-gradient(ellipse at center, rgba(30,30,32,.85), rgba(0,0,0,.95)); }
.overlay h2 { margin: 0 0 6px; font-size: clamp(20px, 3vw, 30px); letter-spacing: -.01em; }
.overlay .countdown .u { background: rgba(255,255,255,.08); }
.overlay .countdown .l { color: #aaa; }
.join-btn { font-size: 18px; padding: 16px 30px; }
.ctrl { position: absolute; left: 0; right: 0; bottom: 0; display: flex; gap: 10px; align-items: center; padding: 10px 12px; background: linear-gradient(transparent, rgba(0,0,0,.7)); opacity: 0; transition: opacity .2s; }
.player:hover .ctrl, .ctrl.show { opacity: 1; }
.ctrl button { background: rgba(255,255,255,.14); border: 0; color: #fff; border-radius: 999px; padding: 7px 12px; cursor: pointer; font-size: 13px; }
.ctrl input[type=range] { width: 90px; accent-color: #fff; }
.ctrl .spacer { flex: 1; }
.ctrl .time { font-size: 12px; color: #ddd; font-variant-numeric: tabular-nums; }
.seekbar { flex: 1; accent-color: #fff; }
.unmute-tip { position: absolute; top: 12px; left: 12px; background: rgba(0,0,0,.7); color: #fff; border: 0; border-radius: 999px; padding: 8px 14px; cursor: pointer; font-size: 14px; }
.below { margin-top: 18px; display: grid; gap: 14px; }
.room h1.wtitle { font-size: 22px; margin: 0; letter-spacing: -.01em; }
.offer { background: #fff; color: #111; border-radius: 16px; padding: 18px; display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; animation: rise .35s ease; }
.offer.noimg { grid-template-columns: 1fr auto; }
.offer img { width: 84px; height: 84px; object-fit: cover; border-radius: 12px; }
.offer h3 { margin: 0 0 4px; font-size: 18px; }
.offer p { margin: 0; color: #555; font-size: 14px; white-space: pre-line; }
.offer .timer { font-size: 13px; color: var(--live); font-weight: 600; margin-top: 6px; font-variant-numeric: tabular-nums; }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } }
.handouts { background: rgba(255,255,255,.06); border-radius: 14px; padding: 14px 16px; }
.handouts a { display: block; color: #fff; padding: 6px 0; text-decoration: none; }
.handouts a::before { content: "⬇  "; opacity: .7; }
.side { border-left: 1px solid rgba(255,255,255,.08); display: flex; flex-direction: column; min-height: 0; }
.side-head { padding: 14px 16px; font-weight: 600; border-bottom: 1px solid rgba(255,255,255,.08); }
.side-head .small { font-weight: 400; color: #999; display: block; }
.poll { margin: 12px; background: #fff; color: #111; border-radius: 14px; padding: 14px; animation: rise .35s ease; }
.poll h4 { margin: 0 0 10px; }
.poll button.opt { display: block; width: 100%; text-align: left; background: #f2f2f4; border: 0; border-radius: 10px; padding: 10px 12px; margin-bottom: 6px; cursor: pointer; position: relative; overflow: hidden; }
.poll button.opt .bar { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(0,0,0,.08); z-index: 0; transition: width .5s; }
.poll button.opt span { position: relative; z-index: 1; }
.poll button.opt.mine { outline: 2px solid var(--brand); }
.poll .pct { float: right; position: relative; z-index: 1; font-weight: 600; }
.chat { flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; min-height: 120px; }
.msg { font-size: 14px; line-height: 1.45; word-wrap: break-word; }
.msg .who { font-weight: 600; color: #bbb; margin-right: 6px; }
.msg.host { background: rgba(255,255,255,.07); border-radius: 12px; padding: 8px 10px; }
.msg.host .who { color: #ffd166; }
.msg.host .who::after { content: " ✓"; }
.msg.mine .who { color: #8ab4ff; }
.msg .priv { font-size: 11px; color: #888; margin-left: 4px; }
.msg a { color: #8ab4ff; }
.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid rgba(255,255,255,.08); }
.chat-form input { background: rgba(255,255,255,.08); border-color: transparent; color: #fff; }
.chat-form input::placeholder { color: #888; }
.chat-form .btn { background: #fff; color: #111; padding: 10px 16px; }
.chat-note { font-size: 12px; color: #888; padding: 0 14px 10px; }

@media (max-width: 900px) {
  .player.slides-on video, .player.slides-on .livebox, .player.slides-on.swap .slide { width: 36%; }
  .reg-wrap { grid-template-columns: 1fr; gap: 24px; }
  .reg-card { position: static; }
  .room-grid { grid-template-columns: 1fr; height: auto; }
  .stage { padding: 0; }
  .player { border-radius: 0; }
  .below { padding: 0 14px; }
  .side { border-left: 0; border-top: 1px solid rgba(255,255,255,.08); height: 60vh; height: 60dvh; }
  .offer { grid-template-columns: 1fr; text-align: center; }
  .offer.noimg { grid-template-columns: 1fr auto; }
.offer img { margin: 0 auto; }
  .countdown .u { min-width: 62px; }
}

/* ---------- admin ---------- */
body.admin { background: #f5f5f7; }
.adm-top { display: flex; align-items: center; gap: 12px; padding: 14px 22px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.adm-top .logo { font-weight: 700; flex: 1; }
.adm-wrap { max-width: 1180px; margin: 0 auto; padding: 22px; }
.adm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.wcard { background: #fff; border-radius: 18px; padding: 20px; box-shadow: 0 1px 2px rgba(0,0,0,.04); display: flex; flex-direction: column; gap: 10px; }
.wcard h3 { margin: 0; font-size: 18px; }
.wcard .row { display: flex; gap: 8px; flex-wrap: wrap; }
.stat-row { display: flex; gap: 18px; font-size: 14px; color: var(--muted); }
.stat-row b { color: var(--text); font-size: 18px; display: block; }
.tabs { display: flex; gap: 4px; overflow-x: auto; margin: 6px 0 18px; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; background: none; padding: 10px 14px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--text); border-bottom-color: var(--text); font-weight: 600; }
.panel { background: #fff; border-radius: 18px; padding: 22px; box-shadow: 0 1px 2px rgba(0,0,0,.04); margin-bottom: 16px; }
.panel h3 { margin: 0 0 14px; font-size: 17px; }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.cols3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 16px; }
.check-row { display: flex; align-items: center; gap: 10px; margin: 10px 0; cursor: pointer; }
.check-row input { width: 18px; height: 18px; accent-color: #111; }
.days { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 14px; }
.days label { border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: 14px; user-select: none; }
.days label.on { background: #111; color: #fff; border-color: #111; }
.days input { display: none; }
.list-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.ev { border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.ev-head { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.ev-type { font-weight: 700; font-size: 13px; padding: 4px 10px; border-radius: 999px; background: #f0f0f3; }
.ev-type.offer { background: #fff2d6; } .ev-type.poll { background: #e3f0ff; } .ev-type.message { background: #e8f7ee; } .ev-type.handout { background: #f1e8ff; }
.ev-head input.at { width: 100px; }
.ev-head .x { margin-left: auto; }
.save-bar { position: sticky; bottom: 0; background: rgba(245,245,247,.92); backdrop-filter: blur(10px); padding: 12px 0; display: flex; gap: 10px; align-items: center; justify-content: flex-end; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { color: var(--muted); font-weight: 500; font-size: 13px; }
.tbl-wrap { overflow-x: auto; }
.pill { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #f0f0f3; }
.pill.ok { background: #e3f6ea; color: #17733f; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 10px; }
.bars div { flex: 1; background: #111; border-radius: 6px 6px 0 0; position: relative; min-height: 2px; }
.bars div span { position: absolute; top: -20px; left: 0; right: 0; text-align: center; font-size: 11px; color: var(--muted); }
.bars-x { display: flex; gap: 6px; font-size: 11px; color: var(--muted); }
.bars-x span { flex: 1; text-align: center; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: #fff; border-radius: 16px; padding: 16px; }
.kpi b { font-size: 26px; display: block; letter-spacing: -.02em; }
.progress { height: 8px; background: #eee; border-radius: 99px; overflow: hidden; margin: 10px 0; }
.progress div { height: 100%; background: #111; width: 0; transition: width .2s; }
.inbox { display: grid; grid-template-columns: 1fr; gap: 8px; max-height: 60vh; overflow: auto; }
.inmsg { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; cursor: pointer; }
.inmsg.unread { border-color: #111; }
.inmsg.sel { background: #f4f4f6; }
.inmsg.host { background: #fffbe8; cursor: default; }
.login { max-width: 380px; margin: 12vh auto; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #111; color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; z-index: 99; }
@media (max-width: 700px) { .cols2, .cols3 { grid-template-columns: 1fr; } }

/* slides + live console */
.slide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.slide-item { border: 1px solid var(--line); border-radius: 14px; padding: 10px; display: grid; gap: 8px; }
.slide-item img { width: 100%; aspect-ratio: 16/9; object-fit: contain; background: #111; border-radius: 8px; }
.slide-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.slide-meta input.at { width: 90px; padding: 6px 8px; }
.slide-now { width: 100%; max-width: 640px; aspect-ratio: 16/9; object-fit: contain; background: #111; border-radius: 12px; display: block; }
.slide-strip { display: flex; gap: 8px; overflow-x: auto; margin-top: 12px; padding-bottom: 4px; }
.slide-strip img { height: 64px; aspect-ratio: 16/9; object-fit: cover; border-radius: 6px; cursor: pointer; opacity: .6; border: 2px solid transparent; }
.slide-strip img.on { opacity: 1; border-color: #111; }
.big-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0 6px; }
.big-actions .btn { padding: 14px 22px; font-size: 16px; }
.live-head.on { box-shadow: 0 0 0 2px var(--live); }
.live-status { font-size: 18px; margin-bottom: 10px; }
.live-head.on .live-status > b:first-child { color: var(--live); }
.kv { display: flex; gap: 10px; align-items: center; margin: 8px 0; flex-wrap: wrap; }
.kv span { color: var(--muted); font-size: 13px; min-width: 120px; }
.kv code { background: #f2f2f4; padding: 6px 10px; border-radius: 8px; font-size: 13px; word-break: break-all; }
.pub-preview { width: 100%; max-width: 420px; aspect-ratio: 16/9; background: #000; border-radius: 12px; display: block; margin: 8px 0; object-fit: cover; }
.pubbar { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); background: #c62828; color: #fff; border-radius: 999px; padding: 8px 8px 8px 18px; display: flex; gap: 12px; align-items: center; z-index: 50; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
@media (max-width: 700px) { .big-actions .btn { flex: 1; } }

.msg .past-tag { font-size: 10px; color: #999; border: 1px solid #444; border-radius: 4px; padding: 0 4px; margin-right: 6px; vertical-align: 1px; }
