@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --text: #111111;
  --text-soft: #5d6675;
  --line: #6c6c6c;
  --line-soft: rgba(108, 108, 108, 0.28);
  --primary: #2683eb;
  --sidebar-bg: #000000;
  --header-bg: #ffffff;
  --workspace-bg: linear-gradient(180deg, rgba(168, 211, 255, 0.58) 0%, rgba(255, 244, 223, 0.62) 100%);
  --shadow: 0 6px 18px rgba(17, 17, 17, 0.06);
  --shadow-hover: 0 10px 24px rgba(17, 17, 17, 0.1);
  --focus-ring: 0 0 0 3px rgba(38, 131, 235, 0.2);
  --fs-body: 14px;
  --fs-ui: 14px;
  --fs-meta: 12px;
  --fs-card-title: 16px;
  --fs-project: 14px;
  --lh-body: 1.5714;
  --lh-tight: 1.375;
  --space-card: 20px;
  --space-gap: 12px;
  --app-max-width: 1880px;
  --transition-fast: 180ms ease;
}

* {
  box-sizing: border-box;
}

html,
body,
#root {
  min-height: 100%;
  margin: 0;
}

body {
  font-family: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--text);
  background: var(--bg);
}

.app-shell {
  min-height: 100vh;
  padding: 0;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 0;
  align-items: start;
  width: 100%;
  max-width: none;
  margin: 0;
}

.app-shell-home {
  display: grid;
  place-items: center;
}

.home-panel {
  width: min(920px, 100%);
  border: 1px solid var(--line-soft);
  background: var(--surface);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.home-copy h1 {
  margin: 0;
  font-size: clamp(2.1rem, 4vw, 3.4rem);
  line-height: 0.98;
  display: inline-block;
  padding: 4px 10px;
  background: #f1f1f1;
}

.home-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.home-button {
  min-height: 56px;
  justify-content: center;
}

.home-button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.home-button-primary {
  min-height: 62px;
  font-size: 1.02rem;
}

.home-upgrade-row {
  display: flex;
  justify-content: flex-start;
}

.upgrade-status {
  color: var(--text-soft);
  font-size: 0.95rem;
}

.home-notes {
  border-top: 1px solid var(--line-soft);
  padding-top: 14px;
  color: var(--text-soft);
  line-height: 1.55;
}

.home-notes p {
  margin: 0;
}

.reset-local-button {
  margin-top: 10px;
}

.home-notes code {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 0.92em;
  background: #f3f3f3;
  padding: 2px 5px;
}

.recent-projects {
  border-top: 1px solid var(--line-soft);
  padding-top: 16px;
}

.recent-project-list {
  display: grid;
  gap: 10px;
}

.recent-project-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: #fafafa;
  color: var(--text);
  text-align: left;
}

.recent-project-item:hover {
  background: #f0f0f0;
}

.recent-project-title {
  font-weight: 700;
}

.recent-project-file {
  color: var(--text-soft);
  font-size: 0.92rem;
}

.project-sidebar,
.workspace {
  min-width: 0;
}

.project-sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  border: 0;
  background: var(--sidebar-bg);
  color: #ffffff;
  min-height: 100vh;
  border-radius: 0;
  box-shadow: none;
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px 20px;
  min-height: 100vh;
}

.sidebar-top,
.sidebar-bottom {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-bottom {
  margin-top: auto;
}

.sidebar-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-header .eyebrow {
  color: #ffffff;
  font-size: 14px;
  line-height: 20px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.sidebar-title-link {
  width: fit-content;
  text-decoration: none;
}

.sidebar-title-link:hover {
  color: rgba(255, 255, 255, 0.82);
}

.sidebar-tagline {
  margin: 0;
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.72);
}

.sidebar-section,
.sidebar-actions,
.sidebar-copy,
.sidebar-links,
.sidebar-utility {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 16px;
}

.sidebar-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.sidebar-section-title,
.sidebar-license-state {
  font-size: var(--fs-meta);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.62);
}

.project-list {
  display: grid;
  gap: 10px;
}

.sidebar-view-all-button {
  margin-top: 8px;
}

.project-item {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 12px;
  border: 0;
  background: rgba(38, 131, 235, 0.2);
  text-align: left;
  color: #ffffff;
  border-radius: 14px;
  transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.project-item.is-active {
  border-color: transparent;
  background: rgba(38, 131, 235, 0.24);
}

.project-item:hover {
  background: rgba(38, 131, 235, 0.28);
}

.project-item-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: flex-start;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 0;
  color: inherit;
}

