:root {
  color-scheme: dark;
  --project-header-height: 66px;
  --bg: #070707;
  --bg-elevated: #111214;
  --panel: #17191d;
  --panel-soft: #202328;
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.22);
  --text: #f2efe8;
  --muted: #a6a096;
  --dim: #6f6d68;
  --gold: #ffffff;
  --amber: #ffffff;
  --red: #8e3e35;
  --green: #5f7f76;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.48);
  --radius: 8px;
  --font-ui: "Helvetica Neue", Arial, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-project: "American Typewriter", "Courier New", ui-serif, serif;
  font-family: var(--font-ui);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell,
.home-view,
.account-view,
.project-view {
  min-height: 100vh;
}

.home-view,
.account-view,
.project-view {
  display: none;
}

.home-view.is-active,
.account-view.is-active,
.project-view.is-active {
  display: block;
}

.home-view {
  position: relative;
  overflow: hidden;
  background: #000;
}

.hero-image {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.9) contrast(1.08);
  transform: scale(1.02);
}

.hero-shade {
  position: fixed;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(2, 3, 4, 0.94) 0%, rgba(2, 3, 4, 0.68) 40%, rgba(2, 3, 4, 0.14) 100%),
    linear-gradient(0deg, rgba(2, 3, 4, 0.78) 0%, rgba(2, 3, 4, 0.08) 56%);
}

.home-topbar {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
  padding: 28px;
}

.home-content {
  position: relative;
  z-index: 2;
  display: flex;
  min-height: 100vh;
  width: min(760px, calc(100% - 48px));
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 36px;
  margin: 0 auto;
  padding: 0;
  text-align: center;
}

.kicker {
  margin: 0 0 14px;
  color: var(--amber);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: var(--font-ui);
  font-size: clamp(3.4rem, 7vw, 5.6rem);
  font-weight: 300;
  letter-spacing: 0.04em;
  line-height: 0.95;
}

.home-copy {
  max-width: 560px;
  margin: 26px 0 34px;
  color: rgba(242, 239, 232, 0.78);
  font-size: 1.06rem;
  line-height: 1.7;
}

.home-content .primary-button {
  min-height: 70px;
  padding: 0 34px;
  border: 3px solid var(--text);
  background: transparent;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 1.7rem;
  font-weight: 300;
}

.home-content .primary-button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.primary-button,
.ghost-button,
.secondary-button,
.icon-button,
.tool-button,
.tab-button,
.episode-button,
.menu-item,
.theme-chip,
.file-action {
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease;
}

.primary-button:hover,
.ghost-button:hover,
.secondary-button:hover,
.icon-button:hover,
.tool-button:hover,
.tab-button:hover,
.episode-button:hover,
.menu-item:hover,
.theme-chip:hover,
.file-action:hover {
  border-color: rgba(255, 255, 255, 0.58);
  background: rgba(255, 255, 255, 0.12);
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: fit-content;
  min-height: 48px;
  padding: 0 20px;
  border-radius: var(--radius);
  background: var(--amber);
  color: #111;
  font-weight: 800;
}

.primary-button:hover {
  color: #111;
  transform: translateY(-1px);
}

.ghost-button {
  height: 40px;
  padding: 0 16px;
  border-radius: var(--radius);
  background: rgba(7, 7, 7, 0.54);
  backdrop-filter: blur(16px);
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: var(--radius);
  font-size: 0.78rem;
  font-weight: 700;
}

.mode-toggle {
  justify-self: end;
  white-space: nowrap;
  font-size: 0.84rem;
  font-weight: 800;
}

.mode-toggle.is-active {
  border-color: rgba(255, 255, 255, 0.74);
  background: rgba(255, 255, 255, 0.15);
}

.connected-user {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-self: end;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.76rem;
  font-weight: 300;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.connected-user span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text);
}

.project-view.is-reader .connected-user {
  display: none;
}

.project-view {
  background:
    linear-gradient(180deg, rgba(16, 18, 20, 0.98), rgba(7, 7, 7, 1) 42%),
    url("assets/image1.png") top right / 62vw auto no-repeat;
}

.reader-intro {
  position: relative;
  display: none;
  min-height: 100vh;
  place-items: center;
  overflow: hidden;
  background: #000;
}

.project-view.is-reader-intro .reader-intro {
  display: grid;
}

.project-view.is-reader-intro .project-header,
.project-view.is-reader-intro .project-top-controls,
.project-view.is-reader-intro .project-main,
.project-view.is-reader-intro .side-menu,
.project-view.is-reader-intro .menu-scrim {
  display: none;
}

