/* ─── Design Tokens ─────────────────────────────────────────────── */
:root {
  --bg:       #0E0C0B;
  --panel:    #1A1612;
  --panel2:   #241E18;
  --panel3:   #2E261E;
  --line:     #352D24;
  --text:     #EDE8E0;
  --muted:    #8A8278;
  --faint:    #4A433B;
  --gold:     #C8922A;
  --gold-dim: #8A5F18;
  --rose:     #9B3A5E;
  --ok:       #4CAF7D;
  --warn:     #D4882A;
  --danger:   #C05050;
}

/* ─── Animations ────────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position:  400px 0; }
}

/* ─── Reset / Base ──────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-width: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.75 'Noto Sans SC', -apple-system, "Hiragino Sans", system-ui, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, textarea, select { font: inherit; }
img, video, audio { max-width: 100%; }

/* ─── Layout ────────────────────────────────────────────────────── */
.container { max-width: 980px; margin: 0 auto; padding: 0 18px; }

/* ─── Hero ───────────────────────────────────────────────────────── */
.hero-band {
  position: relative;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  min-height: clamp(480px, 72vh, 780px);
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  margin-bottom: 40px;
  background-image:
    radial-gradient(120% 140% at 80% 0%, rgba(155,58,94,0.22), transparent 55%),
    radial-gradient(100% 120% at 10% 30%, rgba(200,146,42,0.16), transparent 50%),
    repeating-linear-gradient(0deg, transparent, transparent 31px, rgba(53,45,36,0.5) 32px);
}
.hero-inner {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: clamp(48px, 8vw, 96px) clamp(24px, 6vw, 80px);
}
.hero-eyebrow {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 14px;
}
.hero-title {
  font-family: Georgia, 'Hiragino Mincho ProN', serif;
  font-weight: normal;
  font-size: clamp(28px, 4vw, 56px);
  line-height: 1.15;
  max-width: 640px;
  margin: 0 0 18px;
}
.hero-sub {
  font-size: clamp(15px, 1.6vw, 18px);
  line-height: 1.75;
  max-width: 500px;
  margin-bottom: clamp(24px, 4vw, 40px);
}
.hero-actions { margin: 0; flex-wrap: wrap; gap: 12px; }
.hero-cta { padding: clamp(10px, 1.5vw, 14px) clamp(20px, 3vw, 32px); font-size: clamp(14px, 1.2vw, 16px); }

/* ── Hero 轮播 ─────────────────────────────────────── */
.hero-slides {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}
.hero-slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transform: scale(1.04);
  transition: opacity 1.1s cubic-bezier(.4,0,.2,1), transform 6s ease;
  will-change: opacity, transform;
}
.hero-slide.active {
  opacity: 1;
  transform: scale(1);
}
.hero-inner { position: relative; z-index: 1; }
.hero-align-left   { text-align: left; }
.hero-align-center { text-align: center; margin: 0 auto; }
.hero-align-center .hero-title,
.hero-align-center .hero-sub   { max-width: 100%; }
.hero-align-center .hero-actions { justify-content: center; }
.hero-align-right  { text-align: right; margin-left: auto; }
.hero-align-right .hero-actions  { justify-content: flex-end; }

