:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --panel: #ffffff;
  --panel-soft: #eef4f8;
  --ink: #17202a;
  --muted: #657182;
  --line: #dce4ea;
  --line-strong: #c5d1dc;
  --blue: #176fd0;
  --blue-soft: #edf5ff;
  --green: #2e7d4f;
  --green-soft: #edf7ef;
  --coral: #c9553d;
  --amber: #b67414;
  --amber-soft: #fff7e8;
  --shadow: 0 18px 46px rgba(24, 34, 45, 0.16);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

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

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: 64px 58px minmax(0, 1fr);
  background: var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 8;
}

.brand-mark {
  color: var(--blue);
  font-size: 29px;
  font-weight: 850;
  letter-spacing: 0;
  white-space: nowrap;
}

.project-status {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
}

.project-title {
  max-width: min(420px, 46vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 18px;
  font-weight: 760;
  padding: 8px 0;
}

.save-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--green);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.view-tabs {
  display: flex;
  gap: 10px;
  align-items: center;
  overflow-x: auto;
  padding: 9px 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.view-tab,
.board-tab,
.kind-button,
.ghost-button,
.small-button,
.mentor-mode-select,
.toolbar button,
.column-title button,
.column-title select,
.asset-chip,
.history-item,
.board-item-card,
.task-card,
.new-scene,
.scene-chip,
.project-action {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  color: var(--ink);
}

.view-tab {
  flex: 0 0 auto;
  min-width: 118px;
  min-height: 40px;
  padding: 8px 16px;
  color: #3c4858;
  font-weight: 760;
}

.view-tab.active {
  border-color: #bdd8ef;
  background: var(--blue-soft);
  color: var(--blue);
}

.app-main {
  min-width: 0;
  overflow: auto;
  padding: 16px;
}

.view-panel {
  min-width: 0;
}

.write-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  gap: 16px;
  align-items: start;
}

.writing-column {
  min-width: 0;
}

.prompt-row {
  display: grid;
  grid-template-columns: 142px minmax(280px, 1fr) 92px 112px;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.mentor-mode-select {
  min-width: 0;
  min-height: 40px;
  padding: 0 10px;
  color: var(--blue);
  background: var(--blue-soft);
  border-color: #bdd8ef;
  font-weight: 730;
}

.prompt-form {
  display: flex;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.prompt-form input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  padding: 0 13px;
}

.primary-button,
.prompt-form button,
.visual-form button {
  border: 0;
  border-radius: 8px;
  min-height: 40px;
  background: var(--blue);
  color: #fff;
  font-weight: 760;
  padding: 9px 13px;
}

.prompt-form button {
  border-radius: 0;
}

.ghost-button {
  min-height: 36px;
  padding: 7px 11px;
  font-weight: 680;
}

.ghost-button.danger {
  color: var(--coral);
}

.editor-panel {
  margin-top: 14px;
  min-width: 0;
}

.scene-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.scene-title-input {
  flex: 1;
  min-width: 0;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  font-size: 22px;
  font-weight: 780;
  letter-spacing: 0;
  padding: 7px 0;
  outline: none;
}

.scene-title-input:focus {
  border-bottom-color: var(--line-strong);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-bottom: 0;
  background: #fff;
  padding: 9px;
  border-radius: 8px 8px 0 0;
}

.toolbar button {
  min-height: 32px;
  padding: 5px 9px;
  color: #344154;
  font-size: 13px;
  font-weight: 700;
}

#storyText {
  width: 100%;
  height: clamp(430px, 58svh, 720px);
  min-height: 430px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  background: #fff;
  color: #1e242c;
  outline: none;
  padding: 28px 34px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  line-height: 1.72;
}

#storyText.compiled-textarea {
  display: none;
}

.block-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  background: #fff;
  padding: 9px;
  border-radius: 8px;
}

.block-toolbar button,
.story-block-actions button,
.block-resize-row button,
.block-drag-handle {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #344154;
  padding: 6px 10px;
  font-weight: 720;
}

.block-toolbar button {
  color: var(--blue);
}

#blockSaveStatus {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
  font-weight: 680;
}

.block-editor {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  min-height: clamp(420px, 56svh, 700px);
}

.story-block-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.story-block-card.dragging {
  border-color: var(--blue);
  box-shadow: 0 12px 28px rgba(23, 111, 208, 0.16);
  opacity: 0.78;
}

