:root {
  --bg: #000;
  --panel: #141414;
  --line: #2a2a2a;
  --gold: #ffdc53;
  --text: #f5f0e4;
  --muted: #9a9588;
  --chip: #1c1c1c;
  /* 原站比例：换脸/图片 3/4；漫剧 62/91 */
  --face-ratio: 3 / 4;
  --img-ratio: 3 / 4;
  --drama-ratio: 62 / 91;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 500 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
button, a { font: inherit; color: inherit; }
button { appearance: none; border: 0; background: none; cursor: pointer; }

.app {
  min-height: 100svh;
  padding:
    max(8px, env(safe-area-inset-top))
    14px
    calc(88px + env(safe-area-inset-bottom));
}

.app-top {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  margin-bottom: 8px;
}
.app-back {
  width: 40px;
  height: 40px;
  border: 1px solid #3a3a3a;
  border-radius: 999px;
  color: #eee;
  font-size: 18px;
  line-height: 1;
}
.app-brand {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--gold);
  border-radius: 999px;
  color: var(--gold);
  text-decoration: none;
  font: 800 12px/1 "Arial Black", Arial, sans-serif;
  letter-spacing: 0.08em;
}
.app-top-right {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-self: end;
}
.app-login,
.app-coins {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #3a3a3a;
  border-radius: 999px;
  background: #151515;
  color: #f0eadc;
  font-weight: 700;
  font-size: 12px;
}
.app-coins {
  color: var(--gold);
  border-color: #4a4332;
  min-width: 44px;
  font-variant-numeric: tabular-nums;
}
.app-login.is-avatar {
  width: 34px;
  min-width: 34px;
  padding: 0;
  border-radius: 999px;
  overflow: hidden;
}
.app-login.is-avatar .tn-avatar,
.tn-login.is-avatar .tn-avatar {
  display: grid;
  place-items: center;
  width: 100%;
  height: 34px;
  background: linear-gradient(145deg, #3a3428, #1a1814);
  color: var(--gold);
}
.app-login.is-avatar .tn-avatar-icon,
.tn-login.is-avatar .tn-avatar-icon {
  display: block;
}

.face-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0 14px;
}
.face-head h1 {
  margin: 0;
  font: 800 34px/1 "PingFang SC", "Helvetica Neue", sans-serif;
  letter-spacing: -0.03em;
}
.face-coins {
  margin: 0;
  color: var(--gold);
  font: 650 12px/1.2 system-ui, sans-serif;
  white-space: nowrap;
}

.face-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  margin-bottom: 14px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--panel);
}
.face-count {
  display: flex;
  align-items: baseline;
  gap: 6px;
  color: #cfc7b6;
  font-size: 13px;
}
.face-count b {
  color: #fff;
  font-size: 15px;
}
.face-actions {
  display: flex;
  gap: 8px;
}
.face-chip {
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid #3a3a3a;
  border-radius: 999px;
  background: transparent;
  color: #e8e0d0;
  font-size: 12px;
  font-weight: 650;
}

