/* Overlay styles (transparent background for OBS) */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
/* Emoji-capable fonts for Windows/OBS */
body { font-family: Inter, "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", "Segoe UI Symbol", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; background: transparent; }
.name, .content { font-family: inherit; }

:root {
  --text: #fff;
  --bubble: rgba(0,0,0,0.35);
  --base-scale: 1;
  --scale: var(--base-scale);
  --message-gap: 0.4;
  --primary: #00b5ff;
}

.overlay { position: relative; width: 100%; height: 100%; overflow: hidden; }
.messages {
  position: absolute;
  inset: 0 8px 0.5rem 8px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: calc(var(--message-gap) * 1rem * var(--scale));
  overflow: hidden;
}

.message {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-auto-rows: auto;
  align-items: start;
  column-gap: calc(0.5rem * var(--scale));
  row-gap: calc(0.25rem * var(--scale));
  color: var(--text);
  background: var(--bubble);
  border: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: calc(8px * var(--scale));
  padding: calc(0.28rem * var(--scale)) calc(0.36rem * var(--scale));
  width: 100%;
  max-width: 100%;
  animation: slide-in 200ms ease-out;
}

.message.super { --scale: calc(var(--base-scale) * 1.15); }

.no-bubbles .message {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
  padding: 0 0 0 8px !important;
  margin-block: calc(0.125rem * var(--scale));
}

.avatar { width: calc(20px * var(--scale)); height: calc(20px * var(--scale)); border-radius: 50%; overflow: hidden; display: block; }
.message.super .avatar { width: calc(26px * var(--scale)); height: calc(26px * var(--scale)); }
.avatar--spacer { background: transparent; border: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.no-avatars .message { grid-template-columns: 1fr; }
.no-avatars .message .body { grid-column: 1 / -1; }
.no-avatars .message .avatar { display: none !important; }

.ring-owner .avatar { outline: 3px solid #ff5a5a; outline-offset: 3px; }
.ring-mod .avatar { outline: 3px solid #419dff; outline-offset: 3px; }
.ring-member .avatar { outline: 3px solid #25e186; outline-offset: 3px; }
.ring-verified .avatar { outline: 3px solid #fffed7; outline-offset: 3px; }

.no-badges .avatar { outline: none !important; outline-offset: 0 !important; }
.no-badges .ring-owner .avatar,
.no-badges .ring-mod .avatar,
.no-badges .ring-member .avatar,
.no-badges .ring-verified .avatar { outline: none !important; outline-offset: 0 !important; }

.body { grid-column: 2 / -1; display: block; min-width: 0; }
.name { font-weight: 700; font-size: calc(1.18rem * var(--scale)); line-height: 1.25; white-space: nowrap; margin-right: calc(0.3rem * var(--scale)); }
.content { font-size: calc(1.20rem * var(--scale)); line-height: 1.35; word-wrap: break-word; overflow-wrap: break-word; min-width: 0; display: inline; }

/* Role colors */
.ring-owner .name { color: #ff5a5a; }
.ring-mod .name { color: #419dff; }
.ring-member .name { color: #25e186; }
.ring-verified .name { color: #fffed7; }

.sticker-img { display: inline-block; height: calc(18px * var(--scale)); width: auto; vertical-align: middle; margin-left: calc(0.25rem * var(--scale)); }
.emoji-img { display: inline-block; height: calc(18px * var(--scale)); width: auto; vertical-align: text-bottom; margin: 0 0.12rem; }

.message.single-line { align-items: center; }
.message.single-line .body { display: flex; align-items: center; }

.message:not(.single-line) .avatar { align-self: start; margin-top: 0.35rem; }

.super { box-shadow: none; }

.message.super { position: relative; }
.message .primary { color: var(--primary); font-weight: 800; text-shadow: 0 0 6px rgba(0,181,255,0.35); }

.toast { position: absolute; top: 0.5rem; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,0.7); color: #fff; padding: 0.5rem 0.75rem; border-radius: 8px; font-size: 14px; opacity: 0; transition: opacity 160ms ease; }
.toast.show { opacity: 1; }
.hidden { display: none; }

.settings-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 48px;
  height: 48px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 160ms ease;
  z-index: 5;
  opacity: 0;
  pointer-events: none;
}

.settings-btn:hover {
  background: rgba(0, 0, 0, 0.9);
  border-color: rgba(255, 255, 255, 0.4);
  transform: scale(1.05);
}

.settings-btn.show {
  opacity: 1;
  pointer-events: auto;
}

.settings { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 6; background: rgba(15,15,20,0.9); color: #fff; border: 1px solid rgba(255,255,255,0.12); border-radius: 12px; padding: 12px; min-width: min(420px, 95vw); max-height: 90vh; overflow: auto; backdrop-filter: blur(8px); box-shadow: 0 0 0 2px rgba(255,255,255,0.28); }
.settings h2 { margin: 0 0 8px 0; font-size: 16px; }
.settings label { display: grid; gap: 6px; margin: 8px 0; font-size: 13px; }
.settings input[type="text"], .settings input[type="password"], .settings input[type="number"] { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.15); color: #fff; border-radius: 8px; padding: 8px; }
.settings .grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.settings .row { display: flex; gap: 8px; margin-top: 8px; }
.settings button { background: var(--primary); color: #02131a; border: none; border-radius: 8px; padding: 8px 10px; font-weight: 700; cursor: pointer; }
.settings button.secondary { background: rgba(255,255,255,0.1); color: #fff; }
.settings .hint { opacity: 0.8; font-size: 12px; }

@keyframes slide-in { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

@media (max-width: 600px) { :root { --base-scale: 0.9; } }
@media (max-width: 420px) { :root { --base-scale: 0.8; } }
@media (max-height: 400px) { :root { --base-scale: 0.85; } }
