/* ============================================================
   绘画兴趣班 · 画室风格
   奶油纸底 / 暖墨文字 / 赭橙主色 / 墨绿点缀 / 宋体标题
   ============================================================ */

:root {
  color-scheme: light;

  /* 纸与墨 */
  --paper: #f6efe2;
  --paper-deep: #eee3cd;
  --surface: #fffdf7;
  --surface-subtle: #faf5e9;
  --ink: #2c241d;
  --muted: #7a6a59;
  --line: #e3d7bf;
  --line-strong: #d3c4a5;

  /* 赭橙（主色） */
  --primary: #bc5127;
  --primary-strong: #9d3f1c;
  --primary-soft: #f6e2d3;

  /* 辅助色 */
  --green: #3f5c4b;
  --green-soft: #e7ece3;
  --gold: #b3843a;
  --red: #ad3d2c;
  --red-soft: #f6e4de;

  /* 阴影（暖色） */
  --shadow-sm: 0 1px 2px rgba(74, 54, 30, 0.05);
  --shadow-md: 0 16px 40px rgba(74, 54, 30, 0.12);

  --radius: 14px;
  --radius-sm: 10px;

  /* 字体 */
  --font-display: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "STSong", "SimSun", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background-color: var(--paper);
  /* 纸张肌理：极淡的横向与斜向纹理 */
  background-image:
    repeating-linear-gradient(0deg, rgba(120, 90, 50, 0.016) 0 1px, transparent 1px 3px),
    radial-gradient(1200px 600px at 50% -10%, rgba(255, 252, 244, 0.9), transparent 70%);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
}

::selection {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

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

button {
  border: 0;
  cursor: pointer;
}

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

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

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.02em;
}

h1 {
  font-size: 32px;
  line-height: 1.25;
}

h2 {
  font-size: 20px;
  line-height: 1.3;
}

h3 {
  font-size: 16px;
}

.muted {
  color: var(--muted);
}

/* ---------- 顶栏 ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 72px;
  background: rgba(255, 253, 247, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.topbar-inner {
  max-width: 1220px;
  height: 72px;
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--primary);
  color: var(--surface);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18);
}

.brand h2 {
  font-size: 18px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  color: var(--ink);
  font-weight: 600;
}

/* ---------- 版面 ---------- */

.page {
  width: min(1220px, calc(100% - 40px));
  margin: 0 auto;
  padding: 30px 0 72px;
}

.grid {
  display: grid;
  gap: 22px;
}

.grid.two {
  grid-template-columns: minmax(0, 0.96fr) minmax(0, 1.04fr);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 26px;
  animation: rise 0.4s ease both;
}

.panel + .panel {
  margin-top: 22px;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* 面板标题：赭橙短竖线起笔 */
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.section-title h2,
.section-title h3 {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title h2::before,
.section-title h3::before {
  content: "";
  width: 4px;
  height: 1.05em;
  border-radius: 2px;
  background: var(--primary);
  flex: none;
}

/* ---------- 表单 ---------- */

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  color: var(--ink);
  background: var(--surface);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #b3a390;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(188, 81, 39, 0.13);
}

.field textarea {
  resize: vertical;
}

/* ---------- 按钮 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--surface);
  background: var(--primary);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.16);
  transition: background 0.18s ease, transform 0.12s ease;
}

.btn:hover {
  background: var(--primary-strong);
}

.btn:active {
  transform: translateY(1px);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.16);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.btn.secondary {
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  box-shadow: none;
}

.btn.secondary:hover {
  background: var(--surface-subtle);
  border-color: #c2b190;
}

.btn.danger {
  color: var(--red);
  background: var(--red-soft);
  box-shadow: none;
}

.btn.danger:hover {
  background: #f0d6cd;
}

.btn.small {
  min-height: 32px;
  padding: 0 13px;
  font-size: 13px;
  letter-spacing: 0.05em;
}

.error-box {
  min-height: 22px;
  color: var(--red);
  font-size: 13px;
}

/* ---------- 登录页 ---------- */

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

.login-layout {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: 0.94fr 1.06fr;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

/* 左侧：墨绿板面，如教室的黑板 */
.login-story {
  padding: 52px 44px;
  color: #f3efe3;
  background:
    radial-gradient(560px 300px at 20% 0%, rgba(255, 255, 255, 0.05), transparent 70%),
    repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.012) 0 2px, transparent 2px 5px),
    #2e3d33;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}

.login-story .brand-mark {
  background: var(--surface);
  color: var(--primary);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.1);
}