.project-item-title {
  font-weight: 700;
  line-height: 1.2;
  font-size: var(--fs-body);
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  text-wrap: balance;
}

.project-item-meta {
  color: rgba(255, 255, 255, 0.62);
  font-size: var(--fs-meta);
  line-height: 1.25;
}

.project-item-delete {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.56);
  padding: 0;
  font-size: var(--fs-meta);
  line-height: 1.2;
}

.project-item-delete:hover {
  color: #ffffff;
}

.all-films-overlay {
  position: fixed;
  inset: 0;
  z-index: 34;
  background: rgba(10, 10, 10, 0.28);
  display: grid;
  place-items: center;
  padding: 28px;
}

.all-films-panel {
  width: min(960px, 100%);
  max-height: min(80vh, 860px);
  overflow: auto;
  display: grid;
  gap: 16px;
  padding: 22px;
  background: #fff;
  border: 1px solid var(--line);
}

.all-films-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.all-films-panel-header h2 {
  margin: 4px 0 0;
  font-size: 1.05rem;
}

.all-films-search input {
  background: #fafaf8;
}

.all-films-list {
  display: grid;
  gap: 8px;
}

.all-films-empty {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.86rem;
}

.sidebar-actions {
  display: grid;
  gap: 6px;
}

.sidebar-button {
  width: 100%;
  justify-content: center;
}

.sidebar-copy {
  display: grid;
  gap: 6px;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.42;
  font-size: 14px;
}

.sidebar-copy p {
  margin: 0;
}

.sidebar-links {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: var(--fs-ui);
}

.sidebar-links a,
.sidebar-link-button {
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  background: transparent;
  border: 0;
  padding: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.sidebar-links a:hover,
.sidebar-link-button:hover {
  color: #ffffff;
}

#enter-license-button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: none;
  transform: none;
}

.sidebar-utility {
  display: flex;
  justify-content: flex-start;
}

.workspace {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
  justify-self: start;
  background: transparent;
}

.workspace-top,
.workspace-board,
.workspace-bottom {
  width: 100%;
}

.workspace-content {
  width: 100%;
  max-width: 1364px;
  margin-inline: auto;
}

.workspace-content-board {
  width: 100%;
  max-width: 1364px;
}

.workspace-top > .workspace-content,
.workspace-bottom > .workspace-content,
.workspace-footer {
  max-width: 100%;
}

.workspace-top {
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: var(--header-bg);
  border: 0;
  border-radius: 0;
  padding: 48px 48px 24px;
  box-shadow: none;
}

.workspace-board {
  background: var(--workspace-bg);
  border-radius: 0;
  padding: 40px 48px 48px;
}

.workspace-bottom {
  background: var(--header-bg);
  border: 0;
  border-radius: 0;
  padding: 24px 48px 32px;
  box-shadow: none;
}

.workspace-footer {
  background: var(--header-bg);
  padding: 16px 48px 32px;
}

.app-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 4px;
  color: var(--text-soft);
  font-size: var(--fs-ui);
}

.app-footer a {
  color: inherit;
}

.footer-links {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.app-footer-home {
  width: min(920px, 100%);
  margin-top: 14px;
}

.board-header,
.toolbar,
.scene-card,
.board-empty-state,
.detail-panel {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow);
}

.board-header,
.toolbar,
.board-empty-state {
  border-radius: 0;
  padding: 0;
}

.board-header {
  display: flex;
  justify-content: space-between;
  gap: 32px;
  align-items: flex-start;
  background: transparent;
  border: 0;
  box-shadow: none;
  width: 100%;
}

.toolbar {
  background: transparent;
  border: 0;
  box-shadow: none;
  width: 100%;
  margin-top: 4px;
}

.board-copy {
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: var(--fs-meta);
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
}