/* 导航区 */
.hero-nav {
  position: absolute;
  bottom: 28px;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 0 clamp(20px, 5vw, 80px);
}
.hero-dots {
  display: flex;
  gap: 8px;
  align-items: center;
}
.hero-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: none;
  background: rgba(237,232,224,0.3);
  cursor: pointer;
  padding: 0;
  transition: background 0.3s, transform 0.3s, width 0.3s;
}
.hero-dot.active {
  background: var(--gold);
  width: 22px;
  border-radius: 3px;
  transform: none;
}
.hero-arrow {
  background: rgba(14,12,11,0.5);
  border: 1px solid rgba(200,146,42,0.25);
  color: var(--gold);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.hero-arrow:hover {
  background: rgba(200,146,42,0.15);
  border-color: var(--gold);
}

/* 平板 768–1024 */
@media (max-width: 1024px) {
  .hero-band { min-height: clamp(400px, 60vh, 600px); }
  .hero-title { max-width: 520px; }
}

/* 手机 ≤ 760px */
@media (max-width: 760px) {
  .hero-band { min-height: auto; padding: 0; }
  .hero-inner { padding: 56px 20px 72px; }
  .hero-title { font-size: clamp(26px, 7vw, 36px); max-width: 100%; }
  .hero-sub { font-size: 15px; max-width: 100%; margin-bottom: 28px; }
  .hero-actions { gap: 10px; }
  .hero-cta { padding: 12px 24px; font-size: 15px; width: 100%; text-align: center; }
  .hero-nav { bottom: 16px; gap: 10px; }
  .hero-arrow { width: 30px; height: 30px; font-size: 13px; }
  .hero-dot { width: 5px; height: 5px; }
  .hero-dot.active { width: 16px; }
}

/* 小手机 ≤ 420px */
@media (max-width: 420px) {
  .hero-inner { padding: 44px 16px 40px; }
  .hero-title { font-size: 26px; }
  .hero-sub { font-size: 14px; }
}

/* 大屏 ≥ 1600px（24寸以上）*/
@media (min-width: 1600px) {
  .hero-band { min-height: clamp(600px, 65vh, 900px); }
  .hero-title { font-size: clamp(52px, 3.5vw, 72px); max-width: 800px; }
  .hero-sub { font-size: clamp(18px, 1.2vw, 22px); max-width: 600px; }
}

/* ─── Profile / Settings 两栏布局 ───────────────────────────────── */
.profile-cover-card {
  margin: 26px 0 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0,0,0,0.22);
}
.profile-cover {
  position: relative;
  min-height: clamp(150px, 24vw, 230px);
  overflow: hidden;
}
.profile-cover::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(120deg, rgba(14,12,11,0.15), rgba(14,12,11,0.72)),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.05), rgba(255,255,255,0.05) 1px, transparent 1px, transparent 34px);
}
.profile-cover.library {
  background:
    radial-gradient(90% 120% at 12% 8%, rgba(200,146,42,0.38), transparent 46%),
    linear-gradient(135deg, #2B2118, #72501B 48%, #15110D);
}
.profile-cover.night {
  background:
    radial-gradient(60% 90% at 80% 16%, rgba(87,119,158,0.48), transparent 50%),
    linear-gradient(135deg, #10151E, #263447 52%, #0E0C0B);
}
.profile-cover.sakura {
  background:
    radial-gradient(70% 100% at 20% 5%, rgba(238,173,181,0.45), transparent 52%),
    linear-gradient(135deg, #2A171D, #7D3C51 54%, #1A1612);
}
.profile-cover.paper {
  background:
    radial-gradient(90% 120% at 18% 0%, rgba(237,232,224,0.28), transparent 48%),
    linear-gradient(135deg, #3A2D20, #8A6B3F 50%, #1B1713);
}
.profile-cover-grain {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(0deg, rgba(14,12,11,0.72), transparent 44%),
    repeating-linear-gradient(0deg, transparent, transparent 9px, rgba(237,232,224,0.045) 10px);
}
.profile-hero {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  margin: 0;
  padding: 0 22px 20px;
}
.profile-avatar {
  width: 96px;
  height: 96px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  color: var(--bg);
  font-family: Georgia, "Hiragino Mincho ProN", serif;
  font-size: 42px;
  border: 4px solid var(--panel);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.22), 0 18px 40px rgba(0,0,0,0.28);
  position: relative;
  z-index: 1;
  margin-top: -46px;
}
.profile-avatar.gold { background: linear-gradient(135deg, #D7A642, #6E4A12); }
.profile-avatar.rose { background: linear-gradient(135deg, #C76A86, #552238); color: var(--text); }
.profile-avatar.green { background: linear-gradient(135deg, #6AB889, #1F4D3B); color: var(--text); }
.profile-avatar.ink { background: linear-gradient(135deg, #6D7580, #171A1D); color: var(--text); }
.profile-hero-copy h1 {
  margin: 0;
  font-family: Georgia, "Hiragino Mincho ProN", serif;
  font-weight: normal;
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.1;
}
.profile-hero-copy {
  min-width: 0;
  padding-top: 16px;
}
.profile-kicker {
  margin: 0 0 5px;
  color: var(--gold);
  font-size: 11px;
  line-height: 1.2;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.profile-signature {
  margin: 10px 0 0;
  color: var(--text);
  font-size: 15px;
}
.profile-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.profile-meta-row span {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(36,30,24,0.64);
  padding: 3px 10px;
  font-size: 12px;
}
.profile-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  align-items: start;
  margin-top: 24px;
  max-width: 900px;
}
.profile-sidebar { display: flex; flex-direction: column; gap: 16px; }
.profile-main    { display: flex; flex-direction: column; gap: 20px; }
.profile-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.profile-info-card h2 {
  margin: 0 0 12px;
  font-size: 16px;
}
.profile-info-list {
  display: grid;
  gap: 10px;
  margin: 0;
}
.profile-info-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(53,45,36,0.55);
  padding-bottom: 8px;
}
.profile-info-list dt {
  color: var(--muted);
  font-size: 13px;
}
.profile-info-list dd {
  margin: 0;
  color: var(--text);
  text-align: right;
}
.profile-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 10px;
}
.profile-stat-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(36,30,24,0.5);
  padding: 10px;
}
.profile-stat-grid strong {
  display: block;
  font-size: 22px;
  line-height: 1.1;
  color: var(--gold);
}
.profile-stat-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}
.profile-activity-list {
  display: grid;
  gap: 8px;
}
.profile-activity-list a,
.profile-activity-list > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel2);
  padding: 9px 10px;
  color: inherit;
}
.profile-activity-list span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-activity-list em {
  flex: none;
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}
.profile-mini-card h2 {
  font-size: 13px;
  margin: 0 0 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.profile-mini-card .muted {
  font-size: 12px;
  margin: 0 0 10px;
}
.status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  margin-bottom: 6px;
}
.status-line span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}
.status-line.ok { color: var(--ok); }
.status-line.ok span { background: var(--ok); }
.status-line.warn { color: var(--warn); }
.status-line.warn span { background: var(--warn); }
.invite-copy-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  gap: 8px;
  align-items: center;
}
.invite-copy-box input {
  width: 100%;
  padding: 9px 10px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--gold);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  letter-spacing: 0.05em;
  cursor: pointer;
}
.icon-btn {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(200,146,42,0.45);
  border-radius: 8px;
  background: rgba(200,146,42,0.1);
  color: var(--gold);
  cursor: pointer;
}
.icon-btn:hover { background: rgba(200,146,42,0.18); }
.copy-feedback {
  min-height: 18px;
  margin: 6px 0 0;
  color: var(--ok);
  font-size: 12px;
  opacity: 0;
}
.copy-feedback.show { opacity: 1; }
.password-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
  cursor: pointer;
  color: var(--gold);
  font-size: 14px;
}
.profile-settings-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
  cursor: pointer;
  color: var(--gold);
}
.profile-settings-details summary::-webkit-details-marker { display: none; }
.profile-settings-details[open] summary { margin-bottom: 16px; }
.profile-settings-details[open] summary span:last-child { transform: rotate(90deg); }
.profile-settings-body {
  border-top: 1px solid rgba(53,45,36,0.7);
  padding-top: 16px;
}
.password-details summary::-webkit-details-marker { display: none; }
.password-details[open] summary { margin-bottom: 12px; }
.password-details[open] summary span:last-child { transform: rotate(90deg); }
.password-details form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.password-details label,
.profile-edit-panel label,
.genre-fieldset legend {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}
.password-details input,
.profile-edit-panel input:not([type=radio]):not([type=checkbox]),
.profile-edit-panel textarea,
.profile-edit-panel select {
  width: 100%;
  padding: 10px 12px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
}
.profile-edit-panel textarea {
  min-height: 118px;
  resize: vertical;
}
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.section-head h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}
.banner-picker {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.banner-picker > span {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 13px;
}
.banner-choice {
  position: relative;
  cursor: pointer;
}
.banner-choice input {
  position: absolute;
  opacity: 0;
}
.banner-choice span {
  display: flex;
  align-items: flex-end;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  color: rgba(237,232,224,0.86);
  font-size: 12px;
  overflow: hidden;
}
.banner-choice.library span { background: linear-gradient(135deg, #2B2118, #72501B 52%, #15110D); }
.banner-choice.night span { background: linear-gradient(135deg, #10151E, #263447 56%, #0E0C0B); }
.banner-choice.sakura span { background: linear-gradient(135deg, #2A171D, #7D3C51 56%, #1A1612); }
.banner-choice.paper span { background: linear-gradient(135deg, #3A2D20, #8A6B3F 50%, #1B1713); }
.banner-choice input:checked + span {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}
.avatar-picker {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}
.avatar-picker > span {
  color: var(--muted);
  font-size: 13px;
  margin-right: 2px;
}



/* ① CRITICAL FIX: prevent display:block from overriding the [hidden] attribute */
.img-upload-preview[hidden] { display: none !important; }

.img-upload-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}
.img-upload-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

/* Shared drop-zone base */
.img-upload-zone {
  position: relative;
  border: 1.5px dashed rgba(200,146,42,0.35);
  background: rgba(24,18,10,0.55);
  cursor: pointer;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.img-upload-zone:hover,
.img-upload-zone:focus-within {
  border-color: rgba(200,146,42,0.7);
  background: rgba(200,146,42,0.05);
  box-shadow: 0 0 0 3px rgba(200,146,42,0.08);
}
.img-upload-zone.drag-over {
  border-color: var(--gold);
  background: rgba(200,146,42,0.11);
  box-shadow: 0 0 0 3px rgba(200,146,42,0.16);
}

/* Banner zone — wide panoramic */
.banner-upload-zone {
  width: 100%;
  height: 112px;
  border-radius: 10px;
}

/* Avatar zone — square avatar */
.avatar-upload-zone {
  width: 84px;
  height: 84px;
  border-radius: 16px;
  flex: none;
}

/* Preview image — fills the zone absolutely */
.img-upload-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
}

/* Invisible file input overlay */
.img-upload-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

/* Placeholder hint (shown when no image) */
.img-upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 16px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  pointer-events: none;
  user-select: none;
  z-index: 1;
}
.img-upload-icon {
  font-size: 20px;
  line-height: 1;
  opacity: 0.6;
  margin-bottom: 2px;
}
.img-upload-hint {
  font-size: 10px;
  color: rgba(180,155,105,0.45);
  margin-top: 1px;
}

/* Delete button — floating top-right inside the zone */
.img-clear-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  background: rgba(10,8,5,0.72);
  border: 1px solid rgba(200,146,42,0.35);
  border-radius: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  pointer-events: all;
}
.img-clear-btn:hover {
  background: rgba(160,32,32,0.45);
  color: #ffaaaa;
  border-color: rgba(200,60,60,0.5);
}

/* Avatar row layout (zone + tone picks side-by-side) */
.img-upload-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
}
.avatar-options {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  min-width: 0;
}

/* Tone row (below banner / beside avatar) */
.tone-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.tone-row-label {
  font-size: 10px;
  color: rgba(180,155,100,0.5);
  white-space: nowrap;
}

/* Keep old selectors working */
.banner-tone-fallback,
.avatar-tone-fallback {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.banner-picker-inline {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tone-choice {
  position: relative;
  width: 34px;
  height: 34px;
  cursor: pointer;
}
.tone-choice input {
  position: absolute;
  opacity: 0;
}
.tone-choice span {
  display: block;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.tone-choice.gold span { background: linear-gradient(135deg, #D7A642, #6E4A12); }
.tone-choice.rose span { background: linear-gradient(135deg, #C76A86, #552238); }
.tone-choice.green span { background: linear-gradient(135deg, #6AB889, #1F4D3B); }
.tone-choice.ink span { background: linear-gradient(135deg, #6D7580, #171A1D); }
.tone-choice input:checked + span {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

/* ─── Image Upload Zones ─────────────────────────────────────────── */
.img-upload-section { display: flex; flex-direction: column; gap: 8px; }
.img-upload-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}
.img-upload-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}
.img-upload-zone {
  position: relative;
  border: 2px dashed rgba(200,146,42,0.38);
  border-radius: 10px;
  background: rgba(36,30,24,0.42);
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.img-upload-zone:hover,
.img-upload-zone:focus-within {
  border-color: rgba(200,146,42,0.75);
  background: rgba(200,146,42,0.07);
}
.img-upload-zone.drag-over {
  border-color: var(--gold);
  background: rgba(200,146,42,0.14);
}
.banner-upload-zone {
  width: 100%;
  min-height: 90px;
}
.avatar-upload-zone {
  width: 96px;
  height: 96px;
  border-radius: 14px;
}
.img-upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 14px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  pointer-events: none;
}
.img-upload-icon {
  font-size: 22px;
  line-height: 1;
  margin-bottom: 2px;
}
.img-upload-hint {
  font-size: 11px;
  color: rgba(200,180,140,0.5);
}
.img-upload-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
}
.img-upload-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.img-clear-btn {
  flex: none;
  margin-top: 4px;
  font-size: 12px;
}
.banner-tone-fallback,
.avatar-tone-fallback {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.banner-picker-inline {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ─── Media upload grid (Banner + Avatar two-column) ──────────── */
.media-upload-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  margin-bottom: 22px;
  align-items: start;
}
.media-upload-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.media-upload-col--avatar {
  width: 130px;
  flex: none;
}
.media-upload-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.upload-svg-icon {
  width: 26px;
  height: 26px;
  color: rgba(200,146,42,0.45);
  margin-bottom: 4px;
}

/* Tone chips row under each zone */
.tone-chips-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.tone-chips-label {
  font-size: 10px;
  color: rgba(180,155,100,0.5);
  white-space: nowrap;
}

/* Profile text fields section */
.profile-fields-section {
  border-top: 1px solid rgba(53,45,36,0.6);
  padding-top: 18px;
  margin-top: 4px;
}
.profile-fields-head {
  margin-bottom: 14px;
}
.profile-fields-head h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

/* Save button row at the bottom */
.form-save-row {
  display: flex;
  justify-content: flex-end;
  padding-top: 16px;
  margin-top: 4px;
  border-top: 1px solid rgba(53,45,36,0.45);
}

/* Handle normalization preview */
.handle-preview {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--gold);
  opacity: 0.75;
}
.field-hint {
  font-size: 10px;
  color: rgba(180,155,100,0.5);
  font-weight: normal;
  margin-left: 4px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.profile-edit-panel > form > label { margin-top: 14px; }

.name-editor {
  min-height: 44px;
}
.name-view,
.name-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.name-view span {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(36,30,24,0.48);
  color: var(--text);
}
.name-field[hidden],
.name-view[hidden] { display: none; }
.handle-input {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel2);
  overflow: hidden;
}
.handle-input span {
  color: var(--gold);
  text-align: center;
  border-right: 1px solid var(--line);
}
.handle-input input {
  border: 0 !important;
  background: transparent !important;
}
.genre-fieldset {
  border: 0;
  padding: 0;
  margin: 16px 0 0;
}
.genre-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.genre-pills label { margin: 0; cursor: pointer; }
.genre-pills input {
  position: absolute;
  opacity: 0;
}
.genre-pills span {
  display: block;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel2);
  color: var(--muted);
  padding: 6px 12px;
  font-size: 13px;
}
.genre-pills input:checked + span {
  border-color: rgba(200,146,42,0.65);
  background: rgba(200,146,42,0.13);
  color: var(--gold);
}
.profile-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.profile-note-card h2 {
  margin: 0 0 8px;
  font-size: 15px;
}
.profile-note-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

/* ─── Register optional author intent ───────────────────────────── */
.register-author-option {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(200,146,42,0.08), transparent 42%),
    var(--panel);
  overflow: hidden;
}
.register-author-toggle {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.register-author-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  gap: 12px;
  align-items: center;
  padding: 13px 14px;
  margin: 0;
  cursor: pointer;
}
.register-author-summary strong {
  display: block;
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
}
.register-author-summary small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin-top: 2px;
}
.register-author-arrow {
  color: var(--gold);
  font-size: 20px;
  line-height: 1;
  transform: rotate(0deg);
  transition: transform 0.18s ease;
}
.register-author-details {
  display: none;
  padding: 0 14px 14px;
  border-top: 1px solid rgba(53,45,36,0.7);
}
.register-author-toggle:checked + .register-author-summary {
  background: rgba(200,146,42,0.07);
}
.register-author-toggle:checked + .register-author-summary .register-author-arrow {
  transform: rotate(90deg);
}
.register-author-toggle:checked ~ .register-author-details {
  display: block;
}
.register-author-details label {
  margin-top: 12px;
}
.register-author-details .muted {
  font-size: 12px;
  margin: 8px 0 0;
}
.work-author-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(36,30,24,0.56);
  padding: 10px 12px;
  margin: 14px 0 0;
}
.author-work-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}
.author-work-metrics span {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  padding: 2px 8px;
}
@media (max-width: 1024px) {
  .profile-layout { grid-template-columns: 220px 1fr; gap: 16px; }
}
@media (max-width: 760px) {
  .profile-cover-card { border-radius: 10px; }
  .profile-cover { min-height: 132px; }
  .profile-hero {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 14px;
    margin-top: 0;
    padding: 0 14px 16px;
  }
  .profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 14px;
    font-size: 30px;
    margin-top: -34px;
  }
  .profile-layout { grid-template-columns: 1fr; }
  .profile-sidebar { gap: 12px; }
  .section-head { align-items: stretch; flex-direction: column; }
  .section-head .btn { width: 100%; }
  .banner-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid,
  .profile-dashboard-grid,
  .profile-preview-grid { grid-template-columns: 1fr; }
  .work-author-strip { align-items: stretch; flex-direction: column; }
}

/* ─── Nav ───────────────────────────────────────────────────────── */
header.nav {
  position: sticky;
  top: 0;
  background: rgba(14, 12, 11, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  z-index: 200;
}
.nav-in {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 58px;
  height: auto;
  padding: 0 32px;
}
.logo {
  font-family: Georgia, "Hiragino Mincho ProN", "Noto Serif CJK SC", serif;
  font-weight: normal;
  font-size: 22px;
  color: var(--gold);
}
.nav-primary,
.nav-admin-links,
.nav-auth {
  display: flex;
  align-items: center;
  gap: 18px;
}
.nav-auth { gap: 10px; }
.nav a.link { color: var(--muted); font-size: 14px; }
.nav a.link:hover { color: var(--text); text-decoration: none; }
.nav .user-link { font-size: 13px; }
.lang-switch { display: flex; gap: 4px; margin-left: 8px; }
.spacer { flex: 1; }
.nav-menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--text);
  font-size: 20px;
}
.nav-drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  z-index: 300;
}
.nav-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(320px, 86vw);
  display: none;
  background: #1A1612;
  border-left: 1px solid var(--line);
  z-index: 310;
  padding: 18px;
  flex-direction: column;
  gap: 14px;
  box-shadow: -16px 0 32px rgba(0,0,0,0.35);
}
.nav-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--text);
  font-weight: 700;
}
.nav-drawer a.link {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  background: #211B15;
}
.drawer-lang { display: flex; gap: 6px; margin-top: 12px; }
body.drawer-open { overflow: hidden; }
body.drawer-open .nav-drawer { display: flex; }
body.drawer-open .nav-drawer-backdrop { display: block; }

/* ─── Progress Bar ──────────────────────────────────────────────── */
.reading-progress {
  height: 3px;
  background: linear-gradient(90deg, #C8922A, #9B3A5E);
  width: 100%;
}

/* ─── Typography ────────────────────────────────────────────────── */
h1 { font-size: 24px; margin: 24px 0 6px; }
h2 {
  font-family: Georgia, "Hiragino Mincho ProN", "Noto Serif CJK SC", serif;
  font-size: 18px;
  font-weight: normal;
  margin: 28px 0 10px;
  border-left: 3px solid var(--gold);
  padding-left: 10px;
}

/* ─── Buttons ───────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  min-height: 38px;
  padding: 9px 18px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
  text-align: center;
  transition: opacity 150ms ease, transform 150ms ease;
}
.btn:hover {
  opacity: 0.85;
  transform: translateY(-1px);
  text-decoration: none;
}
.btn:focus-visible {
  outline: 2px solid var(--gold-dim);
  outline-offset: 3px;
}
.btn.primary {
  background: linear-gradient(135deg, #C8922A, #A0711A);
  border: none;
  color: #0E0C0B;
  font-weight: 600;
}
.btn.primary:hover { opacity: 0.9; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.sm {
  padding: 6px 13px;
  font-size: 13px;
  border-radius: 6px;
  min-height: 32px;
}
.btn.disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── Grid / Cards ──────────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
  gap: 16px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}
.card:hover {
  border-color: var(--gold-dim);
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}
.cover {
  aspect-ratio: 3/4;
  background: linear-gradient(145deg, #1E2A3A, #2D1A2D);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
}
.cover img { width: 100%; height: 100%; object-fit: cover; }
.card .body { padding: 12px; }
.card h3 { margin: 0 0 6px; font-size: 15px; }

/* ─── Utility ───────────────────────────────────────────────────── */
.muted { color: var(--muted); }
.tag {
  display: inline-block;
  font-size: 12px;
  color: var(--gold);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 8px;
}

/* ─── Panel ─────────────────────────────────────────────────────── */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  margin: 14px 0;
}

/* ─── Empty State Grid ──────────────────────────────────────────── */
.empty-state-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
  gap: 16px;
  opacity: 0.45;
  pointer-events: none;
  user-select: none;
  filter: blur(1px);
}
.empty-card .cover { position: relative; }

/* ─── Stat Cards ────────────────────────────────────────────────── */
.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
}
.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.1em;
  margin-bottom: 10px;
}
.stat-value {
  font-family: Georgia, "Hiragino Mincho ProN", "Noto Serif CJK SC", serif;
  font-size: 42px;
  line-height: 1;
}

