:root {
  color-scheme: dark;
  --c-bg: #0c0c0c;
  --c-surface: #0f0f0f;
  --c-border: #1f2229;
  --c-text: #ffffff;
  --c-accent: #e11d48;
  --c-muted: #9aa0ad;
  --app-background: url("/assets/imgs/back/winter.png");
  --master-map-glass-fill: rgba(15, 15, 15, 0.72);
  --master-map-glass-border: rgba(255, 255, 255, 0.14);
  --master-map-glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  --font-sans: "Montserrat", system-ui, -apple-system, sans-serif;
  --font-serif: "Cinzel", Georgia, serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

body {
  height: 100dvh;
  overflow: hidden;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-sans);
}

body.has-background-image {
  background: var(--c-bg) var(--app-background) center / cover no-repeat;
}

body.has-background-image::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(6, 8, 12, 0.58);
  backdrop-filter: blur(4px);
  pointer-events: none;
  z-index: 0;
}

.hidden {
  display: none !important;
}

/* Login Screen (NewRPG style) */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(6, 8, 12, 0.82);
  backdrop-filter: blur(12px);
}

.login-main {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1.25rem;
  max-width: 920px;
  width: 100%;
}

.login-card {
  background: rgba(15, 16, 20, 0.92);
  border: 1px solid var(--c-border);
  border-radius: 18px;
  padding: 1.6rem;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.login-brand-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.login-logo-img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.login-eyebrow {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #fb7185;
  font-weight: 700;
}

.login-card h1 {
  font-family: var(--font-serif);
  font-size: 1.55rem;
}

.login-card p {
  color: var(--c-muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.login-highlight {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.login-highlight__title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #f8fafc;
}

.login-highlight__list {
  padding-left: 1.1rem;
  font-size: 0.8rem;
  color: var(--c-muted);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.auth-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.tab-btn {
  flex: 1;
  padding: 0.55rem;
  border-radius: 10px;
  border: 1px solid var(--c-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--c-muted);
  font-weight: 700;
  cursor: pointer;
}

.tab-btn.active {
  background: var(--c-accent);
  color: #fff;
  border-color: #fb7185;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.login-input,
input,
select,
textarea {
  background: rgba(8, 10, 14, 0.9);
  border: 1px solid var(--c-border);
  color: var(--c-text);
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.85rem;
  width: 100%;
}

.login-error {
  color: #f87171;
  font-size: 0.8rem;
}

.login-submit {
  background: var(--c-accent);
  color: #fff;
  border: none;
  padding: 0.7rem;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 0.25rem;
}

/* Estrutura Principal do App */
.app {
  position: relative;
  z-index: 1;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

.app-header {
  height: 46px;
  background: rgba(12, 12, 14, 0.88);
  border-bottom: 1px solid var(--c-border);
  backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.85rem;
  gap: 0.75rem;
  z-index: 20;
}

.tool-header-group {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.tool-header-button {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--c-border);
  color: var(--c-text);
  padding: 0.35rem 0.7rem;
  border-radius: 9px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.tool-header-button:hover,
.tool-header-button.active {
  background: rgba(225, 29, 72, 0.22);
  border-color: #fb7185;
}

.app-title-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.app-title-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.app-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.app-title small {
  color: #fb7185;
  font-size: 0.72rem;
}

/* Boss Bar (NewRPG Header) */
.app-title-boss-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(225, 29, 72, 0.14);
  border: 1px solid rgba(251, 113, 133, 0.35);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
}

.app-title-boss-bar__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 8px #ef4444;
}

.app-title-boss-bar__name {
  font-weight: 700;
  white-space: nowrap;
}

.app-title-boss-bar__bar {
  width: 110px;
}

.app-title-boss-bar__track {
  height: 6px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 999px;
  overflow: hidden;
}

.app-title-boss-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, #ef4444, #f97316);
  transition: width 0.25s ease;
}

.app-title-boss-bar__values {
  font-size: 0.7rem;
  color: #fda4af;
  white-space: nowrap;
}

.status-pill {
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--c-muted);
}

.status-pill.online {
  background: rgba(34, 197, 94, 0.18);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.45);
}

/* Main Workspace */
.app-body {
  flex: 1;
  display: flex;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

/* Painel Esquerdo: Dados & Chat */
.master-sidebar {
  width: 280px;
  background: rgba(12, 13, 17, 0.88);
  border-right: 1px solid var(--c-border);
  backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
  z-index: 15;
}

.master-panel {
  display: flex;
  flex-direction: column;
  padding: 0.75rem;
  border-bottom: 1px solid var(--c-border);
}

.master-panel--chat {
  flex: 1;
  min-height: 0;
  border-bottom: none;
}

.master-panel__title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--c-muted);
  margin-bottom: 0.55rem;
}

.dice-roller-box {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.dice-skin-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.dice-skin-img {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--c-border);
  background: rgba(0, 0, 0, 0.4);
}

.dice-skin-controls {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.72rem;
  color: var(--c-muted);
}

.quick-dice-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.dice-btn {
  flex: 1 1 30%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--c-border);
  color: #fff;
  padding: 0.35rem 0.45rem;
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
}

