@charset "UTF-8";
/* --- LOCAL FONTS --- */
@font-face {
  font-family: "Inter";
  src: url("/modules/storyteller-cinema/assets/fonts/Inter.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Merriweather";
  src: url("/modules/storyteller-cinema/assets/fonts/Merriweather.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
/* Base Styles */
:root {
  --stage-font-family: 'Inter';
  --stage-actor-font-family: 'Merriweather';
  --stage-font-size: 24px;
  --stage-actor-font-size: 28px;
  --tray-idle-opacity: 0.4;
}

/* =========================================
   STORYTELLER CINEMA - STYLE.SCSS (V10.2 WIDESCREEN FIX)
   ========================================= */
#storyteller-cinema-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  /* INTERATIVIDADE: 
      Container é permeável (none) para permitir clicar no mapa no centro. */
  pointer-events: none;
  /* CAMADA (Z-INDEX):
      0 = Canvas (Mapa/Tokens)
      10 = Overlay (Cinematic Bars) - [REDUZIDO DE 50 PARA 10]
      100 = Foundry UI (Sidebars, Hotbar)

      Mantenha baixo para garantir que NUNCA cubra a interface. */
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  opacity: 0;
  transition: opacity 1s ease-in-out;
}
#storyteller-cinema-overlay.active {
  opacity: 1;
}
#storyteller-cinema-overlay .cinematic-bar {
  width: 100%;
  height: 12vh;
  min-height: 100px;
  background-color: var(--cinematic-bar-bg, black);
  /* Fallback: tenta textura específica primeiro, depois a genérica */
  background-size: var(--cinematic-bg-size, cover);
  background-position: var(--cinematic-bg-position, center);
  background-repeat: var(--cinematic-bg-repeat, no-repeat);
  background-attachment: var(--cinematic-bg-attachment, scroll);
  pointer-events: none;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.9);
}
#storyteller-cinema-overlay .cinematic-bar.top {
  background-image: var(--cinematic-bar-top-texture, var(--cinematic-bg-texture, none));
  border-bottom: var(--cinematic-bar-border, none);
}
#storyteller-cinema-overlay .cinematic-bar.bottom {
  background-image: var(--cinematic-bar-bottom-texture, var(--cinematic-bg-texture, none));
  border-bottom: none;
  border-top: var(--cinematic-bar-border, none);
}
#storyteller-cinema-overlay .cinematic-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 12vh;
  min-height: 100px;
  z-index: 11;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 0 10%;
  box-sizing: border-box;
  /* Estilo customizado do footer independente */
  background-color: var(--cinematic-footer-bg, transparent);
  background-image: var(--cinematic-footer-texture, var(--cinematic-bar-bottom-texture, var(--cinematic-bg-texture, none)));
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
#storyteller-cinema-overlay .cinematic-footer .subtitle-container {
  font-family: var(--stage-font-family, "Inter"), sans-serif;
  text-align: center;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.5s ease;
  pointer-events: none;
}
#storyteller-cinema-overlay .cinematic-footer .subtitle-container.active {
  opacity: 1;
  transform: translateY(0);
}
#storyteller-cinema-overlay .cinematic-footer .subtitle-container .actor-name {
  color: var(--cinematic-accent-color, #ff6400);
  font-family: var(--stage-actor-font-family, "Merriweather"), serif;
  font-weight: bold;
  font-size: var(--stage-actor-font-size, 28px);
  text-transform: uppercase;
  letter-spacing: 3px;
  margin-bottom: 8px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}
#storyteller-cinema-overlay .cinematic-footer .subtitle-container .message-text {
  color: #fff;
  font-size: var(--stage-font-size, 24px);
  line-height: 1.4;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
}
#storyteller-cinema-overlay {
  /* OVERLAY TEXTURE (Grain/Vignette) */
}
#storyteller-cinema-overlay::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
  /* Above canvas, below bars (bars are z-10 children of this overlay context?) No, overlay is flex. */
  /* Bars are children of overlay. Bars are on top? 
     Overlay uses z-index 10.
     If we put texture on ::after with absolute, valid.
  */
  background-image: var(--cinematic-overlay-texture, none);
  background-size: cover;
  opacity: 0.5;
  /* Default opacity for overlays */
}