/* ─── Chapter List ──────────────────────────────────────────────── */
.chapter-list a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  margin: 8px 0;
  color: var(--text);
  transition: border-color 150ms ease, background 150ms ease;
}
.chapter-list a > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.chapter-list a:hover {
  border-color: var(--gold-dim);
  background: var(--panel2);
  text-decoration: none;
}
.lock { color: var(--warn); font-size: 13px; }

/* ─── Reader ────────────────────────────────────────────────────── */
.chapter-topnav {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(60px, 1fr);
  align-items: center;
  gap: 10px;
  margin: 16px auto 8px;
  max-width: 1120px;
}
.chapter-backlink {
  min-width: 0;
  color: var(--muted);
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
  white-space: nowrap;
}
.chapter-position {
  color: var(--muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.chapter-topnav > .btn { justify-self: end; }
.chapter-title {
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}
.chapter-short-link {
  max-width: 760px;
  margin: 0 auto 12px;
}
.reader {
  font-family: Georgia, "Hiragino Mincho ProN", "Noto Serif CJK SC", serif;
  font-size: 17px;
  line-height: 2.1;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
}
.reader p { margin: 1em 0; }
.reader blockquote {
  border-left: 3px solid var(--gold-dim);
  margin: 1em 0;
  padding: 0.2em 1em;
  color: var(--muted);
}

/* ─── Reader Shell / Audio ─────────────────────────────────────── */
.reader-shell {
  width: min(100%, 1120px);
  margin: 14px auto 0;
  padding: 0 20px;
}
.content-lang-panel {
  max-width: 760px;
  margin: 10px auto 16px;
  padding: 12px;
}
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.audio-reader-panel { max-width: 760px; margin: 10px auto 18px; }
.audio-player-custom {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 92px;
  margin: 12px 0;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface, #1a1a1a);
}
.audio-play-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--rose));
  cursor: pointer;
  font-size: 18px;
}
.audio-player-main { flex: 1; min-width: 0; }
.audio-player-title {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.audio-seek {
  width: 100%;
  accent-color: var(--gold);
}
.audio-time-row {
  display: flex;
  justify-content: space-between;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}
.audio-follow-toolbar {
  position: sticky;
  top: 68px;
  z-index: 4;
  display: flex;
  justify-content: flex-end;
  max-width: 600px;
  margin: 0 auto;
}
.audio-transcript [data-audio-block] {
  border-left: 3px solid transparent;
  margin-left: -14px;
  padding: 4px 10px;
  transition: background 180ms ease, border-color 180ms ease;
}
.audio-transcript [data-audio-block].audio-follow-active {
  border-left-color: var(--gold);
  background: rgba(200, 146, 42, 0.12);
}

/* ─── Audio timeline editor ─── */
.timeline-editor { max-width: 980px; margin: 0 auto; }
.timeline-language { margin: 18px 0; }
.timeline-player {
  position: sticky;
  top: 58px;
  z-index: 6;
  padding: 12px 16px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.timeline-player audio { margin: 0 0 8px; }
.timeline-blocks { display: grid; gap: 10px; margin: 16px 0 80px; }
.timeline-block {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.8fr);
  gap: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.timeline-block.is-current { border-color: var(--gold); }
.timeline-block-copy { display: flex; gap: 10px; cursor: pointer; }
.timeline-block-copy p { margin: 0; line-height: 1.75; }
.timeline-block-number { color: var(--gold); font-variant-numeric: tabular-nums; }
.timeline-times { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: end; }
.timeline-times label { font-size: 12px; color: var(--muted); }
.timeline-times input { width: 100%; margin-top: 4px; }
.timeline-times button { min-height: 38px; white-space: normal; }
.timeline-savebar {
  position: sticky;
  bottom: 0;
  z-index: 7;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  background: var(--bg);
  border-top: 1px solid var(--line);
}
@media (max-width: 760px) {
  .timeline-block { grid-template-columns: 1fr; }
  .timeline-times { grid-template-columns: 1fr; }
  .timeline-player { top: 52px; }
}

/* ─── Chapter Images / Short Player ────────────────────────────── */
.chapter-images {
  display: grid;
  gap: 12px;
  max-width: 680px;
  margin: 14px auto;
}
.chapter-images img {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  display: block;
}
.short-player { max-width: 520px; margin: 0 auto; }
.short-player video { aspect-ratio: 9/16; max-height: 78vh; object-fit: contain; }

@media (min-width: 1680px) {
  .chapter-topnav { max-width: 1280px; }
  .reader-shell { max-width: 1280px; padding-left: 32px; padding-right: 32px; }
  .reader { max-width: 760px; font-size: 18px; line-height: 2.15; }
  .chapter-images { max-width: 760px; }
  .audio-reader-panel { max-width: 820px; }
}

@media (max-width: 1180px) {
  .chapter-topnav { max-width: 960px; }
  .reader-shell { max-width: 960px; padding-left: 18px; padding-right: 18px; }
  .reader { max-width: 660px; }
  .chapter-images { max-width: 660px; }
  .audio-reader-panel { max-width: 720px; }
}

@media (max-width: 820px) {
  .chapter-topnav {
    grid-template-columns: minmax(0, 1fr) auto;
    max-width: 640px;
  }
  .chapter-position {
    grid-column: 1 / -1;
    grid-row: 2;
    text-align: left;
  }
  .chapter-title { max-width: 640px; text-align: left; }
  .reader-shell { padding-left: 14px; padding-right: 14px; }
  .reader { max-width: 640px; font-size: 16px; line-height: 2; }
  .chapter-images { max-width: 640px; }
  .audio-reader-panel { max-width: 640px; }
}

@media (max-width: 560px) {
  .chapter-topnav {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 12px;
  }
  .chapter-topnav > .btn {
    justify-self: stretch;
    text-align: center;
  }
  .chapter-backlink { white-space: normal; }
  .chapter-position { grid-column: auto; }
  .chapter-short-link .btn { width: 100%; text-align: center; }
  .reader-shell { padding-left: 0; padding-right: 0; }
  .reader { max-width: 100%; font-size: 16px; line-height: 1.95; }
  .reader p { margin: 0.9em 0; }
  .chapter-images { max-width: 100%; gap: 10px; }
  .chapter-images img { border-radius: 8px; }
  .audio-reader-panel { max-width: 100%; }
  .audio-player-custom {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 16px;
  }
  .audio-player-custom #audio-play-btn { align-self: center; }
  .audio-player-title { white-space: normal; }
}

/* ─── Author dashboard responsive layout ───────────────────────── */
.author-dashboard-header {
  justify-content: space-between;
  margin-top: 20px;
}
.author-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin: 24px 0 32px;
}
.author-work-card {
  margin-bottom: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.author-work-table-head {
  display: flex;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.author-work-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px 90px 160px;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.author-work-title { min-width: 0; }
.author-work-status { width: 120px; }
.author-work-count {
  width: 90px;
  color: var(--muted);
  font-size: 14px;
}
.author-work-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.author-chapter-table {
  width: 100%;
  margin: 0;
  border-radius: 0;
}
.author-chapter-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}
.chapter-language-controller {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  margin: 20px 0 16px;
  padding: 18px;
  border: 1px solid rgba(211, 154, 42, 0.5);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(211, 154, 42, 0.16), rgba(160, 69, 58, 0.08)),
    var(--panel);
}
.chapter-language-controller h2 {
  margin: 2px 0 6px;
  font-size: 22px;
}
.chapter-language-kicker {
  margin: 0;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.chapter-language-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(92px, 1fr));
  gap: 8px;
  min-width: 340px;
}
.chapter-language-option {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel2);
  cursor: pointer;
  text-align: center;
}
.chapter-language-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.chapter-language-option span {
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
}
.chapter-language-option small {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}
.chapter-language-option.is-active {
  border-color: var(--gold);
  background: linear-gradient(135deg, var(--gold), #b77f15);
  color: #120c05;
}
.chapter-language-option.is-active span,
.chapter-language-option.is-active small {
  color: #120c05;
}
.multilingual-editor {
  padding: 14px;
  margin-top: 10px;
}
.audio-language-upload {
  margin: 14px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.audio-language-upload legend {
  padding: 0 8px;
  color: var(--text);
  font-weight: 700;
}
.audio-language-upload select {
  max-width: 260px;
}
.audio-language-upload .language-field {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel2);
}

@media (max-width: 900px) {
  .chapter-language-controller {
    grid-template-columns: 1fr;
  }
  .chapter-language-options {
    min-width: 0;
  }
  .author-work-table-head { display: none; }
  .author-work-summary {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }
  .author-work-status,
  .author-work-count,
  .author-work-actions {
    width: auto;
  }
  .author-work-count { justify-self: end; }
  .author-work-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .chapter-language-controller {
    margin: 16px 0 14px;
    padding: 14px;
  }
  .chapter-language-controller h2 {
    font-size: 19px;
  }
  .chapter-language-options {
    grid-template-columns: 1fr;
  }
  .chapter-language-option {
    min-height: 58px;
  }
  .author-dashboard-header {
    align-items: stretch;
    flex-direction: column;
  }
  .author-dashboard-header .btn { text-align: center; }
  .author-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 18px 0 24px;
  }
  .author-work-summary {
    grid-template-columns: 1fr;
    padding: 14px;
  }
  .author-work-count { justify-self: start; }
  .author-work-actions .btn,
  .author-work-actions form,
  .author-work-actions button {
    width: 100%;
  }
  .author-chapter-table,
  .author-chapter-table thead,
  .author-chapter-table tbody,
  .author-chapter-table tr,
  .author-chapter-table th,
  .author-chapter-table td {
    display: block;
  }
  .author-chapter-table {
    overflow: visible;
    white-space: normal;
  }
  .author-chapter-table thead { display: none; }
  .author-chapter-table tr {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
  }
  .author-chapter-table tr:last-child { border-bottom: 0; }
  .author-chapter-table td {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 10px;
    padding: 6px 0;
    border-bottom: 0;
    white-space: normal;
  }
  .author-chapter-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
  }
  .author-chapter-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }
  .author-chapter-actions .btn,
  .author-chapter-actions form,
  .author-chapter-actions button {
    width: 100%;
  }
  .audio-language-upload select {
    max-width: 100%;
  }
}