.reader-intro-image,
.reader-intro-shade {
  position: absolute;
  inset: 0;
}

.reader-intro-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.88) contrast(1.05);
}

.reader-intro.has-no-cover {
  background:
    radial-gradient(circle at 50% 34%, rgba(255, 255, 255, 0.08), transparent 34%),
    #000;
}

.reader-intro-shade {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.36), rgba(0, 0, 0, 0.78)),
    rgba(0, 0, 0, 0.18);
}

.reader-intro-content {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 28px;
  width: min(760px, calc(100% - 48px));
  text-align: center;
}

.reader-intro h1 {
  color: var(--text);
  font-family: var(--font-project);
  font-size: clamp(2.8rem, 8vw, 6.2rem);
  font-weight: 400;
  letter-spacing: 0.08em;
}

.reader-enter-button {
  min-height: 48px;
  padding: 0 24px;
  border: 2px solid var(--text);
  border-radius: 0;
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  backdrop-filter: blur(12px);
}

.reader-enter-button:hover {
  background: var(--text);
  color: #111;
}

.account-view {
  background: #000;
}

.project-header {
  position: sticky;
  top: 0;
  z-index: 22;
  display: grid;
  grid-template-columns: 48px 1fr auto 48px;
  align-items: center;
  gap: 10px;
  min-height: var(--project-header-height);
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 7, 7, 0.78);
  backdrop-filter: blur(20px);
}

.project-view .close-project {
  grid-column: 1;
}

.project-view .close-project,
.project-view .share-project-button,
.project-view .settings-project-button {
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: var(--radius);
  display: inline-grid;
  place-items: center;
  font-size: 1.08rem;
  font-weight: 800;
  line-height: 1;
}

.project-view .close-project {
  font-size: 1.7rem;
}

.project-view .share-project-button {
  grid-column: 2;
}

.project-view .settings-project-button {
  grid-column: 3;
}

.project-view .project-title {
  grid-column: 4;
}

.project-view .connected-user {
  grid-column: 5;
}

.project-view .menu-button {
  grid-column: 6;
}

.project-view .project-header {
  grid-template-columns: 48px 40px 40px minmax(0, 1fr) auto 48px;
}

.icon-button,
.tool-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  font-size: 1.42rem;
  font-weight: 700;
  line-height: 1;
}

.close-project {
  font-size: 2.2rem;
}

.project-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

.project-title span {
  color: var(--muted);
  font-family: var(--font-project);
  font-size: 1.08rem;
  font-weight: 400;
  letter-spacing: 0.1em;
}

.project-title strong {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.94rem;
}

.menu-button {
  gap: 5px;
}

.menu-button span {
  display: block;
  width: 23px;
  height: 3px;
  border-radius: 999px;
  background: currentColor;
}

.project-main {
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
  gap: 18px;
  width: min(1440px, calc(100% - 36px));
  margin: 0 auto;
  padding: 18px 0 34px;
}

