/* tavern — one dark theme, made for a second monitor next to a game. */
:root {
  --bg: #16161b;
  --side: #1c1c23;
  --panel: #23232c;
  --line: #2e2e39;
  --text: #e8e8ee;
  --muted: #9a9aa8;
  --accent: #6366f1;
  --accent2: #8b5cf6;
  --ok: #22c55e;
  --danger: #ef4444;
  --radius: 8px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}
a { color: #a5b4fc; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }

/* ---------- buttons and inputs ---------- */
.btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: var(--radius);
  padding: 7px 12px;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn:hover { border-color: #444457; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); border-color: transparent; color: #fff; }
.btn.danger { background: #3a1d22; border-color: #5c2a31; color: #fecaca; }
.btn.on { background: #4c1d24; border-color: var(--danger); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .6; cursor: default; }
.link { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }
input, textarea, select {
  background: #101015;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  font: inherit;
}
input:focus, textarea:focus, select:focus { outline: 2px solid #4f46e5aa; outline-offset: 0; }
.row { display: flex; gap: 8px; align-items: center; }

/* ---------- join pages ---------- */
.door { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.door-card { width: min(420px, 100%); background: var(--side); border: 1px solid var(--line); border-radius: 14px; padding: 28px; text-align: center; }
.door-icon { width: 64px; height: 64px; }
.door h1 { margin: 10px 0 6px; font-size: 22px; }
.stack { display: grid; gap: 14px; margin-top: 18px; text-align: left; }
.stack label { display: grid; gap: 6px; font-size: 14px; }
.signout { margin-top: 18px; }

/* ---------- admin ---------- */
.admin { max-width: 720px; margin: 0 auto; padding: 20px 16px 60px; }
.request { display: flex; justify-content: space-between; gap: 12px; align-items: center; background: var(--side); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 10px 0; flex-wrap: wrap; }
.request .note { margin: 4px 0 0; color: var(--muted); }
.members { list-style: none; padding: 0; }
.members li { display: flex; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tag { font-size: 12px; background: #312e81; color: #c7d2fe; border-radius: 99px; padding: 1px 8px; }
.remove { margin-left: auto; }
.remove summary { cursor: pointer; color: var(--muted); list-style: none; padding: 0 6px; }

/* ---------- room layout ---------- */
.app {
  height: 100dvh;
  display: grid;
  grid-template-columns: 250px 1fr;
  grid-template-rows: auto 1fr;
  grid-template-areas: "top top" "side chat";
}
.top {
  grid-area: top;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  padding-top: max(8px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  background: var(--side);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .02em; }
.brand img { width: 22px; height: 22px; }
.grow { flex: 1; }
.admin-link { color: var(--muted); text-decoration: none; font-size: 14px; padding: 4px 10px; border-radius: 99px; border: 1px solid var(--line); }
.admin-link.has { color: #fff; background: var(--accent); border-color: transparent; }
.me { position: relative; }
.me summary { cursor: pointer; list-style: none; padding: 4px 10px; border-radius: 99px; border: 1px solid var(--line); font-size: 14px; }
.me-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 10; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: grid; gap: 10px; width: 260px; }

.side {
  grid-area: side;
  background: var(--side);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.roster { flex: 1; overflow-y: auto; padding: 10px 10px 0; }
.roster h4 { margin: 8px 4px 6px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.person { display: grid; grid-template-columns: 28px 1fr auto auto; align-items: center; gap: 4px 8px; padding: 5px 6px; border-radius: 6px; }
.person:hover { background: #ffffff08; }
.person.away { opacity: .5; }
.person .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person .flags { font-size: 12px; white-space: nowrap; }
.person .vol { grid-column: 2 / 4; width: 100%; height: 14px; padding: 0; accent-color: var(--accent); display: none; }
.person .ibtn.small { grid-column: 4; grid-row: 1; opacity: 0; }
.person:hover .ibtn.small, .person.open .ibtn.small, .person .ibtn.small.on { opacity: 1; }
.person:hover .vol, .person .vol:focus { display: block; }
.av { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: #34344a; box-shadow: 0 0 0 2px transparent; transition: box-shadow .1s; }
.av.dim { background: #2a2a36; color: var(--muted); }
.av.speaking { box-shadow: 0 0 0 2px var(--ok); }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; vertical-align: middle; background: var(--muted); }
.dot.ok { background: var(--ok); }
.dot.relay { background: #38bdf8; }
.dot.connecting, .dot.none { background: #facc15; }
.dot.bad { background: var(--danger); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .3; } }
.vc { position: relative; padding: 8px; border-top: 1px solid var(--line); display: grid; gap: 8px; padding-bottom: max(8px, env(safe-area-inset-bottom)); background: #18181e; }

/* icon buttons: grey, red with a slash when switched off (Discord's look) */
.ibtn { display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 6px; background: none; color: #b5b5c3; cursor: pointer; padding: 0; }
.ibtn:hover { background: #ffffff12; color: var(--text); }
.ibtn.on { color: var(--danger); }
.ibtn.open { background: #ffffff18; color: var(--text); }
.ibtn.danger { color: var(--text); }
.ibtn.danger:hover { background: #ef444433; color: #fecaca; }
.ibtn.small { width: 24px; height: 24px; }
.ibtn.small svg { width: 16px; height: 16px; }

/* "Voice connected" bar */
.vbar { display: flex; align-items: center; gap: 8px; padding: 2px 2px 8px 4px; border-bottom: 1px solid var(--line); }
.vbar-text { flex: 1; min-width: 0; display: grid; }
.vbar-title { color: var(--ok); font-size: 13px; }
.vbar.warn .vbar-title { color: #facc15; }
.vbar.bad .vbar-title { color: var(--danger); }
.vbar-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* the user panel: avatar, name, status, mute / deafen / settings */
.upanel { display: flex; align-items: center; gap: 4px; }
.upanel .av { flex: none; }
.upanel-text { flex: 1; min-width: 0; display: grid; margin-left: 4px; line-height: 1.2; }
.upanel-text b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upanel-text span { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* audio settings: a popover above the panel */
.vc-settings { position: absolute; left: 8px; right: 8px; bottom: calc(100% + 6px); z-index: 20; font-size: 13px; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; box-shadow: 0 10px 30px #0008; }
.vc-settings-head { color: var(--text); font-weight: 650; font-size: 14px; }
.vc-settings .keys { font-size: 11px; margin: 10px 0 0; }
.vc-settings label { display: grid; gap: 4px; margin-top: 10px; }
.vc-settings select { width: 100%; font-size: 13px; padding: 5px; }
.vc-settings input[type=range] { width: 100%; padding: 0; accent-color: var(--accent); }
.vc-settings .check { display: flex; align-items: center; gap: 6px; }
.vc-settings .btn { margin-top: 8px; width: 100%; font-size: 13px; padding: 5px; }
.row-between { display: flex; justify-content: space-between; }
.level { height: 6px; margin-top: 8px; border-radius: 3px; background: #101015; overflow: hidden; }
.level div { height: 100%; width: 0; background: linear-gradient(90deg, var(--ok) 70%, #facc15 85%, var(--danger)); transition: width .08s linear; }
.person .pct { grid-column: 4; font-size: 11px; color: var(--muted); display: none; }
.person:hover .pct, .person.open .pct { display: block; }
.move-ask { background: var(--panel); border: 1px solid var(--accent); border-radius: var(--radius); padding: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.move-ask p { margin: 0 0 4px; width: 100%; font-size: 14px; }

/* ---------- chat ---------- */
.chat { grid-area: chat; display: flex; flex-direction: column; min-height: 0; position: relative; }
.chat.drop::after { content: "Drop the image to attach it"; position: absolute; inset: 8px; border: 2px dashed var(--accent); border-radius: 12px; display: grid; place-items: center; background: #16161bcc; font-size: 18px; pointer-events: none; }
.log { flex: 1; overflow-y: auto; padding: 12px 16px 8px; overscroll-behavior: contain; }
.older { text-align: center; color: var(--muted); font-size: 13px; padding: 8px; }
.msg { padding: 6px 8px; border-radius: 6px; }
.msg:hover { background: #ffffff06; }
.msg header { display: flex; align-items: baseline; gap: 8px; }
.msg .who { font-weight: 650; }
.msg time { color: #6f6f7d; font-size: 12px; }
.msg .del { margin-left: auto; background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; opacity: 0; padding: 0 4px; }
.msg:hover .del, .msg .del:focus { opacity: 1; }
@media (pointer: coarse) { .msg .del { opacity: .5; } }
.body { overflow-wrap: anywhere; }
.body p { margin: 2px 0; }
.body pre { background: #0f0f14; border: 1px solid var(--line); border-radius: 6px; padding: 8px; overflow-x: auto; }
.body code { background: #0f0f14; border-radius: 4px; padding: 1px 4px; font-size: 13px; }
.body pre code { background: none; padding: 0; }
.body blockquote { margin: 4px 0; padding-left: 10px; border-left: 3px solid var(--line); color: var(--muted); }
.body ul, .body ol { margin: 2px 0; padding-left: 22px; }
.img { display: inline-block; margin-top: 6px; }
.img img { display: block; max-width: min(100%, 420px); max-height: 320px; width: auto; height: auto; border-radius: 6px; background: #0f0f14; }
.img-expired { margin-top: 6px; display: inline-block; color: var(--muted); font-size: 13px; background: var(--panel); border: 1px dashed var(--line); border-radius: 6px; padding: 8px 12px; }
.card { display: grid; gap: 2px; margin-top: 6px; max-width: 460px; padding: 8px 12px; border-left: 3px solid var(--accent); background: var(--panel); border-radius: 4px; text-decoration: none; color: var(--text); }
.card .site { font-size: 12px; color: var(--muted); }
.card strong { color: #c7d2fe; }
.card .desc { font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.banner { margin: 0 16px 6px; padding: 8px 12px; border-radius: var(--radius); background: #312e81; color: #e0e7ff; font-size: 14px; }
.composer { padding: 8px 16px 12px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
.composer.sending { opacity: .6; }
.composer-row { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { flex: 1; resize: none; min-height: 40px; max-height: 180px; }
.clip { cursor: pointer; font-size: 20px; padding: 6px 4px; user-select: none; }
.send { height: 40px; }
.attach { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 8px; width: fit-content; }
.attach img { height: 56px; max-width: 120px; object-fit: cover; border-radius: 4px; }
.attach .x { background: none; border: 0; color: var(--muted); font-size: 20px; cursor: pointer; }

.lightbox { position: fixed; inset: 0; background: #000d; display: grid; place-items: center; z-index: 50; cursor: zoom-out; }
.lightbox img { max-width: 96vw; max-height: 94vh; }

/* ---------- phone ---------- */
@media (max-width: 720px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; grid-template-areas: "top" "side" "chat"; }
  .side { border-right: 0; border-bottom: 1px solid var(--line); max-height: 38dvh; }
  .vc { padding-bottom: 10px; }
  .log { padding: 8px 10px; }
  .composer { padding: 6px 10px 10px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  /* On a phone the sliders open with a tap on the person, not on hover. */
  .person.open .vol { display: block; }
}
