/* ==========================================================================
   Screenwriting by Stukes — Fall Weather Theme
   Created by thestukescompany.com
   ========================================================================== */

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-script: 'Courier Prime', Courier, "Courier New", monospace;

  /* Theme: Fall Weather Dark (Cozy Spiced Cider, Roasted Chestnut & Autumn Terracotta) */
  --bg-app: #181310;
  --bg-surface: #221a15;
  --bg-surface-elevated: #2d231c;
  --bg-surface-hover: #3d2f26;
  --bg-page: #fffdfa;
  --text-page: #1a130e;

  --border-color: #3e3127;
  --border-subtle: #2b211a;
  --text-main: #fdf7f0;
  --text-muted: #c2b09e;
  --text-dim: #877464;

  --primary-color: #e06b24;          /* Warm Autumn Pumpkin / Terracotta */
  --primary-hover: #c75816;          /* Deep Spiced Cinnamon */
  --primary-alpha: rgba(224, 107, 36, 0.18);

  --accent-gold: #e59c24;           /* Golden Maple Leaf */
  --accent-emerald: #4d735a;        /* Autumn Pine & Moss */
  --accent-purple: #8c3b4a;         /* Spiced Plum */
  --accent-rose: #bf3d3d;           /* Autumn Crimson */

  --sidebar-width: 280px;
  --header-height: 56px;
  --statusbar-height: 32px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --shadow-elevation: 0 10px 25px -5px rgba(18, 11, 7, 0.65), 0 8px 10px -6px rgba(18, 11, 7, 0.55);
}

