:root {
  color-scheme: light;
  --paper: #f8f4ea;
  --paper-strong: #fffaf1;
  --ink: #1c2230;
  --muted: #667085;
  --line: rgba(28, 34, 48, 0.12);
  --shadow: 0 24px 70px rgba(35, 41, 61, 0.16);
  --blue: #4067d8;
  --rose: #d95b7f;
  --jade: #0f9f83;
  --amber: #d99028;
  --violet: #6d5bd0;
  --radius: 8px;
  --pill: 999px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    linear-gradient(135deg, rgba(64, 103, 216, 0.08), transparent 30%),
    linear-gradient(315deg, rgba(217, 91, 127, 0.1), transparent 34%),
    var(--paper);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family:
    "Microsoft YaHei UI",
    "Microsoft YaHei",
    "PingFang SC",
    "Segoe UI",
    Arial,
    sans-serif;
}

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

button {
  border: 0;
  cursor: pointer;
}

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

img {
  max-width: 100%;
  display: block;
}

.app-shell {
  min-height: 100vh;
}

.hero {
  position: relative;
  min-height: 92vh;
  padding: 26px clamp(18px, 4vw, 56px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid var(--line);
  border-radius: 28px;
  pointer-events: none;
}

.hero-art {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(140deg, rgba(255, 250, 241, 0.92), rgba(248, 244, 234, 0.72)),
    url("data:image/svg+xml,%3Csvg width='1600' height='1000' viewBox='0 0 1600 1000' xmlns='http://www.w3.org/2000/svg'%3E%3Cdefs%3E%3ClinearGradient id='a' x1='0' x2='1' y1='0' y2='1'%3E%3Cstop stop-color='%234067d8'/%3E%3Cstop offset='.45' stop-color='%230f9f83'/%3E%3Cstop offset='1' stop-color='%23d99028'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='1600' height='1000' fill='%23f8f4ea'/%3E%3Cpath d='M1070 92c174 44 330 182 368 344 39 162-39 348-190 424-151 75-374 38-504-67-130-104-167-276-94-414 73-139 247-331 420-287Z' fill='url(%23a)' opacity='.28'/%3E%3Cpath d='M191 280c92-99 259-145 384-84 126 61 210 229 174 355-36 125-193 209-333 200-139-9-263-110-300-223-37-114-17-149 75-248Z' fill='%23d95b7f' opacity='.16'/%3E%3Cg fill='none' stroke='%231c2230' stroke-opacity='.2' stroke-width='2'%3E%3Cpath d='M858 205h276a54 54 0 0 1 54 54v356a54 54 0 0 1-54 54H858a54 54 0 0 1-54-54V259a54 54 0 0 1 54-54Z'/%3E%3Cpath d='M884 293h218M884 365h168M884 437h244M884 509h196'/%3E%3Cpath d='M473 321h183a44 44 0 0 1 44 44v239a44 44 0 0 1-44 44H473a44 44 0 0 1-44-44V365a44 44 0 0 1 44-44Z'/%3E%3Cpath d='M502 387c54-28 114-28 168 0M502 453h137M502 514h161'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover;
  background-position: center;
}

.hero-character-image {
  position: absolute;
  right: clamp(-24px, 1vw, 38px);
  bottom: 1vh;
  z-index: 0;
  width: min(56vw, 980px);
  max-height: 96vh;
  opacity: 0.38;
  filter: saturate(0.9) sepia(0.08) blur(0.2px);
  mix-blend-mode: multiply;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse at 52% 48%, #000 54%, rgba(0, 0, 0, 0.62) 68%, transparent 84%);
  mask-image: radial-gradient(ellipse at 52% 48%, #000 54%, rgba(0, 0, 0, 0.62) 68%, transparent 84%);
}

.hero-character-image img {
  width: 100%;
  max-height: 96vh;
  object-fit: contain;
  object-position: right bottom;
}

.hero-nav,
.hero-content,
.hero-footer {
  position: relative;
  z-index: 1;
}

.hero-nav,
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.brand-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: conic-gradient(from 20deg, var(--blue), var(--jade), var(--amber), var(--rose), var(--blue));
  box-shadow: 0 0 0 7px rgba(255, 255, 255, 0.68);
}

.hero-content {
  align-self: center;
  max-width: 860px;
  padding: 8vh 0 5vh;
}

.eyebrow {
  color: var(--jade);
  font-weight: 800;
  margin: 0 0 14px;
}

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

.hero h1 {
  max-width: 760px;
  margin-bottom: 20px;
  font-size: clamp(54px, 11vw, 148px);
  line-height: 0.95;
  letter-spacing: 0;
}

.hero-subtitle {
  max-width: 670px;
  color: #3c465c;
  font-size: clamp(17px, 2vw, 22px);
  line-height: 1.8;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 34px;
}

.hero-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
}

.mini-pill,
.branch-chip,
.role-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: var(--pill);
  background: rgba(255, 250, 241, 0.72);
  color: #485269;
  font-size: 13px;
}