.face-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 12px;
}
.grid-sentinel {
  grid-column: 1 / -1;
  height: 1px;
  pointer-events: none;
}
.face-card {
  position: relative;
  display: grid;
  gap: 8px;
  text-align: left;
  padding: 0;
  background: transparent;
  content-visibility: auto;
  contain-intrinsic-size: 320px;
}
.face-fav {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #ffdc53;
  font: 700 16px/1 system-ui, sans-serif;
  cursor: pointer;
}
.face-fav.is-on { color: #ff6b8a; }
.face-form-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.face-fav-btn {
  appearance: none;
  border: 1px solid rgba(255, 220, 83, 0.35);
  border-radius: 999px;
  background: transparent;
  color: #ffdc53;
  padding: 6px 12px;
  font: 750 12px/1 system-ui, sans-serif;
  cursor: pointer;
  white-space: nowrap;
}
.face-fav-btn.is-on {
  background: rgba(255, 107, 138, 0.15);
  border-color: #ff6b8a;
  color: #ff6b8a;
}
.face-card-media {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  aspect-ratio: var(--face-ratio);
  background: #121212;
}
.face-card-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.face-card strong {
  display: block;
  overflow: hidden;
  color: #fff;
  font: 700 14px/1.2 system-ui, sans-serif;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.face-card .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  color: var(--muted);
  font-size: 11px;
}
.face-card .meta b {
  color: #d8c789;
  font-weight: 650;
}
.face-empty {
  margin: 48px 0;
  text-align: center;
  color: var(--muted);
}

.stub {
  padding: 48px 8px;
  text-align: center;
}
.stub h2 { margin: 0 0 8px; font-size: 28px; }
.stub p { margin: 0; color: var(--muted); }

.drama-switches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 12px;
}
.seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: #171717;
  border: 1px solid #2c2c2c;
}
.seg-btn {
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  color: #cfcfcf;
  font-size: 12px;
  font-weight: 700;
}
.seg-btn.is-on {
  background: var(--gold);
  color: #17150f;
}
.drama-filter-toggle {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 0 14px;
  border: 1px solid #2c2c2c;
  border-radius: 12px;
  background: #141414;
  color: #e8e0d0;
  font-size: 13px;
  font-weight: 650;
}
.drama-filter-toggle b { color: var(--gold); font-size: 16px; }
.drama-filter-panel {
  margin: -4px 0 14px;
  padding: 12px;
  border: 1px solid #2c2c2c;
  border-radius: 12px;
  background: #121212;
}
.drama-sort {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}
.drama-sort select {
  min-height: 34px;
  border: 1px solid #333;
  border-radius: 8px;
  background: #1a1a1a;
  color: #eee;
  padding: 0 8px;
}
.drama-title-row {
  margin: 4px 0 14px;
}
.drama-title-row h2 {
  margin: 0;
  font: 800 22px/1.2 "PingFang SC", "Helvetica Neue", sans-serif;
}
.drama-title-row h2 span { font-weight: 800; }
.drama-title-row p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.drama-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 12px;
}
.drama-card {
  position: relative;
  display: grid;
  padding: 0;
  text-align: left;
  background: transparent;
}
.drama-card-media {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  aspect-ratio: var(--drama-ratio);
  background: #121212;
}
.drama-card-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.drama-card-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 48%, rgba(0,0,0,.88));
  pointer-events: none;
}
.drama-langs {
  position: absolute;
  z-index: 2;
  left: 8px;
  top: 8px;
  display: flex;
  gap: 4px;
}
.drama-langs span {
  min-width: 22px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(0,0,0,.55);
  color: #fff;
  font: 700 10px/20px system-ui, sans-serif;
  text-align: center;
}
.drama-new {
  position: absolute;
  z-index: 2;
  right: 8px;
  top: 8px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #e23b3b;
  color: #fff;
  font: 800 10px/28px system-ui, sans-serif;
  text-align: center;
}
.drama-card-body {
  position: absolute;
  z-index: 2;
  left: 10px;
  right: 10px;
  bottom: 10px;
  display: grid;
  gap: 3px;
}
.drama-card-body strong {
  color: #fff;
  font: 750 14px/1.2 system-ui, sans-serif;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drama-card-body .row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: #cfc7b6;
  font-size: 11px;
}
.drama-card-body .eps { color: var(--gold); font-weight: 700; }