.project-top-controls {
  position: sticky;
  top: var(--project-header-height);
  z-index: 18;
  display: grid;
  gap: 2px;
  width: min(1440px, calc(100% - 36px));
  margin: 0 auto;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(17, 18, 20, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.sequence-panel {
  background: transparent;
}

.episode-panel {
  align-self: start;
  min-width: 0;
  padding: 4px 6px 5px;
}

.timeline-panel {
  min-width: 0;
  padding: 2px 6px 4px;
}

.sequence-panel {
  min-width: 0;
  padding: 0;
}

.work-area {
  display: grid;
  gap: 18px;
  align-self: start;
  min-width: 0;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-heading p {
  margin: 0;
  color: var(--amber);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.section-heading span {
  color: var(--dim);
  font-size: 0.82rem;
}

.episode-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.episode-button {
  flex: 0 1 clamp(44px, 6vw, 58px);
  display: inline-grid;
  place-items: center;
  min-height: 32px;
  padding: 5px 8px;
  border-radius: var(--radius);
  text-align: center;
}

.episode-button span {
  color: var(--muted);
  font-size: 0.72rem;
}

.episode-button.is-active,
.tab-button.is-active,
.theme-chip.is-active {
  border-color: rgba(255, 255, 255, 0.74);
  background: rgba(255, 255, 255, 0.15);
  color: var(--amber);
}

.episode-number {
  display: inline-grid;
  place-items: center;
  color: var(--amber);
  font-weight: 800;
}

.timeline-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  padding-top: 3px;
}

.tool-button {
  width: 24px;
  height: 24px;
  font-size: 0.82rem;
}

.zoom-range {
  appearance: none;
  width: 58px;
  height: 2px;
  accent-color: var(--amber);
  border-radius: 999px;
  background: var(--line-strong);
}

.zoom-range::-webkit-slider-thumb {
  appearance: none;
  width: 8px;
  height: 8px;
  border: 1px solid var(--text);
  border-radius: 50%;
  background: var(--bg);
}

.zoom-range::-moz-range-thumb {
  width: 8px;
  height: 8px;
  border: 1px solid var(--text);
  border-radius: 50%;
  background: var(--bg);
}

.timeline-strip {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3px;
}

.timeline-wrap {
  min-width: 0;
  overflow-x: auto;
  padding: 5px 2px 2px;
}

.timeline-track {
  position: relative;
  display: flex;
  align-items: stretch;
  width: max-content;
  min-width: 100%;
  gap: clamp(2px, calc(8px * var(--timeline-scale, 1)), 8px);
  padding-top: 5px;
}

.timeline-track::before {
  content: none;
}

.sequence-node {
  position: relative;
  display: flex;
  min-width: clamp(16px, calc(66px * var(--timeline-scale, 1)), 119px);
  flex: 0 0 clamp(16px, calc(66px * var(--timeline-scale, 1)), 119px);
  flex-direction: column;
  gap: 5px;
  align-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
}

.sequence-node span {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 28px;
  padding: 4px 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: clamp(0.48rem, calc(0.68rem * var(--timeline-scale, 1)), 0.68rem);
  font-weight: 800;
  text-align: center;
}

.sequence-node.is-active span {
  border-color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.14);
  color: var(--amber);
}

.sequence-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 18px;
  align-items: start;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(32, 35, 40, 0.92), rgba(20, 21, 23, 0.92));
}

.sequence-card h2 {
  margin: 0;
  font-family: var(--font-ui);
  font-size: clamp(1.5rem, 3vw, 2.4rem);
  font-weight: 300;
  letter-spacing: 0.01em;
  line-height: 1.12;
}

.sequence-card p {
  grid-column: 1 / -1;
  margin: 0;
  color: rgba(242, 239, 232, 0.78);
  line-height: 1.65;
}

.sequence-edit-toggle {
  display: none;
  width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
}

.project-view.is-editor .sequence-edit-toggle {
  display: inline-grid;
  place-items: center;
}

.sequence-edit-toggle span {
  transform: translateY(-1px);
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 0.78rem;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.tab-button,
.theme-chip {
  min-height: 30px;
  padding: 0 9px;
  border-radius: var(--radius);
  font-size: 0.74rem;
  font-weight: 700;
}

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

.content-card {
  display: flex;
  min-height: 178px;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(10, 11, 12, 0.72);
  overflow: hidden;
}

.content-card.is-editor {
  min-height: 260px;
}

.content-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
}

.content-top h3 {
  margin: 0;
  font-size: 0.98rem;
}

.content-top span {
  color: var(--dim);
  font-size: 0.76rem;
  text-transform: uppercase;
}

.drop-zone {
  display: grid;
  place-items: center;
  min-height: 112px;
  margin: 12px 12px 0;
  padding: 16px;
  border: 1px dashed rgba(255, 255, 255, 0.28);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(95, 127, 118, 0.04)),
    rgba(255, 255, 255, 0.03);
  text-align: center;
}

.drop-zone.is-dragging {
  border-color: var(--amber);
  background: rgba(255, 255, 255, 0.12);
}

.drop-zone strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
}

.drop-zone small {
  color: var(--dim);
}