.footer-contact {
  color: #8c919d;
  background: rgba(255, 255, 255, 0.48);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 16px;
  border-radius: var(--pill);
  background: #ece4d6;
  color: var(--ink);
  font-weight: 800;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(28, 34, 48, 0.16);
}

.button.primary {
  background: var(--ink);
  color: white;
}

.button.blue {
  background: var(--blue);
  color: white;
}

.button.ghost {
  background: rgba(255, 250, 241, 0.78);
  border: 1px solid var(--line);
}

.button.danger {
  background: #f5d8d8;
  color: #8f1e2d;
}

.icon-button {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 16px 34px rgba(28, 34, 48, 0.24);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 14px clamp(14px, 3vw, 38px);
  background: rgba(248, 244, 234, 0.9);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.mode-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--pill);
  background: rgba(255, 250, 241, 0.76);
}

.mode-switch button {
  min-height: 36px;
  padding: 7px 14px;
  border-radius: var(--pill);
  background: transparent;
  color: #576178;
  font-weight: 800;
}

.mode-switch button.active {
  background: var(--ink);
  color: white;
}

.page {
  position: relative;
  width: min(1220px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 54px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin: 8px 0 22px;
}

.section-head h2 {
  margin-bottom: 8px;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.1;
}

.section-head p,
.muted {
  color: var(--muted);
  line-height: 1.7;
}

.section-copy-slot {
  min-height: 1.7em;
}

.hub-grid {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 560px;
  gap: 16px;
}

.hub-grid:hover .hub-card {
  flex: 0.88;
}

.hub-card {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(118px, 0.34fr) minmax(280px, 0.66fr);
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid rgba(28, 34, 48, 0.14);
  background: var(--paper-strong);
  color: var(--ink);
  box-shadow: 0 14px 44px rgba(28, 34, 48, 0.1);
  transition: flex 220ms ease, transform 220ms ease, box-shadow 220ms ease;
}

.hub-card:hover {
  flex: 1.45 !important;
  transform: translateY(-8px);
  box-shadow: var(--shadow);
}

.hub-title {
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hub-title strong {
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1.1;
}

.hub-title span {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.5;
}

.hub-art {
  position: relative;
  overflow: hidden;
  min-height: 100%;
}

.hub-art img {
  width: 100%;
  height: 100%;
  min-height: 320px;
  object-fit: cover;
  transition: transform 240ms ease;
}

.hub-card:hover .hub-art img {
  transform: scale(1.05);
}

.hub-art::after,
.image-field::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(28, 34, 48, 0.25), transparent 45%);
  pointer-events: none;
}

.panel,
.form-panel,
.admin-panel,
.auth-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 250, 241, 0.84);
  box-shadow: 0 14px 40px rgba(28, 34, 48, 0.09);
}

.panel,
.form-panel {
  padding: clamp(16px, 3vw, 26px);
}

.world-banner {
  min-height: 330px;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--paper-strong);
  box-shadow: var(--shadow);
}

.world-banner img {
  width: 100%;
  height: 100%;
  min-height: 330px;
  object-fit: cover;
}

.article {
  margin-top: 22px;
  padding: clamp(20px, 4vw, 42px);
  border-left: 6px solid var(--jade);
  background: rgba(255, 250, 241, 0.72);
  border-radius: var(--radius);
  line-height: 2;
  white-space: pre-wrap;
  font-size: 17px;
}

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

.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
  align-items: start;
}

.card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-strong);
  box-shadow: 0 12px 34px rgba(28, 34, 48, 0.09);
}

.card-click {
  width: 100%;
  height: 100%;
  padding: 0;
  text-align: left;
  background: transparent;
  color: inherit;
}

.character-card {
  max-width: 320px;
}

.character-card-image {
  aspect-ratio: 4 / 5;
  background:
    linear-gradient(135deg, rgba(64, 103, 216, 0.08), rgba(217, 91, 127, 0.1)),
    rgba(255, 255, 255, 0.5);
  overflow: hidden;
}

.character-card-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.card-image {
  height: 260px;
  background: #ddd;
}

.card-image img,
.thumb img,
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-body {
  padding: 15px;
}

