/* N Sosyal look: palette sampled from nsosyal.com (dark theme) */
:root {
  --bg: #1b1e26;
  --surface: #232732;
  --surface-2: #252b3c;
  --surface-hover: #2a2f3d;
  --border: #2d3240;
  --border-strong: #40475a;
  --text: #f8fafc;
  --text-2: #c4c6cc;
  --muted: #a7aab3;
  --faint: #555a64;
  --primary: #1890ff;
  --primary-hover: #40a9ff;
  --primary-soft: rgba(50, 75, 255, 0.12);
  --accent: #3b82f6;
  --danger: #f5222d;
  --danger-soft: rgba(245, 34, 45, 0.12);
  --success: #52c41a;
  --warning: #faad14;
  --logo-gradient: linear-gradient(135deg, #22d3ee 0%, #3b82f6 55%, #324bff 100%);
  --radius: 16px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scrollbar-gutter: stable; } /* the page never shifts sideways when a scrollbar appears */
/* Scrollbars in the palette, not the browser's light default: a thin thumb on the page's own background.
   (Chrome and Firefox read scrollbar-color; Safari reads the ::-webkit-scrollbar rules.) */
html { scrollbar-color: var(--border-strong) var(--bg); }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*:hover { scrollbar-color: #5a6278 transparent; }
html:hover { scrollbar-color: #5a6278 var(--bg); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border: 3px solid transparent; border-radius: 999px; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: #5a6278; }
::-webkit-scrollbar-corner { background: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary-hover); text-decoration: none; }
button { font-family: inherit; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--primary-hover); outline-offset: 2px; }
.person:focus-visible { outline-offset: -2px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------------------------------------------------------------- layout */
.layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 600px) 350px;
  justify-content: center;
  gap: 0 24px;
  min-height: 100vh;
  padding: 0 16px;
}
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 6px;
  padding: 18px 8px;
}
.logo { display: inline-flex; flex-direction: column; align-items: center; width: 56px; margin: 0 0 18px 8px; }
.logo svg { width: 44px; height: 44px; }
.logo small { font-size: 9px; letter-spacing: 2px; color: var(--muted); margin-top: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 16px; border-radius: 999px;
  color: var(--text); font-size: 18px; font-weight: 500;
  cursor: pointer; background: none; border: 0; text-align: left;
}
.nav-item:hover { background: var(--surface); }
.nav-item.active { font-weight: 700; }
.nav-item svg { width: 24px; height: 24px; flex: none; }
.nav-item .badge {
  background: var(--primary); color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 999px; padding: 1px 7px; margin-left: -8px;
}
.sidebar .btn-primary { margin-top: 14px; padding: 14px; font-size: 16px; }
.me-card {
  margin-top: auto; display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; border: 0; border-radius: 999px; background: none; color: inherit;
  font: inherit; text-align: left; cursor: pointer; transition: background-color .15s;
}
.me-card:hover, .me-card[aria-expanded="true"] { background: var(--surface); }
.me-card .names { min-width: 0; flex: 1; }
.me-card .names > span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-card > svg { flex: none; color: var(--text-2); }

/* Middle column: content on top, the room controls stuck to the bottom of the viewport */
.col {
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  min-height: 100vh; min-width: 0;
  display: flex; flex-direction: column;
}
.main { flex: 1; min-width: 0; }
.aside { padding: 16px 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }

/* ---------------------------------------------------------------- header + tabs */
.header {
  position: sticky; top: 0; z-index: 5;
  background: rgba(27, 30, 38, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-title { display: flex; align-items: center; gap: 16px; min-height: 56px; padding: 0 16px; font-size: 20px; font-weight: 700; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px;
  border-radius: 999px; border: 0; background: none; color: var(--text); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-hover); }
.icon-btn svg { width: 20px; height: 20px; }
.tabs { display: flex; }
.tab {
  flex: 1; background: none; border: 0; color: var(--muted); font-size: 15px; font-weight: 500;
  padding: 16px 0 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.tab::after { content: ""; height: 4px; width: 56px; border-radius: 999px; background: transparent; }
.tab:hover { background: var(--surface); }
.tab.active { color: var(--primary); font-weight: 700; }
.tab.active::after { background: var(--primary); }

.chips { display: flex; gap: 8px; padding: 12px 16px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--border); }
.chip {
  flex: none; border: 1px solid var(--border-strong); background: transparent; color: var(--text-2);
  padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 500; cursor: pointer;
}
.chip:hover { background: var(--surface); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------------------------------------------------------------- buttons */
.btn {
  border: 0; border-radius: 999px; padding: 10px 18px; font-size: 14px; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .15s, opacity .15s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border-strong); }
.btn-outline:hover:not(:disabled) { background: var(--surface-hover); }
.btn-danger { background: var(--danger-soft); color: #ff7875; }
.btn-danger:hover:not(:disabled) { background: rgba(245, 34, 45, 0.2); }
.btn-ghost { background: var(--surface-2); color: var(--text); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-hover); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }

/* ---------------------------------------------------------------- avatars */
.avatar {
  width: 40px; height: 40px; border-radius: 999px; flex: none;
  display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 15px;
  position: relative;
}
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; border: 2px solid var(--surface); }
.avatar-stack { display: flex; }
.avatar-stack .avatar + .avatar { margin-left: -8px; }
.verified { width: 16px; height: 16px; color: var(--primary); vertical-align: -3px; }
.name { font-weight: 700; }
.handle { color: var(--muted); }

