:root {
  --ink: #07103a;
  --deep: #030915;
  --navy: #08122f;
  --panel: rgba(12, 25, 61, 0.86);
  --line: rgba(160, 218, 255, 0.2);
  --muted: #8fa4ca;
  --soft: #f3f7ff;
  --white: #ffffff;
  --cyan: #18d9ff;
  --blue: #3d7cff;
  --violet: #8b43ff;
  --magenta: #e032ff;
  --green: #31d68b;
  --shadow: 0 24px 70px rgba(4, 11, 31, 0.22);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  color: var(--white);
  background:
    radial-gradient(circle at 15% -8%, rgba(24, 217, 255, 0.26), transparent 34rem),
    radial-gradient(circle at 88% 0%, rgba(224, 50, 255, 0.22), transparent 34rem),
    linear-gradient(180deg, #030915 0%, #091538 48%, #eef6ff 48%, #f7fbff 100%);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(143, 240, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(143, 240, 255, 0.045) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(180deg, #000 0%, #000 48%, transparent 78%);
  pointer-events: none;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.studio-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 28px;
  background: rgba(3, 9, 21, 0.88);
  border-bottom: 1px solid rgba(160, 218, 255, 0.18);
  backdrop-filter: blur(18px);
}

.studio-header::after {
  content: "";
  position: absolute;
  left: 28px;
  right: 28px;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(224, 50, 255, 0.72), rgba(24, 217, 255, 0.72), transparent);
  opacity: 0.75;
}

.studio-brand,
.studio-header nav {
  display: flex;
  align-items: center;
  gap: 14px;
}

.studio-brand {
  font-weight: 900;
  font-size: 1.08rem;
}

.brand-mark {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--magenta), var(--violet), var(--cyan));
  transform: rotate(45deg);
}

.brand-mark span {
  position: absolute;
  inset: 9px;
  border-radius: 4px;
  background: var(--deep);
}

.studio-header nav a:not(.button) {
  color: rgba(255, 255, 255, 0.74);
  font-weight: 800;
  font-size: 0.9rem;
}

.header-action {
  color: rgba(255, 255, 255, 0.74);
  font-weight: 900;
}

.studio-shell {
  width: min(1400px, calc(100% - 32px));
  margin: 0 auto;
  padding: 46px 0 70px;
}

.studio-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 28px;
  align-items: end;
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 10px;
  color: #8ff0ff;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 930px;
  margin-bottom: 18px;
  font-size: clamp(2.6rem, 6vw, 5.7rem);
  line-height: 0.95;
}

h1::after {
  content: "";
  display: block;
  width: min(310px, 62vw);
  height: 5px;
  margin-top: 22px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), var(--violet), transparent);
  box-shadow: 0 0 28px rgba(24, 217, 255, 0.32);
}

.studio-hero p:not(.eyebrow),
.section-heading p,
.form-note {
  color: var(--muted);
  line-height: 1.6;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--white);
  font-weight: 900;
  cursor: pointer;
}

.button-primary {
  background: linear-gradient(135deg, var(--cyan), var(--blue) 52%, var(--violet));
  box-shadow: 0 16px 36px rgba(61, 124, 255, 0.3);
}

.button-secondary {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(160, 218, 255, 0.2);
}

.credits-card,
.tool-panel,
.workspace-panel,
.flow-panel,
.publish-form,
.builder-card {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(15, 31, 73, 0.9), rgba(5, 14, 37, 0.93));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.credits-card {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  padding: 22px;
}

.credits-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 76% 18%, rgba(24, 217, 255, 0.22), transparent 12rem),
    radial-gradient(circle at 18% 80%, rgba(224, 50, 255, 0.18), transparent 12rem);
  pointer-events: none;
}

.credits-card > * {
  position: relative;
  z-index: 1;
}