.board-header h1,
.detail-panel h2,
.board-empty-state h2 {
  margin: 0;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.board-title-field {
  display: block;
  max-width: 100%;
}

.board-title-field input {
  width: 100%;
  min-height: 44px;
  height: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  padding: 0;
  font-size: 32px;
  line-height: 40px;
  font-weight: 700;
  letter-spacing: -0.03em;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.board-title-field input:focus {
  outline: none;
  box-shadow: none;
}

.board-empty-state p {
  margin: 10px 0 0;
  color: var(--text-soft);
  line-height: 1.45;
  max-width: 62ch;
  font-size: var(--fs-body);
}

.board-actions,
.board-meta,
.legend,
.view-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.board-actions {
  justify-content: flex-end;
  align-self: start;
  min-width: 130px;
  gap: 12px;
  align-items: center;
}

.board-stats {
  margin-top: 0;
}

.board-meta-inline {
  margin-left: 4px;
  margin-right: auto;
  align-self: center;
  transform: translateY(2px);
}

.legend {
  width: 100%;
  justify-content: space-between;
  align-items: flex-start;
}

.legend .filter-menu:last-of-type {
  margin-right: auto;
}

.visualize-toolbar-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.toolbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.button-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border: 0;
  border-radius: 999px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  background: rgba(38, 131, 235, 0.06);
}

.eye-icon {
  position: relative;
}

.eye-icon::before {
  content: "";
  width: 12px;
  height: 8px;
  border: 1.5px solid currentColor;
  border-radius: 999px / 700px;
  display: block;
}

.eye-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 3px;
  border-radius: 999px;
  background: currentColor;
  transform: translate(-50%, -50%);
}

.visualize-toolbar-button:hover .button-icon {
  border-color: rgba(38, 131, 235, 0.28);
  background: #fff;
}

.utility-action-group {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.board-utility-group {
  padding: 6px 8px;
  border: 1px solid rgba(108, 108, 108, 0.12);
  border-radius: 14px;
  background: rgba(17, 17, 17, 0.03);
}

.header-menu {
  position: relative;
}

.header-split-menu {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.split-toggle-button {
  min-width: 32px;
  padding-left: 0;
  padding-right: 0;
}

.utility-split-menu {
  gap: 8px;
}

.utility-icon-button {
  width: 32px;
  min-width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.utility-icon-button:hover {
  background: rgba(17, 17, 17, 0.06);
  color: var(--text);
  border-color: rgba(108, 108, 108, 0.14);
  transform: none;
  box-shadow: none;
}

.utility-icon-button:active {
  background: rgba(17, 17, 17, 0.12);
}

.utility-icon-button:focus-visible {
  border-color: rgba(38, 131, 235, 0.24);
  box-shadow: var(--focus-ring);
}

.utility-icon {
  display: inline-flex;
  width: 16px;
  height: 16px;
}

.utility-icon svg {
  width: 16px;
  height: 16px;
}

.header-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 196px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  box-shadow: var(--shadow-hover);
  z-index: 10;
}

.menu-item-button {
  width: 100%;
  text-align: left;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.menu-status-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.menu-item-button:hover {
  background: rgba(38, 131, 235, 0.08);
  color: var(--text);
}

.view-controls {
  justify-content: flex-end;
  min-height: 0;
}

.view-controls-stacked {
  width: 100%;
  justify-content: flex-start;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.filter-menu {
  position: relative;
}

.filter-trigger-button {
  min-width: 132px;
  justify-content: space-between;
}

.toolbar .small-button.filter-trigger-button {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 20px;
  font-size: 13px;
  line-height: 18px;
}

.filter-menu-panel {
  min-width: 180px;
}

.status-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.checkbox-field {
  justify-content: flex-start;
  align-self: start;
}

.checkbox-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-ui);
  color: var(--text);
  width: fit-content;
}

.board-meta span {
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: #6b7280;
  border: 0;
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
}

.board-meta-separator {
  font-size: 14px;
  line-height: 20px;
  color: #9aa3af;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button {
  border-radius: 10px;
  border: 1px solid var(--line-soft);
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.primary-button,
.secondary-button,
.ghost-button {
  padding: 0 16px;
  font-weight: 600;
  font-size: 14px;
  line-height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.compact-action-button {
  min-height: 40px;
}

.primary-button {
  min-height: 44px;
  border-radius: 12px;
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  min-width: 130px;
}

.secondary-button,
.ghost-button,
.icon-button {
  background: #fff;
  color: var(--text);
}

.secondary-button {
  min-height: 40px;
}

.ghost-button {
  min-height: 40px;
  background: #ffffff;
}

.small-button {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 22px;
}

.icon-button {
  min-height: 40px;
  padding: 0 14px;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.icon-button:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.primary-button:hover {
  background: #1f72d0;
  border-color: #1f72d0;
  color: #fff;
}

.secondary-button:hover,
.ghost-button:hover,
.icon-button:hover {
  background: rgba(17, 17, 17, 0.04);
  color: var(--text);
  border-color: rgba(108, 108, 108, 0.2);
}

.primary-button:active,
.secondary-button:active,
.ghost-button:active,
.icon-button:active,
.menu-item-button:active,
.project-item:active,
.recent-project-item:active,
.drag-handle:active,
.plot-scene-chip:active {
  transform: translateY(0);
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-color: var(--primary);
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 22px;
  border: 1px solid var(--line-soft);
  background: #fff;
  color: var(--text);
}

.legend-chip.is-active,
.ghost-button.is-active {
  background: #ffffff;
  color: var(--text);
  border-color: rgba(108, 108, 108, 0.28);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--chip-color);
}

.scene-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 320px));
  grid-auto-rows: 332px;
  column-gap: 28px;
  row-gap: 28px;
  align-content: start;
  justify-content: start;
  background: transparent;
  padding: 0;
  width: 100%;
  max-width: 100%;
}

.scene-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 320px;
  min-height: 332px;
  height: 332px;
  padding: 20px;
  border-radius: 18px;
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 10px rgba(17, 17, 17, 0.035);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast), background var(--transition-fast);
  overflow: hidden;
}