/* ---------------------------------------------------------------- space cards */
.feed-empty { padding: 48px 32px; text-align: center; color: var(--muted); }
.feed-empty h3 { color: var(--text); font-size: 22px; margin: 0 0 8px; }
.space-card {
  margin: 12px 16px; padding: 16px; border-radius: var(--radius);
  background: linear-gradient(135deg, #2b3a8c 0%, #1f4fd1 45%, #1890ff 100%);
  cursor: pointer; position: relative; overflow: hidden;
  transition: box-shadow .12s, border-color .12s;
}
.space-card:hover { box-shadow: 0 8px 24px rgba(24, 144, 255, .18); }
.space-card.scheduled { background: var(--surface); border: 1px solid var(--border); }
.space-card .live-pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700;
  letter-spacing: .5px; text-transform: uppercase;
}
.live-dot { width: 8px; height: 8px; border-radius: 999px; background: #fff; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.space-card h3 { margin: 10px 0 12px; font-size: 20px; line-height: 1.25; }
.space-card .meta { display: flex; align-items: center; gap: 10px; font-size: 13px; color: rgba(255,255,255,.85); }
.space-card.scheduled .meta { color: var(--muted); }
.space-card .topics { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.space-card .topic { background: rgba(255,255,255,.16); padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.space-card.scheduled .topic { background: var(--primary-soft); color: var(--primary-hover); }
.space-card .here { margin-top: 10px; font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.space-card .footer { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }

/* ---------------------------------------------------------------- aside widgets */
.widget { background: var(--surface); border-radius: var(--radius); margin-bottom: 16px; overflow: hidden; }
.widget h4 { margin: 0; padding: 14px 16px; font-size: 19px; font-weight: 800; }
.widget-row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; }
.widget-row:hover { background: var(--surface-hover); }
.widget-row .grow { flex: 1; min-width: 0; }
.widget-row .sub { color: var(--muted); font-size: 13px; }
.widget .empty { padding: 4px 16px 16px; color: var(--muted); font-size: 14px; }
.search {
  display: flex; align-items: center; gap: 10px; background: var(--surface); border-radius: 999px;
  padding: 10px 16px; margin-bottom: 16px; color: var(--muted); border: 1px solid transparent;
}
.search:focus-within { border-color: var(--primary); }
.search input { background: none; border: 0; outline: 0; color: var(--text); flex: 1; font-size: 15px; font-family: inherit; }

/* ---------------------------------------------------------------- room */
.room { padding: 0 0 16px; }
.room-head { padding: 16px; border-bottom: 1px solid var(--border); }
.room-head .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.room-head h2 { margin: 8px 0 6px; font-size: 22px; line-height: 1.25; }
.room-head .live-pill { color: var(--primary-hover); font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.room-head .live-dot { background: var(--primary-hover); }
.room-head .sub { color: var(--muted); font-size: 14px; display: flex; gap: 12px; flex-wrap: wrap; }
.rec-badge { color: #ff7875; font-weight: 600; }

.section-title { padding: 16px 16px 4px; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; display: flex; justify-content: space-between; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 14px 8px; padding: 12px 16px; }
.person { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; cursor: pointer; position: relative; border-radius: 12px; padding: 6px 2px; }
.person:hover { background: var(--surface); }
.person .avatar { transition: box-shadow .15s; }
.person.speaking .avatar { box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--primary); }
.person .pname { font-size: 13px; font-weight: 600; max-width: 96px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person .role { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.person .role.host { color: var(--primary-hover); }
.person .mic-state {
  position: absolute; top: 44px; right: calc(50% - 34px);
  width: 22px; height: 22px; border-radius: 999px; background: var(--surface-2);
  display: grid; place-items: center; border: 2px solid var(--bg);
}
.person .mic-state svg { width: 12px; height: 12px; }
.person .mic-state.off { color: var(--danger); }
/* A raised hand (moderators see it): a badge on the avatar, the people with one come first */
.person .hand { position: absolute; top: -2px; right: calc(50% - 38px); width: 26px; height: 26px; border-radius: 999px;
  display: grid; place-items: center; font-size: 14px; background: var(--surface-2); border: 2px solid var(--warning); }
.menu .menu-hand { margin-left: auto; font-size: 18px; }

/* Sits in the middle column, so it lines up with the content by construction */
#dock-slot { position: sticky; bottom: 0; z-index: 20; }
.dock {
  background: rgba(35, 39, 50, 0.96); backdrop-filter: blur(12px);
  border-top: 1px solid var(--border); padding: 12px 16px;
  display: flex; align-items: center; gap: 10px; min-height: 76px;
}
.dock .grow { flex: 1; min-width: 0; }
.dock-title { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dock .round {
  width: 48px; height: 48px; border-radius: 999px; border: 0; cursor: pointer;
  display: grid; place-items: center; background: var(--surface-2); color: var(--text);
}
.dock .round { flex: none; }
.dock .round:hover { background: var(--surface-hover); }
.dock .round.on { background: var(--primary); color: #fff; }
.dock .round.muted { color: var(--danger); }
.dock .round svg { width: 22px; height: 22px; }
.dock .status { font-size: 13px; color: var(--muted); }

/* ---------------------------------------------------------------- chat */
.chat { display: flex; flex-direction: column; }
.chat[hidden] { display: none; }
/* Inline under the room (not a pop-up), collapsed until the viewer opens it */
.room-chat {
  margin: 0 16px 16px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface);
}
#aside-chat .room-chat { margin: 16px 16px 0; }
#aside-chat .chat-list { max-height: calc(100vh - 320px); min-height: 200px; }
.delay-chip { background: var(--primary-soft); color: var(--primary-hover); padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 20px; }
.room-actions { display: flex; gap: 6px; align-items: center; }
body.has-dock .mobile-fab { display: none !important; }
.chat-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 8px 8px 16px; }
.chat-head h4 { margin: 0; font-size: 17px; font-weight: 800; }
.chat-head-actions { display: flex; align-items: center; gap: 6px; }
.chat-list { display: flex; flex-direction: column; gap: 2px; max-height: min(420px, 50vh); min-height: 120px; overflow-y: auto; padding: 0 8px 8px; }
.dock .round { position: relative; }
.dock-badge {
  position: absolute; top: -2px; right: -2px; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 999px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700;
  display: grid; place-items: center; border: 2px solid var(--surface);
}
.chat-empty, .chat-dropped { color: var(--muted); font-size: 13px; padding: 12px 8px; text-align: center; }
.chat-dropped { padding: 4px 8px; font-style: italic; }
.chat-msg { display: flex; gap: 10px; padding: 6px 8px; border-radius: 10px; position: relative; }
.chat-msg:hover { background: var(--surface-hover); }
.chat-body { min-width: 0; flex: 1; }
.chat-meta { display: flex; align-items: baseline; gap: 6px; font-size: 13px; }
.chat-meta .name { font-size: 13px; }
.chat-time { color: var(--muted); font-size: 12px; margin-left: auto; }
.chat-text { font-size: 14px; color: var(--text-2); overflow-wrap: anywhere; white-space: pre-wrap; }
.chat-role { font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-hover); }
.chat-role.host { background: var(--primary); color: #fff; }
.chat-role.speaker { background: rgba(82, 196, 26, .15); color: #73d13d; }
.chat-actions { display: none; position: absolute; right: 6px; top: 4px; background: var(--surface-2); border-radius: 999px; }
.chat-msg:hover .chat-actions, .chat-msg:focus-within .chat-actions { display: flex; }
.chat-actions .icon-btn { width: 28px; height: 28px; font-size: 13px; }
.chat-form { display: flex; gap: 8px; padding: 8px 12px 4px; border-top: 1px solid var(--border); }
.chat-form .input { padding: 9px 12px; font-size: 14px; border-radius: 999px; }
.chat-form .input:disabled { opacity: .55; }
.chat-status { font-size: 12px; color: var(--muted); padding: 2px 16px 12px; min-height: 18px; }

/* ---------------------------------------------------------------- mod panel */
.panel-list .widget-row { align-items: center; }
.panel-list .actions { display: flex; gap: 6px; }
.count-pill { background: var(--primary); color: #fff; font-size: 12px; border-radius: 999px; padding: 1px 8px; margin-left: 6px; vertical-align: 2px; }

/* ---------------------------------------------------------------- menus, modals, toasts */
.menu {
  position: fixed; z-index: 60; background: var(--bg); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,.5); min-width: 220px; padding: 6px 0;
}
.menu button {
  display: flex; width: 100%; gap: 10px; align-items: center; background: none; border: 0;
  color: var(--text); padding: 11px 16px; font-size: 14px; font-weight: 600; cursor: pointer; text-align: left;
}
.menu button:hover { background: var(--surface); }
.menu button.danger { color: #ff7875; }
.menu .menu-head { padding: 10px 16px; border-bottom: 1px solid var(--border); margin-bottom: 4px; display: flex; gap: 10px; align-items: center; }
.account-menu { min-width: 240px; padding: 6px; border-radius: 16px; animation: menu-in .14s ease-out; }
.account-menu .menu-head { padding: 10px 12px 14px; margin-bottom: 6px; }
.account-menu .menu-head .handle { color: var(--muted); font-size: 13px; }
.account-menu button { gap: 12px; padding: 12px; border-radius: 10px; }
.account-menu button svg { width: 19px; height: 19px; flex: none; }
.account-menu button:focus-visible { outline: none; background: var(--surface); }
.account-menu button.danger:hover, .account-menu button.danger:focus-visible { background: var(--danger-soft); }
@keyframes menu-in { from { opacity: 0; transform: translateY(6px); } }

/* confirmations in the app's look (confirm-dialog.js) instead of the browser's box */
.cdlg {
  width: min(340px, calc(100% - 32px)); padding: 0; border: 1px solid var(--border); border-radius: 20px;
  background: var(--bg); color: var(--text); box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}
.cdlg[open] { animation: cdlg-in .18s cubic-bezier(.2, .9, .3, 1.2); }
.cdlg::backdrop { background: rgba(91, 112, 131, 0.4); }
.cdlg[open]::backdrop { animation: fade .18s ease-out; }
body.filmet-mode .cdlg::backdrop { background: rgba(8, 6, 5, 0.62); }
@keyframes cdlg-in { from { opacity: 0; transform: scale(.94); } }
.cdlg-body { display: grid; padding: 32px; }
.cdlg-mark { justify-self: center; width: 44px; height: 44px; margin-bottom: 18px; }
.cdlg-mark svg { width: 100%; height: 100%; }
.cdlg h2 { margin: 0 0 8px; font-size: 20px; font-weight: 800; line-height: 1.25; }
.cdlg p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.45; }
.cdlg-actions { display: grid; gap: 12px; margin-top: 24px; }
.cdlg-btn {
  height: 44px; border-radius: 999px; font: inherit; font-size: 15px; font-weight: 700; cursor: pointer;
  transition: background-color .15s, opacity .15s, transform .1s;
}
.cdlg-btn:active { transform: scale(.98); }
.cdlg-ok { border: 0; background: var(--text); color: var(--bg); }
.cdlg-ok:hover { opacity: .88; }
.cdlg-danger .cdlg-ok { background: var(--danger); color: #fff; }
.cdlg-cancel { border: 1px solid var(--border-strong); background: transparent; color: var(--text); }
.cdlg-cancel:hover { background: var(--surface-hover); }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(91, 112, 131, 0.4); z-index: 50;
  display: grid; place-items: start center; padding-top: 6vh;
}
.modal { width: min(600px, calc(100% - 32px)); background: var(--bg); border-radius: var(--radius); padding: 0 0 20px; max-height: 88vh; overflow-y: auto; }
.modal-head { display: flex; align-items: center; gap: 16px; padding: 12px 16px; font-weight: 700; font-size: 18px; }
.modal-body { padding: 4px 24px; display: flex; flex-direction: column; gap: 16px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.input, select.input, textarea.input {
  width: 100%; background: transparent; border: 1px solid var(--border-strong); border-radius: 8px;
  color: var(--text); padding: 12px; font-size: 16px; font-family: inherit; outline: none;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
select.input option { background: var(--surface); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.toggle input { width: 42px; height: 24px; accent-color: var(--primary); }
.hint { font-size: 13px; color: var(--muted); }
.char-count { text-align: right; font-size: 12px; color: var(--muted); margin-top: 4px; }

.toasts { position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%); z-index: 70; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--primary); color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 14px; font-weight: 500; box-shadow: 0 6px 24px rgba(0,0,0,.35); animation: fade .2s ease-out; }
.toast.error { background: #a8071a; }
.toast.action { background: var(--surface-2); border: 1px solid var(--border-strong); display: flex; align-items: center; gap: 12px; }
@keyframes fade { from { opacity: 0; } }

/* ---------------------------------------------------------------- login */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; }
@media (max-width: 900px) {
  .login { grid-template-columns: minmax(0, 1fr); align-content: center; }
  .login .brand svg { width: 120px; height: 120px; }
  .login h1 { font-size: 40px; }
}
.login .brand { display: grid; place-items: center; }
.login .brand svg { width: 280px; height: 280px; filter: drop-shadow(0 10px 60px rgba(59,130,246,.35)); }
.login .panel { padding: 32px; max-width: 520px; }
.login h1 { font-size: 56px; line-height: 1.05; margin: 0 0 32px; font-weight: 800; letter-spacing: -1px; }
.login h2 { font-size: 26px; margin: 0 0 16px; }
.auth-form { display: grid; gap: 14px; max-width: 380px; }
.auth-form h2 { margin: 0 0 2px; }
.auth-field { display: grid; gap: 6px; }
.auth-field span { font-size: 13px; font-weight: 600; color: var(--text-2); }
.auth-error { margin: 0; color: #ff7875; font-size: 14px; }
.auth-submit { margin-top: 4px; padding: 13px 18px; font-size: 15px; }
.auth-switch { margin: 20px 0 0; color: var(--muted); font-size: 14px; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--primary-hover); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

.spinner { width: 28px; height: 28px; border: 3px solid var(--border-strong); border-top-color: var(--primary); border-radius: 999px; animation: spin 0.8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 88px minmax(0, 600px); }
  .aside { display: none; }
  .nav-item span, .sidebar .btn-primary span, .me-card .names { display: none; }
  .sidebar .btn-primary { width: 52px; height: 52px; padding: 0; }
}
@media (max-width: 640px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding: 0; }
  .sidebar { display: none; }
  .main { border: 0; }
  .login { grid-template-columns: 1fr; }
  .login .brand svg { width: 120px; height: 120px; }
  .login h1 { font-size: 36px; }
  .mobile-fab { display: grid !important; }
  .icon-btn { width: 44px; height: 44px; }
  .dock { padding: 10px 12px; gap: 8px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); padding: 12px; }
  .col { border: 0; }
}
.mobile-fab {
  display: none; position: fixed; right: 16px; bottom: 16px; width: 56px; height: 56px; border-radius: 999px;
  background: var(--primary); color: #fff; border: 0; place-items: center; z-index: 30; box-shadow: 0 6px 20px rgba(24,144,255,.4);
}
.mobile-fab svg { width: 24px; height: 24px; }

/* ---------------------------------------------------------------- room activity: Vampir Köylü
   Stream mode: while a game is on screen the middle column widens and the sidebar shrinks to
   icons; the scene is a 16:9 stage with its HUD, announcements and chat drawn on top of it. */
@media (min-width: 1101px) {
  body.game-mode .layout { grid-template-columns: 88px minmax(0, 1280px) 360px; }
  body.game-mode .nav-item span, body.game-mode .sidebar .btn-primary span, body.game-mode .me-card .names { display: none; }
  body.game-mode .sidebar .btn-primary { width: 52px; height: 52px; padding: 0; }
}
.room-top { padding-bottom: 0; }
.game-pill { background: rgba(176, 29, 57, .18); color: #ff8a9e; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 20px; }
#game-root { padding: 12px 16px 0; }
#game-root[hidden] { display: none; }
.game { display: grid; gap: 8px; container: game / inline-size;  /* layouts follow the scene's width (see the end) */
  /* no taller than the screen: the 24:17 scene narrows instead */
  width: 100%; max-width: calc((100vh - 200px) * 24 / 17); max-width: calc((100svh - 200px) * 24 / 17); margin-inline: auto; }
.g-stage { position: relative; aspect-ratio: 24 / 17; border-radius: var(--radius); overflow: hidden; background: #4d7741; box-shadow: 0 18px 40px -24px rgba(0, 0, 0, .8); }
.g-layers, .g-layer, .g-fx { position: absolute; inset: 0; }
.g-layer svg, .g-fx { display: block; width: 100%; height: 100%; }
.g-layer.fade-in { animation: g-fade 1.2s ease both; }
@keyframes g-fade { from { opacity: 0; } }
.g-fx { pointer-events: none; }
.g-stage svg text { font-family: var(--font); font-weight: 700; }
.g-stage .pick { cursor: pointer; }
.g-stage .pick:hover .hit, .g-stage .pick:focus-visible .hit { stroke: #fff; stroke-opacity: .9; }
.g-stage .pick:focus { outline: none; }
.g-stage .pulse { transform-box: fill-box; transform-origin: center; animation: g-pulse 1.4s ease-out infinite; }
@keyframes g-pulse { from { transform: scale(.75); opacity: .95; } to { transform: scale(1.35); opacity: 0; } }

/* HUD: phase + clock on the left, your role on the right */
.g-hud { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; pointer-events: none; }
.g-role { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.g-phase { background: rgba(14, 17, 30, .72); backdrop-filter: blur(6px); color: #fff; font-weight: 800; font-size: 15px; padding: 5px 12px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.g-chip { display: inline-block; font-size: 13px; font-weight: 800; padding: 5px 12px; border-radius: 999px; color: #fff; }
.g-chip.dark { background: rgba(14, 17, 30, .72); backdrop-filter: blur(6px); color: #e8e8f0; }

/* Announcements: big, in the middle, gone after a moment */
.g-banner { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); pointer-events: none; opacity: 0;
  font-size: clamp(20px, 3.4vw, 34px); font-weight: 800; color: #fff; padding: 10px 26px; border-radius: 16px; white-space: nowrap;
  background: rgba(14, 17, 30, .78); text-shadow: 0 2px 10px rgba(0, 0, 0, .5); }
.g-banner.night { background: rgba(29, 35, 80, .86); }
.g-banner.bad { background: rgba(140, 18, 40, .88); }
.g-banner.calm { background: rgba(12, 90, 80, .86); }
.g-banner.play { animation: g-banner 2.8s ease both; }
@keyframes g-banner {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.85); }
  12%, 78% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(1); }
}

/* Role card: shown once when the roles are dealt, then it flies into the role chip */
.g-reveal { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 5; width: min(80%, 400px);
  display: grid; justify-items: center; gap: 4px; padding: 18px 24px 20px; border-radius: 22px; overflow: hidden; cursor: pointer;
  color: #fff; text-align: center; background: radial-gradient(circle at 50% 18%, var(--role-light), var(--role) 72%);
  box-shadow: 0 26px 60px -14px rgba(0, 0, 0, .75), inset 0 0 0 2px rgba(255, 255, 255, .28); }
.g-reveal[hidden] { display: none; }
.g-reveal.role-V { --role: #8f1730; --role-light: #e2566f; }
.g-reveal.role-D { --role: #0a6458; --role-light: #35c6ae; }
.g-reveal.role-K { --role: #6e5419; --role-light: #d4ab53; }
.g-reveal .rays { position: absolute; inset: -60%; z-index: -1; animation: g-rays 14s linear infinite;
  background: repeating-conic-gradient(rgba(255, 255, 255, .13) 0 9deg, transparent 9deg 18deg); }
@keyframes g-rays { to { transform: rotate(360deg); } }
.g-reveal .eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; opacity: .85; }
.g-reveal svg { width: clamp(64px, 11vw, 104px); height: auto; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .35)); }
.g-reveal .name { font-size: clamp(28px, 5vw, 46px); font-weight: 800; line-height: 1.05; letter-spacing: -.01em; text-shadow: 0 2px 12px rgba(0, 0, 0, .35); }
.g-reveal .goal { margin: 2px 0 0; font-size: 14px; line-height: 1.4; max-width: 32ch; opacity: .95; }
.g-reveal .mates { margin-top: 6px; font-size: 13px; font-weight: 700; background: rgba(0, 0, 0, .28); padding: 3px 12px; border-radius: 999px; }

/* Game chat inside the scene: a short feed bottom-left (bubbles are drawn over the speakers) */
.g-chatbox { position: absolute; left: 12px; bottom: 12px; width: min(38%, 340px); display: grid; gap: 4px; }
.g-feed { margin: 0; padding: 0; list-style: none; display: grid; gap: 3px; pointer-events: none; }
.g-feed li { background: rgba(14, 17, 30, .6); color: #e8e8f0; font-size: 12px; line-height: 1.35; padding: 3px 9px; border-radius: 9px;
  overflow-wrap: anywhere; animation: g-feed-in .25s ease both; transition: opacity 1.2s ease;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }  /* at most two lines each */
.g-feed li.gone { opacity: 0; }
.g-feed li .tag { margin-left: 6px; font-size: 11px; color: #ff8a9e; }
@keyframes g-feed-in { from { opacity: 0; transform: translateY(6px); } }
/* The players' input sits right under the feed and looks like part of it */
.g-say { display: flex; align-items: center; gap: 4px; padding: 2px 2px 2px 10px; border-radius: 10px;
  background: rgba(14, 17, 30, .66); backdrop-filter: blur(6px); border: 1px solid rgba(255, 255, 255, .1); transition: border-color .15s, background-color .15s; }
.g-say[hidden] { display: none; }
.g-say:focus-within { background: rgba(14, 17, 30, .82); border-color: rgba(255, 255, 255, .35); }
.g-say.whisper { border-color: rgba(255, 90, 115, .55); }
.g-say-input { flex: 1; min-width: 0; padding: 7px 0; border: 0; outline: 0; background: none; color: #fff; font: 13px var(--font); }
.g-say-input::placeholder { color: rgba(232, 232, 240, .6); }
.g-say-input:disabled { cursor: default; }
.g-say-send { flex: none; width: 30px; height: 30px; border: 0; border-radius: 8px; display: grid; place-items: center; cursor: pointer;
  background: var(--primary); color: #fff; }
.g-say.whisper .g-say-send { background: #b01d39; }
.g-say-send:hover { filter: brightness(1.1); }
.g-say-send:disabled { opacity: .35; cursor: default; filter: none; }
.g-say-send svg { width: 15px; height: 15px; }
.g-say:has(.g-say-input:disabled) { opacity: .7; }

/* End card */
.g-end { padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.g-end[hidden] { display: none; }
.g-end h3 { margin: 0 0 6px; font-size: 22px; font-weight: 800; }
.g-end h3.villagers { color: #45c9b5; }
.g-end h3.vampires { color: #ff8a9e; }
.g-end p { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.g-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; font-size: 13px; }
.g-log li { display: grid; grid-template-columns: 4rem 1fr; gap: 8px; }
.g-log li span:first-child { color: var(--muted); font-size: 12px; font-weight: 600; padding-top: 1px; }

/* One line of guidance under the scene */
.g-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 34px; }
.g-hint { margin: 0; color: var(--text-2); font-size: 14px; }
.g-hint .kill { color: #ff8a9e; }
.g-buttons { display: flex; gap: 8px; flex: none; }
.chat-role.dead { background: var(--surface-2); color: var(--muted); }
.dock .round.held { opacity: .55; }

/* The scene's width (not the window's) decides: the room column changes with the sidebar and the chat */
@container game (max-width: 839px) {
  /* Too small to hold the chat without covering houses: the feed and the input go under the scene */
  .g-stage { overflow: visible; aspect-ratio: auto; display: grid; gap: 6px; background: none; box-shadow: none; }
  .g-layers { position: relative; inset: auto; aspect-ratio: 24 / 17; border-radius: var(--radius); overflow: hidden; }
  .g-fx { bottom: auto; height: auto; aspect-ratio: 24 / 17; }
  .g-chatbox { position: static; width: auto; }
  .g-feed:empty { display: none; }
  .g-feed li, .g-say { background: var(--surface); }
  /* centred on the scene (24:17, as wide as the container), not on the scene and the chat */
  .g-banner { top: 29.75cqw; }
  .g-reveal { top: 35.4cqw; }
}
@container game (max-width: 600px) {
  .g-hud { top: 6px; left: 6px; right: 6px; }
  .g-phase, .g-chip { font-size: 12px; padding: 3px 9px; }
  .g-reveal { width: 88%; padding: 12px 14px 14px; gap: 2px; }
  .g-reveal .goal { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .g-stage .pulse { animation: none; opacity: .75; }
}