.credits-card span {
  color: var(--muted);
  font-weight: 900;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.credits-card strong {
  display: block;
  margin: 8px 0;
  font-size: 3.5rem;
  line-height: 1;
  text-shadow: 0 0 26px rgba(24, 217, 255, 0.28);
}

.account-shell .studio-hero {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  align-items: stretch;
}

.account-summary strong {
  overflow-wrap: break-word;
  word-break: normal;
  font-size: clamp(1.75rem, 3vw, 2.75rem);
  line-height: 1.04;
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}

.account-forms {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.account-stat {
  min-height: 190px;
  padding-right: 22px;
  padding-bottom: 22px;
}

.account-stat::after,
.account-card::after {
  display: none;
}

.account-stat h3 {
  margin-bottom: 10px;
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  line-height: 1.05;
}

.account-stat .button {
  margin-top: 10px;
}

.studio-console {
  min-height: 282px;
}

.console-orbit {
  position: absolute;
  z-index: 0;
  top: 26px;
  right: 26px;
  width: 138px;
  height: 138px;
  border: 1px solid rgba(143, 240, 255, 0.18);
  border-radius: 50%;
  opacity: 0.82;
}

.console-orbit::before,
.console-orbit::after,
.console-orbit span {
  content: "";
  position: absolute;
  border-radius: 50%;
}

.console-orbit::before {
  inset: 30px;
  border: 1px solid rgba(139, 67, 255, 0.25);
}

.console-orbit::after {
  inset: 57px;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  box-shadow: 0 0 28px rgba(24, 217, 255, 0.55);
}

.console-orbit span {
  width: 14px;
  height: 14px;
  background: var(--cyan);
  box-shadow: 0 0 18px rgba(24, 217, 255, 0.62);
}

.console-orbit span:nth-child(1) {
  top: 12px;
  left: 56px;
}

.console-orbit span:nth-child(2) {
  right: 12px;
  top: 78px;
  background: var(--violet);
}

.console-orbit span:nth-child(3) {
  left: 18px;
  bottom: 24px;
  background: var(--green);
}

.console-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 22px;
}

.console-stats b {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(160, 218, 255, 0.18);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.07);
  color: #c8f7ff;
  font-size: 0.78rem;
}

.studio-grid {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 300px;
  gap: 18px;
  align-items: start;
}

.tool-panel,
.workspace-panel,
.flow-panel {
  border-radius: 18px;
  padding: 18px;
}

.workspace-panel {
  position: relative;
  overflow: hidden;
}

.workspace-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(143, 240, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(143, 240, 255, 0.045) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(180deg, #000, transparent 72%);
  pointer-events: none;
}

.workspace-panel > * {
  position: relative;
  z-index: 1;
}

.panel-heading h2,
.workspace-top h2,
.section-heading h2 {
  margin-bottom: 0;
  font-size: clamp(1.35rem, 3vw, 2.2rem);
}

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

.tool-button {
  position: relative;
  overflow: hidden;
  width: 100%;
  padding: 14px;
  border: 1px solid rgba(160, 218, 255, 0.16);
  border-radius: 12px;
  color: var(--white);
  text-align: left;
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.tool-button::before {
  content: "";
  position: absolute;
  top: 14px;
  right: 14px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(143, 240, 255, 0.55);
  box-shadow: 0 0 16px rgba(24, 217, 255, 0.42);
}

.tool-button:hover {
  transform: translateY(-1px);
  border-color: rgba(24, 217, 255, 0.4);
}

.tool-button.is-active {
  border-color: rgba(24, 217, 255, 0.66);
  background: linear-gradient(135deg, rgba(24, 217, 255, 0.18), rgba(139, 67, 255, 0.18));
}

.tool-button strong,
.tool-button span {
  display: block;
}

.tool-button span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.workspace-top,
.output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.status-pill {
  flex: 0 0 auto;
  padding: 9px 12px;
  border: 1px solid rgba(24, 217, 255, 0.28);
  border-radius: 999px;
  color: #a8f4ff;
  background: rgba(24, 217, 255, 0.08);
  font-weight: 900;
  font-size: 0.82rem;
}

.prompt-box {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

label {
  display: grid;
  gap: 8px;
  color: rgba(255, 255, 255, 0.86);
  font-weight: 900;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid rgba(160, 218, 255, 0.2);
  border-radius: 12px;
  color: var(--white);
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

textarea {
  min-height: 160px;
  padding: 14px;
  resize: vertical;
}

input,
select {
  min-height: 46px;
  padding: 0 13px;
}

select option {
  color: var(--ink);
}

.prompt-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.story-dashboard {
  display: grid;
  gap: 16px;
}

.story-page-shell {
  width: min(1700px, calc(100% - 32px));
}

.story-page-hero {
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
}

.story-page-dashboard {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(15, 31, 73, 0.86), rgba(5, 14, 37, 0.94));
  box-shadow: var(--shadow);
}

.story-dashboard[hidden] {
  display: none;
}

.story-dashboard-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border: 1px solid rgba(160, 218, 255, 0.18);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(24, 217, 255, 0.1), rgba(139, 67, 255, 0.12));
}

.story-dashboard-head h3,
.story-form h4,
.story-card-preview h4,
.story-player h4 {
  margin-bottom: 8px;
  font-size: clamp(1.25rem, 2vw, 1.85rem);
}

.story-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.story-tab {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(160, 218, 255, 0.18);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.78);
  background: rgba(255, 255, 255, 0.06);
  font-weight: 900;
  cursor: pointer;
}