.dice-btn:hover {
  border-color: #fb7185;
  background: rgba(225, 29, 72, 0.2);
}

.master-chat__messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding-right: 0.25rem;
  font-size: 0.8rem;
}

.chat-item {
  background: rgba(255, 255, 255, 0.04);
  border-left: 3px solid var(--c-accent);
  padding: 0.4rem 0.55rem;
  border-radius: 6px;
}

.chat-item strong {
  font-size: 0.76rem;
}

.chat-roll-badge {
  margin-top: 0.25rem;
  display: inline-block;
  background: rgba(225, 29, 72, 0.22);
  border: 1px solid rgba(251, 113, 133, 0.45);
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  font-weight: 700;
  color: #fda4af;
}

.master-chat__composer {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.55rem;
}

.master-chat__icon-button {
  background: var(--c-accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  width: 36px;
  cursor: pointer;
  font-weight: 700;
}

/* Estágio Central do Mapa (NewRPG MasterMap) */
.master-viewport {
  flex: 1;
  position: relative;
  min-width: 0;
  min-height: 0;
}

.master-map__stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: rgba(8, 10, 12, 0.45);
}

.master-map__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

/* Toolbars Glassmorphism do NewRPG */
.master-map__toolbar {
  position: absolute;
  z-index: 10;
  pointer-events: none;
}

.master-map__toolbar--top-left {
  left: 14px;
  top: 14px;
}

.master-map__toolbar--top {
  right: 14px;
  top: 14px;
}

.master-map__bubble {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 16px;
  border: 1px solid var(--master-map-glass-border);
  background: var(--master-map-glass-fill);
  box-shadow: var(--master-map-glass-shadow);
  backdrop-filter: blur(14px) saturate(125%);
  pointer-events: auto;
  max-width: calc(100vw - 28px);
  overflow-x: auto;
}

.master-map__group {
  display: flex;
  align-items: center;
  gap: 5px;
}

.master-map__divider {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.16);
  margin: 0 2px;
}

.master-map__button {
  min-width: 36px;
  height: 36px;
  padding: 0 0.55rem;
  border-radius: 11px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--c-text);
  font-size: 0.8rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}

.master-map__button:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
}

.master-map__button.is-active {
  border-color: #fb7185;
  background: rgba(225, 29, 72, 0.26);
}

.master-map__button.danger-icon:hover {
  background: rgba(220, 38, 38, 0.35);
  border-color: #f87171;
}

/* HUD Flutuante de Template de Magia */
.template-hud {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(12, 14, 20, 0.92);
  border: 1px solid #fb7185;
  border-radius: 14px;
  padding: 0.7rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(14px);
  z-index: 14;
  max-width: calc(100vw - 24px);
}

.hud-title {
  display: flex;
  flex-direction: column;
  font-size: 0.8rem;
}

.hud-title span {
  font-size: 0.72rem;
  color: var(--c-muted);
}

.hud-controls {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.angle-control {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
}

/* Balão de Jogadores no Mapa (MapPlayersBalloon.tsx) */
.master-map__players-balloon {
  position: absolute;
  left: 14px;
  bottom: 14px;
  background: var(--master-map-glass-fill);
  border: 1px solid var(--master-map-glass-border);
  border-radius: 14px;
  padding: 0.55rem 0.75rem;
  backdrop-filter: blur(14px);
  box-shadow: var(--master-map-glass-shadow);
  z-index: 10;
  pointer-events: auto;
  min-width: 155px;
}

.master-map__players-balloon__label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--c-muted);
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.master-map__players-balloon__list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.master-map__players-balloon__item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  font-weight: 600;
}