.sheet-player {
  width: 100vw;
  max-width: 100vw;
  height: 100svh;
  max-height: 100svh;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #000;
  overflow: hidden;
  color: #f4f1e7;
}
.sheet-player::backdrop {
  background: #000;
}
.sheet-player .player-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 0;
  width: 100%;
  height: 100%;
  max-height: 100svh;
  padding: 0;
  box-sizing: border-box;
  overflow: hidden;
  background: #000;
}
.sheet-player .sheet-head {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  margin: 0;
  padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
  background: linear-gradient(180deg, rgba(0,0,0,.72), transparent);
  pointer-events: none;
}
.sheet-player .sheet-head > * { pointer-events: auto; }
.sheet-player .sheet-head strong {
  color: #fff;
  font: 700 15px/1.2 system-ui, sans-serif;
  text-shadow: 0 1px 4px rgba(0,0,0,.55);
  max-width: calc(100% - 96px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sheet-player .sheet-close {
  background: rgba(28,28,28,.72);
  color: #fff;
  border: 0;
}
.player-stage {
  position: relative;
  min-height: 0;
  width: 100%;
  height: 100%;
  background: #000;
  display: grid;
  place-items: center;
}
.player-stage video,
#player-video {
  display: block;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
  border-radius: 0;
  background: #000;
}
.player-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.player-fs-btn {
  min-width: 52px;
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: rgba(20,20,20,.72);
  color: #ffdc53;
  font: 700 13px/1 system-ui, sans-serif;
  cursor: pointer;
}
.player-dock {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  padding: 48px 12px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(0deg, rgba(0,0,0,.82), transparent);
  pointer-events: none;
}
.player-dock > * { pointer-events: auto; }
.sheet-player .player-tools {
  margin: 0 0 8px;
}
.sheet-player .player-status {
  color: #cfc7b6;
  margin: 0 0 8px;
}
.sheet-player .player-eps {
  margin-top: 0;
  max-height: 88px;
  overflow: auto;
}
.sheet-player.player-is-fs .player-dock,
.sheet-player.player-is-fs .player-fs-btn,
.sheet-player.player-is-fs .sheet-head {
  display: none;
}
/* 换脸编辑器：自研样式，版式对齐常见「预览 + 表单」模板 */
.face-editor-dlg {
  width: min(920px, 100vw);
  max-width: 100vw;
  height: min(100svh, 100%);
  max-height: 100svh;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.face-editor-dlg::backdrop {
  background: #000c;
}
.face-editor {
  --face-line: #2c2a24;
  --face-gold: #ffdc53;
  position: relative;
  display: grid;
  grid-template-columns: minmax(180px, 0.85fr) minmax(0, 1.15fr);
  gap: 22px;
  width: 100%;
  min-height: 100%;
  max-height: 100svh;
  overflow: auto;
  padding: 18px 16px calc(28px + env(safe-area-inset-bottom));
  border: 1px solid var(--face-line);
  border-radius: 0;
  background: linear-gradient(130deg, #232119, #12120f);
  color: #f4f1e7;
  box-sizing: border-box;
}
.face-editor-topbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 10px;
  grid-column: 1 / -1;
}
.face-editor-back {
  appearance: none;
  border: 1px solid #3a3528;
  border-radius: 999px;
  background: #28251d;
  color: #ffdc53;
  padding: 10px 14px;
  font: 700 13px/1 system-ui, sans-serif;
  cursor: pointer;
}
.face-editor-close {
  display: grid;
  place-items: center;
  width: 38px;
  min-height: 38px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #28251d;
  color: #f4f1e7;
  font: 400 27px/1 system-ui, sans-serif;
  cursor: pointer;
}
.face-video-wrap {
  position: relative;
  min-width: 0;
  max-height: 42svh;
  border-radius: 10px;
  overflow: hidden;
  background: #090909;
}
.face-video-wrap video {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 42svh;
  object-fit: contain;
  background: #090909;
  border-radius: 10px;
}
.face-video-wrap > img#face-player-poster {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  max-height: 42svh;
  object-fit: contain;
  background: #090909;
  border-radius: 10px;
  pointer-events: none;
}
.face-video-wrap > img:not(#face-player-poster) {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 42svh;
  object-fit: contain;
  background: #090909;
  border-radius: 10px;
}
.face-video-wrap > span {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 5px 10px;
  border-radius: 20px;
  background: #000b;
  color: #f4f1e7;
  font: 650 11px/1 system-ui, sans-serif;
}
.face-form {
  align-self: start;
  min-width: 0;
  padding-bottom: 8px;
}
.face-step {
  display: block;
  color: var(--face-gold);
  font: 800 11px/1 system-ui, sans-serif;
  letter-spacing: 2px;
}
.face-form h3 {
  margin: 8px 0 6px;
  font: 800 23px/1.2 Georgia, "Songti TC", serif;
  color: #fff8e8;
}
.face-selected-meta,
.face-form-guide {
  margin: 0 0 8px;
  color: #bdb6a6;
  font: 600 12px/1.5 system-ui, sans-serif;
}
.face-photo-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 18px 0;
  padding: 16px 0;
  border-top: 1px solid var(--face-line);
  border-bottom: 1px solid var(--face-line);
  flex-wrap: wrap;
}
.face-photo-row > img {
  width: 90px;
  height: 110px;
  object-fit: cover;
  border-radius: 8px;
  background: #1a1812;
  flex: 0 0 auto;
}
.face-photo-copy {
  min-width: 0;
  flex: 1 1 160px;
}
.face-photo-copy strong {
  display: block;
  margin: 0 0 4px;
  color: #f1ead9;
  font: 750 14px/1.35 system-ui, sans-serif;
}
.face-photo-copy > p {
  margin: 0 0 10px;
  color: #9a9588;
  font: 600 12px/1.4 system-ui, sans-serif;
}
.face-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.face-file-action {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 14px;
  border: 1px solid #514c3e;
  border-radius: 7px;
  background: #1b1a15;
  color: #f1ead9;
  font: 700 12px/1 system-ui, sans-serif;
  cursor: pointer;
  overflow: hidden;
}
.face-file-action:hover,
.face-file-action:focus-within {
  border-color: var(--face-gold);
  background: #252218;
}
.face-file-action > input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0.001;
  cursor: pointer;
  font-size: 0;
}
.face-consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 14px 0;
  color: #dedacc;
  font: 600 13px/1.5 system-ui, sans-serif;
}
.face-consent input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  margin: 1px 0;
  accent-color: var(--face-gold);
}
.face-privacy {
  margin: 0 0 14px;
  color: #8f897c;
  font: 600 11px/1.5 system-ui, sans-serif;
}
.face-primary {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid #e7c45a;
  border-radius: 8px;
  background: linear-gradient(120deg, #ffe986, #e2af21);
  color: #15140e;
  font: 800 14px/1 system-ui, sans-serif;
  cursor: pointer;
}
.face-primary:disabled,
.face-primary.is-busy {
  opacity: 0.72;
  cursor: wait;
}
.face-primary.is-busy {
  position: relative;
  letter-spacing: 0.02em;
  animation: btn-busy-pulse 1.1s ease-in-out infinite;
}
@keyframes btn-busy-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.08); }
}
.face-form-status {
  min-height: 20px;
  margin: 10px 0 0;
  color: #f0d56a;
  font: 650 12px/1.4 system-ui, sans-serif;
}
.face-form-status.is-err { color: #ff8f8f; }
.face-preview-status { color: #9a9588; }

.detail-chip {
  display: inline-block;
  margin: 0 0 6px;
  color: var(--gold);
  font: 800 10px/1 system-ui, sans-serif;
  letter-spacing: 0.08em;
}
.detail-guide {
  margin: 0 0 10px;
  color: #cfc7b6;
  font: 600 12px/1.45 system-ui, sans-serif;
}
.detail-status {
  min-height: 18px;
  margin: 6px 0 0;
  color: #f0d56a;
  font: 650 12px/1.4 system-ui, sans-serif;
}
.detail-status.is-err { color: #ff8f8f; }

@media (max-width: 760px) {
  .face-editor {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 14px 16px calc(24px + env(safe-area-inset-bottom));
  }
  .face-video-wrap,
  .face-video-wrap video,
  .face-video-wrap img {
    max-height: 40svh;
  }
  .face-form h3 { font-size: 22px; }
}
.player-status {
  min-height: 18px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.player-eps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.player-eps button {
  min-width: 44px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid #333;
  border-radius: 10px;
  background: #1a1a1a;
  color: #eee;
  font-size: 12px;
  font-weight: 700;
}
.player-eps button.is-on {
  border-color: var(--gold);
  background: rgba(255, 220, 83, 0.14);
  color: var(--gold);
}

.img-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 6px 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid #242424;
}
.img-count {
  margin: 0;
  color: var(--gold);
  font: 750 15px/1 system-ui, sans-serif;
}
.img-count b { font-weight: 800; }
.img-refresh {
  min-width: 54px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  background: #1c1c1c;
  color: #eee;
  font-size: 12px;
  font-weight: 700;
}
.img-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.img-card {
  display: grid;
  gap: 8px;
  padding: 0;
  text-align: left;
  background: transparent;
  content-visibility: auto;
  contain-intrinsic-size: 280px;
}
.img-card-media {
  overflow: hidden;
  border-radius: 14px;
  aspect-ratio: var(--img-ratio);
  background: #121212;
  border: 1px solid #222;
}
.img-card-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.img-card strong {
  display: block;
  overflow: hidden;
  color: #fff;
  font: 700 13px/1.2 system-ui, sans-serif;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.img-card .size {
  color: var(--muted);
  font-size: 11px;
}
.img-video-wrap {
  display: grid;
  place-items: center;
}
.img-video-wrap img {
  width: 100%;
  max-height: 42svh;
  object-fit: contain;
  border-radius: 10px;
  background: #090909;
}

.app-tabbar {
  position: fixed;
  z-index: 40;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: 1fr 1.15fr 1fr;
  gap: 4px;
  width: min(360px, calc(100vw - 28px));
  padding: 5px;
  border: 1px solid #3a3628;
  border-radius: 18px;
  background: rgba(10, 10, 9, 0.94);
  box-shadow: 0 16px 40px rgba(0,0,0,.55);
  backdrop-filter: blur(14px);
  transform: translateX(-50%);
}
.app-tabbar .tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 46px;
  border-radius: 12px;
  color: #f2efe6;
  font-size: 14px;
  font-weight: 750;
}
.app-tabbar .tab i {
  color: var(--gold);
  font-style: normal;
  font-size: 12px;
}
.app-tabbar .tab-face {
  gap: 4px;
}
.app-tabbar .tab-face i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: currentColor;
  color: transparent;
  font-size: 14px;
  font-weight: 900;
  position: relative;
}
.app-tabbar .tab-face i::before {
  content: "+";
  position: absolute;
  color: #111;
  font-size: 14px;
  line-height: 1;
}
.app-tabbar .tab.is-on {
  background: var(--gold);
  color: #17150f;
}
.app-tabbar .tab.is-on i { color: #17150f; }
.app-tabbar .tab-face.is-on i { background: #17150f; }
.app-tabbar .tab-face.is-on i::before { color: var(--gold); }

.sheet {
  width: min(420px, calc(100vw - 24px));
  margin: auto auto 18px;
  padding: 0;
  border: 1px solid #333;
  border-radius: 18px;
  background: #121212;
  color: var(--text);
}
.sheet::backdrop { background: rgba(0,0,0,.62); }
.sheet-panel { padding: 16px; }
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.sheet-close {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: #1c1c1c;
  font-size: 20px;
}
.sheet-label {
  margin: 14px 0 8px;
  padding-top: 10px;
  border-top: 1px solid #2c2a24;
  color: #8f8a7c;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.sheet-opts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}
.sheet-opts-list {
  margin-bottom: 4px;
}
.sheet-opts .opt {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  width: 100%;
  min-height: 40px;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  border: 1px solid #39362c;
  border-radius: 7px;
  background: #1a1915;
  color: #aaa69b;
  font-size: 11px;
  line-height: 1.2;
  text-align: left;
}
.sheet-opts-list .opt:first-child {
  grid-column: 1 / -1;
  min-height: 42px;
  font-size: 12px;
}
.sheet-opts .opt .filter-dot {
  display: block;
  width: 7px;
  height: 7px;
  border: 1px solid #5a5648;
  border-radius: 50%;
  background: #24231e;
}
.sheet-opts .opt .filter-label {
  min-width: 0;
  overflow-wrap: anywhere;
}
.sheet-opts .opt .filter-count {
  color: #777267;
  font-size: 10px;
  font-weight: 400;
}
.sheet-opts .opt.is-on {
  border-color: #f0ca4e;
  background: linear-gradient(120deg, #ffe986, #e2af21);
  color: #15140e;
}
.sheet-opts .opt.is-on .filter-dot {
  border-color: #594600;
  background: #594600;
}
.sheet-opts .opt.is-on .filter-count {
  color: #594600;
}
.sheet-done {
  width: 100%;
  min-height: 44px;
  margin-top: 18px;
  border-radius: 999px;
  background: var(--gold);
  color: #17150f;
  font-weight: 800;
}
.sheet-note {
  margin: 8px 0 4px;
  color: var(--muted);
  text-align: center;
}

@media (min-width: 760px) {
  .app {
    max-width: 430px;
    margin: 0 auto;
  }
}

.works-list{display:grid;gap:8px;margin-top:10px}
.works-row{display:flex;justify-content:space-between;gap:10px;padding:12px;border:1px solid #2f2b22;border-radius:12px;background:#12110e;font:650 12px/1.35 system-ui;color:#f0eadc}
.works-row small{color:#9a9588}
.works-main{min-width:0;flex:1}
.works-title-row{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:4px}
.works-title-row b{font:700 13px/1.3 system-ui}
.works-badge{display:inline-flex;align-items:center;padding:2px 8px;border-radius:999px;font:700 10px/1.2 system-ui;letter-spacing:.02em}
.works-badge.is-run{background:#2a2418;color:#ffdc53}
.works-badge.is-done{background:#132418;color:#7dffb0}
.works-badge.is-fail{background:#2a1515;color:#ff9a9a}
.works-bar{margin-top:8px;height:4px;border-radius:99px;background:#2a261c;overflow:hidden}
.works-bar>span{display:block;height:100%;background:linear-gradient(90deg,#ffdc53,#f0b429)}
.works-err{margin:8px 0 0;color:#ff9a9a;font:600 12px/1.4 system-ui;word-break:break-word}

/* age / locale / studio */
.age-gate{position:fixed;inset:0;z-index:2147483646;display:grid;place-items:center;padding:20px;background:#050505e6}
.age-gate[hidden]{display:none!important}
.age-card{width:min(420px,100%);border:1px solid rgba(255,220,83,.3);border-radius:16px;background:#14120e;padding:22px 18px;color:#f3eee2}
.age-card h2{margin:0 0 8px;color:#ffdc53;font:800 20px/1.3 Georgia,serif}
.age-card p{margin:0 0 16px;color:#b8b2a5;font:600 13px/1.5 system-ui}
.age-actions{display:flex;gap:8px;flex-wrap:wrap}
.age-actions .ta-primary,.player-paywall .ta-primary{flex:1;appearance:none;border:0;border-radius:999px;background:#ffdc53;color:#111;padding:12px 14px;font:800 13px/1 system-ui;cursor:pointer}
.age-actions .ta-ghost{flex:1;appearance:none;border:1px solid #444;border-radius:999px;background:transparent;color:#ddd;padding:12px 14px;font:700 13px/1 system-ui;cursor:pointer}
.locale-switch{appearance:none;border:1px solid #3a3528;border-radius:999px;background:#12100c;color:#e8ddc5;padding:6px 10px;font:700 11px/1 system-ui}
.drama-search-wrap{margin:0 0 12px}
.drama-search-wrap input{width:100%;box-sizing:border-box;border:1px solid #333;border-radius:12px;background:#12110e;color:#fff;padding:11px 12px;font:600 13px/1.3 system-ui}
.player-tools{display:flex;align-items:center;justify-content:space-between;gap:10px;margin:8px 0;flex-wrap:wrap}
.player-cc{color:#bbb;font:650 12px/1 system-ui;display:flex;gap:6px;align-items:center}
.player-paywall{margin:8px 0;padding:12px;border:1px solid #3a3528;border-radius:12px;background:#15130f}
.player-paywall p{margin:0 0 10px;color:#e8ddc5;font:650 13px/1.4 system-ui}
.works-actions{display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end}
.ta-mini{appearance:none;border:1px solid #5a523f;border-radius:8px;background:#1b1812;color:#ffdc53;padding:6px 8px;font:700 11px/1 system-ui;cursor:pointer}

/* 站内作品播放：避免跳系统播放器卡住 */
.result-player{
  width:min(520px,100vw);
  max-width:100vw;
  height:min(100svh,100%);
  max-height:100svh;
  margin:0;
  padding:0;
  border:0;
  background:#070706;
  color:#f5f0e4;
}
.result-player::backdrop{background:#000d}
.result-player-panel{
  display:flex;
  flex-direction:column;
  min-height:100%;
  max-height:100svh;
  padding:calc(10px + env(safe-area-inset-top)) 14px calc(16px + env(safe-area-inset-bottom));
  box-sizing:border-box;
}
.result-player-bar{
  display:grid;
  grid-template-columns:auto 1fr auto;
  align-items:center;
  gap:10px;
  margin-bottom:12px;
}
.result-player-bar strong{
  text-align:center;
  font:700 14px/1.3 system-ui;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.result-back,.result-back-secondary,.result-dl,.result-close{
  appearance:none;border:0;cursor:pointer;font:700 13px/1 system-ui;
}
.result-back{
  padding:10px 12px;
  border-radius:999px;
  background:#1c1a14;
  color:#ffdc53;
  border:1px solid #3a3528;
}
.result-close{
  width:38px;height:38px;border-radius:50%;
  background:#1c1a14;color:#f5f0e4;font:400 24px/1 system-ui;
}
.result-stage{
  flex:1;
  display:grid;
  place-items:center;
  min-height:48svh;
  border-radius:14px;
  overflow:hidden;
  background:#0c0c0a;
  border:1px solid #2a261c;
}
.result-stage video,.result-stage img{
  display:block;width:100%;max-height:68svh;object-fit:contain;background:#000;
}
.result-player[data-mode="image"] .result-stage{
  background:
    linear-gradient(45deg,#1a1915 25%,transparent 25%),
    linear-gradient(-45deg,#1a1915 25%,transparent 25%),
    linear-gradient(45deg,transparent 75%,#1a1915 75%),
    linear-gradient(-45deg,transparent 75%,#1a1915 75%);
  background-size:18px 18px;
  background-position:0 0,0 9px,9px -9px,-9px 0;
  background-color:#10100e;
}
.result-player[data-mode="image"] .result-stage video{display:none!important}
.result-player[data-mode="image"] .result-stage img{
  display:block;
  width:auto;
  max-width:100%;
  max-height:72svh;
  height:auto;
  object-fit:contain;
  border-radius:10px;
  box-shadow:0 10px 28px #0008;
  background:#0a0a08;
}
.result-player[data-mode="video"] .result-stage img{display:none!important}

.works-toast{
  position:fixed;
  left:50%;
  bottom:max(120px, calc(104px + env(safe-area-inset-bottom)));
  z-index:2147483000;
  transform:translateX(-50%) translateY(12px);
  max-width:min(340px, calc(100vw - 28px));
  padding:12px 16px;
  border-radius:14px;
  border:1px solid #3a3426;
  background:rgba(18,16,12,.96);
  color:#f5f0e4;
  font:700 13px/1.4 system-ui;
  box-shadow:0 12px 30px #0008;
  opacity:0;
  pointer-events:none;
  transition:opacity .2s ease, transform .2s ease;
  text-align:center;
}
.works-toast.is-on{opacity:1;transform:translateX(-50%) translateY(0)}

.tn-works-fab{
  position:fixed;
  z-index:2147480002;
  right:max(14px, env(safe-area-inset-right));
  bottom:max(148px, calc(132px + env(safe-area-inset-bottom)));
  display:inline-flex;
  align-items:center;
  gap:8px;
  min-height:48px;
  padding:6px 14px 6px 6px;
  border:1px solid #ffe992;
  border-radius:999px;
  background:linear-gradient(145deg,#24231f,#11110f);
  color:#fff;
  font:800 13px/1 system-ui,sans-serif;
  box-shadow:0 12px 32px #0007,0 0 0 3px #ffffffb8;
  cursor:pointer;
}
.tn-works-fab:hover{transform:translateY(-1px)}
.tn-works-fab-icon{
  display:grid;place-items:center;
  width:36px;height:36px;border-radius:50%;
  background:linear-gradient(145deg,#ffe985,#f3c94f 58%,#c99012);
  color:#171713;
}
.tn-works-fab-icon svg{width:18px;height:18px}
.tn-works-fab-label{white-space:nowrap;padding-right:2px}
@media(max-width:700px){
  .tn-works-fab{bottom:max(168px, calc(152px + env(safe-area-inset-bottom)));right:12px}
  .tn-works-fab-label{font-size:12px}
}
html.ta-sheet-open .tn-works-fab{opacity:.35;pointer-events:none}
.result-actions{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
  margin-top:14px;
}
.result-dl{
  padding:14px 12px;border-radius:12px;
  background:#ffdc53;color:#17150f;
}
.result-back-secondary{
  padding:14px 12px;border-radius:12px;
  background:#1c1a14;color:#f0eadc;border:1px solid #3a3528;
}

/* 消耗确认 */
.coin-confirm{
  width:min(380px, calc(100vw - 28px));
  margin:auto;
  padding:0;
  border:0;
  border-radius:20px;
  background:transparent;
}
.coin-confirm::backdrop{background:rgba(0,0,0,.72)}
.coin-confirm-panel{
  padding:22px 18px 16px;
  border:1px solid #3a3426;
  border-radius:20px;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(255,220,83,.16), transparent 55%),
    linear-gradient(165deg, #1a1812, #0e0d0a 70%);
  color:#f5f0e4;
  box-shadow:0 18px 50px rgba(0,0,0,.45);
}
.coin-confirm-kicker{
  margin:0 0 6px;
  color:#b7a56a;
  font:700 11px/1 system-ui;
  letter-spacing:.08em;
  text-transform:uppercase;
}
.coin-confirm-title{
  margin:0 0 10px;
  font:800 22px/1.25 Georgia, "Songti SC", serif;
  color:#fff8e8;
}
.coin-confirm-scene{
  margin:0 0 16px;
  color:#9a9588;
  font:600 13px/1.4 system-ui;
  word-break:break-word;
}
.coin-confirm-amount{
  display:flex;
  align-items:baseline;
  gap:8px;
  margin:0 0 14px;
  padding:16px 14px;
  border-radius:14px;
  background:#12100c;
  border:1px solid #3a3426;
}
.coin-confirm-cost{
  font:800 36px/1 Georgia, "Songti SC", serif;
  color:#ffdc53;
}
.coin-confirm-unit{
  color:#cbb56a;
  font:700 13px/1 system-ui;
}
.coin-confirm-note{
  margin:0 0 18px;
  color:#8f8a7c;
  font:600 12px/1.55 system-ui;
}
.coin-confirm-actions{
  display:grid;
  grid-template-columns:1fr 1.2fr;
  gap:10px;
}
.coin-confirm-cancel,.coin-confirm-ok{
  appearance:none;border:0;cursor:pointer;
  min-height:48px;border-radius:12px;
  font:800 14px/1 system-ui;
}
.coin-confirm-cancel{
  background:#1b1812;color:#d8d0c0;border:1px solid #3a3528;
}
.coin-confirm-ok{
  background:linear-gradient(120deg,#ffe27a,#e8b41d);
  color:#17150f;
}

/* 通用提示 / 确认（替代浏览器默认 alert/confirm） */
.toon-msg{
  width:min(380px, calc(100vw - 28px));
  margin:auto;
  padding:0;
  border:0;
  border-radius:20px;
  background:transparent;
}
.toon-msg::backdrop{background:rgba(0,0,0,.72)}
.toon-msg-panel{
  padding:22px 18px 16px;
  border:1px solid #3a3426;
  border-radius:20px;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(255,220,83,.14), transparent 55%),
    linear-gradient(165deg, #1a1812, #0e0d0a 70%);
  color:#f5f0e4;
  box-shadow:0 18px 50px rgba(0,0,0,.45);
}
.toon-msg-kicker{
  margin:0 0 6px;
  color:#b7a56a;
  font:700 11px/1 system-ui;
  letter-spacing:.08em;
  text-transform:uppercase;
}
.toon-msg-title{
  margin:0 0 10px;
  font:800 20px/1.3 Georgia, "Songti SC", serif;
  color:#fff8e8;
}
.toon-msg-body{
  margin:0 0 18px;
  color:#9a9588;
  font:600 13px/1.55 system-ui;
  word-break:break-word;
  white-space:pre-wrap;
}
.toon-msg-actions{
  display:grid;
  grid-template-columns:1fr;
  gap:10px;
}
.toon-msg-actions.is-confirm{
  grid-template-columns:1fr 1.2fr;
}
.toon-msg-cancel,.toon-msg-ok{
  appearance:none;border:0;cursor:pointer;
  min-height:48px;border-radius:12px;
  font:800 14px/1 system-ui;
}
.toon-msg-cancel{
  background:#1b1812;color:#d8d0c0;border:1px solid #3a3528;
}
.toon-msg-ok{
  background:linear-gradient(120deg,#ffe27a,#e8b41d);
  color:#17150f;
}
.toon-msg[data-kind="warn"] .toon-msg-kicker{color:#e8a35a}
.toon-msg[data-kind="warn"] .toon-msg-panel{
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(232,163,90,.16), transparent 55%),
    linear-gradient(165deg, #1a1812, #0e0d0a 70%);
}