.story-tab.is-active {
  color: var(--white);
  border-color: rgba(24, 217, 255, 0.52);
  background: linear-gradient(135deg, rgba(24, 217, 255, 0.22), rgba(139, 67, 255, 0.2));
}

.story-tab-panel {
  display: none;
}

.story-tab-panel.is-active {
  display: block;
}

.story-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  gap: 16px;
  align-items: start;
}

.story-form,
.story-card-preview,
.story-player,
.publish-checklist article {
  border: 1px solid rgba(160, 218, 255, 0.16);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
}

.story-form {
  display: grid;
  gap: 13px;
  padding: 16px;
}

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

.story-checkbox-row {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(143, 240, 255, 0.18);
  border-radius: 14px;
  color: rgba(226, 240, 255, 0.84);
  background: rgba(255, 255, 255, 0.05);
}

.story-checkbox-row input {
  width: 18px;
  height: 18px;
  accent-color: #18d9ff;
}

.story-card-preview,
.story-player {
  padding: 16px;
}

.character-image-frame {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  margin: 10px 0 16px;
  overflow: hidden;
  border: 1px solid rgba(160, 218, 255, 0.2);
  border-radius: 16px;
  background:
    radial-gradient(circle at 28% 18%, rgba(24, 217, 255, 0.22), transparent 34%),
    radial-gradient(circle at 76% 72%, rgba(139, 67, 255, 0.24), transparent 38%),
    rgba(255, 255, 255, 0.06);
  color: rgba(226, 240, 255, 0.58);
  font-size: 0.86rem;
  font-weight: 900;
  text-align: center;
}

.character-image-frame img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.character-card-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0 14px;
}

.character-card-actions .button {
  min-height: 42px;
  padding-inline: 10px;
}

.story-form .button:disabled {
  opacity: 0.62;
  cursor: progress;
}

.story-badge-row,
.story-choice-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.story-badge-row span {
  min-height: 30px;
  padding: 7px 10px;
  border: 1px solid rgba(24, 217, 255, 0.22);
  border-radius: 999px;
  color: #a8f4ff;
  background: rgba(24, 217, 255, 0.08);
  font-size: 0.78rem;
  font-weight: 900;
}

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

.scene-preview-stack {
  display: grid;
  gap: 14px;
}

.scene-responsive-preview {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(160, 218, 255, 0.16);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
}

.scene-responsive-preview h4 {
  margin-bottom: 6px;
  font-size: clamp(1.18rem, 1.8vw, 1.55rem);
}

.scene-preview-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.scene-preview-single {
  max-width: 980px;
}

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