.master-map__players-balloon__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Painel Direito: Biblioteca Tormenta20 & Admin */
.sidebar {
  width: 350px;
  background: rgba(12, 13, 17, 0.9);
  border-left: 1px solid var(--c-border);
  backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
  z-index: 15;
}

.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--c-border);
}

.side-tab {
  flex: 1;
  padding: 0.65rem;
  background: transparent;
  color: var(--c-muted);
  border: none;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
}

.side-tab.active {
  color: #fff;
  border-bottom: 2px solid var(--c-accent);
  background: rgba(255, 255, 255, 0.03);
}

.side-panel {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.filter-row {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.compendium-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.compendium-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--c-border);
  border-radius: 11px;
  padding: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.compendium-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
}

.category-tag {
  font-size: 0.66rem;
  text-transform: uppercase;
  padding: 0.14rem 0.45rem;
  border-radius: 5px;
  background: rgba(225, 29, 72, 0.24);
  color: #fda4af;
  font-weight: 700;
}

.card-meta {
  font-size: 0.74rem;
  color: #cbd5e1;
}

.card-desc {
  font-size: 0.78rem;
  color: var(--c-muted);
  line-height: 1.4;
}

.card-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.76rem;
  font-weight: 600;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.form-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.primary-btn {
  background: var(--c-accent);
  color: #fff;
  border: none;
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.06);
  color: var(--c-text);
  border: 1px solid var(--c-border);
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
}

.small {
  padding: 0.3rem 0.6rem;
  font-size: 0.74rem;
}

.lock-notice {
  background: rgba(239, 68, 68, 0.16);
  border: 1px solid #ef4444;
  padding: 0.6rem;
  border-radius: 8px;
  font-size: 0.78rem;
}

/* Rodapé (NewRPG Footer) */
.app-footer {
  height: 44px;
  background: rgba(12, 12, 14, 0.9);
  border-top: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.85rem;
  font-size: 0.76rem;
  z-index: 20;
}

.footer-profile {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.footer-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #79d0ff;
  border: 2px solid rgba(255, 255, 255, 0.7);
}

.footer-text {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.footer-name {
  font-weight: 700;
}

.footer-role {
  font-size: 0.66rem;
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--c-muted);
  font-weight: 700;
}

.footer-center-info {
  color: var(--c-muted);
  font-size: 0.74rem;
}

/* Responsividade Mobile e Tablet */
@media (max-width: 960px) {
  .login-main {
    grid-template-columns: 1fr;
  }
  .footer-center-info,
  .app-title-boss-bar {
    display: none;
  }
  .master-sidebar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(88vw, 300px);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.7);
  }
  .master-sidebar.collapsed-mobile {
    display: none;
  }
  .sidebar {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: min(92vw, 340px);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.7);
  }
  .sidebar.collapsed {
    display: none;
  }
}

/* ============================================================================
   Lobby de Mesas (ID de 12 dígitos + Convite do Mestre) & Modais FoundryVTT
   ============================================================================ */

.lobby-container {
  width: min(1040px, 95vw);
  max-height: 92vh;
  overflow-y: auto;
  background: rgba(14, 15, 20, 0.94);
  border: 1px solid var(--c-border);
  border-radius: 18px;
  padding: 1.5rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.lobby-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  border-bottom: 1px solid var(--c-border);
  padding-bottom: 1rem;
}

.lobby-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.lobby-brand h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  margin: 0;
}

.lobby-brand p {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  color: var(--c-muted);
}

.lobby-header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.superadmin-pill {
  background: linear-gradient(135deg, rgba(254, 202, 87, 0.24), rgba(255, 159, 67, 0.28));
  border: 1px solid #feca57;
  color: #fde68a;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
}

.lobby-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.15rem;
}

.lobby-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--c-border);
  border-radius: 14px;
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.lobby-card h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin: 0;
}

.lobby-card p {
  font-size: 0.8rem;
  color: var(--c-muted);
  line-height: 1.45;
  margin: 0;
}