.scene-card.is-dragging {
  opacity: 0.52;
}

.scene-card.is-drop-target {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.scene-card:hover {
  box-shadow: 0 10px 24px rgba(17, 17, 17, 0.07);
  transform: translateY(-1px);
}

.scene-card.is-selected {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary), var(--shadow-hover);
}

.card-topline,
.card-surface {
  display: flex;
  position: relative;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-topline {
  min-height: 28px;
}

.card-surface {
  display: block;
  border: 0;
  padding: 0;
  background: transparent;
  text-align: left;
  pointer-events: none;
  min-height: 4px;
}

.card-accent {
  display: block;
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: var(--card-accent);
  margin-bottom: 0;
}

.card-header,
.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.scene-number {
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
}

.card-tags {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-indicator,
.subplot-pill {
  border: 1px solid var(--line-soft);
}

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #fff546;
  border: 0;
}

.subplot-pill {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 999px;
  background: #f1f3f6;
  color: var(--text);
  font-size: 15px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.status-needs_work {
  background: #66640f;
}

.status-ready {
  background: #0ac61c;
}

.status-open {
  background: #fff546;
}

.drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  min-width: 60px;
  padding: 0 10px;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  transition: background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.drag-handle:hover {
  background: rgba(38, 131, 235, 0.08);
  border-color: rgba(38, 131, 235, 0.3);
  color: var(--text);
}

.drag-handle:active {
  cursor: grabbing;
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.scene-title-field input {
  min-height: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  font-size: 16px;
  line-height: 22px;
  font-weight: 700;
  box-shadow: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scene-title-field input:focus {
  background: transparent;
  box-shadow: none;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-group > span {
  font-size: var(--fs-meta);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.field-group input,
.field-group textarea,
.field-group select {
  width: 100%;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--surface-strong);
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  line-height: 20px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.field-group textarea {
  min-height: 98px;
  resize: vertical;
}

.field-group input:focus,
.field-group textarea:focus,
.field-group select:focus {
  outline: none;
  background: #fff;
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}

.board-empty-state {
  display: grid;
  place-items: center;
  min-height: 300px;
  text-align: center;
  background: #ffffff;
  border-radius: 20px;
  padding: 32px;
}

.board-empty-state > div {
  width: min(720px, 100%);
  margin: 0 auto;
}

.empty-hints {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
}

.empty-hints span {
  padding: 8px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: #f5f5f5;
  color: var(--text-soft);
  font-size: var(--fs-ui);
}

.treatment-panel {
  border: 1px solid var(--line-soft);
  background: #fbfbfb;
  padding: 18px;
  border-radius: 16px;
}

.treatment-copy-block {
  min-height: 72vh;
  margin: 0;
  background: #fff;
  font-size: 1rem;
  line-height: 1.75;
  padding: 18px 20px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  white-space: pre-wrap;
  user-select: text;
}

.treatment-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.36);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 25;
}

.treatment-modal {
  width: min(1180px, 100%);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line-soft);
  overflow: auto;
}

.treatment-modal-header,
.treatment-modal-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.treatment-modal-header h2 {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.15;
}

.detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: grid;
  place-items: center;
  padding: 24px;
}

.detail-panel {
  width: min(1120px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border-radius: 20px;
  padding: 24px;
  border-top: 6px solid var(--panel-accent);
}

.visual-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 20;
}

.license-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.36);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 30;
}

.privacy-panel {
  width: min(640px, 100%);
}