.story-block-card.chapter {
  border-left: 5px solid var(--blue);
}

.story-block-card.paragraph {
  border-left: 5px solid var(--green);
}

.story-block-top {
  display: grid;
  grid-template-columns: auto minmax(120px, 160px) minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.block-drag-handle {
  color: var(--muted);
  cursor: grab;
}

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

.block-type-select {
  min-width: 0;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: #334052;
  padding: 5px 8px;
  font-weight: 730;
}

.block-version-pill {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
  white-space: nowrap;
}

.story-block-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}

.story-block-actions button {
  color: var(--blue);
  font-size: 13px;
}

.story-block-actions button.danger {
  color: var(--coral);
}

.story-block-body {
  width: 100%;
  min-height: 112px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #1e242c;
  outline: none;
  padding: 16px 18px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 19px;
  line-height: 1.62;
}

.story-block-card.chapter .story-block-body {
  min-height: 72px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.28;
}

.block-resize-row {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.block-resize-row button {
  color: var(--blue);
  font-size: 13px;
}

.block-resize-handle {
  min-height: 38px;
  cursor: ns-resize;
  touch-action: none;
  color: #334052 !important;
  background: repeating-linear-gradient(
    0deg,
    #fff,
    #fff 8px,
    #f1f5f9 8px,
    #f1f5f9 10px
  ) !important;
}

body.block-resizing {
  cursor: ns-resize;
  user-select: none;
}

body.block-resizing .story-block-body {
  pointer-events: none;
}

.version-drawer {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfd;
  padding: 10px;
}

.version-drawer h3 {
  margin-bottom: 8px;
  font-size: 14px;
}

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

.version-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.version-row strong {
  display: block;
  color: #334052;
  font-size: 12px;
  margin-bottom: 3px;
}

.version-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.version-row button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--blue);
  padding: 5px 9px;
  font-weight: 720;
}

.editor-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  margin-top: 9px;
}

#versionStatus {
  color: var(--green);
  text-align: right;
}

.mentor-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
  max-height: calc(100svh - 170px);
  overflow: auto;
}

.mentor-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.spark {
  color: var(--blue);
  font-size: 15px;
  font-weight: 850;
}

.mentor-title h2 {
  margin: 0;
  font-size: 18px;
}

.source-pill {
  margin-left: auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--panel-soft);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
}

.mentor-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  margin-bottom: 11px;
}

.mentor-card h3 {
  font-size: 15px;
  margin-bottom: 8px;
}

.mentor-card p,
.mentor-card li {
  color: #465264;
  font-size: 14px;
  line-height: 1.46;
}

.mentor-card ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.mentor-block {
  border-top: 1px solid #edf0ec;
  padding-top: 9px;
  margin-top: 9px;
}

