:root {
  color-scheme: dark;
  --bg: #1a1410;
  --bg2: #241c16;
  --bg3: #2e241c;
  --border: #4a3828;
  --text: #e8dcc8;
  --muted: #a09078;
  --accent: #c45c26;
  --accent2: #e8a54b;
  --danger: #c0392b;
  --ok: #3d9a5f;
  --on-accent2: #1a1410;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
#login[hidden], #lobby[hidden], #watch[hidden], #menu[hidden], #roster[hidden], #log[hidden], #say[hidden] { display: none !important; }
body { font: 14px/1.4 "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent2); }
button, input { font: inherit; color: inherit; }
button {
  background: #3a2a1e;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
}
button.primary { background: var(--accent2); color: var(--on-accent2); border-color: var(--accent2); font-weight: 700; }
a.home-back {
  display: block;
  text-align: center;
  text-decoration: none;
  color: inherit;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
}
a.home-back:hover { background: var(--bg3); }
input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}
.hint { color: var(--muted); }
.hint.sm { font-size: 12px; }
.error { color: #ffb4a8; min-height: 1.2em; }
.auth { height: 100%; min-height: 0; display: grid; place-items: center; padding: 24px; }
.auth-card {
  width: min(420px, 100%);
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.auth-card h1 { margin: 0; color: var(--accent2); font-size: 22px; }
.auth-card label { display: flex; flex-direction: column; gap: 4px; }

.app-shell {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: 264px minmax(240px, 1fr) 260px;
  overflow: hidden;
}
#lobby[hidden] { display: none !important; }
.sidebar, .rightbar {
  background: var(--bg2);
  min-height: 0;
  overflow: auto;
  padding: 12px;
}
.sidebar { border-right: 1px solid var(--border); }
.rightbar { border-left: 1px solid var(--border); }
.sidebar-player {
  font-weight: 700;
  color: var(--accent2);
  font-size: 14px;
  padding: 4px 2px 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
  word-break: break-word;
}
.section-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 12px 0 6px;
}
.list-item { padding: 8px; border-radius: 8px; margin-bottom: 4px; }
.lobby-item { border: 1px solid transparent; font-weight: 600; cursor: pointer; }
.lobby-item.active {
  background: var(--bg3);
  border-color: var(--accent2);
  box-shadow: inset 0 0 0 1px var(--accent2);
  color: var(--accent2);
}
.room-card { background: transparent; cursor: pointer; }
.room-card.active { background: var(--bg3); box-shadow: inset 0 0 0 1px var(--accent2); }
.room-card-name { font-weight: 650; }
.room-note { margin: 8px 2px 0; }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; }
.topbar, .composer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
}
.composer { border-bottom: 0; border-top: 1px solid var(--border); position: relative; flex-direction: column; align-items: stretch; }
.composer-row { display: flex; align-items: center; gap: 8px; }
.composer-row input#body { flex: 1; }
.spacer { flex: 1; }
.chat { flex: 1; min-height: 0; overflow: auto; padding: 12px 16px; }
.line { margin: 0 0 8px; }
.name { font-weight: 700; color: var(--accent2); }
.msg-link { color: var(--accent2); text-decoration: underline; cursor: pointer; word-break: break-all; }
.msg-link:hover { color: var(--accent); }