.privacy-copy {
  display: grid;
  gap: 14px;
}

.privacy-copy p {
  margin: 0;
}

.license-panel {
  width: min(560px, 100%);
  background: #fff;
  border: 1px solid var(--line-soft);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.license-panel-header,
.license-panel-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.license-panel-header h2 {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.15;
}

.license-panel-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.license-copy {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.45;
  font-size: var(--fs-body);
}

.license-help {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.license-help span {
  padding: 6px 10px;
  border: 1px solid var(--line-soft);
  background: #f7f7f7;
  color: var(--text-soft);
  font-size: var(--fs-meta);
}

.license-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.visual-panel {
  width: min(1380px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 0;
  background: #111;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.visual-stage {
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 0;
  overflow: hidden;
  background: #181818;
  display: grid;
  place-items: center;
}

.visual-media {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.visual-placeholder {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, color-mix(in srgb, var(--visual-accent) 62%, black), #111);
  color: rgba(255, 255, 255, 0.9);
  font-size: 5rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.visual-copy {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 16px;
  padding: 28px 32px 28px 24px;
  background: #111;
}

.visual-topline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.visual-scene-number {
  font-size: var(--fs-body);
  font-weight: 800;
  letter-spacing: 0.12em;
}

.visual-copy h2 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1.02;
  max-width: 14ch;
}

.visual-summary {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 1.02rem;
  line-height: 1.6;
  white-space: pre-wrap;
  max-width: 34ch;
}

.visual-controls {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
  width: 100%;
}

.visual-controls .ghost-button,
.visual-controls .icon-button {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 12px;
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.9);
  box-shadow: none;
}

.visual-controls .ghost-button:hover,
.visual-controls .icon-button:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.visual-controls .ghost-button:disabled,
.visual-controls .icon-button:disabled {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.4);
  border-color: transparent;
}

.visual-controls .ghost-button:disabled:hover,
.visual-controls .icon-button:disabled:hover {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.4);
}

.detail-topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
}

.detail-actions {
  display: flex;
  gap: 8px;
}

