:root {
  --accent: #2563eb;
  --accent-dark: #1e40af;
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #1a2333;
  --muted: #6b7686;
  --border: #e2e8f0;
  --danger: #dc2626;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.site-header {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 1rem 1.5rem;
  background: #0f1b33;
  color: #fff;
}

.brand {
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  letter-spacing: 0.02em;
}

.brand-dot { color: var(--accent); }
.brand-sub { color: #93a4c4; font-size: 0.9rem; }

.container {
  flex: 1;
  width: 100%;
  max-width: 860px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.75rem;
  box-shadow: 0 1px 3px rgba(15, 27, 51, 0.06);
}

.card.narrow { max-width: 440px; margin: 3rem auto; }

h1 { font-size: 1.4rem; margin: 0 0 0.75rem; }
h2 { font-size: 1.05rem; margin: 1.75rem 0 0.6rem; color: #33415c; }

.muted { color: var(--muted); }
.alert { color: var(--danger); font-weight: 600; }
.ok { color: #15803d; font-weight: 600; }

input[type="text"],
input[type="password"],
textarea,
input[type="file"] {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}

textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9rem; }

.code-input {
  text-transform: uppercase;
  letter-spacing: 0.35em;
  font-size: 1.5rem;
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.btn {
  display: inline-block;
  padding: 0.6rem 1.1rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover { background: var(--accent-dark); }
.btn.small { padding: 0.3rem 0.7rem; font-size: 0.85rem; }
.btn.ghost { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn.ghost:hover { background: rgba(37, 99, 235, 0.08); }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #b91c1c; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.code-form { display: flex; gap: 0.6rem; margin-top: 1rem; }
.code-form .code-input { flex: 1; }

.stack { display: flex; flex-direction: column; gap: 0.75rem; }
.inline-form { display: flex; gap: 0.6rem; align-items: center; margin: 1rem 0; flex-wrap: wrap; }
.inline-form input { flex: 1; min-width: 220px; }
.inline { display: inline; }

.session-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }

.code-badge {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: #eef2ff;
  color: var(--accent-dark);
  border: 1px solid #c7d2fe;
  border-radius: 6px;
  padding: 0.15rem 0.5rem;
  letter-spacing: 0.2em;
  font-weight: 700;
}
.code-badge.big { font-size: 1.3rem; padding: 0.35rem 0.8rem; }

.notes {
  background: #0f1b33;
  color: #dbe4ff;
  border-radius: 8px;
  padding: 1rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
}

.file-list { list-style: none; padding: 0; margin: 0.5rem 0 0; }
.file-list li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.file-list li:last-child { border-bottom: none; }
.file-name { flex: 1; min-width: 180px; word-break: break-all; }
.file-size { color: var(--muted); font-size: 0.85rem; }

.table { width: 100%; border-collapse: collapse; margin-top: 0.75rem; }
.table th, .table td { text-align: left; padding: 0.55rem 0.4rem; border-bottom: 1px solid var(--border); }
.table th { color: var(--muted); font-size: 0.85rem; }

.share-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.share-box h2 { margin-top: 0; }
.qr { width: 140px; height: 140px; }

.danger-zone { color: var(--danger); }

.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 1.25rem;
}

/* Two-column session layout: posts feed + files side panel */
.session-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1.75rem;
  align-items: start;
  margin-top: 1rem;
}

@media (max-width: 720px) {
  .session-grid { grid-template-columns: 1fr; }
}

.feed-col h2:first-child,
.files-col h2:first-child { margin-top: 0; }

.post {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.9rem;
  background: #fbfcfe;
}

.post-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.post-time {
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}

.post-head .post-time { margin-bottom: 0; }
.post .notes { margin: 0.5rem 0 0; }
.post-head + .notes { margin-top: 0.75rem; }

/* Document viewer */
.doc-view { margin-top: 1rem; }

.markdown-body {
  line-height: 1.6;
  font-size: 0.98rem;
}

.markdown-body h1, .markdown-body h2, .markdown-body h3 { color: #33415c; }
.markdown-body pre {
  background: #0f1b33;
  color: #dbe4ff;
  border-radius: 8px;
  padding: 1rem;
  overflow-x: auto;
}
.markdown-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
}
.markdown-body p code, .markdown-body li code {
  background: #eef2ff;
  border-radius: 4px;
  padding: 0.1em 0.35em;
}
.markdown-body pre code { background: none; padding: 0; }
.markdown-body table { border-collapse: collapse; }
.markdown-body th, .markdown-body td { border: 1px solid var(--border); padding: 0.35rem 0.6rem; }
.markdown-body img { max-width: 100%; }
.markdown-body a { color: var(--accent); }

/* Admin tabs */
.tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.tab {
  padding: 0.45rem 1rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  border: 1px solid var(--border);
  background: #fff;
}
.tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Live indicator */
.live-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #16a34a;
  margin-right: 0.45rem;
  animation: pulse 1.6s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
.row-live td { background: #f0fdf4; }

/* Screen sharing */
.share-screen-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.85rem 1rem;
  margin-top: 1rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.share-preview {
  width: 260px;
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #000;
}

.container.wide { max-width: 1100px; }

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.video-tile {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #000;
}
.video-tile video { width: 100%; display: block; aspect-ratio: 16 / 9; background: #000; }
.video-label {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  color: var(--muted);
  background: #fff;
}

/* Name prompt modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 27, 51, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 1rem;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: #fff;
  border-radius: 12px;
  padding: 1.75rem;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 10px 40px rgba(15, 27, 51, 0.3);
}
.modal h2 { margin-top: 0; }

.who-label a { color: var(--accent); }