@media (max-width: 420px) {
  .author-stats-grid { grid-template-columns: 1fr; }
  .author-chapter-table td { grid-template-columns: 1fr; }
}

/* ─── Paywall ────────────────────────────────────────────────────── */
.paywall {
  text-align: center;
  padding: 48px;
  border: 1px dashed var(--gold-dim);
  border-radius: 12px;
}

/* ─── Forms ─────────────────────────────────────────────────────── */
.form { width: 100%; max-width: 420px; margin: 30px auto; }
.form-wide { width: 100%; max-width: 100%; margin: 30px 0; }
.form label, .form-wide label { display: block; margin: 12px 0 4px; font-size: 13px; color: var(--muted); }
.form input, .form textarea, .form select,
.form-wide input, .form-wide textarea, .form-wide select,
input, textarea, select { max-width: 100%; }
.form input:not([type=checkbox]):not([type=radio]), .form textarea, .form select,
.form-wide input:not([type=checkbox]):not([type=radio]), .form-wide textarea, .form-wide select {
  width: 100%;
  padding: 10px 14px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.form input:not([type=checkbox]):not([type=radio]):focus, .form textarea:focus, .form select:focus,
.form-wide input:not([type=checkbox]):not([type=radio]):focus, .form-wide textarea:focus, .form-wide select:focus {
  outline: none;
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px rgba(200, 146, 42, 0.12);
}
.form textarea, .form-wide textarea { min-height: 160px; resize: vertical; }

/* 宽表单两栏布局（PC） */
.form-wide .form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 760px) {
  .form-wide .form-row-2 { grid-template-columns: 1fr; }
}
.err { color: var(--danger); font-size: 14px; margin: 8px 0; }