.scene-preview-frame {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  overflow: hidden;
  padding: 14px;
  border: 1px solid rgba(24, 217, 255, 0.22);
  border-radius: 18px;
  background:
    radial-gradient(circle at 26% 20%, rgba(24, 217, 255, 0.3), transparent 28%),
    radial-gradient(circle at 78% 14%, rgba(139, 67, 255, 0.35), transparent 28%),
    linear-gradient(145deg, rgba(8, 23, 61, 0.96), rgba(32, 17, 74, 0.9));
  background-position: center;
  background-size: cover;
  box-shadow: inset 0 0 32px rgba(24, 217, 255, 0.08);
}

.scene-preview-frame.has-generated-image {
  border-color: rgba(24, 217, 255, 0.5);
  box-shadow: inset 0 -80px 90px rgba(3, 9, 21, 0.72), 0 18px 45px rgba(24, 217, 255, 0.14);
}

.scene-preview-frame::before {
  content: "";
  position: absolute;
  inset: 12%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  background:
    linear-gradient(rgba(143, 240, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(143, 240, 255, 0.08) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: 0.6;
}

.scene-preview-frame.has-generated-image::before {
  opacity: 0.16;
}

.scene-enlarge-button {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  color: var(--white);
  background: rgba(3, 9, 21, 0.74);
  box-shadow: 0 12px 28px rgba(3, 9, 21, 0.28);
  font-size: 0.72rem;
  font-weight: 900;
  cursor: pointer;
}

.scene-enlarge-button:hover {
  border-color: rgba(143, 240, 255, 0.74);
  background: rgba(24, 217, 255, 0.18);
}

.scene-preview-frame > * {
  position: relative;
  z-index: 1;
}

.scene-preview-frame span {
  align-self: flex-start;
  padding: 5px 8px;
  border-radius: 999px;
  color: #a8f4ff;
  background: rgba(24, 217, 255, 0.12);
  font-size: 0.72rem;
  font-weight: 900;
}

.scene-preview-frame strong {
  color: var(--white);
  line-height: 1.05;
}

.scene-preview-frame p {
  color: rgba(226, 240, 255, 0.72);
  font-size: 0.78rem;
  line-height: 1.35;
}

.web-view {
  min-height: clamp(260px, 36vw, 460px);
  aspect-ratio: 16 / 9;
}

.scene-preview-choice {
  min-height: 28px;
  padding: 7px 9px;
  border: 1px solid rgba(160, 218, 255, 0.22);
  border-radius: 10px;
  color: var(--white);
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.76rem;
  font-weight: 900;
}

.web-choice-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.lightbox-open {
  overflow: hidden;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  place-items: center;
  padding: clamp(16px, 4vw, 48px);
}

.image-lightbox.is-open {
  display: grid;
}

.image-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 9, 21, 0.82);
  backdrop-filter: blur(14px);
}

.image-lightbox-panel {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
  width: min(1120px, 100%);
  max-height: 92vh;
  margin: 0;
  padding: 14px;
  border: 1px solid rgba(143, 240, 255, 0.28);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(8, 23, 61, 0.96), rgba(20, 12, 48, 0.96));
  box-shadow: 0 28px 90px rgba(3, 9, 21, 0.62);
}

.image-lightbox-panel figcaption {
  color: var(--white);
  font-size: 0.9rem;
  font-weight: 900;
}

.image-lightbox-panel img {
  display: block;
  width: 100%;
  max-height: calc(92vh - 86px);
  border-radius: 16px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.04);
}

.image-lightbox-close {
  position: absolute;
  top: 14px;
  right: 14px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  color: var(--white);
  background: rgba(3, 9, 21, 0.72);
  font-size: 0.72rem;
  font-weight: 900;
  cursor: pointer;
}

.scene-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(160, 218, 255, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
}

.scene-card-thumbs {
  display: grid;
  grid-template-columns: 0.55fr 1fr;
  gap: 8px;
  margin: 8px 0 10px;
}