.card-body h3 {
  margin-bottom: 8px;
  font-size: 22px;
}

.card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 14px 14px;
}

.meta-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(260px, 360px) 1fr;
  gap: 18px;
}

.detail-side {
  align-self: start;
}

.detail-image {
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--paper-strong);
}

.detail-image img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: contain;
  background:
    linear-gradient(135deg, rgba(64, 103, 216, 0.08), rgba(217, 91, 127, 0.1)),
    rgba(255, 255, 255, 0.42);
}

.detail-main {
  min-width: 0;
}

.fact-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.fact {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.48);
}

.fact small {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
}

.longtext {
  white-space: pre-wrap;
  line-height: 1.9;
}

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

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

.character-editor-layout {
  display: grid;
  grid-template-columns: minmax(240px, 360px) minmax(320px, 1fr);
  gap: 18px;
  align-items: start;
}

.character-editor-image {
  grid-row: span 2;
}

.character-editor-layout > .field.full {
  grid-column: 1 / -1;
}

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

.field.full {
  grid-column: 1 / -1;
}

label {
  color: #39435a;
  font-weight: 800;
  font-size: 14px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(28, 34, 48, 0.18);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  outline: none;
  padding: 11px 12px;
}

textarea {
  min-height: 150px;
  resize: vertical;
  line-height: 1.7;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(64, 103, 216, 0.14);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.image-field {
  position: relative;
  overflow: hidden;
  min-height: 220px;
  border: 1px dashed rgba(28, 34, 48, 0.3);
  border-radius: 18px;
  background: #f0eadf;
}

.image-field img {
  width: 100%;
  height: 260px;
  object-fit: cover;
}

.image-field.portrait {
  min-height: auto;
  aspect-ratio: 4 / 5;
}

.image-field.portrait img {
  height: 100%;
  aspect-ratio: 4 / 5;
  object-fit: contain;
  background:
    linear-gradient(135deg, rgba(64, 103, 216, 0.08), rgba(217, 91, 127, 0.1)),
    rgba(255, 255, 255, 0.42);
}

.image-field input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.image-hint {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 1;
  padding: 8px 12px;
  border-radius: var(--pill);
  background: rgba(28, 34, 48, 0.78);
  color: white;
  font-size: 13px;
}

.relation-row,
.chapter-row,
.interaction-row {
  display: grid;
  grid-template-columns: 62px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.48);
  margin-top: 10px;
}

.relation-row.editing {
  grid-template-columns: 1fr 1fr auto;
}

.avatar,
.thumb {
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: 0 0 auto;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--jade));
  color: white;
  font-weight: 900;
}

.thumb {
  border-radius: var(--radius);
}

.warning-dot {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #ffe0a3;
  color: #7a4c00;
  font-weight: 900;
}

.plot-entry-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 420px));
  gap: 18px;
  align-items: stretch;
}

.plot-entry-illustration {
  width: min(920px, 100%);
  height: auto;
  min-height: 220px;
  margin: 8px 0 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(255, 250, 241, 0.5), rgba(255, 250, 241, 0.18)),
    rgba(255, 255, 255, 0.42);
  box-shadow: 0 18px 46px rgba(28, 34, 48, 0.1);
}

.plot-entry-illustration img {
  width: 100%;
  height: auto;
  object-fit: contain;
  object-position: center;
  opacity: 1;
  filter: saturate(0.92) contrast(0.98);
}

.plot-entry-card {
  min-height: 210px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper-strong);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 16px 42px rgba(28, 34, 48, 0.1);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.plot-entry-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.plot-entry-card strong {
  display: block;
  margin-bottom: 12px;
  font-size: 28px;
}

.plot-entry-card span {
  display: block;
  color: var(--muted);
  line-height: 1.7;
}

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

.plot-sidebar {
  position: sticky;
  top: 88px;
  display: grid;
  gap: 12px;
}

.sidebar-title,
.reader-head,
.plot-chapter-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.sidebar-title h3,
.reader-head h3,
.plot-chapter-head strong {
  margin: 0;
}

.plot-chapter {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.45);
}

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

.text-button {
  min-height: 28px;
  padding: 4px 9px;
  border-radius: var(--pill);
  background: #ece4d6;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.text-button.danger {
  background: #f5d8d8;
  color: #8f1e2d;
}

.act-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.act-pill {
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: var(--pill);
  background: rgba(255, 250, 241, 0.8);
  color: var(--ink);
  font-weight: 800;
}

.act-pill.active {
  background: linear-gradient(135deg, var(--blue), var(--jade));
  color: white;
}