/* ─── Stars ──────────────────────────────────────────────────────── */
.stars { color: var(--gold); letter-spacing: 2px; }

/* ─── Review ─────────────────────────────────────────────────────── */
.review { border-top: 1px solid var(--line); padding: 12px 0; }

/* ─── Row ────────────────────────────────────────────────────────── */
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; min-width: 0; }

/* ─── Media ──────────────────────────────────────────────────────── */
audio, video { width: 100%; margin: 14px 0; border-radius: 10px; background: #000; }

/* ─── Footer ─────────────────────────────────────────────────────── */
footer.foot {
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--line);
  margin-top: 50px;
  padding: 24px 0;
}

/* ─── Table ──────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); }
td, th { vertical-align: top; }

/* ─── Pre ────────────────────────────────────────────────────────── */
pre { max-width: 100%; overflow: auto; }

/* ─── Pills ──────────────────────────────────────────────────────── */
.pill {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 99px;
  border: 1px solid;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.pill.FREE {
  color: #4CAF7D;
  border-color: rgba(76, 175, 125, 0.3);
  background: rgba(76, 175, 125, 0.08);
}
.pill.LOGIN {
  color: #8AB4F8;
  border-color: rgba(138, 180, 248, 0.3);
  background: rgba(138, 180, 248, 0.08);
}
.pill.PAID {
  color: #D4882A;
  border-color: rgba(212, 136, 42, 0.3);
  background: rgba(212, 136, 42, 0.08);
}

/* ─── Markdown Editor ────────────────────────────────────────────── */
.markdown-tools { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 8px; }
.markdown-tools button {
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--text);
  cursor: pointer;
}
.markdown-preview {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  margin-top: 8px;
  max-height: 360px;
  overflow: auto;
}
.markdown-preview h1 { font-size: 20px; margin: 8px 0; }
.markdown-preview h2 { font-size: 17px; }
.markdown-preview h3 { font-size: 15px; }
.markdown-preview blockquote {
  border-left: 3px solid var(--gold-dim);
  margin: 8px 0;
  padding: 4px 10px;
  color: var(--muted);
}