.scene-card-thumbs img {
  width: 100%;
  height: 82px;
  border: 1px solid rgba(160, 218, 255, 0.18);
  border-radius: 10px;
  object-fit: cover;
}

.scene-card > span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  font-size: 0.8rem;
  font-weight: 900;
}

.scene-card p,
.story-card-preview p,
.story-player p,
.publish-checklist p {
  color: var(--muted);
  line-height: 1.5;
}

.scene-card small {
  color: #a8f4ff;
  font-weight: 800;
}

.scene-format-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.scene-format-row em {
  padding: 5px 8px;
  border: 1px solid rgba(24, 217, 255, 0.18);
  border-radius: 999px;
  color: #a8f4ff;
  background: rgba(24, 217, 255, 0.08);
  font-size: 0.7rem;
  font-style: normal;
  font-weight: 900;
}

.story-map-board {
  position: relative;
  overflow: auto;
  min-height: 340px;
  padding: 18px;
  border: 1px solid rgba(160, 218, 255, 0.16);
  border-radius: 16px;
  background:
    linear-gradient(rgba(143, 240, 255, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(143, 240, 255, 0.055) 1px, transparent 1px),
    rgba(255, 255, 255, 0.04);
  background-size: 44px 44px;
}

.map-tool-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.map-tool {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(160, 218, 255, 0.2);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.76);
  background: rgba(255, 255, 255, 0.06);
  font-weight: 900;
  cursor: pointer;
}

.map-tool.is-active {
  color: var(--white);
  border-color: rgba(24, 217, 255, 0.5);
  background: linear-gradient(135deg, rgba(24, 217, 255, 0.25), rgba(139, 67, 255, 0.2));
  box-shadow: 0 0 22px rgba(24, 217, 255, 0.16);
}

.story-map-tools {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.story-map-tools h4 {
  margin-bottom: 4px;
  font-size: clamp(1.2rem, 2vw, 1.65rem);
}

.story-map-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  gap: 14px;
  align-items: start;
}

.story-map-shell.is-expanded {
  position: fixed;
  inset: 112px 18px 18px;
  z-index: 50;
  overflow: auto;
  padding: 18px;
  border: 1px solid rgba(24, 217, 255, 0.28);
  border-radius: 18px;
  background:
    radial-gradient(circle at 18% 8%, rgba(24, 217, 255, 0.22), transparent 28rem),
    radial-gradient(circle at 86% 4%, rgba(139, 67, 255, 0.24), transparent 30rem),
    #030915;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.5);
}

body.story-map-open {
  overflow: hidden;
}

body.story-map-open .story-map-tools {
  position: fixed;
  top: 18px;
  left: 18px;
  right: 18px;
  z-index: 70;
  min-height: 64px;
  padding: 12px 14px;
  border: 1px solid rgba(24, 217, 255, 0.28);
  border-radius: 16px;
  background:
    radial-gradient(circle at 14% 20%, rgba(24, 217, 255, 0.18), transparent 24rem),
    linear-gradient(145deg, rgba(15, 31, 73, 0.96), rgba(5, 14, 37, 0.98));
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
}

.story-map-shell.is-expanded .story-map-board {
  min-height: calc(100vh - 78px);
}

.story-route-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(160, 218, 255, 0.16);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(15, 31, 73, 0.94), rgba(5, 14, 37, 0.95));
}

.story-node {
  position: absolute;
  width: 230px;
  min-height: 118px;
  padding: 14px;
  border: 1px solid rgba(24, 217, 255, 0.24);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(15, 31, 73, 0.94), rgba(5, 14, 37, 0.95));
  box-shadow: 0 18px 42px rgba(4, 11, 31, 0.2);
  user-select: none;
}

.story-node.is-selected {
  border-color: rgba(139, 67, 255, 0.72);
  box-shadow: 0 20px 50px rgba(42, 113, 255, 0.22), 0 0 0 2px rgba(139, 67, 255, 0.18);
}

