/* Admin template — light / dark via data-theme on html */
:root,
[data-theme="light"] {
  --bg: #f0f2f5;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --border: #dfe3ea;
  --text: #1a1d26;
  --text-muted: #5c6578;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #dc2626;
  --success-bg: #ecfdf5;
  --success-text: #047857;
  --danger-bg: #fef2f2;
  --danger-text: #b91c1c;
  --sidebar-bg: #1e293b;
  --sidebar-text: #e2e8f0;
  --sidebar-muted: #94a3b8;
  --sidebar-active: #334155;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  --radius: 8px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --checker-a: #e4e6ea;
  --checker-b: #cfd2d8;
}

[data-theme="dark"] {
  --bg: #0f1117;
  --surface: #181b24;
  --surface-2: #1f2430;
  --border: #2d3548;
  --text: #e8eaef;
  --text-muted: #9aa3b5;
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --danger: #f87171;
  --success-bg: #052e1f;
  --success-text: #6ee7b7;
  --danger-bg: #3f1515;
  --danger-text: #fca5a5;
  --sidebar-bg: #0c0e14;
  --sidebar-text: #cbd5e1;
  --sidebar-muted: #64748b;
  --sidebar-active: #1e293b;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  --checker-a: #2a2f3a;
  --checker-b: #1f2430;
}

.checker-bg {
  background-color: var(--checker-a);
  background-image:
    linear-gradient(45deg, var(--checker-b) 25%, transparent 25%),
    linear-gradient(-45deg, var(--checker-b) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--checker-b) 75%),
    linear-gradient(-45deg, transparent 75%, var(--checker-b) 75%);
  background-size: 12px 12px;
  background-position: 0 0, 0 6px, 6px -6px, -6px 0;
}

/** 抠图/透明 PNG 预览：固定浅色棋盘，暗色主题下也不变黑 */
.alpha-checker-bg {
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #c6c6c6 25%, transparent 25%),
    linear-gradient(-45deg, #c6c6c6 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #c6c6c6 75%),
    linear-gradient(-45deg, transparent 75%, #c6c6c6 75%);
  background-size: 14px 14px;
  background-position: 0 0, 0 7px, 7px -7px, -7px 0;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

a {
  color: var(--primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.admin-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 20px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 100vh;
  position: sticky;
  top: 0;
  align-self: flex-start;
}

.sidebar-top {
  flex-shrink: 0;
}

.brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
  text-decoration: none;
}
.brand:hover {
  text-decoration: none;
  opacity: 0.9;
}

.sidebar-hint {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--sidebar-muted);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-nav-main {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin-right: -6px;
  padding-right: 6px;
}

.sidebar-footer {
  flex-shrink: 0;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
}

.nav-link-footer {
  margin: 0;
}

.nav-link {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13px;
}
.nav-link:hover {
  background: var(--sidebar-active);
  text-decoration: none;
}
.nav-link.active {
  background: var(--sidebar-active);
  color: #fff;
}
.nav-sub {
  padding-left: 18px;
  font-size: 12px;
}

.main-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.topbar-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.topbar-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
}

.topbar-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
}

.topbar-subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
}