/* Garante que nenhum estilo interfira na UI do Foundry */
body.cinematic-mode {
  transition: background-color 1.5s ease-in-out;
  /* Isolar o filtro apenas para o que é visual/cenográfico */
}
body.cinematic-mode #board, body.cinematic-mode #storyteller-cinema-overlay {
  filter: var(--cinematic-filter, none);
}
body.cinematic-mode {
  /* --- Cinematic Mode UI Cleanup --- */
}
body.cinematic-mode #hotbar,
body.cinematic-mode #players,
body.cinematic-mode #navigation,
body.cinematic-mode #controls,
body.cinematic-mode #logo,
body.cinematic-mode #fps {
  display: none !important;
}

#storyteller-cinema-toggle {
  position: fixed;
  top: 5px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 95;
  /* Layout */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  /* Size & Shape */
  height: 32px;
  padding: 0 10px;
  border-radius: 16px;
  /* Pill shape */
  /* Styling */
  background: rgba(10, 10, 10, 0.95);
  border: 1px solid #ff6400;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  color: #e0e0e0;
  font-family: var(--font-primary);
  font-size: 14px;
  transition: all 0.3s ease;
  /* Toggle Action Area */
}
#storyteller-cinema-toggle .hud-toggle-action {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding-right: 8px;
  /* More breathing room */
  height: 100%;
}
#storyteller-cinema-toggle .hud-toggle-action:hover {
  color: #fff;
  text-shadow: 0 0 8px #ff6400;
}
#storyteller-cinema-toggle {
  /* Controls Area (Select + Cog) */
}
#storyteller-cinema-toggle .hud-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.3);
  padding-left: 12px;
  height: 18px;
  /* Slightly shorter separator */
  margin-left: 2px;
  /* Hide by default (JS handles display) */
  display: none;
}
#storyteller-cinema-toggle {
  /* --- Custom Dropdown Implementation (Replaces Native Select) --- */
}
#storyteller-cinema-toggle .custom-skin-select {
  position: relative;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  color: #aaa;
  font-size: 14px;
  padding: 0 5px;
  transition: color 0.2s;
}
#storyteller-cinema-toggle .custom-skin-select:hover {
  color: #fff;
}
#storyteller-cinema-toggle .custom-skin-select.open {
  color: #ff6400;
}
#storyteller-cinema-toggle .custom-skin-select.open .dropdown-options {
  display: block;
  /* Show menu */
  animation: fadeIn 0.1s ease-out;
}
#storyteller-cinema-toggle .custom-skin-select.open .fa-chevron-down {
  transform: rotate(180deg);
}
#storyteller-cinema-toggle .custom-skin-select .fa-chevron-down {
  font-size: 10px;
  transition: transform 0.2s;
}
#storyteller-cinema-toggle .custom-skin-select {
  /* The Floating Menu */
}
#storyteller-cinema-toggle .custom-skin-select .dropdown-options {
  display: none;
  /* Hidden by default */
  position: absolute;
  top: 30px;
  /* Below the header */
  left: 50%;
  transform: translateX(-50%);
  background: #111;
  border: 1px solid #ff6400;
  border-radius: 6px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.8);
  list-style: none;
  padding: 5px 0;
  margin: 0;
  min-width: 150px;
  z-index: 200;
}
#storyteller-cinema-toggle .custom-skin-select .dropdown-options li {
  padding: 10px 15px;
  /* GENEROUS PADDING HERE! */
  color: #e0e0e0;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
  text-align: left;
}
#storyteller-cinema-toggle .custom-skin-select .dropdown-options li:hover {
  background: #333;
  color: #fff;
}
#storyteller-cinema-toggle .custom-skin-select .dropdown-options li.selected {
  color: #ff6400;
  font-weight: bold;
  background: rgba(255, 100, 0, 0.1);
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}
#storyteller-cinema-toggle {
  /* Config Cog Icon */
}
#storyteller-cinema-toggle .open-config {
  cursor: pointer;
  color: #888;
  font-size: 1.1em;
  transition: all 0.2s;
}
#storyteller-cinema-toggle .open-config:hover {
  color: #fff;
  transform: rotate(90deg);
}
#storyteller-cinema-toggle {
  /* Active State (Cinematic Mode ON) */
}
#storyteller-cinema-toggle.active {
  border-color: #ff6400;
  box-shadow: 0 0 15px rgba(255, 100, 0, 0.2);
}
#storyteller-cinema-toggle.active .hud-toggle-action {
  color: #ff6400;
}