.plot-reader {
  min-height: 460px;
}

.plot-empty {
  min-height: 380px;
}

.story-list-item {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.46);
  color: var(--ink);
  text-align: left;
}

.story-list-item.active {
  border-color: rgba(64, 103, 216, 0.52);
  box-shadow: 0 0 0 4px rgba(64, 103, 216, 0.1);
}

.story-list-item small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

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

.contrib-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.contrib-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.58);
  color: #465065;
}

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
}

.auth-panel {
  width: min(960px, 100%);
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
}

.auth-copy {
  padding: clamp(24px, 5vw, 48px);
  background:
    linear-gradient(135deg, rgba(64, 103, 216, 0.16), transparent),
    linear-gradient(315deg, rgba(15, 159, 131, 0.14), transparent),
    var(--paper-strong);
}

.auth-form {
  padding: clamp(24px, 4vw, 42px);
}

.tabs {
  display: inline-flex;
  padding: 4px;
  margin-bottom: 18px;
  border-radius: var(--pill);
  background: #ece4d6;
}

.tab {
  min-height: 34px;
  padding: 7px 14px;
  border-radius: var(--pill);
  background: transparent;
  color: #566078;
  font-weight: 800;
}

.tab.active {
  background: white;
  color: var(--ink);
}

.notice {
  padding: 12px 14px;
  margin: 14px 0;
  border-radius: var(--radius);
  background: #e8f4ef;
  color: #196452;
  line-height: 1.6;
}

.notice.error {
  background: #f8dddd;
  color: #9b2432;
}

.admin-panel {
  margin-top: 18px;
  padding: 16px;
}

.user-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.user-line:last-child {
  border-bottom: 0;
}

.empty {
  min-height: 240px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  border: 1px dashed rgba(28, 34, 48, 0.24);
  border-radius: var(--radius);
  background: rgba(255, 250, 241, 0.6);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 100;
  transform: translateX(-50%);
  max-width: min(560px, calc(100% - 24px));
  padding: 12px 16px;
  border-radius: var(--pill);
  background: var(--ink);
  color: white;
  box-shadow: var(--shadow);
}

.crop-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(28, 34, 48, 0.42);
  backdrop-filter: blur(10px);
}

.crop-panel {
  width: min(980px, 100%);
  max-height: calc(100vh - 44px);
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper-strong);
  box-shadow: var(--shadow);
}

.crop-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.crop-head h3 {
  margin-bottom: 6px;
}

.crop-stage {
  position: relative;
  overflow: hidden;
  max-width: 100%;
  margin: 0 auto;
  border-radius: 14px;
  background: #f1eadf;
}

.crop-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.crop-box {
  position: absolute;
  border: 2px solid white;
  box-shadow:
    0 0 0 9999px rgba(28, 34, 48, 0.42),
    0 12px 32px rgba(28, 34, 48, 0.24);
  cursor: move;
}

.crop-box::before,
.crop-box::after {
  content: "";
  position: absolute;
  inset: 33.333% 0 auto;
  border-top: 1px solid rgba(255, 255, 255, 0.58);
}

.crop-box::after {
  inset: 66.666% 0 auto;
}

.crop-handle {
  position: absolute;
  right: -7px;
  bottom: -7px;
  width: 18px;
  height: 18px;
  border: 2px solid white;
  border-radius: 50%;
  background: var(--blue);
  cursor: nwse-resize;
}

.hidden {
  display: none !important;
}

@media (max-width: 920px) {
  .hub-grid {
    display: grid;
    min-height: auto;
  }

  .hero-character-image {
    width: min(78vw, 640px);
    opacity: 0.24;
  }

  .hub-grid:hover .hub-card,
  .hub-card:hover {
    flex: initial !important;
  }

  .detail-layout,
  .character-editor-layout,
  .plot-workspace,
  .auth-panel {
    grid-template-columns: 1fr;
  }

  .plot-sidebar {
    position: static;
  }

  .plot-entry-grid {
    grid-template-columns: 1fr;
  }

  .plot-entry-illustration {
    min-height: 0;
  }
}

@media (max-width: 640px) {
  .hero {
    min-height: 86vh;
  }

  .hero::before {
    inset: 10px;
    border-radius: 18px;
  }

  .topbar,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

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

  .form-grid,
  .form-grid.compact,
  .relation-row,
  .relation-row.editing,
  .chapter-row,
  .interaction-row {
    grid-template-columns: 1fr;
  }

  .card-image {
    height: 220px;
  }

  .crop-head {
    flex-direction: column;
  }
}