.topbar-left .breadcrumb-top {
  margin: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.breadcrumb-top {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.breadcrumb-top a {
  color: var(--text-muted);
}
.breadcrumb-top a:hover {
  color: var(--primary);
}
.breadcrumb-top .bc-sep {
  opacity: 0.5;
}
.breadcrumb-top .bc-current {
  color: var(--text);
}

.content {
  padding: 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.app-icp {
  margin-top: auto;
  padding-top: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}
.app-icp .site-icp {
  margin: 0;
}
.app-icp a {
  color: var(--text-muted);
  text-decoration: none;
}
.app-icp a:hover {
  color: var(--primary);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.panel-title {
  margin: 0 0 16px;
  font-size: 1rem;
  font-weight: 600;
}

.panel-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 16px;
  margin-bottom: 16px;
}
.panel-head-row .panel-title {
  margin: 0;
}

.panel-head-row-start {
  justify-content: flex-start;
  align-items: center;
}

.panel-head-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.panel-head-title .panel-title {
  margin: 0;
}

.group-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.group-filter-item {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 12px;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.group-filter-item:hover {
  text-decoration: none;
  border-color: var(--primary);
  color: var(--primary);
}
.group-filter-item.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.group-filter-item.is-active:hover {
  color: #fff;
  filter: brightness(1.05);
}

.panel-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  justify-content: space-between;
}

.toolbar-right {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.muted {
  color: var(--text-muted);
}

.breadcrumb {
  margin: 0 0 16px;
  color: var(--text-muted);
  font-size: 13px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover {
  filter: brightness(0.97);
  text-decoration: none;
}
[data-theme="dark"] .btn:hover {
  filter: brightness(1.08);
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-danger {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.btn.is-disabled,
.btn.is-disabled:hover {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
  filter: none;
  color: var(--text-muted);
  background: var(--surface-2);
  border-color: var(--border);
}

.btn-lg {
  padding: 10px 20px;
  font-size: 15px;
}

.btn input[type="file"] {
  display: none;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 140px;
}

.field-label {
  font-size: 12px;
  color: var(--text-muted);
}

input[type="text"],
input[type="number"],
input[type="file"] {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.input-sm {
  max-width: 160px;
}

.input-xs {
  width: 72px;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 420px;
}

.flex-grow {
  flex: 1;
  min-width: 200px;
}

.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  border: 1px solid var(--border);
}
.alert-success {
  background: var(--success-bg);
  color: var(--success-text);
}
.alert-danger {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.text-danger {
  color: var(--danger);
}
.small {
  font-size: 12px;
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th,
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.data-table th {
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-2);
}

.col-preview {
  width: 88px;
}

.frame-preview {
  width: 72px;
  height: 72px;
  object-fit: contain;
  background: var(--surface-2);
  border-radius: 4px;
  border: 1px solid var(--border);
  image-rendering: pixelated;
}

.action-detail-play {
  width: 160px;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 12px;
}

.action-detail-play-img {
  width: 140px;
  height: 140px;
  border: none;
  background: transparent;
}

.frame-pick-toolbar,
.frame-reextract-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
  margin-bottom: 14px;
}

.frame-pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 10px;
}

.frame-pick {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 8px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
}

.frame-pick.is-selected,
.frame-pick:has(input:checked) {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.frame-pick input {
  margin: 0;
  accent-color: var(--primary);
}

.frame-pick-shot {
  height: 88px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.frame-pick-shot img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  image-rendering: auto;
}

.frame-pick-time {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

.field-inline {
  margin: 0;
}

.field-inline input {
  width: 120px;
}

.actions-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: flex-start;
}

.inline-form {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  margin: 0;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.badge-ready {
  color: var(--success-text);
}
.badge-failed {
  color: var(--danger-text);
}
.badge-pending {
  color: var(--text-muted);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.chip {
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.chip.active {
  border-color: var(--primary);
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
}

.chip-custom-preset {
  border-color: #16a34a;
  color: #15803d;
  background: #f0fdf4;
}

.chip-custom-preset:hover,
.chip-custom-preset.active {
  border-color: #15803d;
  color: #14532d;
  background: #dcfce7;
}

[data-theme="dark"] .chip-custom-preset {
  border-color: #4ade80;
  color: #86efac;
  background: rgba(34, 197, 94, 0.16);
}

[data-theme="dark"] .chip-custom-preset:hover,
[data-theme="dark"] .chip-custom-preset.active {
  border-color: #86efac;
  color: #bbf7d0;
  background: rgba(34, 197, 94, 0.28);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

/* 项目列表 — 文件夹图标网格（资源管理器风格） */
.project-folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
  gap: 12px;
  padding: 4px 0 8px;
  justify-items: center;
}

.project-folder {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 168px;
  min-width: 0;
  padding: 8px 10px 12px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.project-folder:hover,
.project-folder:focus-within {
  background: var(--surface-2);
  border-color: var(--border);
  box-shadow: var(--shadow);
}

.project-folder-visual {
  position: relative;
  width: 72px;
  height: 66px;
  flex-shrink: 0;
  margin: 0 auto;
}

.project-folder-open {
  display: block;
  text-decoration: none;
  color: inherit;
  outline: none;
  border-radius: 6px;
}

.project-folder-open:focus-visible {
  box-shadow: 0 0 0 2px var(--primary);
}

.project-folder-delete-form {
  position: absolute;
  top: 0;
  right: -6px;
  margin: 0;
  z-index: 2;
}

.project-folder-delete-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: var(--danger);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.15s, transform 0.15s;
}

.project-folder:hover .project-folder-delete-btn,
.project-folder:focus-within .project-folder-delete-btn,
.project-folder-delete-btn:focus-visible {
  opacity: 0.95;
  transform: scale(1);
}

.project-folder-delete-btn:hover {
  opacity: 1;
  filter: brightness(1.06);
}

.icon-trash {
  display: block;
  width: 14px;
  height: 14px;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M3 6h18'/%3E%3Cpath d='M8 6V4h8v2'/%3E%3Cpath d='M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6'/%3E%3Cpath d='M10 11v6'/%3E%3Cpath d='M14 11v6'/%3E%3C/svg%3E") center / contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M3 6h18'/%3E%3Cpath d='M8 6V4h8v2'/%3E%3Cpath d='M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6'/%3E%3Cpath d='M10 11v6'/%3E%3Cpath d='M14 11v6'/%3E%3C/svg%3E") center / contain no-repeat;
}

.project-folder-label-row {
  display: flex;
  justify-content: center;
  margin-top: 10px;
  width: 100%;
  min-width: 0;
}

.project-folder-name-wrap {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  max-width: 100%;
  min-width: 0;
}

.project-folder-name {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  word-break: break-word;
  text-align: center;
  color: var(--text);
  text-decoration: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-width: 0;
}

.project-folder-name:hover {
  color: var(--primary);
  text-decoration: underline;
}

.project-folder-label-row .rename-project-btn {
  flex-shrink: 0;
}

.project-folder-create-trigger {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  border-radius: 6px;
  outline: none;
}

.project-folder-create-trigger:focus-visible {
  box-shadow: 0 0 0 2px var(--primary);
}

.project-folder-create-label {
  margin-top: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.project-folder-create:hover .project-folder-create-label,
.project-folder-create-trigger:hover .project-folder-create-label {
  color: var(--primary);
}

.project-folder-icon-new {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 72px;
  height: 58px;
  margin-top: 8px;
  position: relative;
  background: var(--surface);
  border: 2px dashed var(--border);
  border-radius: 6px 10px 8px 8px;
  box-shadow: none;
  color: var(--text-muted);
}

.project-folder-icon-new::before {
  content: "";
  position: absolute;
  left: -2px;
  top: -9px;
  width: 34px;
  height: 12px;
  box-sizing: border-box;
  border-radius: 5px 5px 0 0;
  background: var(--surface);
  border: 2px dashed var(--border);
  border-bottom: none;
}

.project-folder-new-plus {
  position: relative;
  z-index: 1;
  font-size: 1.75rem;
  font-weight: 300;
  line-height: 1;
  color: var(--text-muted);
}

.project-folder-create:hover .project-folder-icon-new,
.project-folder-create:hover .project-folder-icon-new::before {
  border-color: var(--primary);
}

.project-folder-create:hover .project-folder-new-plus {
  color: var(--primary);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.project-folder-icon {
  display: block;
  width: 72px;
  height: 58px;
  flex-shrink: 0;
  margin-top: 8px;
  background: linear-gradient(165deg, #93c5fd 0%, #3b82f6 42%, #2563eb 100%);
  border-radius: 6px 10px 8px 8px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 3px 8px rgba(37, 99, 235, 0.28);
  position: relative;
}

.project-folder-icon::before {
  content: "";
  position: absolute;
  left: 0;
  top: -7px;
  width: 34px;
  height: 12px;
  border-radius: 5px 5px 0 0;
  background: linear-gradient(180deg, #bfdbfe 0%, #60a5fa 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

[data-theme="dark"] .project-folder-icon {
  background: linear-gradient(165deg, #60a5fa 0%, #2563eb 45%, #1d4ed8 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 4px 12px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .project-folder-icon::before {
  background: linear-gradient(180deg, #93c5fd 0%, #3b82f6 100%);
}

.project-folder-meta {
  margin: 4px 0 0;
  font-size: 11px;
  line-height: 1.3;
  text-align: center;
}

.card-add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 24px 12px;
  font: inherit;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.card-add:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--surface-2);
}
.card-add-icon {
  font-size: 2.5rem;
  line-height: 1;
  font-weight: 300;
}
.card-add-label {
  margin-top: 8px;
  font-size: 13px;
}

.panel-hint {
  margin: 12px 0 0;
}

.card-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.card-title-row .card-title {
  margin: 0;
}

.card-title-with-edit {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
}
.icon-btn:hover {
  color: var(--primary);
  background: var(--surface);
}

.icon-pen {
  display: block;
  width: 14px;
  height: 14px;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M12 20h9'/%3E%3Cpath d='M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z'/%3E%3C/svg%3E") center / contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M12 20h9'/%3E%3Cpath d='M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.panel-toolbar-end {
  justify-content: flex-end;
}

.modal-sm {
  max-width: 400px;
}

.modal-lg {
  max-width: 560px;
}

.modal-hint {
  margin: 0 0 12px;
  font-size: 13px;
}

.modal-body textarea {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  line-height: 1.45;
  resize: vertical;
  min-height: 100px;
  width: 100%;
}
.group-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
}

.card-media-wrap {
  position: relative;
  display: block;
  line-height: 0;
}

.card-media-wrap:not(:has(img)) {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  line-height: normal;
}

.card-media-size-badge {
  position: absolute;
  right: 6px;
  bottom: 6px;
  z-index: 2;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
  color: #f8fafc;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.35);
  pointer-events: none;
  user-select: none;
}

.card-media-wrap.alpha-checker-bg {
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #c6c6c6 25%, transparent 25%),
    linear-gradient(-45deg, #c6c6c6 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #c6c6c6 75%),
    linear-gradient(-45deg, transparent 75%, #c6c6c6 75%);
  background-size: 14px 14px;
  background-position: 0 0, 0 7px, 7px -7px, -7px 0;
}

.card-media {
  display: block;
}

a.card-media-link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.character-ref-compare .image-preview-warning {
  margin: 0 0 14px;
}

.character-ref-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.character-ref-head .panel-title {
  margin: 0;
}

.character-ref-compare .image-preview-compare {
  align-items: start;
  justify-content: start;
  grid-template-columns: repeat(2, max-content);
}

.character-ref-compare .image-preview-pane {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 0;
}

.character-ref-compare .image-preview-frame {
  flex: none;
  width: fit-content;
  max-width: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  display: block;
  background: transparent;
  overflow: hidden;
}

.character-ref-compare .image-preview-stage {
  width: fit-content;
  max-width: 399px;
  height: auto;
  min-height: 0;
  display: block;
  box-sizing: border-box;
  overflow: hidden;
}

.character-ref-compare .image-preview-stage-solid {
  background: var(--surface-2);
}

.character-ref-compare .image-preview-stage.alpha-checker-bg {
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #c6c6c6 25%, transparent 25%),
    linear-gradient(-45deg, #c6c6c6 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #c6c6c6 75%),
    linear-gradient(-45deg, transparent 75%, #c6c6c6 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

.character-ref-compare .image-preview-stage img {
  display: block;
  width: auto;
  height: auto;
  max-width: 399px;
  max-height: 399px;
  object-fit: fill;
}

.card-media-preview {
  border: none;
  padding: 0;
  margin: 0;
  width: 100%;
  flex: 1 1 auto;
  cursor: zoom-in;
  background: transparent;
  font: inherit;
  color: inherit;
  text-align: inherit;
  position: relative;
  z-index: 0;
  outline: none;
  box-shadow: none;
  -webkit-tap-highlight-color: transparent;
}

.card-media-preview:focus,
.card-media-preview:focus-visible {
  outline: none;
  box-shadow: none;
}

body.has-modal-open .card-media-preview {
  z-index: 0;
  outline: none !important;
  box-shadow: none !important;
}

#character-image-preview-overlay {
  z-index: 20000;
  padding: 10px;
}

#character-image-preview-overlay .modal.modal-image-preview {
  /* 覆盖通用 .modal 的 max-width: 520px；约为原先全屏预览的 2/3 */
  width: min(65vw, 1120px);
  max-width: min(65vw, 1120px);
  max-height: 65vh;
}

.modal-image-preview {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#character-image-preview-overlay .image-preview-compare-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  max-height: calc(65vh - 56px);
  padding: 12px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.image-preview-warning {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-muted);
}

.image-preview-compare {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
}

@media (max-width: 720px) {
  .image-preview-compare {
    grid-template-columns: 1fr;
  }
}

.image-preview-pane {
  margin: 0;
  min-width: 0;
}

.image-preview-pane figcaption {
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
}

.image-preview-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.image-preview-frame-solid {
  background: var(--surface-2);
}

.image-preview-frame img {
  display: block;
  max-width: 100%;
  max-height: min(52vh, 480px);
  width: auto;
  height: auto;
  object-fit: contain;
  border: none;
  outline: none;
  box-shadow: none;
}

#character-image-preview-overlay .image-preview-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* 外框：仅统一边框；背景与居中在 .image-preview-stage */
#character-image-preview-overlay .image-preview-frame {
  flex: 1 1 auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  background: transparent;
  overflow: hidden;
}

#character-image-preview-overlay .image-preview-stage {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  overflow: hidden;
}

#character-image-preview-overlay .image-preview-stage-solid {
  background: var(--surface-2);
}

#character-image-preview-overlay .image-preview-stage.alpha-checker-bg {
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #c6c6c6 25%, transparent 25%),
    linear-gradient(-45deg, #c6c6c6 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #c6c6c6 75%),
    linear-gradient(-45deg, transparent 75%, #c6c6c6 75%);
  background-size: 14px 14px;
  background-position: 0 0, 0 7px, 7px -7px, -7px 0;
}

#character-image-preview-overlay .image-preview-stage img {
  display: block;
  flex: 0 1 auto;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  margin: 0;
  border: none;
  outline: none;
  box-shadow: none;
  background: transparent;
}

#character-image-preview-overlay .image-preview-body > img[hidden] {
  display: none !important;
}

.card-media-crop {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  height: 160px;
}

.card-media-crop-inner {
  display: block;
  overflow: hidden;
  flex-shrink: 0;
  line-height: 0;
}

.card-media-crop-inner img {
  display: block;
  border: none;
  outline: none;
}

.card-media:not(.card-media-crop),
.card-media-static {
  display: block;
  width: 100%;
  height: auto;
  min-width: 0;
}

.card-media:not(.card-media-crop) img,
.card-media-static .frame-preview {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: none;
  margin: 0;
  object-fit: fill;
  background: transparent;
  pointer-events: none;
  border: none;
  border-radius: 0;
  outline: none;
  box-shadow: none;
}

.card-media-wrap.alpha-checker-bg > .card-media,
.card-media-wrap.alpha-checker-bg > .card-media-static,
.card-media-wrap.alpha-checker-bg .card-media-crop {
  background: none;
}

.card-media-empty {
  font-size: 13px;
  padding: 16px;
}

.card-meta {
  margin: 0 0 8px;
  font-size: 12px;
}

.card-order-switch {
  position: relative;
  margin: 0 0 8px;
}

.card-order-switch summary {
  list-style: none;
  cursor: pointer;
  width: fit-content;
  margin: 0;
}

.card-order-switch summary::-webkit-details-marker {
  display: none;
}

.card-order-switch summary::after {
  content: " ▾";
}

.card-order-menu {
  position: absolute;
  z-index: 6;
  left: 0;
  top: calc(100% + 4px);
  min-width: 168px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.card-order-pick,
.card-order-current {
  display: block;
  width: 100%;
  margin: 0;
  padding: 6px 8px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: left;
}

.card-order-pick {
  cursor: pointer;
}

.card-order-pick:hover {
  background: var(--surface-2);
}

.card-order-current {
  color: var(--text-muted);
}

.card-error {
  margin: 0 0 8px;
}

.keyword-details-card {
  width: 100%;
}
.keyword-details-card .keyword-pre {
  max-width: none;
  margin-top: 8px;
}

.group-badge.badge-status.badge-ready {
  color: var(--success-text);
}
.group-badge.badge-status.badge-pending {
  color: var(--muted);
}
.group-badge.badge-status.badge-failed {
  color: var(--danger-text);
}

.card-delete-x:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.card-delete-form {
  position: absolute;
  top: 8px;
  right: 8px;
  margin: 0;
  z-index: 2;
}

.card-delete-x {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: var(--danger);
  color: #fff;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  opacity: 0.92;
}
.card-delete-x:hover {
  opacity: 1;
  filter: brightness(1.05);
}

.card-body {
  padding: 12px;
}

.card-title {
  margin: 0 0 8px;
  font-size: 14px;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.keyword-details summary {
  list-style: none;
  cursor: pointer;
}
.keyword-pre {
  max-width: 420px;
  max-height: 200px;
  overflow: auto;
  font-size: 11px;
  padding: 10px;
  background: var(--surface-2);
  border-radius: 6px;
  border: 1px solid var(--border);
  white-space: pre-wrap;
  word-break: break-word;
}

.export-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 960px) {
  .export-layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
  }
}

.base-preview {
  display: inline-block;
  max-width: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.base-preview.alpha-checker-bg {
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #c6c6c6 25%, transparent 25%),
    linear-gradient(-45deg, #c6c6c6 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #c6c6c6 75%),
    linear-gradient(-45deg, transparent 75%, #c6c6c6 75%);
  background-size: 14px 14px;
  background-position: 0 0, 0 7px, 7px -7px, -7px 0;
}

.base-preview img {
  display: block;
  max-width: 100%;
  max-height: 280px;
  object-fit: contain;
  background: transparent;
}

.export-action-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.check-row-inline {
  display: inline-flex;
  margin: 0 8px 0 0;
  vertical-align: middle;
}

.deleted-archive-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  white-space: nowrap;
}

.deleted-archive-actions .inline-form {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.deleted-purge-form {
  flex-wrap: wrap;
}

.crop-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.sheet-preview {
  max-width: 100%;
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  image-rendering: pixelated;
}

.export-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.manifest-details pre {
  font-size: 11px;
  overflow: auto;
  max-height: 240px;
  padding: 10px;
  background: var(--surface-2);
  border-radius: 6px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 17, 23, 0.45);
}
.modal-overlay[hidden] {
  display: none !important;
}

body.has-modal-open {
  overflow: hidden;
}

.modal {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  max-width: 520px;
  width: 100%;
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
}

.modal-form {
  overflow: visible;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 {
  margin: 0;
  font-size: 1rem;
}
.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: visible;
}

.field .req {
  color: var(--danger);
}

.upload-input-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.upload-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 168px;
  padding: 20px 16px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}
.upload-dropzone:hover {
  border-color: var(--primary);
  background: var(--surface);
}
.upload-dropzone-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}
.upload-dropzone-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  position: relative;
}
.upload-dropzone-icon::before,
.upload-dropzone-icon::after {
  content: "";
  position: absolute;
  background: var(--text-muted);
  border-radius: 1px;
}
.upload-dropzone-icon::before {
  width: 20px;
  height: 2px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.upload-dropzone-icon::after {
  width: 2px;
  height: 20px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.upload-dropzone-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}
.upload-dropzone-hint {
  font-size: 12px;
  color: var(--text-muted);
}
.upload-dropzone-preview {
  max-width: 100%;
  max-height: 200px;
  object-fit: contain;
  border-radius: 6px;
  image-rendering: pixelated;
}
.upload-dropzone-change {
  margin-top: 8px;
  font-size: 12px;
  color: var(--primary);
}
.upload-dropzone.has-preview .upload-dropzone-placeholder {
  display: none;
}
.upload-dropzone.has-preview .upload-dropzone-preview,
.upload-limit-hint {
  margin: 0 0 8px;
  font-size: 12px;
}

.image-preset-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.image-preset-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-right: 4px;
}

.image-preset-chip.active {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
  color: var(--primary);
}

.upload-dimensions {
  margin: 8px 0 0;
  font-size: 13px;
}

.upload-dimensions-err {
  margin: 6px 0 0;
}

.upload-dropzone.has-preview .upload-dropzone-change {
  display: block;
}
.upload-dropzone-compact {
  min-height: 120px;
  padding: 10px;
}
.upload-dropzone-compact .upload-dropzone-title {
  font-size: 0.85rem;
}
#char-direction-uploads.direction-upload-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}
#char-direction-uploads .direction-slot-upload {
  min-width: 0;
}
#char-direction-uploads .upload-dropzone-tile {
  min-height: 72px;
  padding: 6px 4px;
  border-width: 1px;
  border-style: dashed;
}
#char-direction-uploads .upload-dropzone-tile .upload-dropzone-icon {
  display: none;
}
#char-direction-uploads .upload-dropzone-tile .upload-dropzone-placeholder {
  gap: 2px;
}
#char-direction-uploads .upload-dropzone-tile .upload-dropzone-title {
  font-size: 12px;
  font-weight: 600;
}
#char-direction-uploads .upload-dropzone-tile .upload-dropzone-hint {
  font-size: 10px;
  line-height: 1.2;
}
#char-direction-uploads .upload-dropzone-tile .upload-dropzone-preview {
  max-height: 56px;
  max-width: 100%;
}
#char-direction-uploads .upload-dropzone-tile .upload-dropzone-change {
  margin-top: 2px;
  font-size: 10px;
}
#char-direction-uploads .direction-slot-dims,
#char-direction-uploads .direction-slot-err {
  margin: 2px 0 0;
  font-size: 10px;
  line-height: 1.2;
  text-align: center;
  word-break: break-all;
}
.character-type-inline .field-label {
  margin-bottom: 6px;
}
.character-type-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 8px;
}
.character-type-chip {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  background: var(--surface);
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.25;
}
.character-type-chip:has(input:checked) {
  border-color: var(--primary, #3b82f6);
  color: var(--primary, #3b82f6);
  box-shadow: 0 0 0 1px var(--primary, #3b82f6);
}
.character-type-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
#char-type-upload-hint {
  margin: 6px 0 0;
}
.direction-upload-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.card-meta {
  margin: 4px 0 8px;
}
.action-custom-fields textarea {
  width: 100%;
  min-height: 88px;
  resize: vertical;
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}
.is-hidden {
  display: none !important;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border);
}
.modal-close {
  font-size: 1.25rem;
  line-height: 1;
  padding: 4px 10px;
}

.group-select {
  position: relative;
}
.group-select-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.group-select-panel {
  position: fixed;
  z-index: 9500;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  max-height: min(280px, calc(100vh - 16px));
  display: flex;
  flex-direction: column;
}
.group-select-panel[hidden] {
  display: none !important;
}
.group-select-list {
  list-style: none;
  margin: 0;
  padding: 4px 0;
  flex: 1;
  min-height: 0;
  max-height: 220px;
  overflow-y: auto;
}
.group-select-list li {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 4px 0 0;
}
.group-option {
  flex: 1;
  text-align: left;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  border-radius: 4px;
}
.group-option:hover {
  background: var(--surface-2);
}
.group-delete-btn {
  border: none;
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 4px;
}
.group-delete-btn:hover {
  background: var(--danger-bg);
}
.group-add-bar {
  display: flex;
  gap: 8px;
  padding: 8px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.group-add-input {
  flex: 1;
  min-width: 0;
}

[data-theme="light"] .theme-icon-dark,
[data-theme="dark"] .theme-icon-light {
  display: none;
}

.theme-icon {
  font-size: 1rem;
  line-height: 1;
}

.topbar-theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  padding-left: 8px;
  padding-right: 8px;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

.topbar-user {
  font-size: 13px;
  margin-right: 4px;
}

.badge-ok {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--success-bg);
  color: var(--success-text);
}

.topbar-membership {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
  font-size: 12px;
  margin-right: 8px;
}
.topbar-membership:hover {
  border-color: var(--primary);
  color: var(--text);
}
.topbar-member-level {
  font-weight: 700;
  color: var(--primary);
}
.topbar-member-points {
  color: var(--text-muted);
}

.membership-hero-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 20px;
  align-items: stretch;
}
.membership-kicker {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.membership-level {
  margin: 0 0 8px;
  font-size: 1.6rem;
}
.membership-xp {
  margin: 0 0 12px;
}
.membership-progress {
  height: 8px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}
.membership-progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #8b5cf6);
}
.membership-balance-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  background: color-mix(in srgb, var(--primary) 6%, var(--surface));
}
.membership-points {
  margin: 0;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.1;
}
.membership-cost {
  margin: 8px 0 0;
  font-size: 13px;
}
.membership-storage {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.membership-storage-figure {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.membership-storage .muted {
  margin: 0 0 12px;
}
.membership-packages {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.membership-package-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 16px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.membership-package-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
}
.membership-package-card h3 {
  margin: 0;
  font-size: 1rem;
}
.membership-package-points {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
}
.membership-package-xp,
.membership-package-usage {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}
.membership-package-price {
  margin: 4px 0 10px;
  font-weight: 700;
}
.data-table tr.is-current-level td {
  font-weight: 600;
  background: color-mix(in srgb, var(--primary) 8%, transparent);
}
.text-ok {
  color: var(--success-text);
  font-weight: 600;
}
.text-danger {
  color: var(--danger);
  font-weight: 600;
}

@media (max-width: 960px) {
  .membership-hero-grid {
    grid-template-columns: 1fr;
  }
  .membership-packages {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 640px) {
  .membership-packages {
    grid-template-columns: 1fr;
  }
}

.extract-editor-preview-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  max-height: 420px;
  margin-bottom: 12px;
  border-radius: var(--radius);
  background: #0a0a0a;
  overflow: hidden;
}

.extract-editor-preview {
  display: block;
  max-width: 100%;
  max-height: 400px;
  width: auto;
  height: auto;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.extract-editor-time {
  position: absolute;
  right: 12px;
  bottom: 10px;
  padding: 2px 8px;
  font-size: 12px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
}

.extract-timeline {
  position: relative;
  height: 64px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #111;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  overflow: hidden;
}

.extract-timeline-filmstrip {
  display: flex;
  height: 100%;
  width: 100%;
  pointer-events: none;
}

.extract-timeline-filmstrip img {
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  object-fit: cover;
  opacity: 0.85;
}

.extract-timeline-filmstrip.extract-timeline-ends {
  position: relative;
  z-index: 2;
  justify-content: space-between;
  align-items: stretch;
  box-sizing: border-box;
  padding: 4px 8px;
}

.extract-timeline-filmstrip.extract-timeline-ends img {
  flex: 0 0 64px;
  width: 64px;
  height: 100%;
  object-fit: contain;
  opacity: 1;
  background: #111;
}

.extract-timeline-range {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(37, 99, 235, 0.28);
  pointer-events: none;
  z-index: 1;
}

.extract-timeline-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #fff;
  transform: translateX(-1px);
  pointer-events: none;
  z-index: 2;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
}

.extract-timeline-playhead::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-bottom-color: #fff;
}

.extract-timeline-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 18px;
  transform: translateX(-50%);
  cursor: ew-resize;
  pointer-events: auto;
  z-index: 4;
  touch-action: none;
}

.extract-timeline-handle::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 10px;
  border-radius: 2px 2px 0 0;
}