.person {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
}
.person:hover { background: var(--bg3); }
.online-dot {
  width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; line-height: 1;
  background: var(--bg3); border: 2px solid var(--ok);
  flex-shrink: 0;
}
.online-dot.away { border-color: #f0c040; }
.online-dot.busy { border-color: #ff6b6b; }
.online-dot.sleep { border-color: #8b7ec8; }
.online-dot.offline { border-color: var(--muted); color: var(--muted); }
.online-main { min-width: 0; flex: 1; }
.online-name { font-weight: 650; word-break: break-word; }
.badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.badge {
  display: inline-block;
  font-size: 10px;
  line-height: 1.2;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-weight: 800;
}
.badge.live { color: #fff; background: #c0392b; border-color: #8e2218; cursor: pointer; }
a.badge.live, a.watch-btn { text-decoration: none; display: inline-block; }
.badge.on-web { color: #1a1208; background: #f0c14b; border-color: #c4962a; }
.badge.in-game { color: var(--on-accent2); background: var(--accent2); border-color: var(--accent2); }
.badge.in-room { color: var(--accent2); background: transparent; }
.watch-btn {
  margin-top: 4px;
  background: #c0392b;
  color: #fff;
  border: 1px solid #8e2218;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 8px;
}

.mobile-nav { display: none; }
#menu {
  position: fixed;
  z-index: 6;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 160px;
  padding: 4px;
}
#menu button, #menu a { display: block; width: 100%; text-align: left; background: transparent; color: inherit; text-decoration: none; border-radius: 8px; padding: 6px 12px; }
#menu button:hover, #menu a:hover { background: var(--bg3); }
#watch { position: fixed; inset: 0; background: #000; z-index: 8; }
#watch video { width: 100%; height: 100%; object-fit: contain; background: #000; }
#watch-fs {
  position: absolute;
  top: 12px;
  right: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
#watch.show-ui #watch-fs { opacity: 1; pointer-events: auto; }

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
  }
  .sidebar, .rightbar, .main { display: none; }
  .app-shell.show-rooms .sidebar,
  .app-shell.show-chat .main,
  .app-shell.show-online .rightbar { display: flex; }
  .sidebar, .rightbar { flex-direction: column; border: 0; }
  .mobile-nav {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
    padding: 8px;
    background: var(--bg2);
    border-top: 1px solid var(--border);
  }
  .mobile-nav button.on { border-color: var(--accent2); color: var(--accent2); }
}

/* ---- 1.2.11: media in chat, composer icons, GIF picker (same look as the Lotus Net app) ---- */
.composer.drop-over { outline: 1px dashed var(--accent); }
[hidden] { display: none !important; }
.composer-icon-btn {
  flex: 0 0 auto;
  width: 36px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: #3a2a1e;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}
.composer-icon-btn:hover:not(:disabled), .composer-icon-btn.on { border-color: var(--accent2); }
.composer-icon-btn:disabled { opacity: 0.5; cursor: default; }
.composer-files { display: flex; flex-wrap: wrap; gap: 8px; }
.composer-file {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 180px;
  min-height: 36px;
  padding: 4px 22px 4px 4px;
  border-radius: 6px;
  background: var(--bg);
  overflow: hidden;
}
.composer-file img { width: 48px; height: 36px; object-fit: cover; border-radius: 4px; }
.composer-file-name { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer-file-error { font-size: 11px; color: #ffb4a8; }
.composer-progress { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); }
.composer-file-remove { position: absolute; top: 2px; right: 2px; border: 0; background: transparent; padding: 0 4px; line-height: 1; }
.chat-system { text-align: center; color: var(--muted); font-size: 12px; font-style: italic; margin: 10px 0 4px; }
.chat-photo, .chat-video { display: block; max-width: min(320px, 100%); max-height: 240px; margin-top: 4px; border-radius: 6px; }
.chat-photo-link { display: block; margin: 0; padding: 0; border: 0; background: transparent; cursor: zoom-in; }
.chat-photo-view {
  position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center;
  padding: 28px; background: rgba(0, 0, 0, 0.88); cursor: zoom-out;
}
.chat-photo-view img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: default; }
.chat-audio { display: block; width: min(320px, 100%); margin-top: 4px; }
.chat-youtube { display: block; width: 320px; max-width: 100%; aspect-ratio: 16 / 9; height: auto; border: 0; margin-top: 4px; border-radius: 6px; background: #000; }
.chat-youtube-thumb {
  position: relative; display: block; width: 320px; max-width: 100%; aspect-ratio: 16 / 9;
  margin-top: 4px; padding: 0; border: 0; border-radius: 6px; overflow: hidden; background: #111; cursor: pointer;
}
.chat-youtube-thumb img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; }
.chat-youtube-play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 56px; height: 40px; border-radius: 10px; background: rgba(200, 0, 0, 0.85); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.chat-youtube-thumb:hover .chat-youtube-play { background: rgba(230, 0, 0, 0.95); }
.giphy-backdrop { position: fixed; inset: 0; z-index: 9; }
.giphy-panel {
  position: absolute; left: 14px; bottom: calc(100% + 6px); z-index: 10;
  width: min(440px, calc(100vw - 28px)); height: min(420px, 62vh);
  display: flex; flex-direction: column;
  background: var(--bg2); color: var(--text); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); overflow: hidden;
}
.giphy-head { display: flex; gap: 6px; padding: 8px; border-bottom: 1px solid var(--border); }
.giphy-head input { flex: 1; min-width: 0; }
.giphy-close { width: 32px; padding: 0; }
.giphy-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; background: var(--bg2); }
.giphy-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 8px; }
.giphy-tile { contain: layout paint; aspect-ratio: 4 / 3; padding: 0; border: 0; border-radius: 8px; overflow: hidden; background: var(--bg3); cursor: pointer; }
.giphy-tile:hover { outline: 2px solid var(--accent2); }
.giphy-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.giphy-msg { display: flex; gap: 8px; align-items: center; justify-content: center; padding: 12px; color: var(--muted); font-size: 13px; text-align: center; }
.giphy-msg button { padding: 3px 10px; border-radius: 6px; }
.giphy-end { height: 1px; }
.giphy-foot { padding: 4px 10px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--border); text-align: right; }
.line .msg-link { word-break: break-all; }
/* fullscreen */
#watch:fullscreen, #watch:-webkit-full-screen { width: 100%; height: 100%; }
#watch.pseudo-fs { width: 100vw; height: 100vh; height: 100dvh; z-index: 9999; }
html.pseudo-fs-on, html.pseudo-fs-on body { overflow: hidden; }
@media (hover: none) { #watch #watch-fs { opacity: 1; pointer-events: auto; } }
/* 1.2.16 YouTube Live embed */
#watch .watch-yt { position: absolute; inset: 0; width: 100%; height: 100%; min-width: 200px; min-height: 200px; border: 0; background: #000; }

/* AFK — mirrors client app.css (.online-name-row/.afk-mark/.is-afk) */
.online-name-row{display:inline-flex;align-items:center;gap:6px;min-width:0;max-width:100%}
.afk-mark{flex:0 0 auto;font-style:normal;line-height:1}
.online-name.is-afk{font-style:italic;font-size:inherit}
.me-edit{margin-left:6px;font-size:11px;padding:1px 6px;cursor:pointer}
.line .name.is-afk{font-style:italic}

/* Enlarge only a single emoji body; surrounding text and controls stay normal. */
.line-body.single-emoji { display: inline-block; font-size: 3em; line-height: 1.15; vertical-align: middle; }