.lobby-form {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: auto;
}

.lobby-tables-section h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  margin: 0 0 0.65rem;
}

.lobby-tables-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 0.75rem;
}

.lobby-table-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.lobby-table-item__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.lobby-table-item__name {
  font-weight: 700;
  font-size: 0.92rem;
}

.role-pill-gm {
  background: rgba(254, 202, 87, 0.2);
  border: 1px solid #feca57;
  color: #fde68a;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.14rem 0.45rem;
  border-radius: 6px;
}

.role-pill-player {
  background: rgba(84, 160, 255, 0.2);
  border: 1px solid #54a0ff;
  color: #93c5fd;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.14rem 0.45rem;
  border-radius: 6px;
}

.lobby-table-item__meta {
  font-size: 0.75rem;
  color: var(--c-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.lobby-table-item__actions {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.35rem;
}

/* Header Meta da Mesa de 12 Dígitos */
.table-header-meta {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.table-id-pill {
  font-family: monospace;
  font-size: 0.74rem;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--c-border);
  padding: 0.18rem 0.5rem;
  border-radius: 6px;
  color: #cbd5e1;
}

.gm-invite-bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(254, 202, 87, 0.1);
  border: 1px solid rgba(254, 202, 87, 0.4);
  padding: 0.18rem 0.55rem;
  border-radius: 8px;
}

.gm-invite-code {
  font-size: 0.74rem;
  font-weight: 700;
  color: #fde68a;
}

.invite-copy-btn {
  background: rgba(225, 29, 72, 0.28);
  border: 1px solid #fb7185;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.16rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
}

.invite-copy-btn:hover {
  background: rgba(225, 29, 72, 0.5);
}

/* Pastas de Compêndio Estilo FoundryVTT */
.filter-subrow {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.compendium-packs-container {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.foundry-pack {
  border: 1px solid var(--c-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  overflow: hidden;
}

.foundry-pack__header {
  width: 100%;
  background: linear-gradient(90deg, rgba(225, 29, 72, 0.18), rgba(255, 255, 255, 0.04));
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
  padding: 0.55rem 0.7rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.82rem;
  text-align: left;
}

.foundry-pack__header:hover {
  background: linear-gradient(90deg, rgba(225, 29, 72, 0.28), rgba(255, 255, 255, 0.08));
}

.foundry-pack__count {
  font-size: 0.7rem;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  color: #fda4af;
}

.foundry-pack__body {
  display: flex;
  flex-direction: column;
  max-height: 330px;
  overflow-y: auto;
}

.foundry-pack__item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.42rem 0.65rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  font-size: 0.78rem;
  transition: background 0.12s;
}

.foundry-pack__item:hover {
  background: rgba(225, 29, 72, 0.15);
}

.foundry-pack__item-title {
  font-weight: 600;
  color: #f1f5f9;
}

.foundry-pack__item-sub {
  font-size: 0.68rem;
  color: var(--c-muted);
}

.foundry-pack__item-right {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* Abas de Atores & Cenas */
.actor-actions-bar {
  display: flex;
  gap: 0.45rem;
}

.panel-hint {
  font-size: 0.73rem;
  color: var(--c-muted);
  margin: 0;
  line-height: 1.35;
}

.actor-folder-title {
  font-family: var(--font-display);
  font-size: 0.78rem;
  color: #fda4af;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0.4rem 0 0.2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 0.2rem;
}

.actor-row-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--c-border);
  border-radius: 10px;
  padding: 0.5rem 0.6rem;
}

.actor-row-left {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  min-width: 0;
  flex: 1;
}

.actor-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.78rem;
  color: #0b0c10;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.75);
}

.actor-info {
  min-width: 0;
}

.actor-info strong {
  display: block;
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.actor-info span {
  font-size: 0.7rem;
  color: var(--c-muted);
}

.superadmin-banner {
  background: rgba(254, 202, 87, 0.12);
  border: 1px solid rgba(254, 202, 87, 0.45);
  color: #fde68a;
  padding: 0.55rem;
  border-radius: 8px;
  font-size: 0.75rem;
  line-height: 1.35;
}

/* Janelas Modais Estilo FoundryVTT (Fichas de Personagem/Monstro e Detalhes de Magia) */
.foundry-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 6, 10, 0.74);
  backdrop-filter: blur(6px);
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.foundry-window {
  background: #12141c;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  max-height: 92vh;
  overflow: hidden;
}

.actor-sheet-window {
  width: min(760px, 96vw);
}

.spell-detail-window {
  width: min(620px, 95vw);
}

.foundry-window__header {
  background: linear-gradient(90deg, #1f121b, #171a24);
  border-bottom: 1px solid rgba(251, 113, 133, 0.35);
  padding: 0.65rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.foundry-window__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.98rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.foundry-window__close {
  background: transparent;
  border: none;
  color: var(--c-muted);
  font-size: 1.05rem;
  cursor: pointer;
}

.foundry-window__close:hover {
  color: #fff;
}

.foundry-window__body {
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.sheet-top-banner {
  display: flex;
  gap: 0.9rem;
  align-items: center;
}

.sheet-avatar-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.sheet-avatar-circle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #54a0ff;
  border: 3px solid rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 800;
  color: #0b0c10;
}

.sheet-identity-grid {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.sheet-vitals-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.5rem;
}

.vital-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--c-border);
  border-radius: 10px;
  padding: 0.45rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.vital-hp {
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.08);
}

.vital-pm {
  border-color: rgba(59, 130, 246, 0.45);
  background: rgba(59, 130, 246, 0.08);
}

.vital-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  color: var(--c-muted);
  font-weight: 700;
}