.extract-timeline-handle::after {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  border-radius: 1px;
}

.extract-timeline-handle-start::before,
.extract-timeline-handle-start::after {
  background: #22c55e;
}

.extract-timeline-handle-end::before,
.extract-timeline-handle-end::after {
  background: #f97316;
}

.extract-editor-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-bottom: 12px;
  font-size: 13px;
}

.task-frame-preview {
  max-width: 100%;
}

.task-frame-hero-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  max-height: 360px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #0a0a0a;
}

.task-frame-hero {
  display: block;
  max-width: 100%;
  max-height: 320px;
  width: auto;
  height: auto;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.task-frame-strip {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  align-items: center;
  overflow-x: auto;
  padding-bottom: 4px;
}

.task-frame-thumb {
  display: block;
  padding: 4px;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  cursor: pointer;
  line-height: 0;
}

.task-frame-thumb.is-active {
  border-color: var(--primary);
}

.task-frame-thumb img {
  display: block;
  width: 128px;
  height: 128px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.action-detail-stage {
  position: relative;
}

.action-detail-stage.is-loading > section {
  visibility: hidden;
  position: absolute;
  left: 0;
  right: 0;
  overflow: hidden;
  pointer-events: none;
}

.frame-asset-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 148px);
  margin-bottom: 16px;
  padding: 32px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 50% 0%, rgba(37, 99, 235, 0.18), transparent 55%),
    #0b1220;
  color: #e8eefc;
}

.frame-asset-loader[hidden] {
  display: none;
}

.frame-asset-loader-card {
  width: min(440px, 100%);
}

.frame-asset-loader-title {
  margin: 0 0 16px;
  font-size: 18px;
  letter-spacing: 0.08em;
  text-align: center;
}

.frame-asset-loader-track {
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.frame-asset-loader-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1d4ed8, #22d3ee);
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.45);
  transition: width 0.12s linear;
}

.frame-asset-loader-label {
  margin: 12px 0 0;
  text-align: center;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: rgba(232, 238, 252, 0.82);
}

.action-detail-frames .task-frame-hero-wrap {
  position: relative;
}

.action-detail-frames .task-frame-strip {
  gap: 6px;
}

.action-detail-frames .task-frame-thumb {
  padding: 2px;
  background: #000;
}

.action-detail-frames .task-frame-thumb img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  background: #000;
}

.frame-transport {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.frame-transport .btn.is-on {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.frame-count-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 13px;
}

.frame-count-field[hidden] {
  display: none;
}

.frame-count-field input {
  width: 72px;
}