.story-map-board.is-move-mode .story-node {
  cursor: grab;
}

.story-map-board.is-move-mode .story-node:active {
  cursor: grabbing;
}

.story-map-board:not(.is-connect-mode) .node-port {
  opacity: 0.2;
  pointer-events: none;
}

.story-map-board.is-connect-mode .node-port {
  opacity: 1;
}

.node-mini-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.node-mini-actions button {
  min-height: 26px;
  padding: 5px 8px;
  border: 1px solid rgba(160, 218, 255, 0.2);
  border-radius: 999px;
  color: #a8f4ff;
  background: rgba(24, 217, 255, 0.08);
  font-size: 0.72rem;
  font-weight: 900;
  cursor: pointer;
}

.node-port {
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.88);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  box-shadow: 0 0 16px rgba(24, 217, 255, 0.48);
  cursor: pointer;
}

.node-port:hover {
  transform: scale(1.18);
}

.port-up {
  top: -9px;
  left: calc(50% - 8px);
}

.port-right {
  top: calc(50% - 8px);
  right: -9px;
}

.port-down {
  bottom: -9px;
  left: calc(50% - 8px);
}

.port-left {
  top: calc(50% - 8px);
  left: -9px;
}

.story-node span {
  color: #8ff0ff;
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.selected-scene-editor {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(24, 217, 255, 0.18);
  border-radius: 14px;
  background: rgba(24, 217, 255, 0.06);
}

.selected-scene-editor > strong {
  color: var(--white);
}

.danger-button {
  border-color: rgba(255, 125, 151, 0.35);
  color: #ffd8df;
}

.route-chip-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.route-chip-row small {
  color: #a8f4ff;
}

.route-chip {
  min-height: 26px;
  padding: 6px 8px;
  border: 1px solid rgba(24, 217, 255, 0.2);
  border-radius: 999px;
  background: rgba(24, 217, 255, 0.08);
  font-weight: 900;
}

.publish-checklist {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.publish-checklist article {
  padding: 14px;
}

.publish-checklist span {
  color: #8ff0ff;
  font-weight: 900;
}

.output-board {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(160, 218, 255, 0.14);
}

.text-button {
  border: 0;
  color: #8ff0ff;
  background: transparent;
  font-weight: 900;
  cursor: pointer;
}

.project-board {
  display: grid;
  gap: 12px;
}

.board-card {
  position: relative;
  padding: 16px;
  border: 1px solid rgba(160, 218, 255, 0.15);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
}

.board-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(var(--cyan), var(--violet));
}

.board-card strong {
  display: block;
  margin-bottom: 6px;
}

.board-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
  white-space: pre-line;
}

.flow-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.flow-list li {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  color: var(--muted);
  line-height: 1.45;
}

.flow-list span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  color: var(--white);
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  font-weight: 900;
}

.builders-section,
.publish-section {
  margin-top: 30px;
  color: var(--ink);
}

.section-heading {
  margin-bottom: 18px;
}

.builders-section .eyebrow,
.publish-section .eyebrow {
  color: #3274ff;
}

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

.builder-card {
  position: relative;
  overflow: hidden;
  min-height: 220px;
  border-radius: 18px;
  padding: 20px;
  color: var(--white);
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.builder-card > * {
  position: relative;
  z-index: 1;
}

.builder-card::after {
  content: "";
  position: absolute;
  right: -30px;
  bottom: -46px;
  width: 150px;
  height: 150px;
  border-radius: 22px;
  border: 1px solid rgba(143, 240, 255, 0.25);
  background: linear-gradient(135deg, rgba(24, 217, 255, 0.24), rgba(139, 67, 255, 0.18));
  transform: rotate(18deg);
}

.library-card {
  padding: 0;
  min-height: 360px;
}

.library-card::after {
  display: none;
}

.library-cover {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-bottom: 1px solid rgba(160, 218, 255, 0.16);
  background:
    radial-gradient(circle at 25% 18%, rgba(24, 217, 255, 0.24), transparent 12rem),
    linear-gradient(135deg, rgba(24, 217, 255, 0.12), rgba(139, 67, 255, 0.16));
}

.library-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 48%, rgba(5, 14, 37, 0.42));
  pointer-events: none;
}