.vital-inputs {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.vital-inputs input {
  width: 100%;
  text-align: center;
  font-weight: 700;
}

.sheet-attributes-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.45rem;
}

.attr-box {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--c-border);
  border-radius: 10px;
  padding: 0.45rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.attr-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.78rem;
  color: #fda4af;
}

.attr-box input {
  width: 58px;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 800;
}

.attr-roll-btn {
  width: 100%;
  background: rgba(225, 29, 72, 0.2);
  border: 1px solid rgba(251, 113, 133, 0.4);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.2rem 0.3rem;
  border-radius: 6px;
  cursor: pointer;
}

.attr-roll-btn:hover {
  background: rgba(225, 29, 72, 0.4);
}

.sheet-subtabs {
  display: flex;
  border-bottom: 1px solid var(--c-border);
  gap: 0.35rem;
}

.sheet-subtab {
  background: transparent;
  border: none;
  color: var(--c-muted);
  padding: 0.45rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.sheet-subtab.active {
  color: #fff;
  border-bottom-color: var(--c-accent);
}

.sheet-subpanel {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.quick-skills-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.38rem;
}

.skill-roll-chip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--c-border);
  color: #e2e8f0;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 600;
  cursor: pointer;
}

.skill-roll-chip:hover {
  border-color: #fb7185;
  background: rgba(225, 29, 72, 0.22);
}

.foundry-window__footer {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--c-border);
}

.danger-btn {
  border-color: rgba(239, 68, 68, 0.5);
  color: #fca5a5;
}

/* Modal de Magia do Compêndio */
.spell-header-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.badge-compendium,
.badge-circle,
.badge-school,
.badge-pm {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
}

.badge-compendium {
  background: rgba(254, 202, 87, 0.18);
  border: 1px solid rgba(254, 202, 87, 0.5);
  color: #fde68a;
}

.badge-circle {
  background: rgba(165, 94, 234, 0.2);
  border: 1px solid rgba(165, 94, 234, 0.5);
  color: #e9d5ff;
}

.badge-school {
  background: rgba(84, 160, 255, 0.18);
  border: 1px solid rgba(84, 160, 255, 0.45);
  color: #bfdbfe;
}

.badge-pm {
  background: rgba(225, 29, 72, 0.25);
  border: 1px solid #fb7185;
  color: #fecdd3;
}

.spell-props-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--c-border);
  border-radius: 10px;
  padding: 0.65rem;
  font-size: 0.78rem;
}

.spell-modal-description {
  font-size: 0.83rem;
  line-height: 1.55;
  color: #e2e8f0;
  white-space: pre-line;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 0.3rem;
}

@media (max-width: 760px) {
  .lobby-grid {
    grid-template-columns: 1fr;
  }
  .sheet-attributes-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .grid-3 {
    grid-template-columns: 1fr;
  }
}