/* === CONFIGURATION UI === */
.storyteller-cinema-config {
  margin-top: 0.5em;
  padding-top: 0.5em;
}
.storyteller-cinema-config .form-header {
  margin-bottom: 0.5em;
  border-bottom: 1px solid var(--color-border-light-primary, #7a7971);
  color: var(--color-text-dark-primary, #191813);
  font-family: var(--font-primary);
  font-weight: bold;
}
.storyteller-cinema-config .form-group {
  display: flex;
  flex-direction: row;
  align-items: center;
  margin: 0 0 0.25em 0;
}
.storyteller-cinema-config .form-group label {
  flex: 2;
}
.storyteller-cinema-config .form-group .form-fields {
  flex: 3;
  display: flex;
  gap: 5px;
}

/* === SKIN STUDIO (Modern Dark Theme) === */
.skin-config-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  /* Sleek Dark Gradient Background */
  background: linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%);
  color: #e0e0e0;
  font-family: "Signika", var(--font-primary);
  box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.8);
}
.skin-config-container .skin-header {
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1.5rem;
  text-align: center;
  backdrop-filter: blur(5px);
}
.skin-config-container .skin-header h1 {
  font-family: "Amiri", serif;
  font-size: 2.8em;
  margin: 0 0 5px 0;
  color: #ff6400;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-shadow: 0 2px 10px rgba(255, 100, 0, 0.3);
}
.skin-config-container .skin-header p {
  margin: 0;
  font-size: 0.9em;
  color: #888;
  font-weight: 300;
}
.skin-config-container .skin-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}
.skin-config-container {
  /* SIDEBAR */
}
.skin-config-container .skin-sidebar {
  width: 260px;
  background: rgba(0, 0, 0, 0.4);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  padding: 15px;
  box-shadow: 5px 0 15px rgba(0, 0, 0, 0.2);
}
.skin-config-container .skin-sidebar h3 {
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #666;
  border-bottom: 1px solid #333;
  padding-bottom: 10px;
  margin-top: 0;
  margin-bottom: 15px;
}
.skin-config-container .skin-list {
  flex: 1;
  overflow-y: auto;
  padding-right: 5px;
}
.skin-config-container .skin-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 1em;
}
.skin-config-container .skin-item:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateX(2px);
}
.skin-config-container .skin-item:hover i.delete-skin {
  color: #e74c3c;
}
.skin-config-container .skin-item.active {
  background: linear-gradient(90deg, rgba(255, 100, 0, 0.1) 0%, transparent 100%);
  border-left: 3px solid #ff6400;
  color: #fff;
  font-weight: 600;
}
.skin-config-container .skin-item i.delete-skin {
  color: #666;
  transition: color 0.2s;
}
.skin-config-container {
  /* CREATE BUTTON */
}
.skin-config-container .sidebar-actions {
  margin-top: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.skin-config-container .create-skin-btn,
.skin-config-container .import-skin-btn {
  background: #27ae60;
  color: #fff;
  border: none;
  padding: 10px;
  border-radius: 6px;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.8em;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}
.skin-config-container .create-skin-btn:hover,
.skin-config-container .import-skin-btn:hover {
  background: #219150;
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}
.skin-config-container .import-skin-btn {
  background: #e67e22;
}
.skin-config-container .import-skin-btn:hover {
  background: #d35400;
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}
.skin-config-container {
  /* EDITOR MAIN AREA */
}
.skin-config-container .skin-editor {
  flex: 1;
  padding: 30px;
  overflow-y: auto;
  background: url("/modules/storyteller-cinema/assets/ui/noise.png");
}
.skin-config-container .skin-editor input[type=text] {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid #444;
  color: #fff;
  padding: 10px;
  border-radius: 4px;
  font-family: inherit;
  transition: border-color 0.2s;
}
.skin-config-container .skin-editor input[type=text]:focus {
  border-color: #ff6400;
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 100, 0, 0.2);
}
.skin-config-container .skin-editor input[type=color] {
  width: 100%;
  height: 40px;
  padding: 2px;
  background: #333;
  border: 1px solid #444;
  cursor: pointer;
  border-radius: 4px;
  appearance: none;
}
.skin-config-container .skin-editor input[type=color]::-webkit-color-swatch-wrapper {
  padding: 0;
}
.skin-config-container .skin-editor input[type=color]::-webkit-color-swatch {
  border: none;
  border-radius: 3px;
}
.skin-config-container .editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.skin-config-container .editor-header h2 {
  font-size: 2em;
  font-weight: 300;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  margin: 0;
  border: none;
}
.skin-config-container .actions {
  display: flex;
  gap: 10px;
}
.skin-config-container {
  /* Action Buttons */
}
.skin-config-container .apply-skin-btn,
.skin-config-container .save-skin-btn,
.skin-config-container .export-skin-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  border-radius: 4px;
  padding: 8px 16px;
  font-size: 0.9em;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  height: 36px;
  display: inline-flex;
  align-items: center;
}
.skin-config-container .apply-skin-btn:hover {
  background: #ff6400;
  border-color: #ff6400;
  color: #000;
}
.skin-config-container .save-skin-btn:hover {
  background: #2980b9;
  border-color: #2980b9;
}
.skin-config-container .export-skin-btn:hover {
  background: #8e44ad;
  border-color: #8e44ad;
}
.skin-config-container {
  /* FORMS */
}
.skin-config-container .form-group {
  margin-bottom: 20px;
}
.skin-config-container .form-group label {
  display: block;
  margin-bottom: 8px;
  color: #aaa;
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.skin-config-container fieldset {
  border: 1px solid #333;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 25px;
}
.skin-config-container fieldset legend {
  padding: 0 10px;
  color: #ff6400;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.8em;
}
.skin-config-container .color-picker-group {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
}
.skin-config-container .color-picker-group input[type=color] {
  flex: 0 0 40px !important;
  height: 32px !important;
}
.skin-config-container .modular-border-fields {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
}
.skin-config-container .modular-border-fields input[type=number] {
  flex: 0 0 60px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid #444;
  color: #fff;
  padding: 5px;
  border-radius: 4px;
  text-align: center;
}
.skin-config-container .modular-border-fields select {
  flex: 1;
  background: #222;
  border: 1px solid #444;
  color: #fff;
  height: 32px;
  border-radius: 4px;
  padding: 0 5px;
}
.skin-config-container .modular-border-fields input[type=color] {
  flex: 0 0 40px !important;
  height: 32px !important;
}
.skin-config-container {
  /* File Picker Fix */
}
.skin-config-container .file-picker-group {
  display: flex;
  gap: 8px;
}
.skin-config-container .file-picker-group button {
  flex: 0 0 40px;
  background: #333;
  border: 1px solid #444;
  color: #ccc;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.skin-config-container .file-picker-group button:hover {
  background: #444;
  color: #fff;
}
.skin-config-container {
  /* Empty State */
}
.skin-config-container .empty-state {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
  color: #666;
}
.skin-config-container .empty-state i {
  font-size: 5em;
  margin-bottom: 20px;
  color: #444;
}

/* --- Subtitles & Portraits --- */
#storyteller-cinema-overlay .subtitle-container {
  position: absolute;
  bottom: 2vh;
  left: 50%;
  transform: translateX(-50%) translateY(20px) scale(0.98);
  width: 600px;
  max-width: 90vw;
  padding: 20px 30px;
  background: linear-gradient(135deg, rgba(10, 10, 10, 0.95) 0%, rgba(30, 30, 30, 0.8) 100%);
  backdrop-filter: blur(10px);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), inset 0 0 1px rgba(255, 255, 255, 0.2);
  opacity: 0;
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  z-index: 1001;
  border-bottom: 5px solid #ff6400;
}
#storyteller-cinema-overlay .subtitle-container.active {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
  animation: cinematicFadeInCenter 0.5s forwards;
}
#storyteller-cinema-overlay .subtitle-container .actor-name {
  color: #ff6400;
  font-family: "Modesto Condensed", "Georgia", serif;
  font-size: var(--stage-actor-font-size);
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 8px;
  text-shadow: 3px 3px 4px rgba(0, 0, 0, 0.9);
}
#storyteller-cinema-overlay .subtitle-container .message-text {
  color: #fff;
  font-size: 2em;
  font-family: "Signika", sans-serif;
  line-height: 1.3;
  text-shadow: 2px 2px 5px rgb(0, 0, 0);
}
#storyteller-cinema-overlay .portraits-container {
  position: absolute;
  z-index: 10;
  bottom: 18vh;
  left: 5%;
  right: 5%;
  height: 60vh;
  display: flex;
  justify-content: flex-start;
  align-items: flex-end;
  gap: 30px;
  transition: opacity 0.5s ease;
}
#storyteller-cinema-overlay .portraits-container.active {
  opacity: 1;
}
#storyteller-cinema-overlay .portraits-container .portrait-card {
  flex: 1 1 0;
  max-width: var(--cinematic-portrait-max-width, 450px);
  height: var(--cinematic-portrait-height, 100%);
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  border: 2px solid transparent;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), inset 0 0 1px rgba(255, 255, 255, 0.2);
  position: relative;
  opacity: 0;
  transform: translateY(120px) scale(0.95);
  filter: blur(5px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1), filter 0.8s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s, box-shadow 0.3s;
  /* A área do retrato (imagem e moldura premium) ocupa o espaço do topo */
}
#storyteller-cinema-overlay .portraits-container .portrait-card .portrait-image-area {
  flex: 1;
  position: relative;
  background-image: var(--cinematic-portrait-background, none);
  background-size: cover;
  background-repeat: no-repeat;
  background-position: top center;
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
  width: 100%;
  aspect-ratio: var(--cinematic-portrait-aspect-ratio, auto);
  /* Premium Border Overlay fica restrito à área da imagem */
}
#storyteller-cinema-overlay .portraits-container .portrait-card .portrait-image-area::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background-image: var(--cinematic-portrait-border-image, none);
  background-size: 100% 100%;
  background-repeat: no-repeat;
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
  z-index: 10;
}
#storyteller-cinema-overlay .portraits-container .portrait-card.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
}
#storyteller-cinema-overlay .portraits-container .portrait-card.speaking {
  border-color: #ff6400;
  box-shadow: 0 0 20px rgba(255, 100, 0, 0.6);
  transform: translateY(-10px) scale(1.02);
}
#storyteller-cinema-overlay .portraits-container .portrait-card.speaking .portrait-image-area::after {
  filter: drop-shadow(0 0 8px rgba(255, 100, 0, 0.8));
}
#storyteller-cinema-overlay .portraits-container .portrait-card .portrait-name {
  position: relative;
  width: 100%;
  background: var(--cinematic-portrait-name-bg, var(--cinematic-bar-bg, #000000));
  border-top: var(--cinematic-portrait-name-border-top, var(--cinematic-bar-border, 1px solid rgba(255, 255, 255, 0.1)));
  color: var(--cinematic-text-color, #ffffff);
  padding: 10px;
  text-align: center;
  font-family: "Modesto Condensed", "Georgia", serif;
  font-size: var(--cinematic-portrait-name-font-size, 20px);
  text-transform: uppercase;
  letter-spacing: 2px;
  border-bottom-left-radius: var(--cinematic-portrait-name-radius, 6px);
  border-bottom-right-radius: var(--cinematic-portrait-name-radius, 6px);
  margin-top: auto;
  margin-bottom: var(--cinematic-portrait-name-margin-bottom, 0px);
  box-sizing: border-box;
  z-index: 5;
}

/* --- Dialogue Console App --- */
.dialogue-console-app .cast-bar {
  display: flex;
  gap: 10px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid #333;
  overflow-x: auto;
  margin-bottom: 15px;
}
.dialogue-console-app .cast-bar::-webkit-scrollbar {
  height: 4px;
}
.dialogue-console-app .cast-bar::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 2px;
}
.dialogue-console-app .cast-bar .cast-item {
  flex: 0 0 50px;
  height: 50px;
  border-radius: 50%;
  border: 2px solid #333;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  background: #111;
}
.dialogue-console-app .cast-bar .cast-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.dialogue-console-app .cast-bar .cast-item.narrator-toggle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #666;
}
.dialogue-console-app .cast-bar .cast-item.narrator-toggle i {
  font-size: 18px;
  margin-bottom: 2px;
}
.dialogue-console-app .cast-bar .cast-item:hover {
  border-color: #ff6400;
  transform: scale(1.1);
}
.dialogue-console-app .cast-bar .cast-item.active {
  border-color: #ff6400;
  box-shadow: 0 0 10px rgba(255, 100, 0, 0.5);
}
.dialogue-console-app .dialogue-console {
  padding: 15px;
}
.dialogue-console-app .dialogue-console .form-group {
  margin-bottom: 12px;
}
.dialogue-console-app .dialogue-console .form-group label {
  color: #ff6400;
  font-weight: bold;
  margin-bottom: 5px;
  font-size: 13px;
}
.dialogue-console-app .dialogue-console select.actor-picker {
  width: 100%;
  background: #222;
  color: #ff6400;
  border: 1px solid #444;
  border-radius: 4px;
  padding: 8px;
  font-family: "Signika", sans-serif;
  font-size: 14px;
  font-weight: bold;
}
.dialogue-console-app .dialogue-console select.actor-picker:focus {
  border-color: #ff6400;
  outline: none;
}
.dialogue-console-app .dialogue-console textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  border: 1px solid #444;
  border-radius: 4px;
  padding: 10px;
  font-family: "Signika", sans-serif;
  font-size: 15px;
  resize: vertical;
}
.dialogue-console-app .dialogue-console textarea:focus {
  border-color: #ff6400;
  outline: none;
  background: rgba(0, 0, 0, 0.6);
}
.dialogue-console-app .dialogue-console .console-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}
.dialogue-console-app .dialogue-console .console-actions button {
  flex: 1;
  padding: 12px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}