.rubric-add-zone strong {
  font-size: 0.9rem;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.file-list {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.file-item {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
}

.content-card.is-editor .file-item {
  grid-template-columns: 42px 1fr auto;
}

.file-item.has-inline-preview {
  grid-template-columns: minmax(0, 1fr) auto;
}

.file-item.has-inline-preview .file-thumb {
  display: none;
}

.inline-preview {
  display: grid;
  grid-column: 1 / -1;
  min-height: 168px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

.inline-preview img,
.inline-preview iframe {
  width: 100%;
  height: 100%;
  min-height: 168px;
  border: 0;
  object-fit: contain;
  background: #fff;
}

.inline-preview-empty {
  place-items: center;
  align-content: center;
  gap: 6px;
  color: var(--muted);
  text-align: center;
}

.inline-preview-empty strong {
  color: var(--text);
}

.file-thumb {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: var(--panel-soft);
  color: var(--amber);
  font-size: 0.76rem;
  font-weight: 800;
  overflow: hidden;
}

.file-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-name {
  min-width: 0;
}

.file-name strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.86rem;
}

.file-name span {
  color: var(--dim);
  font-size: 0.75rem;
}

.file-action {
  display: inline-grid;
  place-items: center;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.icon-action-button {
  display: inline-grid;
  place-items: center;
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  font-size: 0.95rem;
  line-height: 1;
  text-transform: none;
}

.icon-action-button span {
  transform: translateY(-1px);
}

.view-button {
  width: 32px;
  min-width: 32px;
  padding: 0;
  font-size: 0.95rem;
  line-height: 1;
}

.view-button span {
  transform: translateY(-1px);
}

.file-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.file-edit-form {
  align-items: end;
}

.file-edit-field {
  min-width: 0;
}

.empty-state {
  display: grid;
  min-height: 120px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  text-align: center;
}

.side-menu {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 24;
  width: min(390px, 92vw);
  height: 100vh;
  padding: 18px;
  border-left: 1px solid var(--line);
  background: rgba(13, 14, 16, 0.96);
  box-shadow: var(--shadow);
  transform: translateX(104%);
  transition: transform 200ms ease;
}

.side-menu.is-open {
  transform: translateX(0);
}

.menu-scrim {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  background: rgba(0, 0, 0, 0.54);
}

.menu-scrim.is-open {
  display: block;
}

.menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.menu-head p {
  margin: 0;
  color: var(--amber);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.menu-list {
  display: grid;
  gap: 7px;
}

.menu-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 42px;
  padding: 0 11px;
  border-radius: var(--radius);
  text-align: left;
}

.menu-item strong {
  font-size: 0.82rem;
}

.menu-item span {
  color: var(--dim);
  font-size: 0.68rem;
}

.theme-library {
  display: grid;
  gap: 14px;
}

.library-head {
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(17, 18, 20, 0.84);
}

.library-head h2 {
  margin: 0;
  font-family: var(--font-ui);
  font-size: clamp(1.8rem, 4vw, 3.2rem);
  font-weight: 300;
  letter-spacing: 0.02em;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.72);
}

.modal.is-open {
  display: grid;
}

.modal-panel {
  position: relative;
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(18, 19, 22, 0.98);
  box-shadow: var(--shadow);
}

.viewer-panel {
  width: min(1120px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  grid-template-rows: auto minmax(0, 1fr);
}

.viewer-body {
  display: grid;
  min-height: min(68vh, 720px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

.viewer-image {
  width: 100%;
  height: 100%;
  max-height: 72vh;
  object-fit: contain;
}

.viewer-frame {
  width: 100%;
  height: min(72vh, 760px);
  border: 0;
  background: #fff;
}

.viewer-empty {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  min-height: 320px;
  color: var(--muted);
  text-align: center;
}

.viewer-empty strong {
  color: var(--text);
}

.share-panel {
  width: min(560px, 100%);
}

.share-field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
}

.share-field input {
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 0.82rem;
}

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

.share-status {
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.project-create-panel,
.login-panel {
  width: min(680px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  border-color: #111;
  background: #fff;
  color: #111;
}

.login-panel {
  width: min(520px, calc(100vw - 32px));
}

.project-create-panel .modal-close,
.login-panel .modal-close {
  border-color: rgba(0, 0, 0, 0.22);
  background: transparent;
  color: #111;
}

.project-create-panel h2,
.login-panel h2 {
  margin: 0;
  color: #111;
  font-size: 2rem;
}

.project-create-panel .project-form {
  gap: 14px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.project-create-panel label,
.project-create-panel legend,
.project-create-panel .cover-upload span,
.login-panel label,
.login-panel .kicker {
  color: #111;
}

.project-create-panel input[type="text"],
.project-create-panel input[type="number"],
.project-create-panel input[type="file"],
.project-create-panel textarea,
.login-panel input[type="text"],
.login-panel input[type="password"] {
  border-color: rgba(0, 0, 0, 0.28);
  background: #fff;
  color: #111;
}

.project-create-panel input::placeholder,
.project-create-panel textarea::placeholder,
.login-panel input::placeholder {
  color: rgba(0, 0, 0, 0.42);
}

.project-create-panel .cover-upload,
.project-create-panel fieldset,
.project-create-panel .theme-option {
  border-color: rgba(0, 0, 0, 0.28);
  background: rgba(0, 0, 0, 0.035);
  color: #111;
}

.project-create-panel .primary-button,
.login-panel .primary-button {
  border-color: #111;
  background: #111;
  color: #fff;
}

.project-create-panel .primary-button:hover,
.login-panel .primary-button:hover {
  color: #fff;
}

.login-panel .login-error {
  color: #111;
}

.sequence-rename-panel {
  width: min(420px, calc(100vw - 32px));
}

.rename-sequence-error {
  min-height: 18px;
  margin: -4px 0 0;
  color: #111;
  font-size: 0.78rem;
  font-weight: 700;
}

.scenario-panel {
  width: min(860px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: hidden;
  grid-template-rows: auto minmax(0, 1fr);
}

.scenario-list {
  display: grid;
  gap: 10px;
  max-height: min(64vh, 620px);
  overflow: auto;
  padding-right: 4px;
}

.scenario-add-button {
  justify-self: start;
  margin-bottom: 4px;
}

.theme-add-controls {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 4px;
}

.theme-add-controls .scenario-add-button {
  margin-bottom: 0;
}

.scenario-item {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
}

.scenario-episode {
  display: grid;
  place-items: center;
  min-height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--text);
  font-weight: 800;
}

.scenario-copy {
  min-width: 0;
}

.theme-document-item {
  grid-template-columns: minmax(0, 1fr) auto;
}

.scenario-copy strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.95rem;
}

.scenario-copy span {
  color: var(--muted);
  font-size: 0.78rem;
}

.scenario-open {
  white-space: nowrap;
}

.scenario-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.modal-panel h2 {
  margin: -8px 0 2px;
  font-family: var(--font-ui);
  font-size: 2rem;
  font-weight: 300;
  letter-spacing: 0.02em;
}

.modal-panel form {
  display: grid;
  gap: 14px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="number"],
textarea {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  padding: 0 12px;
}

textarea {
  padding: 10px 12px;
  line-height: 1.45;
}

input[type="file"] {
  min-height: 44px;
  color: var(--text);
}

.cover-upload {
  padding: 14px;
  border: 1px dashed rgba(255, 255, 255, 0.3);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

.cover-upload span {
  color: var(--dim);
  font-size: 0.78rem;
  font-weight: 600;
}

.full-button {
  width: 100%;
  margin-top: 4px;
}

.account-main {
  width: min(980px, calc(100% - 36px));
  margin: 0 auto;
  padding: 96px 0 42px;
}

.account-header {
  position: relative;
  min-height: 66px;
  padding: 12px 18px;
}

#backAccountHomeButton {
  position: absolute;
  top: 18px;
  left: 18px;
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 2rem;
}

#backAccountHomeButton span {
  display: block;
  line-height: 1;
  transform: translateY(-1px);
}

.account-name {
  position: absolute;
  top: 18px;
  left: 50%;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.76rem;
  font-weight: 300;
  letter-spacing: 0.08em;
  transform: translateX(-50%);
}

.account-name span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--text);
}

.account-hero,
.project-form {
  display: grid;
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(17, 18, 20, 0.84);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.account-hero {
  justify-content: end;
  margin-top: 74px;
  margin-bottom: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  place-items: center;
}

.account-hero h2,
.project-form h2 {
  margin: 0;
  font-family: var(--font-ui);
  font-size: clamp(1.9rem, 4vw, 3.8rem);
  font-weight: 300;
  letter-spacing: 0.02em;
  line-height: 1;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 110px;
  align-items: center;
}

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

.project-open-card {
  position: relative;
  display: grid;
  align-items: end;
  min-height: 164px;
  aspect-ratio: 16 / 9;
  padding: 18px;
  border: 2px solid var(--text);
  border-radius: 0;
  background: rgba(10, 11, 12, 0.72);
  color: var(--text);
  overflow: hidden;
  text-align: left;
}

.project-card-cover,
.project-card-shade {
  position: absolute;
  inset: 0;
}

.project-card-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.9) contrast(1.05);
}

.project-card-shade {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.16), rgba(0, 0, 0, 0.34)),
    rgba(0, 0, 0, 0.12);
}