.login-story .brand h2 {
  color: #f6f2e6;
}

.login-story .brand > div:last-child > div {
  color: rgba(243, 239, 227, 0.6);
  font-size: 13px;
  letter-spacing: 0.12em;
}

.login-story h1 {
  margin-top: 40px;
  max-width: 320px;
  color: #f8f4e8;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}

/* 金色笔触：标题下的一道 */
.login-story h1::after {
  content: "";
  display: block;
  width: 64px;
  height: 5px;
  margin-top: 16px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--gold), rgba(179, 132, 58, 0.25));
}

.login-story .story-copy {
  margin-top: 16px;
  max-width: 320px;
  color: rgba(243, 239, 227, 0.75);
  line-height: 1.8;
}

/* 调色盘色点 */
.palette-dots {
  display: flex;
  gap: 10px;
  margin-top: 30px;
}

.palette-dots span {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  box-shadow: inset 0 -3px 4px rgba(0, 0, 0, 0.22), 0 2px 4px rgba(0, 0, 0, 0.25);
}

.palette-dots span:nth-child(1) { background: #c96a4a; }
.palette-dots span:nth-child(2) { background: #d9a441; }
.palette-dots span:nth-child(3) { background: #7d9c76; }
.palette-dots span:nth-child(4) { background: #6f8ca8; }
.palette-dots span:nth-child(5) { background: #a57ba0; }

.login-story .story-foot {
  margin-top: 44px;
  padding-top: 18px;
  border-top: 1px solid rgba(243, 239, 227, 0.18);
  color: rgba(243, 239, 227, 0.55);
  font-size: 12px;
  letter-spacing: 0.1em;
}

/* 右侧：画纸 */
.login-card {
  padding: 52px 46px;
  background:
    repeating-linear-gradient(0deg, rgba(120, 90, 50, 0.014) 0 1px, transparent 1px 4px),
    var(--surface);
}

.login-card h2 {
  margin-bottom: 8px;
  font-size: 22px;
}

.login-card .login-subtitle {
  margin-bottom: 30px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* ---------- 创作类型 ---------- */

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

.type-button {
  display: grid;
  gap: 3px;
  justify-items: center;
  padding: 10px 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: var(--surface);
  transition: border-color 0.16s ease, background 0.16s ease;
}

.type-button:hover {
  border-color: #c2b190;
  background: var(--surface-subtle);
}

.type-button.active {
  border-color: var(--green);
  background: var(--green-soft);
}

.type-button .type-name {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--ink);
}

.type-button.active .type-name {
  color: var(--green);
}

.type-button .type-hint {
  font-size: 12px;
  color: var(--muted);
}

.card-badges {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.badge.mode {
  color: var(--green);
  background: var(--green-soft);
}

/* ---------- 风格选择 ---------- */

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

.style-button {
  min-height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: var(--surface);
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.1em;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.style-button:hover {
  border-color: #c2b190;
  background: var(--surface-subtle);
}

.style-button.active {
  color: var(--primary-strong);
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: inset 0 -2px 0 rgba(188, 81, 39, 0.25);
}

.prompt-area {
  min-height: 120px;
}

.generate-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 16px;
}

.status-line {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- 选项卡 ---------- */

.tabs {
  display: flex;
  gap: 22px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.tab-button {
  min-height: 40px;
  padding: 0 2px;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  background: transparent;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.08em;
  transition: color 0.16s ease, border-color 0.16s ease;
}

.tab-button:hover {
  color: var(--ink);
}

.tab-button.active {
  color: var(--primary-strong);
  border-bottom-color: var(--primary);
}

/* ---------- 漫画卡片（画纸 + 图钉） ---------- */

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

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

.comic-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.comic-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

/* 图钉：钉在画纸顶部中央 */
.comic-card::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #e2906c, var(--primary) 60%, var(--primary-strong));
  box-shadow: 0 2px 4px rgba(46, 32, 15, 0.35);
  z-index: 2;
}

.comic-cover {
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--paper-deep);
  border-bottom: 1px solid var(--line);
}

.comic-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease;
}

.comic-card:hover .comic-cover img {
  transform: scale(1.03);
}

.comic-cover.placeholder {
  display: grid;
  place-items: center;
  color: #b3a390;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.3em;
}

.comic-card-body {
  padding: 14px 15px;
  display: grid;
  gap: 10px;
}

.comic-card-body h3 {
  font-size: 15px;
}

.comic-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

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

/* ---------- 分镜编辑 ---------- */

.panel-editor {
  margin-top: 26px;
  border-top: 1px dashed var(--line-strong);
  padding-top: 22px;
}

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

.panel-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--surface-subtle);
}

.panel-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.06em;
}

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

.panel-prompt {
  width: 100%;
  min-height: 72px;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.panel-prompt:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(188, 81, 39, 0.13);
}

.panel-result {
  margin-top: 12px;
  min-height: 120px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: grid;
  place-items: center;
  color: #b3a390;
  background: var(--paper-deep);
  font-size: 13px;
  letter-spacing: 0.1em;
}

.panel-result img {
  width: 100%;
  display: block;
}

/* ---------- 作品卡 ---------- */

.art-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.art-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.art-image {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  background: var(--paper-deep);
}

.art-meta {
  padding: 14px;
  display: grid;
  gap: 10px;
}

.art-prompt {
  min-height: 40px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

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

/* ---------- 表格 ---------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: var(--surface-subtle);
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  background: var(--surface-subtle);
}

.inline-input {
  width: 86px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 7px 9px;
  background: var(--surface);
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.inline-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(188, 81, 39, 0.13);
}

/* ---------- 徽标 ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 11px;
  color: var(--primary-strong);
  background: var(--primary-soft);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge.public {
  color: var(--green);
  background: var(--green-soft);
}

/* ---------- 工具条 ---------- */

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.class-select {
  min-width: 220px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
}

.class-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(188, 81, 39, 0.13);
}

.split-list {
  min-height: 130px;
}

/* ---------- 空状态 ---------- */

.empty {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 42px 24px;
  color: var(--muted);
  background: var(--surface-subtle);
  text-align: center;
  letter-spacing: 0.06em;
}

/* ---------- 对话框 ---------- */

.dialog {
  width: min(430px, calc(100vw - 40px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 28px;
  background: var(--surface);
}

.dialog::backdrop {
  background: rgba(44, 36, 29, 0.4);
  backdrop-filter: blur(2px);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 22px;
}

/* ---------- 响应式 ---------- */

@media (max-width: 900px) {
  .grid.two {
    grid-template-columns: 1fr;
  }

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

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

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

  .login-story {
    padding: 34px 30px;
  }

  .login-story h1 {
    margin-top: 24px;
    font-size: 26px;
  }

  .palette-dots {
    margin-top: 20px;
  }

  .login-story .story-foot {
    margin-top: 28px;
  }

  .login-card {
    padding: 34px 30px;
  }
}

@media (max-width: 600px) {
  .page {
    width: min(100% - 24px, 1220px);
    padding-top: 22px;
  }

  .topbar-inner {
    padding: 0 16px;
  }

  .user-chip {
    gap: 6px;
    font-size: 13px;
  }

  .user-chip .btn {
    padding: 0 9px;
  }

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

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

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

  .login-shell {
    padding: 16px;
  }

  .login-card,
  .panel {
    padding: 20px;
  }
}

/* ============================================================
   学生端导航 / 作品库 / 班级社区 / 详情预览
   ============================================================ */

/* ---------- 主导航 ---------- */

.main-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.main-nav a {
  padding: 8px 18px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--muted);
  transition: color 0.16s ease, background-color 0.16s ease;
}

.main-nav a:hover {
  color: var(--ink);
  background: var(--paper-deep);
}

.main-nav a.active {
  color: var(--surface);
  background: var(--primary);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18);
}

/* ---------- 创作页（单栏编辑器，居中收窄） ---------- */

.editor-wrap {
  max-width: 920px;
  margin: 0 auto;
}

/* ---------- 页头（作品库 / 社区） ---------- */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.page-head h2 {
  font-size: 24px;
}

.page-head .muted {
  margin-top: 6px;
  font-size: 13px;
  letter-spacing: 0.04em;
}

/* ---------- 作品卡片网格（自适应多列） ---------- */

.comic-grid.wide {
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}

.badge.vis {
  background: var(--green-soft);
  color: var(--green);
}

/* ---------- 详情预览弹窗 ---------- */

.preview-dialog {
  width: min(1060px, calc(100vw - 40px));
  max-height: calc(100vh - 60px);
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.preview-body {
  overflow-y: auto;
  padding: 30px 32px 26px;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.preview-header h2 {
  font-size: 22px;
}

.preview-meta {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.04em;
}

.preview-setting {
  margin-top: 16px;
  padding: 13px 16px;
  border-left: 3px solid var(--green);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--green-soft);
}

.preview-setting .setting-label {
  display: block;
  margin-bottom: 4px;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--green);
  font-size: 13px;
}

.preview-setting p {
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
}

.preview-panels {
  margin-top: 20px;
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* 三视图：一行三张并排对照 */
.preview-panels[data-mode="views"] {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* 绘本：单页大图居中 */
.preview-panels[data-mode="book"] {
  grid-template-columns: minmax(0, 620px);
  justify-content: center;
}

.preview-panel {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-subtle);
}

.preview-shot {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--paper-deep);
  display: grid;
  place-items: center;
}

.preview-shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.preview-shot.placeholder {
  color: #b3a390;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.3em;
  font-size: 13px;
}

/* 绘本整页以完整版面呈现，不裁切 */
.preview-panels[data-mode="book"] .preview-shot {
  aspect-ratio: auto;
}

.preview-panels[data-mode="book"] .preview-shot img {
  object-fit: contain;
  max-height: 72vh;
}

.preview-panel figcaption {
  padding: 10px 12px 12px;
  display: grid;
  gap: 4px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.preview-panel figcaption span {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 13px;
}

.preview-panel figcaption p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.preview-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  padding: 15px 32px;
  border-top: 1px solid var(--line);
  background: var(--surface-subtle);
}

.preview-actions .btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

/* ---------- 响应式补充 ---------- */

@media (max-width: 900px) {
  .comic-grid.wide {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}

@media (max-width: 720px) {
  .topbar-inner {
    height: auto;
    min-height: 0;
    flex-wrap: wrap;
    padding: 10px 16px;
  }

  .main-nav {
    order: 3;
    width: 100%;
    justify-content: center;
    margin-top: 4px;
  }

  .preview-body {
    padding: 22px 18px;
  }

  .preview-actions {
    padding: 12px 18px;
  }

  .preview-panels[data-mode="views"] {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .comic-grid.wide {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---------- 分镜编辑：左输入右预览 ---------- */

.panel-body {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: 14px;
  align-items: stretch;
}

.panel-prompt {
  min-height: 0;
  height: 100%;
  align-self: stretch;
}

.panel-result {
  margin-top: 0;
  min-height: 150px;
  height: 100%;
  border: 1px solid var(--line);
}

.panel-result img {
  height: 100%;
  object-fit: cover;
}

.panel-result.placeholder {
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  letter-spacing: 0.24em;
}

@media (max-width: 720px) {
  .panel-body {
    grid-template-columns: 1fr;
  }

  .panel-result img {
    height: auto;
    object-fit: contain;
  }
}