.library-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(1.08) contrast(1.04);
}

.cover-placeholder {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  color: rgba(255, 255, 255, 0.82);
  font-size: 3rem;
  font-weight: 900;
}

.library-card-body {
  padding: 20px;
}

.builder-card p {
  position: relative;
  z-index: 1;
  color: var(--muted);
  line-height: 1.55;
}

.builder-card:hover {
  transform: translateY(-3px);
  border-color: rgba(24, 217, 255, 0.36);
  box-shadow: 0 28px 82px rgba(4, 11, 31, 0.28);
}

.auth-shell {
  max-width: 1220px;
}

.auth-hero {
  align-items: stretch;
}

.auth-hero-single {
  grid-template-columns: minmax(0, 1fr);
}

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

.auth-grid-single {
  grid-template-columns: minmax(0, 620px);
}

.text-link {
  display: inline-flex;
  justify-self: start;
}

.account-card h2 {
  margin-bottom: 0;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
}

.turnstile-slot {
  min-height: 70px;
}

.turnstile-missing {
  display: grid;
  place-items: center;
  min-height: 54px;
  border: 1px dashed rgba(160, 218, 255, 0.28);
  border-radius: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.billing-card {
  min-height: 310px;
}

.credit-topup-section {
  margin-top: 34px;
}

.credit-card {
  min-height: 280px;
}

.credit-card .button {
  margin-top: 14px;
}

.price-line {
  color: var(--white) !important;
  font-size: 2.3rem;
  font-weight: 900;
}

.old-price {
  display: inline-block;
  margin-right: 8px;
  color: rgba(143, 164, 202, 0.78);
  font-size: 0.62em;
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.promo-note {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 28px;
  margin: -4px 0 12px;
  padding: 0 10px;
  border: 1px solid rgba(24, 217, 255, 0.28);
  border-radius: 999px;
  color: #a8f4ff;
  background: rgba(24, 217, 255, 0.1);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.payment-actions {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.billing-status {
  margin-top: 18px;
  color: var(--ink);
}

.publish-section {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(320px, 1fr);
  gap: 24px;
  align-items: start;
}

.publish-form {
  display: grid;
  gap: 14px;
  border-radius: 18px;
  padding: 20px;
  color: var(--white);
}

@media (max-width: 1100px) {
  .studio-grid,
  .studio-hero,
  .publish-section,
  .account-grid,
  .account-forms {
    grid-template-columns: 1fr;
  }

  .builder-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .story-workspace,
  .publish-checklist {
    grid-template-columns: 1fr;
  }

  .story-map-board {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .story-map-shell,
  .story-map-shell.is-expanded {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .studio-header {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 18px;
  }

  .studio-header nav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .studio-shell {
    width: min(100% - 22px, 1400px);
    padding-top: 28px;
  }

  h1 {
    font-size: clamp(2.25rem, 13vw, 3.8rem);
  }

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

  .story-dashboard-head {
    flex-direction: column;
  }

  .story-form-grid,
  .story-map-board {
    grid-template-columns: 1fr;
  }

  .scene-preview-pair,
  .scene-preview-actions,
  .web-choice-row {
    grid-template-columns: 1fr;
  }

  .web-view {
    width: 100%;
    margin: 0 auto;
  }

  .story-map-tools {
    flex-direction: column;
  }

  body.story-map-open .story-map-tools {
    align-items: stretch;
    min-height: 138px;
  }

  body.story-map-open .map-tool-row {
    justify-content: flex-start;
  }

  .story-map-shell.is-expanded {
    inset: 176px 12px 12px;
  }

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

  .workspace-top,
  .output-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .console-orbit {
    right: 18px;
    width: 118px;
    height: 118px;
    opacity: 0.36;
  }
}