.project-card-content {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  gap: 8px;
  align-self: center;
  justify-self: center;
  text-align: center;
}

.project-card strong {
  font-family: var(--font-project);
  font-size: clamp(1.65rem, 3vw, 2.45rem);
  font-weight: 400;
  letter-spacing: 0.04em;
}

.project-card-content > span {
  display: none;
  color: var(--dim);
  font-size: 0.82rem;
}

.project-card.has-cover .project-card-content > span {
  color: rgba(242, 239, 232, 0.74);
}

.project-delete {
  justify-self: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.project-delete.icon-action-button {
  width: 32px;
  padding: 0;
  font-size: 0.95rem;
  text-transform: none;
}

.project-delete:hover {
  border-color: var(--text);
  color: var(--text);
}

.account-hero .primary-button {
  min-height: 46px;
  padding: 0 18px;
  border-radius: 0;
  background: var(--text);
  color: #111;
  font-family: var(--font-ui);
  font-size: 1.05rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.project-form {
  width: min(720px, 100%);
}

.project-form fieldset {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.project-form legend {
  padding: 0 6px;
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 800;
}

.theme-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 700;
}

.theme-option input {
  accent-color: var(--amber);
}

.sequence-insert-form {
  display: none;
  gap: 10px;
}

.editor-only {
  display: none;
}

.project-view.is-editor .editor-only {
  display: grid;
}

.project-view.is-reader .editor-only {
  display: none !important;
}

.sequence-insert-form {
  grid-template-columns: auto 24px;
  align-items: center;
  gap: 5px;
}

.sequence-insert-form select {
  min-height: 24px;
  max-width: 72px;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(7, 7, 7, 0.72);
  color: var(--muted);
  font-size: 0.66rem;
}

.sequence-add-button,
.sequence-rename-button,
.sequence-delete-button {
  color: var(--text);
  font-weight: 800;
}

.sequence-rename-button {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  font-size: 0.84rem;
  line-height: 1;
}

.sequence-rename-button span {
  transform: translateY(-1px);
}

.sequence-delete-button {
  font-size: 0.76rem;
}

.sequence-edit-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  align-items: end;
}

.sequence-edit-form .full-button {
  grid-column: 1 / -1;
}

.sequence-edit-panel {
  width: min(640px, calc(100vw - 32px));
}

textarea {
  min-height: 84px;
  resize: vertical;
}

.login-error {
  min-height: 20px;
  margin: -4px 0 0;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
}

@media (max-width: 980px) {
  .project-main {
    grid-template-columns: 1fr;
  }

  .dashboard,
  .library-grid,
  .sequence-edit-form {
    grid-template-columns: 1fr;
  }

  .account-hero {
    grid-template-columns: 1fr;
  }

  .project-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

@media (max-width: 680px) {
  .home-content {
    width: min(100% - 36px, 640px);
    min-height: calc(100vh - 82px);
    padding: 0 0 8vh;
    margin: 0 auto;
  }

  .home-topbar {
    padding: 18px;
  }

  .home-copy {
    font-size: 0.98rem;
  }

  .project-header {
    grid-template-columns: 42px 1fr auto 42px;
    gap: 8px;
    padding: 8px 10px;
  }

  .project-view .project-header {
    grid-template-columns: 42px 32px 32px minmax(0, 1fr) auto 42px;
  }

  .project-view .close-project,
  .project-view .share-project-button,
  .project-view .settings-project-button {
    width: 32px;
    height: 32px;
    min-height: 32px;
    padding: 0;
    font-size: 0.88rem;
  }

  .project-view .close-project {
    font-size: 1.45rem;
  }

  .mode-toggle {
    height: 38px;
    padding: 0 10px;
    font-size: 0.76rem;
  }

  .project-main {
    width: min(100% - 20px, 720px);
    padding-top: 12px;
  }

  .project-top-controls {
    width: min(100% - 20px, 720px);
    gap: 6px;
    padding: 8px 0;
  }

  .timeline-strip {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .account-main {
    width: min(100% - 20px, 720px);
    padding-top: 14px;
  }

  .sequence-card {
    grid-template-columns: 1fr;
  }

  .episode-button {
    flex-basis: 44px;
    min-height: 30px;
    padding: 5px 7px;
  }

  .scenario-item {
    grid-template-columns: 78px minmax(0, 1fr);
  }

  .theme-document-item {
    grid-template-columns: 1fr;
  }

  .theme-add-controls {
    display: grid;
  }

  .theme-add-controls .scenario-add-button {
    width: 100%;
  }

  .scenario-open {
    grid-column: 1 / -1;
    width: 100%;
  }

  .scenario-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
  }

  .scenario-actions > * {
    flex: 1 1 auto;
  }

  .timeline-tools {
    flex-wrap: wrap;
    justify-content: center;
  }

  .zoom-range {
    width: 54px;
  }
}