.detail-panel h2 {
  font-size: 1.5rem;
  line-height: 1.1;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.detail-field-wide {
  grid-column: 1 / -1;
}

.plot-color-field {
  gap: 8px;
}

.plot-color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.plot-color-swatch {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 1px solid var(--line-soft);
  background: var(--swatch-color);
  padding: 0;
}

.plot-color-swatch.is-active {
  border-color: var(--line);
  box-shadow: inset 0 0 0 2px #fff;
}

.detail-help-text {
  margin: 0;
  color: var(--text-soft);
  font-size: var(--fs-meta);
  line-height: 1.35;
}

.image-field {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.image-field-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.image-upload-help {
  margin: 0;
}

.file-button {
  position: relative;
  overflow: hidden;
}

.image-file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.scene-summary-field {
  flex: 1;
}

.scene-summary-field textarea {
  min-height: 0;
  height: 132px;
  max-height: 132px;
  font-size: 14px;
  line-height: 22px;
  font-weight: 400;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  resize: none;
  box-shadow: none;
  overflow: auto;
  scrollbar-width: thin;
  color: #303643;
}

.scene-summary-field textarea:focus {
  background: transparent;
  box-shadow: none;
}

.scene-summary-field textarea::-webkit-scrollbar {
  width: 6px;
}

.scene-summary-field textarea::-webkit-scrollbar-thumb {
  background: rgba(108, 108, 108, 0.28);
  border-radius: 999px;
}

.card-footer {
  margin-top: auto;
  justify-content: flex-start;
  padding-top: 16px;
}

.card-footer .small-button {
  min-height: 32px;
  min-width: 90px;
  padding: 0 12px;
  border-radius: 12px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.plot-overview {
  border: 0;
  background: transparent;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
}

.plot-overview-header {
  margin-bottom: 14px;
}

.plot-balance {
  display: flex;
  width: 100%;
  height: 14px;
  margin-top: 8px;
  border: 1px solid var(--line-soft);
  background: #f2f2f2;
}

.plot-balance-segment {
  display: block;
  width: var(--segment-width);
  min-width: 0;
  background: var(--segment-color);
}

.plot-balance-segment.is-empty {
  width: 0;
}

.plot-overview-grid {
  display: grid;
  gap: 10px;
}

.plot-row {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  align-items: center;
}

.plot-row-label {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  min-height: 32px;
}

.plot-row-track {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.plot-scene-chip {
  min-width: 42px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line-soft);
  background: #fff;
  color: var(--text);
  border-radius: 12px;
  font-size: 12px;
  line-height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.plot-scene-chip:hover {
  background: rgba(38, 131, 235, 0.08);
  border-color: rgba(38, 131, 235, 0.28);
}

.plot-row-empty {
  color: var(--text-soft);
}

button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

button:disabled:hover {
  background: #fff;
  color: var(--text);
}

.utility-icon-button:disabled:hover {
  background: transparent;
  color: var(--text-soft);
  border-color: transparent;
}

@media (max-width: 1080px) {
  .board-header {
    flex-direction: column;
    align-items: stretch;
  }

  .board-actions {
    justify-content: flex-start;
  }

  .view-controls {
    justify-content: flex-start;
  }

  .toolbar-actions {
    width: 100%;
    justify-content: flex-start;
    margin-left: 0;
  }

  .workspace-top,
  .workspace-bottom {
    padding-left: 32px;
    padding-right: 32px;
  }

  .workspace-board {
    padding: 40px 32px 40px;
  }
}

@media (min-width: 1600px) {
  .app-shell {
    grid-template-columns: 236px minmax(0, 1fr);
    gap: 0;
    padding: 0;
  }

  .project-sidebar {
    top: 0;
    min-height: 100vh;
  }

  .sidebar-inner {
    min-height: 100vh;
  }

  .scene-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 320px));
    grid-auto-rows: 332px;
    column-gap: 28px;
    row-gap: 28px;
    width: 100%;
    max-width: 100%;
  }

  .scene-card {
    min-height: 332px;
    height: 332px;
    padding: 20px;
  }

  .card-body {
    gap: 8px;
  }

  .scene-title-field input {
    font-size: 16px;
  }

  .field-group textarea {
    min-height: 0;
  }

  .board-header,
  .toolbar,
  .board-empty-state {
    padding: 0;
  }

  .board-copy {
    max-width: 980px;
  }

  .board-title-field {
    max-width: 920px;
  }

  .board-title-field input {
    padding: 10px 12px;
    font-size: clamp(1.35rem, 1.7vw, 2rem);
  }

  .board-subtitle,
  .board-empty-state p {
    max-width: 70ch;
    font-size: 14px;
    line-height: 1.55;
  }

  .board-actions,
  .board-meta,
  .legend,
  .view-controls {
    gap: 8px;
  }

  .primary-button,
  .secondary-button,
  .ghost-button {
    padding: 8px 12px;
  }

  .board-meta span,
  .legend-chip,
  .subplot-pill {
    padding-top: 6px;
    padding-bottom: 6px;
  }

  .field-group > span,
  .sidebar-section-title,
  .sidebar-license-state,
  .eyebrow {
    letter-spacing: 0.1em;
  }

  .field-group input,
  .field-group textarea,
  .field-group select {
    padding: 9px 11px;
  }

  .detail-panel {
    padding: 28px;
  }

  .visual-copy {
    gap: 20px;
    padding: 34px;
  }

  .visual-copy h2 {
    font-size: clamp(2.15rem, 2.8vw, 3.2rem);
  }

  .visual-summary {
    font-size: 1.06rem;
    line-height: 1.68;
  }

  .detail-grid {
    gap: 20px;
  }
}

@media (min-width: 1900px) {
  .scene-grid {
    grid-template-columns: repeat(auto-fill, 320px);
  }
}

@media (min-width: 2300px) {
  .scene-grid {
    grid-template-columns: repeat(auto-fill, 320px);
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: 100%;
    grid-template-columns: 1fr;
    gap: 0;
  }

  .home-actions {
    grid-template-columns: 1fr;
  }

  .home-button-primary {
    grid-column: auto;
  }

  .scene-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 320px));
    grid-auto-rows: 332px;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .visual-panel {
    grid-template-columns: 1fr;
  }

  .visual-stage,
  .visual-placeholder {
    min-height: 0;
  }

  .workspace {
    width: 100%;
  }

  .workspace-top,
  .workspace-bottom {
    padding: 18px;
  }

  .workspace-board {
    padding: 24px 18px 32px;
  }

  .workspace-content,
  .workspace-content-board,
  .scene-grid {
    width: 100%;
    max-width: 100%;
  }

  .legend {
    gap: 12px;
  }

  .toolbar-actions {
    flex-wrap: wrap;
    gap: 12px;
  }

  .utility-action-group {
    gap: 8px;
  }
}