/* ─── EasyMDE ────────────────────────────────────────────────────── */
.EasyMDEContainer { margin-top: 6px; color: var(--text); }
.EasyMDEContainer .CodeMirror {
  background: var(--panel2);
  color: var(--text);
  border-color: var(--line);
  border-radius: 0 0 10px 10px;
  min-height: 420px;
  font: 15px/1.7 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.EasyMDEContainer .CodeMirror-cursor { border-left-color: var(--text); }
.EasyMDEContainer .CodeMirror-selected { background: #3A2E22; }
.EasyMDEContainer .CodeMirror-placeholder { color: var(--muted); }
.EasyMDEContainer .editor-toolbar {
  background: var(--panel);
  border-color: var(--line);
  border-radius: 10px 10px 0 0;
}
.EasyMDEContainer .editor-toolbar button { color: var(--text); }
.EasyMDEContainer .editor-toolbar button:hover,
.EasyMDEContainer .editor-toolbar button.active {
  background: var(--panel2);
  border-color: var(--line);
}
.EasyMDEContainer .editor-toolbar i.separator {
  border-left-color: var(--line);
  border-right-color: transparent;
}
.EasyMDEContainer .editor-preview,
.EasyMDEContainer .editor-preview-side {
  background: var(--panel);
  color: var(--text);
}
.EasyMDEContainer .editor-preview blockquote,
.EasyMDEContainer .editor-preview-side blockquote {
  border-left: 3px solid var(--gold-dim);
  color: var(--muted);
  padding-left: 12px;
}
.EasyMDEContainer .editor-statusbar { color: var(--muted); }

/* ─── Check Grid ─────────────────────────────────────────────────── */
.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 6px;
  margin: 6px 0 10px;
}
.check-grid label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--text);
  font-size: 13px;
}
.check-grid input { width: auto; }
.hero-upload-grid {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(280px, 1.2fr);
  gap: 16px;
  align-items: start;
}
.work-localized-fields {
  margin: 16px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel2);
}
.work-localized-fields textarea { min-height: 120px; }
.upload-field-hint {
  margin: -4px 0 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
.hero-lang-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}
.hero-lang-tab {
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--muted);
  border-radius: 8px;
  padding: 7px 10px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.hero-lang-tab.active {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(200,146,42,0.1);
}
[data-hero-lang-panel] { display: none; }
[data-hero-lang-panel].active { display: block; }