[data-theme="light"] {
  /* Theme: Fall Weather Light (Crisp Autumn Morning, Warm Linen & Cider Pumpkin) */
  --bg-app: #f4eee4;
  --bg-surface: #fbf8f2;
  --bg-surface-elevated: #efe5d6;
  --bg-surface-hover: #e5d8c6;
  --bg-page: #ffffff;
  --text-page: #1e130d;

  --border-color: #d8c8b4;
  --border-subtle: #e6dac8;
  --text-main: #2d1e14;
  --text-muted: #6e5645;
  --text-dim: #997e6a;

  --primary-color: #c9571b;
  --primary-hover: #aa430e;
  --primary-alpha: rgba(201, 87, 27, 0.14);

  --accent-gold: #c2811a;
  --accent-emerald: #3c634a;
  --accent-purple: #7a323f;
  --accent-rose: #a62e2e;

  --shadow-elevation: 0 10px 25px -5px rgba(50, 30, 15, 0.1), 0 8px 10px -6px rgba(50, 30, 15, 0.05);
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body.desktop-app {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

/* --------------------------------------------------------------------------
   App Header & Toolbar
   -------------------------------------------------------------------------- */
.app-header {
  height: var(--header-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo-link {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.brand-logo-pill {
  height: 34px;
  padding: 3px 10px;
  background: #ffffff;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(224, 107, 36, 0.35);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.brand-logo-pill:hover {
  transform: scale(1.03);
  border-color: var(--primary-color);
}

.brand-logo-img {
  height: 22px;
  width: auto;
  display: block;
}

.brand-title-group {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.brand-title {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
  color: var(--text-main);
  line-height: 1.15;
}

.brand-creator-link {
  font-size: 0.7rem;
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: color 0.12s ease;
}

.brand-creator-link:hover {
  color: var(--accent-gold);
  text-decoration: underline;
}

.project-filename {
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--bg-surface-elevated);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  max-width: 190px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-left: 4px;
}

/* Menu Dropdowns */
.app-menubar {
  display: flex;
  align-items: center;
  gap: 4px;
}

.menu-dropdown {
  position: relative;
}

.menu-trigger {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.menu-trigger:hover, .menu-dropdown:focus-within .menu-trigger {
  color: var(--text-main);
  background: var(--bg-surface-hover);
}

.menu-content {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-elevation);
  min-width: 250px;
  padding: 6px;
  z-index: 1000;
  backdrop-filter: blur(10px);
}

.menu-dropdown:hover .menu-content,
.menu-dropdown:focus-within .menu-content {
  display: block;
}

.menu-content button,
.menu-content .menu-link-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: transparent;
  border: none;
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: background 0.12s ease;
}

.menu-content button .icon,
.menu-content .menu-link-item .icon {
  margin-right: 8px;
}

.menu-content button:hover:not(:disabled),
.menu-content .menu-link-item:hover {
  background: var(--primary-color);
  color: #fff;
}

.menu-content button:hover:not(:disabled) kbd {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.menu-content button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.menu-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 4px 0;
}

kbd {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  padding: 2px 5px;
  color: var(--text-muted);
}

.badge {
  display: inline-block;
  width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  background: var(--bg-surface);
  border-radius: 50%;
  font-size: 0.75rem;
  margin-right: 8px;
}

/* Header Center: View Tabs */
.header-center {
  display: flex;
  align-items: center;
}

.view-tabs {
  display: flex;
  background: var(--bg-surface-elevated);
  border-radius: var(--radius-md);
  padding: 3px;
  border: 1px solid var(--border-subtle);
}

.view-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.view-tab:hover {
  color: var(--text-main);
}

.view-tab.active {
  background: var(--bg-surface);
  color: var(--text-main);
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Header Right */
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.element-tag {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--primary-alpha);
  color: var(--primary-color);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.quick-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.icon-btn:hover:not(:disabled) {
  color: var(--text-main);
  background: var(--bg-surface-hover);
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   App Layout & Sidebar
   -------------------------------------------------------------------------- */
.app-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

.app-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: margin-left 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.app-sidebar.collapsed {
  margin-left: calc(-1 * var(--sidebar-width));
}

.sidebar-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-title {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.scene-count-badge {
  font-size: 0.75rem;
  background: var(--bg-surface-elevated);
  padding: 2px 7px;
  border-radius: 10px;
  color: var(--text-dim);
}

.sidebar-search {
  padding: 10px 14px;
}

.sidebar-search input {
  width: 100%;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 0.8rem;
  outline: none;
}

.sidebar-search input:focus {
  border-color: var(--primary-color);
}

.scene-list-container {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px;
}

.scene-list {
  list-style: none;
}

.scene-item {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: background 0.12s ease;
  border-left: 3px solid transparent;
}

.scene-item:hover {
  background: var(--bg-surface-hover);
}

.scene-item.active {
  background: var(--bg-surface-elevated);
  border-left-color: var(--primary-color);
}

.scene-item-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-script);
}

.scene-item-meta {
  font-size: 0.72rem;
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
}

.sidebar-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--border-subtle);
}

.sidebar-action-btn {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.sidebar-action-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--primary-color);
}

/* --------------------------------------------------------------------------
   Workspace & View Panels
   -------------------------------------------------------------------------- */
.app-workspace {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: var(--bg-app);
}

.view-panel {
  position: absolute;
  inset: 0;
  display: none;
  overflow: hidden;
}

.view-panel.active {
  display: flex;
  flex-direction: column;
}

/* Editor Scroll Wrapper */
.editor-scroll-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 40px 0 120px 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  scroll-behavior: smooth;
}

.page-container {
  width: 850px;
  max-width: 95vw;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.page-container > * {
  flex-shrink: 0;
}

/* Floating Element Bar */
.floating-element-bar {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: 30px;
  padding: 5px 8px;
  display: flex;
  gap: 6px;
  box-shadow: var(--shadow-elevation);
  z-index: 50;
  backdrop-filter: blur(8px);
}

.element-pill {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.element-pill:hover {
  background: var(--bg-surface-hover);
  color: var(--text-main);
}

.element-pill.active {
  background: var(--primary-color);
  color: #fff;
}

/* Autocomplete Popup */
.autocomplete-popup {
  position: absolute;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-elevation);
  min-width: 220px;
  max-height: 250px;
  overflow-y: auto;
  z-index: 1000;
  padding: 6px;
}

.popup-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 4px 8px;
  font-weight: 600;
}

.popup-item {
  padding: 6px 10px;
  font-size: 0.85rem;
  font-family: var(--font-script);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.popup-item:hover, .popup-item.selected {
  background: var(--primary-color);
  color: #fff;
}

/* --------------------------------------------------------------------------
   Corkboard / Index Cards View
   -------------------------------------------------------------------------- */
.corkboard-toolbar {
  padding: 20px 28px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.corkboard-toolbar h2 {
  font-size: 1.2rem;
  font-weight: 600;
}

.corkboard-grid {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  align-content: start;
}

.index-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  transition: transform 0.15s ease, border-color 0.15s ease;
  min-height: 190px;
  border-top: 4px solid var(--primary-color);
}

.index-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary-hover);
}