.dialogue-console-app .dialogue-console .console-actions button.btn-send {
  background: #ff6400;
  color: #000;
  border: none;
}
.dialogue-console-app .dialogue-console .console-actions button.btn-send:hover {
  background: #ff8533;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 100, 0, 0.3);
}
.dialogue-console-app .dialogue-console .console-actions button.btn-clear {
  background: #222;
  color: #ccc;
  border: 1px solid #444;
}
.dialogue-console-app .dialogue-console .console-actions button.btn-clear:hover {
  background: #333;
  color: #fff;
}

/* --- Cinema Tray (Bottom Bar) --- */
.storyteller-cinema-tray-app {
  position: absolute !important;
  display: block !important;
  z-index: 100 !important;
  pointer-events: all;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  height: fit-content !important;
  min-height: 0 !important;
  width: fit-content !important;
  min-width: unset !important;
  max-width: fit-content !important;
  opacity: var(--tray-idle-opacity, 0.4);
  transition: opacity 0.3s ease;
  cursor: move;
}
.storyteller-cinema-tray-app:hover {
  opacity: 1;
}

/* Oclusão Dinâmica: Se o Simple Requests estiver na tela, subir a bandeja inteira 60px para não sobrepor */
body:has(#simple-requests-chat-body) .storyteller-cinema-tray-app {
  bottom: 60px !important;
}