/* ─── Safe Area Insets ───────────────────────────────────────────── */
@supports (padding: max(0px)) {
  .container {
    padding-left:  max(18px, env(safe-area-inset-left));
    padding-right: max(18px, env(safe-area-inset-right));
  }
}

/* ─── No-hover devices ───────────────────────────────────────────── */
@media (hover: none) {
  .card:hover { transform: none; }
}

/* ─── Mobile (≤ 760px) ───────────────────────────────────────────── */
@media (max-width: 760px) {
  body { font-size: 14px; }
  .container { padding: 0 14px; }
  .nav-in {
    gap: 12px;
    white-space: nowrap;
    padding-top: 8px;
    padding-bottom: 8px;
  }
  .nav-primary,
  .nav-admin-links,
  .lang-switch { display: none; }
  .nav-auth { margin-left: auto; gap: 8px; }
  .nav-auth .user-link {
    display: none;
  }
  .nav-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
  }
  .logo { flex: 0 0 auto; font-size: 18px; }
  .nav a.link { flex: 0 0 auto; font-size: 13px; }
  .spacer { flex: 0 0 8px; min-width: 8px; }
  .hero-actions {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    width: min(100%, 420px);
  }
  .hero-actions .btn {
    display: block;
    width: 100%;
    text-align: center;
  }
  .hero-align-center .hero-actions { margin: 0 auto; }
  .hero-align-right .hero-actions { margin-left: auto; }
  .hero-align-center .hero-actions .btn { margin: 0 auto; }
  .hero-align-right .hero-actions .btn { margin-left: auto; }
  h1 { font-size: 22px; line-height: 1.35; margin: 20px 0 6px; }
  h2 { font-size: 17px; line-height: 1.4; }
  .panel { padding: 14px; border-radius: 10px; }
  .btn { min-height: 42px; padding: 9px 12px; }
  .btn.sm { min-height: 38px; padding: 7px 10px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .card { border-radius: 10px; }
  .card .body { padding: 10px; }
  .card h3 { font-size: 14px; line-height: 1.45; }
  .tag, .pill { font-size: 11px; }
  .form { margin: 20px auto; }
  .form label { font-size: 13px; }
  .form input:not([type=checkbox]):not([type=radio]), .form textarea, .form select,
  input:not([type=checkbox]):not([type=radio]), textarea, select { font-size: 16px; }
  .chapter-list a { padding: 10px; gap: 8px; }
  .reader { font-size: 16px; line-height: 1.9; max-width: 100%; }
  .reader blockquote { padding: 0.15em 0.8em; }
  .chapter-images { max-width: 100%; }
  .short-player { max-width: min(420px, 100%); }
  .short-player video { max-height: 72vh; }
  .EasyMDEContainer .editor-toolbar {
    display: flex;
    gap: 2px;
    overflow-x: auto;
    white-space: nowrap;
  }
  .EasyMDEContainer .CodeMirror { min-height: 320px; font-size: 14px; }
  .hero-upload-grid { grid-template-columns: 1fr; }
  .hero-lang-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
  th, td { padding: 8px 10px; }
  footer.foot { margin-top: 36px; }
}

/* ─── Small mobile (≤ 420px) ─────────────────────────────────────── */
@media (max-width: 420px) {
  .container { padding: 0 12px; }
  .nav-in { gap: 10px; }
  .grid { grid-template-columns: 1fr; }
  .cover { max-height: 420px; }
  .row { gap: 8px; }
  .btn { width: auto; }
  .panel .btn, .form .btn { max-width: 100%; }
  .chapter-list a { flex-direction: column; }
  .paywall { padding: 28px 14px; }
}