.index-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.index-card-num {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary-color);
}

.index-card-title {
  font-family: var(--font-script);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
}

.index-card-body {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
  flex: 1;
  outline: none;
}

/* --------------------------------------------------------------------------
   Reports & Analytics
   -------------------------------------------------------------------------- */
.reports-container {
  flex: 1;
  overflow-y: auto;
  padding: 28px 40px;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

.report-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.report-tab {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.report-tab.active {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: #fff;
}

.report-card {
  display: none;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.report-card.active {
  display: block;
}

.report-card-header {
  margin-bottom: 20px;
}

.report-card-header h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table th, .data-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}

.data-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.data-table td {
  color: var(--text-main);
}

.data-table tr:hover td {
  background: var(--bg-surface-elevated);
}

.stats-metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.metric-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
}

.metric-val {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 4px;
}

.metric-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Status Bar
   -------------------------------------------------------------------------- */
.app-statusbar {
  height: var(--statusbar-height);
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.status-left, .status-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-item strong {
  color: var(--text-main);
}

.tip {
  color: var(--text-dim);
}

/* --------------------------------------------------------------------------
   Modals & Dialogs
   -------------------------------------------------------------------------- */
.app-modal {
  border: none;
  background: transparent;
  padding: 0;
  max-width: 550px;
  width: 90%;
  margin: auto;
}

.app-modal::backdrop {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

.modal-box {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-elevation);
  overflow: hidden;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.form-row {
  display: flex;
  gap: 12px;
  margin: 16px 0;
  flex-wrap: wrap;
}

.form-row label {
  display: flex;
  flex-direction: column;
  font-size: 0.8rem;
  color: var(--text-muted);
  gap: 4px;
}

.form-row select, .form-row input {
  padding: 7px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.85rem;
}

.name-results-container {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  margin-top: 12px;
}

.name-results-list {
  list-style: none;
  padding: 6px;
}

.name-result-item {
  padding: 6px 10px;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.name-result-item:hover {
  background: var(--primary-alpha);
  color: var(--primary-color);
}

.shortcuts-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.shortcut-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  padding: 4px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.primary-btn {
  background: var(--primary-color);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.primary-btn:hover {
  background: var(--primary-hover);
}

.secondary-btn {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
}

.secondary-btn:hover {
  background: var(--bg-surface-hover);
}

.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.about-icon { font-size: 2.8rem; margin-bottom: 10px; }

/* Zen Mode */
body.zen-mode .app-header,
body.zen-mode .app-sidebar,
body.zen-mode .app-statusbar,
body.zen-mode .floating-element-bar {
  display: none !important;
}

body.zen-mode .editor-scroll-wrapper {
  padding-top: 60px;
}

/* ==========================================================================
   Accessibility: WCAG 2.1 AA Focus-Visible Indicators & Keyboard States
   ========================================================================== */
:focus-visible {
  outline: 2px solid var(--primary-color) !important;
  outline-offset: 2px !important;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible,
[role="tab"]:focus-visible,
[role="menuitem"]:focus-visible,
[tabindex="0"]:focus-visible {
  outline: 2px solid var(--primary-color) !important;
  outline-offset: 2px !important;
}

.scene-item:focus-visible,
.index-card:focus-visible,
.name-result-item:focus-visible {
  outline: 2px solid var(--primary-color) !important;
  outline-offset: 2px !important;
  background: var(--bg-surface-hover) !important;
}

.modal-close:focus-visible {
  outline: 2px solid var(--primary-color) !important;
  outline-offset: 2px !important;
  border-radius: var(--radius-sm);
}

.index-card-body:focus-visible {
  outline: 1px dashed var(--primary-color) !important;
  outline-offset: 3px !important;
}

/* ==========================================================================
   Story Structure & Tension Arc Visualization Styles
   ========================================================================== */
.tension-arc-container {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 24px;
}

.tension-arc-svg {
  width: 100%;
  max-height: 280px;
  display: block;
  overflow: visible;
}

.tension-arc-svg .arc-point {
  cursor: pointer;
  outline: none;
}

.tension-arc-svg .arc-point:hover circle,
.tension-arc-svg .arc-point:focus circle {
  r: 7px;
  stroke-width: 3.5px;
  fill: #ffffff;
}

.beat-outliner-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.beat-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.beat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.beat-num {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary-color);
  background: var(--primary-alpha);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.beat-act-tag {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.beat-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
}

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

.beat-scenes-list {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.beat-scene-tag {
  font-size: 0.75rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  color: var(--text-main);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}

.beat-scene-tag:hover {
  border-color: var(--primary-color);
}

/* ==========================================================================
   Screenplay Linter Diagnostics Styles
   ========================================================================== */
.linter-summary-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.linter-stat-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
}

.linter-stat-pill.pill-errors {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.08);
}

.linter-stat-pill.pill-warnings {
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.08);
}

.linter-stat-pill.pill-suggestions {
  color: #06b6d4;
  border-color: rgba(6, 182, 212, 0.3);
  background: rgba(6, 182, 212, 0.08);
}

.severity-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.severity-badge.error {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.severity-badge.warning {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.severity-badge.suggestion {
  background: rgba(6, 182, 212, 0.15);
  color: #06b6d4;
  border: 1px solid rgba(6, 182, 212, 0.4);
}

.jump-line-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--primary-color);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.jump-line-btn:hover {
  background: var(--primary-color);
  color: #ffffff;
  border-color: var(--primary-color);
}

/* --------------------------------------------------------------------------
   Retro 90s Browser Box Modal (Message from Julius Stukes Jr)
   -------------------------------------------------------------------------- */
.retro-browser-dialog {
  max-width: 720px;
  width: 95%;
  background: transparent;
  border: none;
  padding: 0;
  box-shadow: none;
}

.retro-browser-dialog::backdrop {
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

.retro-browser-box {
  background: #c0c0c0;
  color: #000000;
  font-family: 'MS Sans Serif', Tahoma, 'Segoe UI', Arial, sans-serif;
  border: 2px solid;
  border-color: #dfdfdf #404040 #404040 #dfdfdf;
  box-shadow: inset 1px 1px #ffffff, inset -1px -1px #808080, 4px 6px 20px rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
  user-select: text;
}

/* 1. Retro Titlebar */
.retro-titlebar {
  background: linear-gradient(90deg, #000080 0%, #1084d0 100%);
  color: #ffffff;
  padding: 3px 4px 3px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: bold;
  font-size: 12px;
  letter-spacing: 0.02em;
}

.retro-title-text {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.retro-browser-icon {
  font-size: 13px;
}

.retro-title-heading {
  font-weight: 700;
  text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.4);
}

.retro-window-controls {
  display: flex;
  gap: 2px;
}

.retro-win-btn {
  background: #c0c0c0;
  color: #000000;
  border: 2px solid;
  border-color: #ffffff #404040 #404040 #ffffff;
  box-shadow: inset 1px 1px #dfdfdf;
  width: 17px;
  height: 15px;
  font-size: 10px;
  font-family: Tahoma, 'Segoe UI', sans-serif;
  font-weight: bold;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}

.retro-win-btn:active {
  border-color: #404040 #ffffff #ffffff #404040;
  padding: 1px 0 0 1px;
}

.retro-win-close {
  font-size: 13px;
  font-weight: 800;
}

/* 2. Retro Menubar */
.retro-menubar {
  background: #c0c0c0;
  border-bottom: 1px solid #808080;
  display: flex;
  gap: 12px;
  padding: 3px 8px;
  font-size: 11px;
  color: #000000;
}

.retro-menu-item {
  cursor: default;
  padding: 1px 4px;
}

.retro-menu-item:hover {
  background: #000080;
  color: #ffffff;
}

/* 3. Retro Toolbar */
.retro-toolbar {
  background: #c0c0c0;
  border-bottom: 1px solid #808080;
  padding: 4px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.retro-toolbar-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.retro-tool-btn {
  background: #c0c0c0;
  color: #000000;
  border: 2px solid;
  border-color: #ffffff #404040 #404040 #ffffff;
  padding: 2px 7px;
  font-size: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-family: Tahoma, 'Segoe UI', sans-serif;
  box-shadow: inset 1px 1px #dfdfdf;
}

.retro-tool-btn:active {
  border-color: #404040 #ffffff #ffffff #404040;
  padding: 3px 6px 1px 8px;
}

.retro-btn-icon {
  font-size: 11px;
}

.retro-btn-lbl {
  font-size: 10px;
}

.retro-throbber {
  width: 36px;
  height: 28px;
  background: #ffffff;
  border: 2px solid;
  border-color: #808080 #ffffff #ffffff #808080;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  flex-shrink: 0;
}

.retro-throbber-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* 4. Retro Address Bar */
.retro-addressbar {
  background: #c0c0c0;
  border-bottom: 2px solid;
  border-color: #808080 #ffffff #ffffff #808080;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}

.retro-address-label {
  font-weight: bold;
}

.retro-address-field {
  flex: 1;
  background: #ffffff;
  color: #000000;
  border: 2px solid;
  border-color: #808080 #ffffff #ffffff #808080;
  padding: 2px 6px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.retro-address-proto {
  color: #808080;
}

.retro-address-url {
  color: #000080;
  font-weight: bold;
}

/* 5. Document Viewport */
.retro-viewport {
  background: #ffffff;
  color: #000000;
  border: 2px solid;
  border-color: #808080 #ffffff #ffffff #808080;
  margin: 4px;
  max-height: 570px;
  overflow-y: auto;
  padding: 16px 20px;
  font-family: 'Times New Roman', Times, Georgia, serif;
  line-height: 1.5;
}

.retro-page-container {
  display: flex;
  flex-direction: column;
}

.retro-page-header {
  text-align: center;
  margin-bottom: 8px;
}

.retro-banner-box {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.retro-page-logo {
  height: 36px;
  width: auto;
  background: #ffffff;
  padding: 2px 8px;
  border: 1px solid #c0c0c0;
}

.retro-page-h1 {
  font-family: 'Courier New', Courier, monospace;
  font-size: 1.15rem;
  font-weight: 800;
  color: #800000;
  margin: 4px 0 0 0;
  letter-spacing: 0.05em;
}

.retro-page-sub {
  font-family: Tahoma, 'Segoe UI', sans-serif;
  font-size: 0.75rem;
  color: #555555;
  margin: 0;
}

.retro-etched-rule {
  height: 2px;
  border-top: 1px solid #808080;
  border-bottom: 1px solid #ffffff;
  margin: 12px 0;
}

.retro-message-content {
  font-size: 1.05rem;
  color: #111111;
}

.retro-lead-p {
  margin-bottom: 12px;
  font-size: 1.05rem;
}

.retro-pledge-callout {
  background: #fff8e7;
  border: 2px dashed #e06b24;
  padding: 12px 16px;
  margin: 14px 0;
  text-align: center;
  color: #b73e00;
  font-family: 'Courier New', Courier, monospace;
}

.retro-callout-header {
  font-size: 0.75rem;
  font-weight: bold;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
  color: #800000;
}

.retro-pledge-text {
  font-weight: 800;
  font-size: 1.05rem;
  margin: 0;
  line-height: 1.4;
}

.retro-contact-p {
  font-size: 1rem;
  margin-top: 12px;
  line-height: 1.6;
}

.retro-link {
  color: #0000cc;
  text-decoration: underline;
  font-weight: bold;
}

.retro-link:visited {
  color: #800080;
}

.retro-link:hover {
  color: #ff0000;
}

.retro-zelle-tag {
  display: inline-block;
  background: #7414ca;
  color: #ffffff;
  font-family: Tahoma, sans-serif;
  font-size: 0.75rem;
  font-weight: bold;
  padding: 2px 7px;
  border-radius: 3px;
  margin-left: 4px;
  letter-spacing: 0.05em;
}

.retro-badges-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.retro-chip-btn {
  background: #efefef;
  color: #0000cc;
  border: 2px solid;
  border-color: #ffffff #808080 #808080 #ffffff;
  padding: 5px 12px;
  font-family: Tahoma, 'Segoe UI', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.retro-chip-btn:hover {
  background: #dfdfdf;
  color: #ff0000;
}

.retro-chip-btn:active {
  border-color: #808080 #ffffff #ffffff #808080;
}

.retro-signature-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: Tahoma, sans-serif;
  font-size: 0.72rem;
  color: #666666;
}

.retro-sig-right {
  font-weight: bold;
  font-style: italic;
}

/* 6. Retro Status Bar */
.retro-statusbar {
  background: #c0c0c0;
  border-top: 1px solid #ffffff;
  padding: 3px 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}

.retro-status-cell {
  border: 1px solid;
  border-color: #808080 #ffffff #ffffff #808080;
  padding: 2px 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.retro-status-main {
  flex: 1;
}

.retro-status-light {
  font-size: 9px;
}

.retro-status-zone {
  width: 110px;
  color: #555555;
}

.retro-status-action {
  padding: 1px 4px;
  border: none;
}

.retro-dialog-ok-btn {
  background: #c0c0c0;
  color: #000000;
  border: 2px solid;
  border-color: #ffffff #404040 #404040 #ffffff;
  box-shadow: inset 1px 1px #dfdfdf;
  padding: 2px 14px;
  font-size: 11px;
  font-family: Tahoma, 'Segoe UI', sans-serif;
  font-weight: bold;
  cursor: pointer;
}

.retro-dialog-ok-btn:active {
  border-color: #404040 #ffffff #ffffff #404040;
  padding: 3px 13px 1px 15px;
}

/* Founder Note Pill in header */
.founder-note-pill {
  background: rgba(224, 107, 36, 0.15);
  color: var(--primary-color);
  border: 1px solid rgba(224, 107, 36, 0.4);
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
  line-height: 1.2;
}

.founder-note-pill:hover {
  background: var(--primary-color);
  color: #ffffff;
  border-color: var(--primary-color);
}

.founder-quick-btn {
  color: var(--primary-color);
}

.founder-quick-btn:hover {
  color: #ffffff;
  background: var(--primary-color);
}

/* ==========================================================================
   Mobile Responsive Suite & Touch Experience (<= 768px)
   ========================================================================== */

/* 1. Mobile Keyboard Format Accessory Bar */
.mobile-keyboard-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-surface-elevated);
  border-top: 1px solid var(--border-color);
  padding: 8px 10px;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  z-index: 95;
  box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.4);
}

.mobile-format-chip {
  flex-shrink: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 8px 12px;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  touch-action: manipulation;
  transition: all 0.15s ease;
  min-height: 38px;
}

.mobile-format-chip:active,
.mobile-format-chip.active {
  background: var(--primary-color);
  color: #ffffff;
  border-color: var(--primary-color);
}

.mobile-sidebar-close {
  display: none;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(2px);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.sidebar-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.mobile-menu-toggle-btn {
  display: none;
}

@media (max-width: 768px) {
  /* Show mobile-specific controls */
  .mobile-keyboard-bar {
    display: flex;
  }

  .mobile-sidebar-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    color: var(--text-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
  }

  .mobile-sidebar-close:active {
    background: rgba(255, 255, 255, 0.1);
  }

  .mobile-menu-toggle-btn {
    display: inline-flex;
  }

  .floating-element-bar {
    display: none !important; /* Replaced by sticky mobile keyboard bar */
  }

  /* 2. Compact Mobile Header */
  .app-header {
    height: auto !important;
    min-height: auto !important;
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 8px 12px !important;
    gap: 8px !important;
  }

  .header-left {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    flex-wrap: wrap;
    gap: 6px;
  }

  .brand-title {
    font-size: 0.95rem;
  }

  .brand-creator-link {
    font-size: 0.68rem;
  }

  .project-filename {
    display: none;
  }

  .app-menubar {
    display: none;
    position: absolute;
    top: 100%;
    left: 8px;
    right: 8px;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
    flex-direction: column;
    padding: 8px;
    z-index: 1000;
  }

  .app-menubar.mobile-open {
    display: flex;
  }

  .app-menubar .menu-dropdown {
    width: 100%;
  }

  .app-menubar .menu-trigger {
    width: 100%;
    text-align: left;
    padding: 8px 12px;
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
  }

  .app-menubar .menu-dropdown:hover .menu-content,
  .app-menubar .menu-dropdown:focus-within .menu-content {
    position: static;
    display: block;
    box-shadow: none;
    border: none;
    background: transparent;
    padding-left: 12px;
  }

  .header-center {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }

  .view-tabs {
    display: flex;
    width: 100%;
    justify-content: stretch;
    gap: 4px;
  }

  .view-tab {
    flex: 1;
    font-size: 0.75rem;
    padding: 6px 8px;
    white-space: nowrap;
    justify-content: center;
  }

  .header-right {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }

  .element-selector-wrap {
    display: none;
  }

  .quick-buttons {
    display: flex;
    gap: 4px;
    width: 100%;
    justify-content: space-between;
  }

  /* 3. Off-Canvas Scene Navigator Drawer */
  .app-layout {
    position: relative;
    overflow-x: hidden;
  }

  .app-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 300px;
    max-width: 82vw;
    z-index: 999;
    background: var(--bg-surface-elevated);
    border-right: 1px solid var(--border-color);
    box-shadow: none;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .app-sidebar.mobile-drawer-open {
    transform: translateX(0);
    box-shadow: 4px 0 30px rgba(0, 0, 0, 0.75);
  }

  .sidebar-backdrop {
    display: block;
  }

  .app-workspace {
    width: 100%;
    min-width: 0;
  }

  .editor-scroll-wrapper {
    padding: 0 !important;
  }

  .page-container {
    padding: 0 !important;
    width: 100% !important;
  }

  /* 4. Compact Status Bar */
  .app-statusbar {
    display: none;
  }

  /* 5. Retro 90s Browser Pop-up on Mobile */
  .retro-browser-dialog {
    max-width: 95% !important;
    width: 95% !important;
    margin: auto !important;
  }

  .retro-titlebar {
    font-size: 11px;
    padding: 2px 4px;
  }

  .retro-menubar {
    display: none;
  }

  .retro-toolbar {
    padding: 3px 4px;
    gap: 4px;
    flex-wrap: wrap;
  }

  .retro-throbber {
    display: none;
  }

  .retro-tool-btn {
    padding: 2px 5px;
    font-size: 9px;
  }

  .retro-addressbar {
    padding: 2px 4px;
    font-size: 10px;
  }

  .retro-address-field {
    font-size: 10px;
  }

  .retro-viewport {
    max-height: 52vh !important;
    padding: 12px 14px !important;
    font-size: 14px;
  }

  .retro-lead-p {
    font-size: 14px !important;
  }

  .retro-pledge-callout {
    padding: 8px 10px !important;
    margin: 10px 0 !important;
  }

  .retro-pledge-text {
    font-size: 12.5px !important;
  }

  .retro-contact-p {
    font-size: 13px !important;
  }

  .retro-badges-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .retro-chip-btn {
    width: 100%;
    justify-content: center;
    padding: 6px 10px;
    font-size: 12px;
  }

  .retro-statusbar {
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    height: auto;
    padding: 4px;
  }

  .retro-status-zone {
    display: none;
  }

  .retro-dialog-ok-btn {
    width: 100%;
    padding: 6px 12px;
    font-size: 13px;
  }

  /* 6. Analytics & Reports on Mobile */
  .report-subtabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }

  .report-tab {
    flex-shrink: 0;
    font-size: 0.75rem;
    padding: 6px 12px;
  }

  .corkboard-grid {
    grid-template-columns: 1fr !important;
  }

  .structure-metric-grid {
    grid-template-columns: 1fr 1fr !important;
  }

  .beat-outliner-grid {
    grid-template-columns: 1fr !important;
  }

  .stats-metric-grid {
    grid-template-columns: 1fr 1fr !important;
  }
}

/* Drag and Drop PDF / Screenplay file import overlay */
.editor-scroll-wrapper.drag-over-active {
  outline: 3px dashed var(--accent-orange, #d97736) !important;
  outline-offset: -8px;
  background-color: rgba(217, 119, 54, 0.08) !important;
  transition: all 0.2s ease;
}