.mentor-block strong {
  display: block;
  color: #2f3a49;
  font-size: 12px;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.quick-card {
  display: grid;
  gap: 8px;
}

.paragraph-draft {
  display: grid;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  margin-bottom: 2px;
}

.paragraph-draft h3 {
  margin: 0;
}

.paragraph-draft p {
  margin: 0;
  color: #263142;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15px;
  line-height: 1.55;
}

.paragraph-draft button {
  justify-self: start;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chips button {
  border: 1px solid #e1bd7e;
  background: #fffaf0;
  color: #8b5d11;
  border-radius: 8px;
  padding: 7px 9px;
  font-weight: 680;
}

.history-list {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.history-item {
  width: 100%;
  display: grid;
  gap: 3px;
  text-align: left;
  padding: 8px;
}

.history-item strong {
  color: var(--blue);
  font-size: 12px;
}

.history-item span {
  color: var(--muted);
  font-size: 12px;
}

.tasks-view {
  display: grid;
  grid-template-columns: minmax(260px, 330px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.task-list-panel,
.task-detail-panel,
.board-column,
.item-editor-column,
.image-builder-panel,
.visual-preview-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
}

.column-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.column-title h2 {
  margin: 0;
  font-size: 18px;
}

.column-title button,
.column-title select {
  min-height: 34px;
  padding: 6px 9px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 720;
}

.task-list,
.item-list {
  display: grid;
  gap: 9px;
  max-height: calc(100svh - 230px);
  overflow: auto;
}

.task-card,
.board-item-card {
  width: 100%;
  min-height: 66px;
  display: grid;
  gap: 5px;
  text-align: left;
  padding: 10px;
}

.task-card strong,
.board-item-card strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #263142;
  font-size: 14px;
}

.task-card span,
.board-item-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.task-card.selected,
.board-item-card.selected {
  border-color: var(--green);
  background: var(--green-soft);
}

.task-card.done strong {
  text-decoration: line-through;
  color: var(--muted);
}

.task-card small {
  width: fit-content;
  border-radius: 999px;
  padding: 3px 7px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.task-card.done small {
  background: var(--green-soft);
  color: var(--green);
}

.done-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  margin-bottom: 10px;
  color: #334052;
  font-weight: 720;
}

.done-row input {
  width: 18px;
  height: 18px;
}

.item-title-input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  outline: none;
  font-weight: 740;
}

.item-body-input {
  width: 100%;
  min-height: 230px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 8px;
  padding: 10px;
  outline: none;
  line-height: 1.48;
}

.task-body-input {
  min-height: 310px;
}

.item-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.small-button {
  min-height: 34px;
  padding: 7px 10px;
  color: var(--blue);
  font-weight: 720;
}

.story-view {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 16px;
}

.story-board-nav {
  grid-column: 1 / -1;
  display: flex;
  gap: 9px;
  overflow-x: auto;
  padding: 2px;
}

.board-tab {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 8px 13px;
  color: #405064;
  font-weight: 730;
}

.board-tab.active {
  border-color: #bdd8ef;
  background: var(--blue-soft);
  color: var(--blue);
}

.scene-strip {
  grid-column: 1 / -1;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(150px, 1fr);
  gap: 10px;
  overflow-x: auto;
}

.new-scene,
.scene-chip {
  min-width: 140px;
  text-align: left;
  padding: 9px 10px;
  color: #526071;
}

.new-scene {
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--blue);
  font-weight: 770;
}

.scene-chip strong,
.scene-chip span {
  display: block;
  margin-top: 2px;
}

.scene-chip strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #263142;
  font-size: 13px;
}

.scene-chip span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.scene-chip.active {
  border-color: #8bbce9;
  background: var(--blue-soft);
}

.images-view {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(260px, 330px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.image-builder-panel,
.visual-preview-panel {
  display: grid;
  gap: 12px;
}

.image-kind-set {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.kind-button {
  min-height: 40px;
  padding: 8px 10px;
  color: #405064;
  font-weight: 740;
}

.kind-button.active {
  border-color: #bdd8ef;
  background: var(--blue-soft);
  color: var(--blue);
}

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

.field-label {
  color: #334052;
  font-size: 13px;
  font-weight: 760;
}

.visual-source-control {
  display: grid;
  gap: 7px;
}

.visual-source-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.visual-source-select {
  min-width: 0;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #334052;
  padding: 6px 9px;
  font-weight: 700;
}

.visual-frame {
  width: 100%;
  border-radius: 8px;
  background: var(--panel-soft);
  min-height: 300px;
}

.visual-frame img {
  width: 100%;
  aspect-ratio: 16 / 10;
  max-height: min(520px, calc(100svh - 280px));
  min-height: 300px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  cursor: zoom-in;
  display: block;
}

.visual-empty {
  min-height: 300px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  background: #f9fbfd;
  padding: 22px;
  text-align: center;
  line-height: 1.45;
  font-weight: 700;
}

.visual-preview-panel p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
  margin: 0;
}

.visual-form {
  display: grid;
  gap: 9px;
}

.visual-form textarea {
  min-width: 0;
  min-height: 138px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  outline: none;
  line-height: 1.45;
}

.visual-form button {
  width: 100%;
}

.saved-images-block {
  display: grid;
  gap: 8px;
  padding-top: 4px;
}

.saved-images-block h3 {
  margin: 0;
  color: #334052;
  font-size: 14px;
}

.asset-list {
  display: grid;
  gap: 10px;
  padding-top: 2px;
}

.asset-group {
  display: grid;
  gap: 6px;
}

.asset-group strong {
  color: #334052;
  font-size: 13px;
}

.asset-group > div {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.asset-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
}

.asset-missing {
  color: var(--amber);
  background: var(--amber-soft);
  border: 1px solid #f0d69b;
  border-radius: 8px;
  padding: 7px 9px;
  font-size: 12px;
  font-weight: 700;
}

.asset-chip span {
  color: var(--muted);
  font-weight: 600;
}

.empty-state,
.empty-inline {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 22px;
}

.image-modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  border-radius: 0;
  background: rgba(12, 18, 27, 0.72);
}

.image-modal-card {
  position: relative;
  z-index: 1;
  width: min(1100px, 100%);
  max-height: calc(100svh - 44px);
  display: grid;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  box-shadow: var(--shadow);
}

.image-modal-card img {
  width: 100%;
  max-height: calc(100svh - 140px);
  object-fit: contain;
  border-radius: 8px;
  background: #101822;
}

.image-modal-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.modal-close {
  justify-self: end;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--blue);
  font-weight: 720;
  padding: 6px 10px;
}