.cinema-tray-container {
  pointer-events: all;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(10, 10, 10, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 15px;
  padding: 5px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
  transition: all 0.3s ease;
  max-width: 90vw;
  margin-bottom: 0;
}
.cinema-tray-container .tray-handle {
  padding: 4px 20px;
  color: #888;
  font-size: 10px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.cinema-tray-container .tray-content {
  display: flex;
  padding: 8px 12px;
  gap: 10px;
  overflow-x: auto;
}
.cinema-tray-container .tray-content::-webkit-scrollbar {
  height: 4px;
}
.cinema-tray-container .tray-content::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 2px;
}
.cinema-tray-container .tray-content .tray-item {
  flex: 0 0 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid #444;
  background: #000;
  cursor: pointer;
  position: relative;
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.cinema-tray-container .tray-content .tray-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cinema-tray-container .tray-content .tray-item i {
  font-size: 24px;
  color: #aaa;
}
.cinema-tray-container .tray-content .tray-item:hover {
  border-color: #ff6400;
  transform: scale(1.15) translateY(-5px);
  z-index: 10;
}
.cinema-tray-container .tray-content .tray-item:hover i {
  color: #ff6400;
}
.cinema-tray-container .tray-content .tray-item.active {
  border-color: #ff6400;
  box-shadow: 0 0 15px #ff6400;
  transform: scale(1.1);
}
.cinema-tray-container .tray-content .tray-item.active-stage {
  border-color: #00ccff;
  box-shadow: 0 0 10px #00ccff;
}
.cinema-tray-container .tray-content .tray-item.narrator-btn i {
  color: #ff6400;
}
.cinema-tray-container .tray-content .tray-item.clear-btn:hover i {
  color: #ff3333;
}

/* Animations */
@keyframes cinematicFadeIn {
  from {
    opacity: 0;
    transform: translateY(120px) scale(0.95);
    filter: blur(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}
@keyframes cinematicFadeInCenter {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}
/* Director Mode UI */
.director-mode-btn {
  background: rgba(255, 100, 0, 0.2) !important;
  color: #ff6400 !important;
  border: 1px solid #ff6400 !important;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-left: 10px;
}
.director-mode-btn.active {
  background: #ff6400 !important;
  color: #fff !important;
  box-shadow: 0 0 10px #ff6400;
}
.director-mode-btn:hover {
  transform: scale(1.1);
}

/* --- Chat Overlay (REMOVED) --- */
/* ==========================================================================
   SYSTEM COMPATIBILITY FIXES
   ========================================================================== */
/* --- Pathfinder 2e (PF2e) Character Sheet Compatibility Fix --- 
   Prevents layout collapse and overlapping in .sheet-content by enabling flex-wrap.
*/
.actor.sheet section.window-content form.crb-style .sheet-body .sheet-content,
.actor.sheet section.window-content form.crb-style .sheet-body .sheet-content .inventory {
  flex-wrap: wrap;
}

/* ==========================================================================
   PREMIUM KEY MANAGER & SHOWCASE APPS
   ========================================================================== */
#storyteller-cinema-key-manager {
  background: #141517 !important;
  color: #e5e5e5;
  font-family: "Inter", sans-serif;
}

.key-manager-app {
  padding: 15px;
  gap: 15px;
  height: 100%;
  overflow-y: auto;
}
.key-manager-app .section-keys-input {
  gap: 10px;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  padding: 12px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.key-manager-app .section-keys-input .new-key-field {
  flex: 2;
  background: #0f1011;
  color: #fff;
  border: 1px solid #333;
  padding: 8px 12px;
  border-radius: 4px;
  font-family: monospace;
}
.key-manager-app .section-keys-input .new-key-field:focus {
  border-color: #e9c46a;
  box-shadow: 0 0 5px rgba(233, 196, 106, 0.3);
}
.key-manager-app .section-keys-input .add-key-btn {
  background: #2a9d8f;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 6px;
}
.key-manager-app .section-keys-input .add-key-btn:hover {
  background: #21867a;
}
.key-manager-app .section-keys-input .patreon-oauth-btn {
  background: #FF424D;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 6px;
}
.key-manager-app .section-keys-input .patreon-oauth-btn:hover {
  background: #e63b44;
}
.key-manager-app .active-keys-section h3 {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 6px;
  margin-bottom: 10px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}
.key-manager-app .active-keys-section .keys-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.key-manager-app .active-keys-section .keys-list .key-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 10px 15px;
  border-radius: 5px;
  align-items: center;
  justify-content: space-between;
}
.key-manager-app .active-keys-section .keys-list .key-item .key-code {
  font-family: monospace;
  font-weight: bold;
  color: #ffd700;
  letter-spacing: 1px;
}
.key-manager-app .active-keys-section .keys-list .key-item .tag {
  padding: 3px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
}
.key-manager-app .active-keys-section .keys-list .key-item .tag.dev {
  background: rgba(155, 89, 182, 0.2);
  color: #9b59b6;
  border: 1px solid #9b59b6;
}
.key-manager-app .active-keys-section .keys-list .key-item .tag.patreon {
  background: rgba(255, 66, 77, 0.2);
  color: #ff424d;
  border: 1px solid #ff424d;
}
.key-manager-app .active-keys-section .keys-list .key-item .tag.promo {
  background: rgba(46, 204, 113, 0.2);
  color: #2ecc71;
  border: 1px solid #2ecc71;
}
.key-manager-app .active-keys-section .keys-list .key-item .tag.free {
  background: rgba(127, 140, 141, 0.2);
  color: #bdc3c7;
  border: 1px solid #7f8c8d;
}
.key-manager-app .active-keys-section .keys-list .key-item .remove-key-btn {
  background: transparent;
  color: #e74c3c;
  border: none;
  cursor: pointer;
  padding: 5px;
  font-size: 14px;
  transition: color 0.2s, transform 0.1s;
}
.key-manager-app .active-keys-section .keys-list .key-item .remove-key-btn:hover {
  color: #c0392b;
  transform: scale(1.1);
}
.key-manager-app .active-keys-section .empty-message {
  color: #7f8c8d;
  font-style: italic;
  text-align: center;
  padding: 10px;
}
.key-manager-app .packs-vitrine-section h3 {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 6px;
  margin-bottom: 12px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}
.key-manager-app .packs-vitrine-section .packs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.key-manager-app .packs-vitrine-section .packs-grid .pack-showcase-card {
  position: relative;
  height: 120px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background-size: cover;
  background-position: center;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 12px;
  box-sizing: border-box;
  overflow: hidden;
}
.key-manager-app .packs-vitrine-section .packs-grid .pack-showcase-card.locked {
  border-color: rgba(231, 76, 60, 0.3);
}
.key-manager-app .packs-vitrine-section .packs-grid .pack-showcase-card.unlocked {
  border-color: rgba(46, 204, 113, 0.3);
}
.key-manager-app .packs-vitrine-section .packs-grid .pack-showcase-card .card-status-indicator {
  position: absolute;
  top: 10px;
  right: 10px;
}
.key-manager-app .packs-vitrine-section .packs-grid .pack-showcase-card .card-status-indicator .status-tag {
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: bold;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}
.key-manager-app .packs-vitrine-section .packs-grid .pack-showcase-card .card-status-indicator .status-tag.unlocked-tag {
  background: #2ecc71;
  color: #fff;
}
.key-manager-app .packs-vitrine-section .packs-grid .pack-showcase-card .card-status-indicator .status-tag.locked-tag {
  background: #e74c3c;
  color: #fff;
}
.key-manager-app .packs-vitrine-section .packs-grid .pack-showcase-card .card-info {
  z-index: 2;
}
.key-manager-app .packs-vitrine-section .packs-grid .pack-showcase-card .card-info h4 {
  margin: 0 0 4px 0;
  color: #fff;
  font-size: 13px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}
.key-manager-app .packs-vitrine-section .packs-grid .pack-showcase-card .card-info .pack-description {
  margin: 0 0 6px 0;
  font-size: 10px;
  color: #ccc;
  line-height: 1.3;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}
.key-manager-app .packs-vitrine-section .packs-grid .pack-showcase-card .card-info .buy-pack-link {
  font-size: 10px;
  color: #e9c46a;
  text-decoration: none;
  font-weight: bold;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.key-manager-app .packs-vitrine-section .packs-grid .pack-showcase-card .card-info .buy-pack-link:hover {
  color: #f4a261;
  text-decoration: underline;
}