.project-popover {
  position: absolute;
  top: 56px;
  left: clamp(16px, 15vw, 220px);
  width: min(326px, calc(100vw - 32px));
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 8px;
  padding: 12px;
  z-index: 20;
}

.project-popover.hidden {
  display: none;
}

.project-option {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 10px;
  border-radius: 8px;
}

.project-option:hover,
.project-option.active {
  background: var(--panel-soft);
}

.project-create {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.project-create input {
  min-width: 0;
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
}

.project-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.project-action {
  min-height: 34px;
  color: var(--blue);
  font-weight: 720;
}

.project-action.danger {
  color: var(--coral);
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: min(980px, 100%);
  min-height: 560px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.login-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.login-panel {
  padding: 54px 44px;
  align-self: center;
}

.login-panel h1 {
  font-size: 34px;
  letter-spacing: 0;
  margin: 20px 0 10px;
}

.login-panel p {
  color: var(--muted);
  line-height: 1.5;
}

.login-form {
  display: grid;
  gap: 10px;
  margin-top: 28px;
}

.login-form input {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 44px;
  padding: 10px 12px;
}

.login-form button {
  border: 0;
  border-radius: 8px;
  min-height: 44px;
  color: #fff;
  background: var(--blue);
  font-weight: 760;
}

.form-message {
  min-height: 20px;
  font-size: 14px;
}

@media (max-width: 1080px) {
  .write-view {
    grid-template-columns: 1fr;
  }

  .mentor-panel {
    max-height: none;
  }

  .prompt-row {
    grid-template-columns: 142px minmax(240px, 1fr) 92px 112px;
  }
}

@media (orientation: portrait) and (max-width: 1024px) {
  .app-shell {
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  .topbar {
    min-height: 64px;
  }

  .tasks-view,
  .story-view,
  .images-view {
    grid-template-columns: 1fr;
  }

  .story-board-nav,
  .scene-strip {
    grid-column: 1;
  }

  .task-list,
  .item-list {
    max-height: 260px;
  }

  #storyText {
    height: 52svh;
  }
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  .topbar {
    position: static;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px;
  }

  .project-status {
    order: 3;
    flex-basis: 100%;
  }

  .project-title {
    max-width: calc(100vw - 72px);
  }

  .top-actions {
    flex-wrap: wrap;
  }

  .view-tabs {
    padding: 8px 12px;
  }

  .view-tab {
    min-width: 96px;
  }

  .app-main {
    padding: 12px;
  }

  .prompt-row,
  .visual-form,
  .visual-source-row,
  .story-block-top {
    grid-template-columns: 1fr;
  }

  #blockSaveStatus {
    width: 100%;
    margin-left: 0;
  }

  .prompt-form {
    min-height: 42px;
  }

  .mentor-mode-select {
    width: 100%;
  }

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

  #storyText {
    min-height: 380px;
    padding: 20px;
    font-size: 18px;
  }

  .story-block-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .block-resize-row {
    grid-template-columns: 1fr 1.2fr 1fr;
  }

  .story-block-body {
    font-size: 18px;
    padding: 14px;
  }

  .version-row {
    grid-template-columns: 1fr;
  }

  .item-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .scene-strip {
    grid-auto-columns: minmax(150px, 1fr);
  }

  .image-modal {
    padding: 10px;
  }

  .image-modal-card {
    max-height: calc(100svh - 20px);
  }

  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-art {
    display: none;
  }

  .login-panel {
    padding: 42px 26px;
  }
}
