:root {
  --primary: #0055ff;
  --primary-hover: #0044cc;
  --bg: #ffffff;
  --bg-page: #f0f0f0;
  --surface: #f7f7f7;
  --border: #e1e1e1;
  --border-strong: #b0b0b0;
  --text: #111111;
  --text-secondary: #555555;
  --text-tertiary: #999999;
  --topbar-height: 58px;
  --danger: #dc2626;
  --radius: 10px;
  --radius-sm: 8px;
  --border-w: 1px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

html,
body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
}

.topbar {
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  height: var(--topbar-height);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 22px;
  z-index: 100;
}

.topbar-brand {
  display: inline-flex;
  align-items: center;
  color: var(--text);
  text-decoration: none;
  min-width: 160px;
  margin-right: 40px;
}

.topbar-brand-img {
  display: block;
  width: auto;
  height: 32px;
  object-fit: contain;
}

.topbar-logo {
  width: 30px;
  height: 30px;
  background: var(--tint-soft);
  color: var(--primary);
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--tint-line);
  border-radius: 8px;
}

.topbar-nav {
  display: flex;
  align-items: center;
  align-self: stretch;
  gap: 22px;
  flex: 1;
}

.topbar-link {
  height: 100%;
  padding: 0 2px;
  display: flex;
  align-items: center;
  gap: 7px;
  justify-content: center;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  position: relative;
  transition: color 0.15s;
}

.topbar-link i {
  font-size: 17px;
  color: var(--text-tertiary);
  transition: color 0.15s;
}

.topbar-link.active {
  color: var(--primary);
}

.topbar-link.active i {
  color: var(--primary);
}

.topbar-link.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--primary);
  border-radius: 2px 2px 0 0;
}

.topbar-link:hover {
  color: var(--text);
}

.topbar-link:hover i {
  color: var(--text);
}

.topbar-account {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-icon-btn {
  position: relative;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.topbar-icon-btn:hover {
  color: var(--primary);
  background: var(--tint-soft);
}

.topbar-icon-btn i {
  font-size: 18px;
}

.topbar-divider {
  width: 1px;
  height: 22px;
  background: var(--border);
  display: inline-block;
}

.topbar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  padding: 0;
  background: var(--bg);
  cursor: pointer;
  border: 1px solid var(--border);
  overflow: hidden;
}

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

.avatar-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--bg);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  min-width: 160px;
  display: none;
  z-index: 200;
}

.avatar-menu.show {
  display: block;
}

.avatar-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: background 0.12s;
}

.avatar-menu a:hover {
  background: var(--surface);
}

.avatar-menu a i {
  font-size: 18px;
  color: var(--text-secondary);
}

.main-content {
  padding-top: var(--topbar-height);
  height: 100vh;
  overflow: hidden;
}

.page-create {
  display: grid;
  grid-template-columns: 320px 1fr 240px;
  height: calc(100vh - var(--topbar-height));
}

.panel-form {
  overflow: hidden;
  border-right: var(--border-w) solid var(--border);
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.panel-form-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px 12px 20px;
}

.panel-form-fixed {
  padding: 16px 20px 20px 20px;
  border-top: var(--border-w) solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}

.panel-center {
  padding: 24px;
  overflow-y: auto;
  background: var(--bg-page);
}

.panel-history {
  padding: 16px 12px;
  overflow-y: auto;
  border-left: var(--border-w) solid var(--border);
  background: var(--bg);
}

.panel-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 20px;
  letter-spacing: -0.3px;
}

.section {
  margin-bottom: 24px;
}

.section-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.upload-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.upload-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: var(--border-w) solid var(--border);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.upload-item:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 122, 95, 0.08);
}

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

.upload-item .remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
}

.upload-item:hover .remove-btn {
  opacity: 1;
}

.upload-item.selected {
  outline: 3px solid var(--primary);
  outline-offset: -3px;
}

.library-delete-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 7px;
  background: rgba(28, 23, 20, 0.72);
  color: #fff;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
}

.library-delete-btn i {
  font-size: 15px;
}

.library-item:hover .library-delete-btn {
  opacity: 1;
}

.library-delete-btn:hover {
  background: var(--danger);
}

.upload-add {
  aspect-ratio: 1;
  border: var(--border-w) dashed var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-tertiary);
  font-size: 20px;
  transition: border-color 0.15s, color 0.15s;
}

.upload-add:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.upload-add input[type="file"] {
  display: none;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

textarea.form-input {
  width: 100%;
  min-height: 80px;
  padding: 10px 12px;
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  resize: vertical;
  outline: none;
  background: var(--bg);
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

textarea.form-input:hover {
  border-color: var(--border-strong);
  background: var(--tint-paper);
}

textarea.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 122, 95, 0.08);
}

textarea.form-input::placeholder {
  color: var(--text-tertiary);
}

/* Custom Slider */
input[type=range] {
  -webkit-appearance: none;
  width: 100%;
  background: transparent;
  margin: 6px 0;
}

input[type=range]:focus {
  outline: none;
}

input[type=range]::-webkit-slider-runnable-track {
  width: 100%;
  height: 6px;
  cursor: pointer;
  background: var(--border);
  border-radius: 4px;
}

input[type=range]::-webkit-slider-thumb {
  height: 16px;
  width: 16px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  -webkit-appearance: none;
  margin-top: -5px;
  box-shadow: 0 0 0 2px var(--bg);
  transition: transform 0.1s;
}

input[type=range]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

input[type=range]::-moz-range-track {
  width: 100%;
  height: 6px;
  cursor: pointer;
  background: var(--border);
  border-radius: 4px;
}

input[type=range]::-moz-range-thumb {
  height: 16px;
  width: 16px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: none;
  box-shadow: 0 0 0 2px var(--bg);
  transition: transform 0.1s;
}

input[type=range]::-moz-range-thumb:hover {
  transform: scale(1.15);
}

.settings-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.settings-row.cols-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

select.form-select {
  width: 100%;
  padding: 9px 12px;
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

select.form-select:hover {
  border-color: var(--border-strong);
  background-color: var(--tint-paper);
}

select.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 122, 95, 0.08);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border: var(--border-w) solid transparent;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
  letter-spacing: -0.2px;
}

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

.btn-primary {
  background: var(--primary);
  color: #fff;
  width: 100%;
}

.btn-primary:hover:not(:disabled) {
  opacity: 0.88;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: transparent;
}

.btn-secondary:hover:not(:disabled) {
  background: var(--tint-soft-2);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  opacity: 0.88;
}

.btn-text {
  background: none;
  border: none;
  color: var(--primary);
  padding: 4px 8px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
}

.btn-text:hover {
  opacity: 0.8;
}

.btn-sm {
  padding: 7px 14px;
  font-size: 12px;
}

.video-result {
  background: var(--bg);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(220px, 1fr);
}

.video-result-player {
  width: 100%;
  aspect-ratio: 16/9;
  background: #1C1714;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.video-result-media {
  min-width: 0;
  background: #1C1714;
}

.video-result-player video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.video-result-player .placeholder-icon {
  color: #444;
  font-size: 48px;
}

.video-result-details {
  padding: 16px;
}

.video-result-side {
  min-width: 0;
  border-left: var(--border-w) solid var(--border);
}

.video-result-prompt {
  font-size: 13px;
  color: var(--text);
  line-height: 1.45;
  margin-bottom: 14px;
}

.video-result-prompt-text {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-result-prompt.expanded .video-result-prompt-text {
  display: block;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
}

.prompt-more-btn {
  margin-top: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.prompt-more-btn:hover {
  color: var(--primary-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.video-result-params {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

.param-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.param-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.param-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.video-result-actions {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: var(--border-w) solid var(--border);
}

.preview-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-tertiary);
  gap: 12px;
}

.preview-empty i {
  font-size: 48px;
}

.preview-empty span {
  font-size: 14px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-top: var(--border-w) solid var(--border);
  font-size: 13px;
  font-weight: 500;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-tertiary);
  flex-shrink: 0;
}

.status-dot.generating {
  background: #f59e0b;
  animation: pulse-dot 1.5s ease-in-out infinite;
}

.status-dot.completed {
  background: #10b981;
}

.status-dot.failed {
  background: var(--danger);
}

@keyframes pulse-dot {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.3;
  }
}

.history-strip-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 12px;
}

.history-strip {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: var(--radius-sm);
  border: var(--border-w) solid var(--border);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  background: #1C1714;
  transition: border-color 0.15s;
}

.history-thumb:hover {
  border-color: var(--primary);
}

.history-thumb.active {
  border-color: var(--primary);
}

.history-thumb video,
.history-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.history-thumb-placeholder {
  width: 100%;
  height: 100%;
  background: #2A2320;
  display: flex;
  align-items: center;
  justify-content: center;
}

.history-thumb-placeholder i {
  font-size: 20px;
  color: #555;
}

.history-thumb .thumb-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 4px 6px;
  background: rgba(0, 0, 0, 0.7);
  font-size: 10px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-thumb .thumb-status {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.history-empty {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-empty-box {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: var(--radius-sm);
  background: var(--bg-page);
  border: var(--border-w) dashed var(--border);
}

.history-empty-box:nth-child(2) {
  opacity: 0.5;
}

.history-empty-box:nth-child(3) {
  opacity: 0.25;
}

.page-history {
  padding: 32px;
  height: calc(100vh - var(--topbar-height));
  overflow-y: auto;
  background: var(--bg-page);
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.search-input {
  width: 280px;
  padding: 9px 12px;
  padding-left: 36px;
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  outline: none;
  background: var(--bg);
  transition: border-color 0.15s;
}

.search-input:focus {
  border-color: var(--primary);
}

.search-wrap {
  position: relative;
}

.search-wrap i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: var(--text-tertiary);
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.video-card {
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
}

.video-thumb {
  aspect-ratio: 16/9;
  background: #1C1714;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.video-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-thumb .play-icon {
  position: absolute;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1C1714;
  font-size: 18px;
}

.video-thumb .status-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.status-badge.generating {
  background: #fef3c7;
  color: #92400e;
}

.status-badge.completed {
  background: #d1fae5;
  color: #065f46;
}

.status-badge.failed {
  background: #fee2e2;
  color: #991b1b;
}

.status-badge.pending {
  background: var(--surface);
  color: var(--text-secondary);
}

.video-info {
  padding: 14px;
}

.video-prompt {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 10px;
}

.video-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.video-date {
  font-size: 12px;
  color: var(--text-tertiary);
}

.video-badges {
  display: flex;
  gap: 4px;
}

.badge {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: var(--surface);
  color: var(--text-secondary);
  border: var(--border-w) solid var(--border);
}

.video-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px 14px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--topbar-height) - 120px);
  color: var(--text-tertiary);
  gap: 12px;
}

.empty-state i {
  font-size: 48px;
}

.empty-state span {
  font-size: 14px;
}

.page-settings {
  padding: 32px;
  height: calc(100vh - var(--topbar-height));
  overflow-y: auto;
  background: var(--bg-page);
}

.settings-container {
  max-width: 560px;
  background: var(--bg);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}

.settings-section {
  margin-bottom: 28px;
}

.settings-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  padding-bottom: 12px;
  border-bottom: var(--border-w) solid var(--border);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input.form-input {
  width: 100%;
  padding: 9px 12px;
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  outline: none;
  background: var(--bg);
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

input.form-input:hover {
  border-color: var(--border-strong);
  background: var(--tint-paper);
}

input.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 122, 95, 0.08);
}

input.form-input::placeholder {
  color: var(--text-tertiary);
}

.input-with-action {
  position: relative;
}

.input-with-action input {
  padding-right: 60px;
}

.input-with-action .input-action {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-family: inherit;
  font-size: 12px;
  color: var(--primary);
  cursor: pointer;
  font-weight: 600;
}

.form-hint {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 6px;
}

.form-hint a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

.form-hint a:hover {
  text-decoration: underline;
}

.settings-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  border: var(--border-w) solid transparent;
}

.toast.show {
  opacity: 1;
}

.toast.success {
  background: #065f46;
  color: #fff;
}

.toast.error {
  background: var(--danger);
  color: #fff;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-overlay.show {
  display: flex;
}

.modal {
  background: var(--bg);
  border-radius: var(--radius);
  border: var(--border-w) solid var(--border);
  padding: 24px;
  width: 100%;
  max-width: 400px;
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.modal-text {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.spinner.dark {
  border-color: rgba(0, 0, 0, 0.1);
  border-top-color: var(--text-secondary);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.library-toggle {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
}

.library-toggle button {
  padding: 5px 12px;
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.library-toggle button:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--tint-paper);
}

.library-toggle button.active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--tint-soft);
}

.library-switch {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--primary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: color 0.15s;
}

.library-switch:hover {
  color: var(--primary-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.library-switch:focus {
  outline: none;
}

.library-switch:focus-visible {
  color: var(--primary-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.library-controls {
  margin-bottom: 10px;
}

.library-search-wrap {
  position: relative;
}

.library-search-wrap i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 15px;
}

.library-search {
  width: 100%;
  height: 36px;
  padding: 0 10px 0 32px;
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
}

.library-search:focus {
  border-color: var(--primary);
}

.library-empty,
.library-load-more-wrap {
  grid-column: 1 / -1;
}

.library-empty {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: var(--border-w) dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 600;
}

.library-load-more {
  width: 100%;
  height: 34px;
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.library-load-more:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--tint-soft);
}

.model-select-wrap {
  position: relative;
  margin-bottom: 20px;
}

.model-selector {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s;
}

.model-selector:hover,
.model-select-wrap.open .model-selector {
  border-color: var(--primary);
}

.model-selector-icon {
  width: 32px;
  height: 32px;
  background: #202124;
  border: 0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--primary);
  flex-shrink: 0;
}

.model-selector-icon img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: block;
}

.model-option img {
  width: 32px;
  height: 32px;
  padding: 5px;
  object-fit: contain;
  display: block;
  background: #202124;
  border-radius: 8px;
  flex: 0 0 auto;
}

.model-selector-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.model-selector-name {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

.model-selector-desc {
  display: block;
  font-size: 11px;
  color: var(--text-tertiary);
  line-height: 1.2;
}

.model-selector-arrow {
  color: var(--text-tertiary);
  font-size: 16px;
  transition: transform 0.15s;
}

.model-select-wrap.open .model-selector-arrow {
  transform: rotate(90deg);
}

.model-options {
  position: absolute;
  z-index: 50;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  display: none;
  padding: 6px;
  background: var(--bg);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 30px rgba(28, 23, 20, 0.12);
}

.model-select-wrap.open .model-options {
  display: block;
}

.model-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.model-option:hover,
.model-option.active {
  background: var(--tint-soft);
}

.model-option span {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.model-option strong {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
}

.model-option small {
  color: var(--text-tertiary);
  font-size: 11px;
  line-height: 1.25;
}

.model-option .ti-check {
  opacity: 0;
  color: var(--primary);
  font-size: 16px;
}

.model-option.active .ti-check {
  opacity: 1;
}

.divider {
  height: var(--border-w);
  background: var(--border);
  margin: 20px 0;
}

/* Seedance UGC studio */
.seedance-studio.page-create {
  grid-template-columns: 440px minmax(460px, 1fr) 260px;
}

.ugc-workspace .panel-form-scroll {
  padding: 20px 18px 12px;
}

.create-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.create-panel-head p {
  margin-top: -6px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.4;
}

.compact-model-select {
  margin-bottom: 8px;
}

.compact-model-select .model-selector {
  padding: 9px 10px;
}

.compact-model-select .model-selector-icon {
  width: 32px;
  height: 32px;
}

.advanced-step {
  display: block;
}

.advanced-summary {
  min-height: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
  cursor: pointer;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.advanced-summary::-webkit-details-marker {
  display: none;
}

.advanced-summary span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.advanced-summary i {
  font-size: 16px;
  color: var(--text-secondary);
}

.advanced-summary>.ti-chevron-down {
  transition: transform 0.15s;
}

.advanced-step[open] .advanced-summary {
  margin-bottom: 14px;
}

.advanced-step[open] .advanced-summary>.ti-chevron-down {
  transform: rotate(180deg);
}

.left-prompt-accordion {
  display: block;
  padding: 0;
  margin-top: 18px;
}

.left-prompt-accordion .prompt-accordion-summary {
  min-height: 42px;
  padding: 0;
}

.left-prompt-accordion[open] .prompt-accordion-summary {
  border-bottom: 0;
}

.left-prompt-accordion .prompt-accordion-body {
  padding: 0 0 2px;
}

.prompt-tools {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.left-prompt-accordion .prompt-preview {
  min-height: 220px;
  max-height: 320px;
}

.preview-stage {
  display: flex;
  flex-direction: column;
  padding: 22px;
}

.preview-stage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.preview-stage-header h1 {
  font-size: 18px;
  letter-spacing: 0;
}

.preview-stage-header span {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
}

.preview-stage .preview-empty {
  flex: 1;
}

.preview-stage #video-results {
  width: 100%;
}

.studio-kicker {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}

.studio-title {
  font-size: 20px;
  margin-bottom: 14px;
  letter-spacing: 0;
}

.studio-subtitle {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 18px;
}

.form-step {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0 0 12px;
  min-height: 22px;
}

.builder-step {
  padding: 18px 0 22px;
  border-bottom: var(--border-w) solid var(--border);
}

.builder-step:first-of-type {
  padding-top: 4px;
}

.builder-step:last-of-type {
  border-bottom: 0;
  padding-bottom: 0;
}

.form-step .section-label {
  margin-bottom: 0;
  line-height: 22px;
  display: flex;
  align-items: center;
}

.step-number {
  width: 22px;
  height: 22px;
  line-height: 22px;
  border-radius: 50%;
  background: var(--text);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.reference-block {
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  background: var(--bg);
  margin-bottom: 12px;
}

.primary-reference {
  border-color: var(--tint-line);
  background: var(--tint-paper);
}

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

.reference-title {
  font-size: 13px;
  font-weight: 700;
}

.reference-accordion {
  margin-bottom: 16px;
}

.reference-accordion summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
  padding: 8px 10px;
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--surface);
}

.reference-accordion summary::-webkit-details-marker {
  display: none;
}

.reference-accordion[open] summary {
  margin-bottom: 12px;
}

.reference-accordion[open] summary i {
  transform: rotate(180deg);
}

.choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.choice-card {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.choice-card i {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border-radius: 7px;
  color: var(--text-secondary);
  font-size: 16px;
  flex-shrink: 0;
}

.choice-card span {
  min-width: 0;
  line-height: 1.25;
}

.choice-card.active,
.choice-card:hover {
  border-color: var(--primary);
  background: var(--tint-soft);
  color: var(--primary);
}

.choice-card.active i,
.choice-card:hover i {
  background: var(--tint-soft-2);
  color: var(--primary);
}

.range-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.range-value {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
}

.director-preview {
  background: var(--bg);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
}

.prompt-accordion {
  padding: 0;
  overflow: visible;
}

.prompt-accordion-summary {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  cursor: pointer;
  list-style: none;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.prompt-accordion-summary::-webkit-details-marker {
  display: none;
}

.prompt-accordion-summary span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.prompt-accordion-summary i {
  color: var(--text-secondary);
  font-size: 17px;
}

.prompt-accordion-summary>.ti-chevron-down {
  transition: transform 0.15s;
}

.prompt-accordion[open] .prompt-accordion-summary {
  border-bottom: var(--border-w) solid var(--border);
}

.prompt-accordion[open] .prompt-accordion-summary>.ti-chevron-down {
  transform: rotate(180deg);
}

.prompt-accordion-body {
  padding: 16px;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}

.preview-header h1 {
  font-size: 19px;
  line-height: 1.2;
  letter-spacing: 0;
}

.prompt-editor-wrap {
  position: relative;
}

.prompt-preview {
  width: 100%;
  min-height: 320px;
  max-height: 420px;
  padding: 10px 12px;
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  line-height: 1.55;
  font-size: 13px;
  color: var(--text);
  background: var(--tint-paper);
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.prompt-editor {
  width: 100%;
  overflow-y: auto;
  white-space: pre-wrap;
  outline: none;
}

.prompt-editor:hover {
  border-color: var(--border-strong);
  background: var(--tint-paper);
}

.prompt-editor:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 122, 95, 0.08);
}

.prompt-preview-hidden {
  display: none;
}

.mention-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 150px;
  padding: 1px 5px 1px 3px;
  margin: 0 2px;
  border: 1px solid var(--tint-line);
  border-radius: 6px;
  background: var(--tint-soft);
  color: var(--primary);
  font-weight: 700;
  font-size: 12px;
  line-height: 1.35;
  white-space: nowrap;
  vertical-align: baseline;
}

.mention-chip img {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  object-fit: cover;
  flex-shrink: 0;
}

.mention-menu {
  position: absolute;
  z-index: 80;
  left: 12px;
  top: 12px;
  display: none;
  max-height: 220px;
  overflow-y: auto;
  padding: 6px;
  background: var(--bg);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 28px rgba(28, 23, 20, 0.16);
}

.mention-menu.show {
  display: block;
}

.mention-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.mention-option:hover,
.mention-option.active {
  background: var(--tint-soft);
}

.mention-option img {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  object-fit: cover;
  flex-shrink: 0;
}

.mention-option span {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.mention-option strong {
  font-size: 12px;
}

.mention-option small {
  color: var(--text-tertiary);
  font-size: 11px;
}

.seedance-studio .preview-empty {
  min-height: 220px;
  height: auto;
  background: var(--bg);
  border: var(--border-w) dashed var(--border);
  border-radius: var(--radius);
}

.toast.info {
  background: #1f2937;
  color: #fff;
}

  .seedance-studio.page-create {
    grid-template-columns: 440px minmax(360px, 1fr);
  }

  .seedance-studio .panel-history {
    display: none;
  }

  .main-content {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .seedance-studio.page-create {
    display: block;
    height: auto;
  }

  .panel-form,
  .panel-center {
    height: auto;
    border-right: none;
  }

  .panel-form-scroll {
    overflow: visible;
  }

  .panel-center {
    padding: 16px;
  }

  .settings-row,
  .choice-grid {
    grid-template-columns: 1fr;
  }

/* UGC reference-style workspace */
.ugc-page {
  height: calc(100vh - var(--topbar-height));
  display: grid;
  grid-template-columns: 520px minmax(420px, 1fr) 320px;
  background: var(--bg);
  overflow: hidden;
}

.ugc-builder,
.ugc-videos {
  min-width: 0;
  background: var(--bg);
}

.ugc-builder {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.ugc-builder-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 22px 16px;
}

.ugc-builder-footer {
  padding: 12px 22px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.ugc-builder-footer .btn {
  width: 100%;
  padding-left: 12px;
  padding-right: 12px;
}

.ugc-step {
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.ugc-step:last-of-type {
  border-bottom: 0;
}

.ugc-step-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.ugc-step-head h2,
.ugc-videos-head h2,
.ugc-preview-head h1 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0;
}

.compact-tabs {
  margin-bottom: 10px;
}

.ugc-reference-row,
.ugc-background-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, 84px);
  gap: 10px;
  align-items: start;
  justify-content: start;
  overflow-x: hidden;
  padding-bottom: 0;
}

.ugc-reference-row .upload-item,
.ugc-reference-row .upload-add,
.ugc-background-row .upload-item,
.ugc-background-row .upload-add {
  width: 84px;
  height: 84px;
  flex: 0 0 auto;
  aspect-ratio: auto;
}

.ugc-product-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, 84px);
  gap: 10px;
  align-items: start;
  justify-content: start;
  overflow-x: hidden;
}

.product-brief-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 12px;
}

.product-brief-grid .form-input {
  font-size: 13px;
}

.ugc-product-row .upload-item {
  width: 84px;
  height: 84px;
  flex: 0 0 auto;
  aspect-ratio: auto;
}

.ugc-upload-box {
  width: 84px;
  height: 84px;
  flex: 0 0 auto;
  gap: 5px;
}

.ugc-add-card {
  gap: 5px;
}

.ugc-add-card,
.ugc-upload-box {
  border-style: solid;
  border-color: var(--border);
  background: var(--tint-paper);
}

.ugc-upload-box {
  border-style: dashed;
  border-color: var(--primary);
  background: var(--tint-paper);
}

.ugc-reference-row .upload-add,
.ugc-background-row .upload-add {
  border-style: dashed;
  border-color: var(--primary);
  background: var(--tint-paper);
}

.ugc-reference-row.library-mode .upload-item,
.ugc-product-row.library-mode .upload-item,
.ugc-background-row.library-mode .upload-item {
  width: 84px;
  height: 84px;
}

.library-mode .library-empty,
.library-mode .library-load-more-wrap {
  grid-column: 1 / -1;
}

.ugc-add-card:hover,
.ugc-upload-box:hover {
  border-color: var(--primary);
  background: var(--tint-paper);
}

.ugc-add-card span,
.ugc-upload-box span {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
}

.ugc-script-input {
  min-height: 72px;
  resize: vertical;
  line-height: 1.45;
}

.script-count {
  margin-top: 4px;
  color: var(--text-tertiary);
  font-size: 11px;
  text-align: right;
}

.ugc-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 20px;
  row-gap: 14px;
}

.ugc-output-grid {
  display: block;
}

.ugc-model-field {
  margin-bottom: 14px;
}

.ugc-model-native {
  display: none;
}

.ugc-output-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 16px;
  row-gap: 14px;
}

.ugc-section-divider {
  height: var(--border-w);
  background: var(--border);
  margin: 2px 0 10px;
}

.hidden-create-fields,
.hidden-range,
.hidden-duration-value {
  display: none;
}

.ugc-advanced {
  margin-top: 4px;
  border-bottom: 0;
}

.ugc-advanced summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  list-style: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.ugc-advanced summary::-webkit-details-marker {
  display: none;
}

.ugc-advanced summary i {
  color: var(--text-secondary);
}

.ugc-advanced[open] summary i {
  transform: rotate(180deg);
}

.ugc-advanced .prompt-preview {
  min-height: 180px;
  max-height: 260px;
}

.ugc-preview {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 18px 28px;
  background: var(--bg);
  min-height: 0;
}

.ugc-preview-head {
  display: block;
  margin-bottom: 16px;
}

.ugc-preview-frame {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  place-items: center;
  padding-bottom: 0;
}

.ugc-preview .preview-empty {
  width: 100%;
  height: 100%;
  min-height: 0;
  aspect-ratio: 16 / 10;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  align-content: center;
  justify-items: center;
}

.ugc-preview .preview-empty i,
.ugc-preview .preview-empty span {
  display: block;
}

.ugc-preview #video-results {
  width: min(820px, 96%);
  max-height: 100%;
  overflow-y: auto;
  margin: 0 auto;
}

.ugc-preview .video-result {
  margin-bottom: 14px;
  border-radius: 8px;
}

.ugc-preview .video-result:last-child {
  margin-bottom: 0;
}

.ugc-preview .video-result-player {
  aspect-ratio: 9 / 16;
}

.ugc-preview .video-result {
  grid-template-columns: minmax(240px, 320px) minmax(220px, 1fr);
}

  .video-result,
  .ugc-preview .video-result {
    grid-template-columns: 1fr;
  }

  .video-result-side {
    border-left: 0;
    border-top: var(--border-w) solid var(--border);
  }

.ugc-videos {
  border-left: 1px solid var(--border);
  padding: 18px 14px;
  overflow-y: auto;
}

.ugc-videos-head {
  margin-bottom: 14px;
}

.ugc-videos .history-strip {
  gap: 10px;
}

.ugc-videos .history-empty {
  display: block;
  color: var(--text-tertiary);
  font-size: 13px;
  padding: 16px 0;
}

.ugc-video-card {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.ugc-video-card:hover {
  border-color: var(--primary);
}

.ugc-video-card.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(16, 122, 95, 0.08);
}

.ugc-video-thumb {
  width: 58px;
  height: 78px;
  border-radius: 6px;
  overflow: hidden;
  background: #2A2320;
}

.ugc-video-thumb img,
.ugc-video-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ugc-video-thumb .history-thumb-placeholder {
  height: 100%;
}

.ugc-video-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
}

.ugc-video-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ugc-video-meta {
  color: var(--text-secondary);
  font-size: 12px;
}

.ugc-video-date {
  color: var(--text-tertiary);
  font-size: 11px;
}

.ugc-all-videos {
  width: 100%;
  margin-top: 14px;
  text-decoration: none;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.icon-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}  .ugc-page {
    grid-template-columns: 520px minmax(360px, 1fr);
  }

  .ugc-videos {
    display: none;
  }

  .ugc-page {
    display: block;
    height: auto;
  }

  .ugc-builder,
  .ugc-preview {
    min-height: auto;
  }

  .ugc-settings-grid {
    grid-template-columns: 1fr 1fr;
  }

  .ugc-output-controls {
    grid-template-columns: 1fr 1fr;
  }

/* Apple-inspired light UI refresh */
:root {
  --primary: #007aff;
  --primary-hover: #0066d6;
  --bg: #ffffff;
  --bg-page: #F6F4F0;
  --surface: var(--surface);
  --surface-strong: var(--surface-strong);
  --border: rgba(28, 23, 20, 0.16);
  --border-strong: rgba(28, 23, 20, 0.28);
  --text: #1C1714;
  --text-secondary: rgba(28, 23, 20, 0.68);
  --text-tertiary: rgba(28, 23, 20, 0.48);
  --radius: 12px;
  --radius-sm: 9px;
}

html,
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", sans-serif;
  background: var(--bg-page);
  color: var(--text);
}

.topbar {
  background: var(--bg-translucent);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom-color: var(--border);
}

.topbar-brand-img {
  height: 34px;
}

.topbar-link {
  color: var(--text-secondary);
  font-weight: 600;
}

.topbar-link:hover,
.topbar-link:hover i {
  color: var(--text);
}

.topbar-link.active,
.topbar-link.active i {
  color: var(--primary);
}

.topbar-link.active::after {
  height: 3px;
  background: var(--primary);
}

.topbar-icon-btn,
.topbar-avatar,
.icon-btn {
  background: rgba(var(--fill-rgb), 0.12);
  border: 0;
}

.topbar-icon-btn:hover,
.icon-btn:hover {
  background: rgba(16, 122, 95, 0.1);
  color: var(--primary);
}

.ugc-page {
  background: var(--bg-page);
}

.ugc-builder,
.ugc-preview,
.ugc-videos {
  background: var(--bg-translucent);
}

.ugc-builder,
.ugc-preview,
.ugc-videos {
  border-color: var(--border);
}

.ugc-step {
  border-bottom-color: var(--border);
}

.ugc-step-head h2,
.ugc-videos-head h2,
.ugc-preview-head h1 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.form-label {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.45px;
}

input.form-input,
textarea.form-input,
select.form-select,
.prompt-preview,
.model-selector {
  background-color: rgba(var(--fill-rgb), 0.09);
  border-color: transparent;
  border-radius: 10px;
  color: var(--text);
}

input.form-input:hover,
textarea.form-input:hover,
select.form-select:hover,
.prompt-editor:hover,
.model-selector:hover {
  background-color: rgba(var(--fill-rgb), 0.13);
  border-color: transparent;
}

input.form-input:focus,
textarea.form-input:focus,
select.form-select:focus,
.prompt-editor:focus,
.model-select-wrap.open .model-selector {
  background-color: var(--bg);
  border-color: rgba(16, 122, 95, 0.42);
  box-shadow: 0 0 0 4px rgba(16, 122, 95, 0.12);
}

.btn {
  border: 0;
  border-radius: 10px;
  font-weight: 700;
  letter-spacing: 0;
}

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

.btn-primary:hover:not(:disabled) {
  opacity: 1;
  background: var(--primary-hover);
}

.btn-secondary {
  background: rgba(var(--fill-rgb), 0.12);
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(var(--fill-rgb), 0.18);
}

.upload-add,
.ugc-add-card,
.ugc-upload-box {
  width: 84px;
  height: 84px;
  aspect-ratio: auto;
  gap: 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-style: dashed;
  border-color: rgba(16, 122, 95, 0.36);
  background: rgba(16, 122, 95, 0.04);
  border-radius: 11px;
}

.upload-add i,
.ugc-add-card i,
.ugc-upload-box i {
  font-size: 22px;
  color: var(--text-tertiary);
}

.upload-add span,
.ugc-add-card span,
.ugc-upload-box span {
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
}

.upload-add:hover,
.ugc-add-card:hover,
.ugc-upload-box:hover {
  background: rgba(16, 122, 95, 0.08);
  border-color: var(--primary);
}

.ugc-reference-row .upload-add,
.ugc-product-row .upload-add,
.ugc-background-row .upload-add {
  border-color: rgba(16, 122, 95, 0.42);
  background: var(--tint-soft);
}

.ugc-reference-row .upload-add:hover,
.ugc-product-row .upload-add:hover,
.ugc-background-row .upload-add:hover {
  border-color: var(--primary);
  background: var(--tint-soft-2);
}

.upload-item,
.video-result,
.ugc-video-card,
.video-card {
  border-color: var(--border);
  border-radius: 12px;
  background: var(--bg);
}

.video-result,
.ugc-video-card,
.video-card {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.ugc-video-card:hover,
.ugc-video-card.active {
  border-color: rgba(16, 122, 95, 0.42);
  box-shadow: 0 0 0 4px rgba(16, 122, 95, 0.08);
}

.model-selector-icon,
.model-option img {
  background: var(--surface);
  border-radius: 9px;
}

.model-options,
.avatar-menu {
  border-color: var(--border);
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.14);
}

.model-option {
  border-radius: 9px;
}

.model-option:hover,
.model-option.active {
  background: rgba(16, 122, 95, 0.08);
}

.status-dot.generating {
  background: var(--primary);
}

.status-dot.completed {
  background: #34c759;
}

.toast {
  border-radius: 12px;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.18);
}

.library-switch,
.prompt-more-btn,
.btn-text {
  color: var(--primary);
}

.library-switch:hover,
.prompt-more-btn:hover,
.btn-text:hover {
  color: var(--primary-hover);
}

.library-controls {
  margin: 10px 0 12px;
}

.library-search-wrap {
  background: rgba(var(--fill-rgb), 0.09);
  border: 0;
  border-radius: 10px;
}

.library-search {
  background: transparent;
  border: 0;
  color: var(--text);
  font-size: 13px;
}

.library-search:focus {
  box-shadow: none;
}

.library-search-wrap:focus-within {
  background: var(--bg);
  box-shadow: 0 0 0 4px rgba(16, 122, 95, 0.12);
}

.library-empty {
  color: var(--text-tertiary);
  background: rgba(var(--fill-rgb), 0.08);
  border-radius: 10px;
  padding: 14px;
}

.library-load-more {
  border: 0;
  border-radius: 10px;
  background: rgba(var(--fill-rgb), 0.12);
  color: var(--text);
  font-weight: 500;
}

.library-load-more:hover {
  background: rgba(var(--fill-rgb), 0.18);
  color: var(--text);
}

.library-delete-btn {
  background: rgba(28, 23, 20, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.ugc-builder-footer .btn {
  font-size: 13px;
  font-weight: 500;
}

.ugc-all-videos,
.video-result-actions .btn,
.modal-actions .btn {
  font-size: 13px;
  font-weight: 500;
}

.page-history {
  padding: 28px;
  background: var(--bg-page);
}

.page-header {
  max-width: 1180px;
  margin: 0 auto 18px;
  padding: 0 2px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.search-input {
  width: 320px;
  height: 38px;
  background: rgba(var(--fill-rgb), 0.09);
  border: 0;
  border-radius: 10px;
  font-size: 13px;
  transition: background 0.15s, box-shadow 0.15s;
}

.search-input:hover {
  background: rgba(var(--fill-rgb), 0.13);
}

.search-input:focus {
  background: var(--bg);
  box-shadow: 0 0 0 4px rgba(16, 122, 95, 0.12);
}

.video-grid {
  max-width: 1180px;
  margin: 0 auto;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 16px;
}

.video-card {
  border: 0;
  border-radius: 14px;
  background: var(--bg-translucent);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: background 0.15s, box-shadow 0.15s;
}

.video-card:hover {
  background: var(--bg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.video-thumb {
  width: 100%;
  border: 0;
  padding: 0;
  background: #1c1c1e;
  aspect-ratio: 16 / 9;
  position: relative;
  cursor: pointer;
  overflow: hidden;
}

.video-thumb:disabled {
  cursor: default;
}

.video-thumb img,
.video-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #000;
}

.video-thumb .play-icon {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 42px;
  height: 42px;
  background: rgba(255, 255, 255, 0.86);
  color: #1C1714;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.video-thumb .status-badge {
  top: 10px;
  left: 10px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 10px;
  font-weight: 700;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.status-badge.completed {
  background: rgba(52, 199, 89, 0.16);
  color: #137333;
}

.status-badge.generating,
.status-badge.pending {
  background: rgba(255, 159, 10, 0.18);
  color: #9a5a00;
}

.status-badge.failed {
  background: rgba(255, 59, 48, 0.14);
  color: #b42318;
}

.video-info {
  padding: 14px 14px 10px;
}

.video-title {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 6px;
}

.video-prompt {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
  margin-bottom: 10px;
}

.video-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.video-date,
.video-meta-line {
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.video-meta-line {
  text-align: right;
}

.video-badges {
  display: none;
}

.badge {
  border: 0;
  background: rgba(var(--fill-rgb), 0.12);
  border-radius: 999px;
  font-weight: 600;
}

.video-actions {
  padding: 8px 14px 14px;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

.video-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: rgba(var(--fill-rgb), 0.12);
  font-size: 12px;
  font-weight: 500;
}

.video-actions .btn:hover {
  background: rgba(var(--fill-rgb), 0.17);
}

.video-actions .btn.danger-soft {
  color: var(--danger);
}

.empty-state {
  max-width: 1180px;
  margin: 0 auto;
  min-height: 420px;
  background: var(--bg-translucent);
  border-radius: 16px;
}

.video-thumb-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: rgba(255, 255, 255, 0.55);
  font-size: 34px;
}

.video-viewer-overlay {
  padding: 28px;
}

.video-viewer-modal {
  position: relative;
  width: min(920px, 94vw);
  max-height: min(680px, 86vh);
  display: grid;
  grid-template-columns: minmax(300px, 420px) minmax(300px, 1fr);
  gap: 0;
  overflow: hidden;
  border-radius: 18px;
  background: var(--bg);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22);
}

.video-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(var(--fill-rgb), 0.16);
  color: var(--text);
  cursor: pointer;
}

.video-viewer-player {
  min-height: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.video-viewer-player video {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(680px, 86vh);
  object-fit: contain;
  background: #000;
}

.video-viewer-detail {
  min-height: 0;
  padding: 24px;
  overflow-y: auto;
  border-left: var(--border);
}

.history-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--text-secondary);
  font-size: 13px;
}

.history-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8e8e93;
}

.history-status-dot.completed {
  background: #34c759;
}

.history-status-dot.generating,
.history-status-dot.pending {
  background: #ff9f0a;
}

.history-status-dot.failed {
  background: #ff3b30;
}

.video-viewer-detail h2 {
  margin: 0 40px 10px 0;
  color: var(--text);
  font-size: 20px;
  font-weight: 650;
  letter-spacing: 0;
}

.video-viewer-prompt-wrap {
  margin: 0 0 18px;
}

.video-viewer-prompt {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-viewer-prompt-wrap.expanded .video-viewer-prompt {
  display: block;
  overflow: visible;
}

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

.history-detail-grid div {
  display: grid;
  gap: 4px;
}

.history-detail-grid span {
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.history-detail-grid strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  word-break: break-word;
}

.video-viewer-actions {
  margin-top: 22px;
  padding-top: 16px;
  border-top: var(--border);
  display: flex;
  gap: 10px;
}

.video-viewer-actions .btn {
  min-height: 36px;
  border: 0;
  background: rgba(var(--fill-rgb), 0.12);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
}

  .video-viewer-modal {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  .video-viewer-player video {
    max-height: 58vh;
  }

  .video-viewer-detail {
    border-left: 0;
    border-top: var(--border);
  }

.modal {
  border: 0;
  border-radius: 16px;
  box-shadow: 0 22px 64px rgba(0, 0, 0, 0.18);
}

.dummy-page {
  grid-template-columns: 420px minmax(520px, 1fr) 300px;
}

.dummy-page .ugc-builder-scroll {
  padding-left: 18px;
  padding-right: 18px;
}

.dummy-page .ugc-preview {
  padding-left: 20px;
  padding-right: 20px;
}

.dummy-page #dummy-preview {
  width: min(820px, 98%);
  max-height: 100%;
  overflow-y: auto;
  margin: 0 auto;
}

.dummy-page #dummy-preview .video-result {
  grid-template-columns: minmax(230px, 310px) minmax(220px, 1fr);
  margin-bottom: 0;
}

.dummy-page #dummy-preview .video-result-player {
  aspect-ratio: 9 / 16;
}

.history-count {
  margin: 4px 0 0;
  color: var(--text-tertiary);
  font-size: 12px;
}

.history-toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1000;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(28, 23, 20, 0.92);
  color: #fff;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.16s, transform 0.16s;
}

.history-toast.show {
  opacity: 1;
  transform: translateY(0);
}

  .dummy-page {
    grid-template-columns: 390px minmax(480px, 1fr) 280px;
  }

/* ============================================================
   Teman Creator — brand system
   Signature: marigold (keranjang kuning) reserved for the step
   sequence and the one action that spends credits.
   Primary: pandan green, carries every other interactive state.
   ============================================================ */

:root {
  color-scheme: light;

  --tc-marigold: #FFB020;
  --tc-marigold-deep: #E09000;
  --tc-marigold-wash: #FFF3DC;
  --tc-pandan: #107A5F;
  --tc-pandan-hover: #0C6650;
  --tc-ink: #1C1714;

  --primary: var(--tc-pandan);
  --primary-hover: var(--tc-pandan-hover);
  --danger: #C0341F;

  --bg: #FFFFFF;
  --bg-translucent: rgba(255, 255, 255, 0.92);
  --bg-page: #FAF8F4;
  --surface: #F5F2EC;
  --surface-strong: #ECE7DF;
  --border: rgba(28, 23, 20, 0.09);
  --border-strong: rgba(28, 23, 20, 0.2);
  --text: var(--tc-ink);
  --text-secondary: rgba(28, 23, 20, 0.6);
  --text-tertiary: rgba(28, 23, 20, 0.4);
  --fill-rgb: 28, 23, 20;

  --tint-paper: #FDFCFA;
  --tint-soft: #EFF6F2;
  --tint-soft-2: #E3EFE9;
  --tint-line: #C8DED5;

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

  --font-display: 'Bricolage Grotesque', 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'DM Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---- Typography ---- */

html,
body {
  font-family: var(--font-body);
  background: var(--bg-page);
  color: var(--text);
}

.page-title,
.ugc-step-head h2,
.ugc-videos-head h2,
.ugc-preview-head h1,
.modal-title,
.settings-section-title,
.video-viewer-detail h2,
.topbar-brand-name {
  font-family: var(--font-display);
  letter-spacing: -0.015em;
}

.page-title {
  font-weight: 700;
  font-size: 26px;
}

.ugc-step-head h2,
.ugc-videos-head h2,
.ugc-preview-head h1 {
  font-weight: 700;
  font-size: 15px;
}

.settings-section-title {
  font-weight: 700;
  letter-spacing: 0.01em;
}

.form-label {
  font-weight: 600;
  letter-spacing: 0.005em;
}

/* Technical values read as data, not prose */
.history-detail-grid strong,
.range-value,
.script-count,
.history-count,
code,
#api-key-input,
#api-url-input {
  font-family: var(--font-mono);
  font-feature-settings: 'tnum' 1;
}

.history-detail-grid span {
  font-family: var(--font-body);
}

/* ---- Brand lockup ---- */

.topbar {
  background: var(--bg-translucent);
  border-bottom-color: var(--border);
}

.topbar-brand {
  gap: 10px;
  min-width: 190px;
}

.topbar-brand-mark {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: block;
}

.topbar-brand-name {
  font-size: 16.5px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.05;
}

.topbar-brand-name em {
  font-style: normal;
  font-weight: 400;
}

/* ---- Step sequence: the signature ---- */

.ugc-step-head h2 {
  display: flex;
  align-items: center;
  gap: 9px;
}

.ugc-step-num {
  flex-shrink: 0;
  width: 21px;
  height: 21px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: var(--tc-marigold);
  color: var(--tc-ink);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

/* ---- The one loud action ---- */

#generate-btn.btn-primary {
  background: var(--tc-marigold);
  color: var(--tc-ink);
  font-weight: 700;
}

#generate-btn.btn-primary:hover:not(:disabled) {
  background: var(--tc-marigold-deep);
  color: var(--tc-ink);
}

#generate-btn.btn-primary:disabled {
  background: var(--tc-marigold);
  color: var(--tc-ink);
}

/* ---- Interactive polish ---- */

.btn {
  font-family: var(--font-body);
  font-weight: 600;
}

:focus-visible {
  outline: 2px solid var(--tc-marigold-deep);
  outline-offset: 2px;
}

.topbar-link.active,
.topbar-link.active i {
  color: var(--primary);
}

.topbar-link.active::after {
  background: var(--tc-marigold);
}

/* ---- Theme toggle ---- */

.theme-btn i {
  font-size: 17px;
}

.theme-btn .ti-moon {
  display: none;
}

[data-theme="dark"] .theme-btn .ti-sun {
  display: none;
}

[data-theme="dark"] .theme-btn .ti-moon {
  display: inline-block;
}

/* ---- Ad slots ---- */

.ad-slot {
  display: block;
  margin: 24px auto 0;
  padding: 10px 12px 12px;
  max-width: 1180px;
  background: var(--tint-paper);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.ad-slot-label {
  display: block;
  margin-bottom: 8px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.ad-slot ins.adsbygoogle {
  display: block;
  min-height: 90px;
}

.ad-slot-settings {
  max-width: 100%;
  margin-top: 28px;
}

  .ad-slot {
    margin-top: 18px;
    padding: 8px 10px 10px;
  }

/* ---- Dark theme ---- */

[data-theme="dark"] {
  color-scheme: dark;

  --primary: #35A98B;
  --primary-hover: #46BE9E;
  --danger: #F0705A;

  --bg: #1F1A16;
  --bg-translucent: rgba(31, 26, 22, 0.88);
  --bg-page: #15110E;
  --surface: #2A231D;
  --surface-strong: #362D25;
  --border: rgba(245, 240, 233, 0.13);
  --border-strong: rgba(245, 240, 233, 0.3);
  --text: #F5F0E9;
  --text-secondary: rgba(245, 240, 233, 0.66);
  --text-tertiary: rgba(245, 240, 233, 0.45);
  --fill-rgb: 245, 240, 233;

  --tint-paper: #241E19;
  --tint-soft: #1E322B;
  --tint-soft-2: #254036;
  --tint-line: #2F5A4B;
}

[data-theme="dark"] .status-badge.completed { color: #5CD68F; }
[data-theme="dark"] .status-badge.generating,
[data-theme="dark"] .status-badge.pending { color: #FFC15E; }
[data-theme="dark"] .status-badge.failed { color: #FF8A7A; }

[data-theme="dark"] .modal,
[data-theme="dark"] .video-viewer-modal,
[data-theme="dark"] .video-card {
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

[data-theme="dark"] .btn-primary {
  color: #10221C;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.ad-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.ad-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ============================================================
   Responsive
   Below 860px the studio stops being three panes side by side
   and becomes one document that scrolls normally, so nothing
   lives inside a nested scroll container.
   ============================================================ */

  .main-content {
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .ugc-page {
    display: block;
    height: auto;
    overflow: visible;
  }

  .ugc-builder {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .ugc-builder-scroll {
    overflow: visible;
    padding: 18px 16px 12px;
  }

  /* The action that spends credits stays reachable at any scroll position. */
  .ugc-builder-footer {
    position: sticky;
    bottom: 0;
    z-index: 60;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: var(--bg);
    border-top: 1px solid var(--border);
  }

  .ugc-preview {
    display: block;
    padding: 18px 16px 28px;
  }

  .ugc-preview-frame {
    height: auto;
    min-height: 300px;
  }

  .ugc-preview .preview-empty {
    height: 300px;
  }

  .page-history,
  .page-settings {
    height: auto;
    min-height: 0;
    overflow: visible;
    padding: 22px 16px 40px;
  }

  .settings-container {
    max-width: none;
    padding: 20px 16px;
  }

  .settings-row-2 {
    grid-template-columns: 1fr;
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .search-input {
    width: 100%;
  }

  .video-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
  }

  .empty-state {
    min-height: 260px;
  }

  /* Touch targets */
  .btn {
    min-height: 44px;
  }

  .topbar-icon-btn,
  .topbar-avatar {
    width: 36px;
    height: 36px;
  }

  .topbar {
    padding: 0 12px;
  }

  .topbar-brand {
    min-width: 0;
    gap: 8px;
  }

  .topbar-brand-mark {
    width: 26px;
    height: 26px;
  }

  .topbar-brand-name {
    font-size: 15px;
    white-space: nowrap;
  }

  /* Two destinations only, so the icons carry the nav on their own. */
  .topbar-nav {
    justify-content: flex-end;
    gap: 2px;
    margin-right: 4px;
  }

  .topbar-link span {
    display: none;
  }

  .topbar-link {
    padding: 0 9px;
  }

  .topbar-link i {
    font-size: 19px;
  }

  .topbar-divider {
    display: none;
  }

  .topbar-account {
    gap: 6px;
  }

  .ugc-settings-grid,
  .ugc-output-controls,
  .product-brief-grid {
    grid-template-columns: 1fr;
  }  .modal {
    max-width: none;
    margin: 0 14px;
  }

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

  .ad-slot {
    border-radius: var(--radius-sm);
  }

  .prompt-editor,
  .video-viewer-prompt {
    overflow-wrap: anywhere;
  }

@media (max-width: 400px) {
  .topbar-brand-name {
    display: none;
  }

  .ugc-builder-footer {
    grid-template-columns: 1fr;
  }

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

/* ============================================================
   SaaS surfaces: accounts, credits, top-up, and the admin console.
   Guests get the full builder; everything below is what changes
   once an account and a credit balance enter the picture.
   ============================================================ */

.credit-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--tint-line);
  background: var(--tint-soft);
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-mono);
  text-decoration: none;
  white-space: nowrap;
}

.credit-pill:hover {
  background: var(--tint-soft-2);
}

.credit-pill i {
  font-size: 15px;
}

.credit-pill-unit {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
}

.credit-pill-empty {
  border-color: var(--tc-marigold);
  background: var(--tc-marigold-wash);
  color: var(--tc-marigold-deep);
}

.credit-pill-empty .credit-pill-unit {
  color: var(--tc-marigold-deep);
}

.topbar-signin {
  height: 34px;
  padding: 0 14px;
  gap: 6px;
  white-space: nowrap;
}

.avatar-initial {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: var(--tint-soft-2);
  color: var(--primary);
  font-weight: 700;
  font-size: 14px;
}

.avatar-menu-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.avatar-menu-head strong {
  font-size: 13px;
}

.avatar-menu-head span {
  font-size: 11px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
}

.avatar-menu form {
  margin: 0;
}

.avatar-menu form button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.avatar-menu form button:hover {
  background: var(--surface);
}

/* ---- Auth and error pages ---- */

/* The app shell is a fixed viewport with overflow hidden, so every page owns
   its own scroll the way the create and history pages already do. */
.auth-page {
  display: flex;
  justify-content: center;
  height: calc(100vh - var(--topbar-height));
  overflow-y: auto;
  padding: 40px 20px;
}

.auth-card {
  /* auto margins instead of align-items:center, so a tall card scrolls
     from its top edge rather than being clipped on both sides. */
  margin: auto;
  width: 100%;
  max-width: 440px;
  padding: 34px 32px 28px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.auth-mark {
  margin-bottom: 16px;
}

.auth-error-icon {
  font-size: 40px;
  color: var(--tc-marigold-deep);
  margin-bottom: 12px;
  display: block;
}

.auth-lead {
  margin: 10px 0 22px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.auth-google {
  width: 100%;
  justify-content: center;
  gap: 8px;
  height: 46px;
}

.auth-alert {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 18px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: var(--tc-marigold-wash);
  border: 1px solid var(--tc-marigold);
  color: var(--tc-marigold-deep);
  font-size: 13px;
  text-align: left;
  line-height: 1.5;
}

.auth-points {
  list-style: none;
  margin: 22px 0 20px;
  text-align: left;
  display: grid;
  gap: 9px;
}

.auth-points li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.auth-points i {
  color: var(--primary);
  font-size: 15px;
  flex-shrink: 0;
}

.auth-back {
  display: inline-block;
  font-size: 13px;
  color: var(--text-secondary);
}

/* ---- Shared page shell for account, pricing, admin ---- */

.page-plain {
  height: calc(100vh - var(--topbar-height));
  overflow-y: auto;
  padding: 28px 22px 60px;
  background: var(--bg-page);
}

/* The scroll container spans the viewport, so the reading column is centred
   one level in rather than on the scrolling element itself. */
.page-plain > * {
  max-width: 1020px;
  margin-left: auto;
  margin-right: auto;
}

/* Vertical rhythm belongs to the page, not to each section remembering to
   declare it. Sibling margins collapse, so a section that already sets its own
   margin-bottom keeps the larger of the two rather than stacking both. */
.page-plain > * + * {
  margin-top: 32px;
}

.page-lead {
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 13px;
}

/* ---- Credit balance ---- */

.balance-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 26px;
  margin-bottom: 26px;
  border-radius: var(--radius);
  border: 1px solid var(--tint-line);
  background: var(--tint-soft);
}

.balance-main {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.balance-label {
  width: 100%;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.balance-value {
  font-family: var(--font-display);
  font-size: 46px;
  line-height: 1;
  color: var(--primary);
}

.balance-unit {
  font-size: 14px;
  color: var(--text-secondary);
}

.balance-rates {
  display: flex;
  gap: 18px;
}

.balance-rates div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
}

.balance-rates span {
  color: var(--text-secondary);
}

.balance-rates strong {
  font-family: var(--font-mono);
}

/* ---- Credit packages ---- */

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

.package-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px;
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  font: inherit;
  color: var(--text);
  transition: border-color 0.15s, transform 0.15s;
}

.package-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.package-name {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.package-credits {
  font-family: var(--font-display);
  font-size: 22px;
}

.package-price {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--primary);
}

.package-unit {
  font-size: 11px;
  color: var(--text-tertiary);
}

/* ---- Top-up flow ---- */

.topup-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 26px;
  align-items: start;
}

.topup-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #ffffff;
}

.topup-qr img {
  width: 100%;
  max-width: 210px;
  height: auto;
  display: block;
}

.topup-merchant {
  font-size: 12px;
  font-weight: 600;
  color: #1C1714;
}

.topup-amount strong {
  display: block;
  font-family: var(--font-display);
  font-size: 32px;
  color: var(--tc-marigold-deep);
  margin: 2px 0 6px;
}

.topup-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.topup-meta div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.topup-meta dt {
  font-size: 11px;
  color: var(--text-secondary);
}

.topup-meta dd {
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-mono);
}

.topup-instructions {
  white-space: pre-line;
}

.topup-proof {
  display: grid;
  gap: 10px;
}

.proof-drop {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-strong);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 13px;
}

.proof-drop:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.topup-actions {
  display: flex;
  gap: 10px;
}

.topup-review {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--tint-soft);
  border: 1px solid var(--tint-line);
  color: var(--primary);
  font-size: 13px;
  line-height: 1.5;
}

.topup-review i {
  font-size: 22px;
  flex-shrink: 0;
}

/* ---- Ledgers ---- */

.ledger {
  display: grid;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.ledger-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 15px;
  background: var(--bg);
}

.ledger-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ledger-main strong {
  font-size: 13px;
}

.ledger-main span {
  font-size: 12px;
  color: var(--text-secondary);
}

.ledger-note {
  font-style: italic;
}

.ledger-amounts {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
}

.ledger-amounts strong {
  font-family: var(--font-mono);
  font-size: 15px;
}

.ledger-amounts strong.positive {
  color: var(--primary);
}

.ledger-amounts strong.negative {
  color: var(--tc-marigold-deep);
}

.ledger-amounts span {
  font-size: 11px;
  color: var(--text-tertiary);
}

/* ---- Pricing page ---- */

.pricing-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin-bottom: 30px;
}

.pricing-card {
  display: flex;
  flex-direction: column;
  padding: 26px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
}

.pricing-card-accent {
  border-color: var(--tc-marigold);
  box-shadow: 0 0 0 3px var(--tc-marigold-wash);
}

.pricing-tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.pricing-card h2 {
  font-family: var(--font-display);
  font-size: 21px;
  margin: 6px 0 10px;
}

.pricing-price {
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--primary);
  margin-bottom: 18px;
}

.pricing-price span {
  display: block;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.pricing-list {
  list-style: none;
  display: grid;
  gap: 9px;
  margin-bottom: 22px;
  flex: 1;
}

.pricing-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  line-height: 1.5;
}

.pricing-list i {
  color: var(--primary);
  flex-shrink: 0;
}

.pricing-list li.muted {
  color: var(--text-tertiary);
}

.pricing-list li.muted i {
  color: var(--text-tertiary);
}

.pricing-rates {
  padding: 24px 26px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
}

.rate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin: 16px 0 12px;
}

.rate-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.rate-res {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.rate-value {
  font-family: var(--font-display);
  font-size: 28px;
  color: var(--primary);
}

.rate-unit {
  font-size: 12px;
  color: var(--text-secondary);
}

.rate-example {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-tertiary);
}

/* ---- Create page: guest prompt output and credit cost ---- */

.cost-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  font-family: var(--font-mono);
  font-size: 11px;
}

.cost-chip i {
  font-size: 13px;
}

.prompt-result {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  overflow: hidden;
}

.prompt-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.prompt-result-head h2 {
  font-family: var(--font-display);
  font-size: 16px;
}

.prompt-result-body {
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 16px;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}

.prompt-result-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.prompt-result-foot p {
  flex: 1;
  min-width: 200px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.videos-locked {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 30px 18px;
  text-align: center;
  color: var(--text-secondary);
}

.videos-locked i {
  font-size: 26px;
  color: var(--text-tertiary);
}

.videos-locked p {
  font-size: 12px;
  line-height: 1.5;
}

.empty-state-locked {
  gap: 12px;
  padding: 60px 20px;
  text-align: center;
}

.empty-state-locked p {
  max-width: 420px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ---- Admin console ---- */

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 15px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
}

.stat-tile span {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.stat-tile strong {
  font-family: var(--font-display);
  font-size: 22px;
}

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

.admin-tab {
  padding: 10px 15px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}

.admin-tab:hover {
  color: var(--text);
}

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

.admin-panel {
  display: none;
}

.admin-panel.active {
  display: block;
}

.admin-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.admin-filter {
  max-width: 220px;
}

.admin-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  margin-bottom: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
}

.admin-proof {
  flex-shrink: 0;
  width: 62px;
  height: 62px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
}

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

.admin-proof-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  font-size: 20px;
}

.admin-row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-row-main strong {
  font-size: 14px;
}

.admin-row-main span {
  font-size: 12px;
  color: var(--text-secondary);
}

.admin-row-meta {
  font-size: 11px !important;
  color: var(--text-tertiary) !important;
}

.admin-row-amount {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.admin-row-amount strong {
  font-family: var(--font-mono);
  font-size: 15px;
}

.admin-row-amount span {
  font-size: 11px;
  color: var(--text-secondary);
}

.admin-row-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.role-chip {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--tint-soft-2);
  color: var(--primary);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: middle;
}

.role-chip-danger {
  background: rgba(192, 52, 31, 0.12);
  color: var(--danger);
}

.package-form {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 10px;
  margin-top: 16px;
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
}

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

.qris-manage {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.qris-preview {
  flex-shrink: 0;
  width: 130px;
  height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #ffffff;
  overflow: hidden;
}

.qris-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.qris-empty {
  font-size: 11px;
  color: #999999;
  text-align: center;
  padding: 0 10px;
}

.qris-upload-btn {
  display: inline-flex;
  cursor: pointer;
  margin-bottom: 8px;
}

  .page-plain,
  .auth-page {
    height: auto;
    overflow: visible;
  }

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

  .package-form {
    grid-template-columns: 1fr;
  }

  .admin-row {
    flex-wrap: wrap;
  }

  .admin-row-actions {
    flex-direction: row;
    width: 100%;
  }

  .settings-row-3 {
    grid-template-columns: 1fr;
  }

  .credit-pill-unit {
    display: none;
  }

  .balance-rates {
    width: 100%;
    justify-content: space-between;
  }

  .qris-manage {
    flex-direction: column;
  }

[data-theme="dark"] .topup-qr,
[data-theme="dark"] .qris-preview {
  background: #F5F0E9;
}

[data-theme="dark"] .cost-chip {
  background: rgba(16, 34, 28, 0.22);
}

[data-theme="dark"] .role-chip-danger {
  background: rgba(240, 112, 90, 0.16);
}

/* ---- Locked output controls (guest mode) ----
   Resolution and model never reach the prompt text, so a guest sees them
   dimmed rather than pretending they do something. */

.lock-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 7px;
  padding: 1px 7px 1px 5px;
  border-radius: 999px;
  background: var(--tint-soft);
  border: 1px solid var(--tint-line);
  color: var(--primary);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: none;
  text-decoration: none;
  vertical-align: middle;
}

.lock-chip:hover {
  background: var(--tint-soft-2);
}

.lock-chip i {
  font-size: 11px;
}

.is-locked .model-selector,
.is-locked .form-select {
  opacity: 0.55;
  cursor: not-allowed;
}

.is-locked .model-selector:hover,
.is-locked .form-select:hover {
  border-color: var(--border);
}

.is-locked .model-selector-arrow {
  visibility: hidden;
}

.output-lock-note {
  margin-top: 12px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-secondary);
}

/* ---- Pricing presentation ----
   The unit that sells is rupiah-per-video, not credits-per-second, so the
   headline and the cards lead with it and keep credits as the fine print. */

.price-hero {
  padding: 34px 0 30px;
  text-align: center;
}

.price-hero-headline {
  margin: 10px 0 12px;
  font-family: var(--font-display);
  font-size: clamp(26px, 4.4vw, 40px);
  line-height: 1.18;
  letter-spacing: -0.02em;
}

.price-hero-headline strong {
  color: var(--tc-marigold-deep);
  font-weight: 800;
}

.price-hero-sub {
  max-width: 520px;
  margin: 0 auto;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
}

.price-packages {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.price-pack {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 24px 22px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
}

.price-pack-best {
  border-color: var(--tc-marigold);
  box-shadow: 0 0 0 3px var(--tc-marigold-wash);
}

.price-pack-save {
  position: absolute;
  top: -10px;
  right: 18px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--tc-marigold);
  color: #1C1714;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.price-pack-name {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.price-pack-per {
  margin: 8px 0 4px;
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}

.price-pack-per strong {
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 1;
  letter-spacing: -0.02em;
}

.price-pack-per span {
  font-size: 13px;
  color: var(--text-secondary);
}

.price-pack-list {
  list-style: none;
  display: grid;
  gap: 8px;
  margin: 18px 0 20px;
  flex: 1;
}

.price-pack-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  line-height: 1.5;
}

.price-pack-list i {
  color: var(--primary);
  flex-shrink: 0;
}

.price-table-wrap {
  margin-top: 14px;
  overflow-x: auto;
}

.price-table {
  width: 100%;
  min-width: 460px;
  border-collapse: collapse;
}

.price-table th,
.price-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.price-table thead th {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.price-table tbody th {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.price-table td strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 15px;
}

.price-table td span {
  font-size: 11px;
  color: var(--text-tertiary);
}

.price-table tbody tr:last-child th,
.price-table tbody tr:last-child td {
  border-bottom: 0;
}

/* Package cards on the account page follow the same per-video framing. */

.package-card {
  position: relative;
}

.package-card-best {
  border-color: var(--tc-marigold);
  box-shadow: 0 0 0 3px var(--tc-marigold-wash);
}

.package-save {
  position: absolute;
  top: -9px;
  right: 14px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--tc-marigold);
  color: #1C1714;
  font-size: 10px;
  font-weight: 800;
}

.package-credits small {
  margin-left: 2px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

  .price-hero {
    padding: 22px 0 24px;
  }

/* ============================================================
   Mobile shell
   The app is a phone-width column at every screen size. Every breakpoint
   above this point has been unwrapped rather than left as a media query,
   because the column never grows past --shell-width and those rules are
   therefore always in force. Only the sub-400px block below stays
   conditional, since that one really does depend on the device.
   ============================================================ */

:root {
  --shell-width: 430px;
  --bottomnav-height: 62px;
  --shell-surround: #E8E4DD;
  /* Distance from the window edge to the column. Fixed chrome uses this to
     line up with the column without a transform, leaving transform free for
     the drawer's slide-in animation. */
  --shell-inset: max(0px, calc((100vw - var(--shell-width)) / 2));
}

[data-theme="dark"] {
  --shell-surround: #0C0A08;
}

html,
body {
  height: 100%;
  /* The column owns the scroll, so the window never gets a scrollbar and
     100vw stays equal to the visible width. */
  overflow: hidden;
  background: var(--shell-surround);
}

.app-shell {
  position: relative;
  width: 100%;
  max-width: var(--shell-width);
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  background: var(--bg-page);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 18px 60px rgba(0, 0, 0, 0.10);
}

/* One scroll container for the whole app. Its box stops at the tab bar, so a
   sticky footer inside it lands above the bar instead of behind it. */
.main-content {
  height: calc(100% - var(--bottomnav-height) - env(safe-area-inset-bottom));
  min-height: 0;
  padding-top: var(--topbar-height);
  padding-bottom: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* Fixed chrome, pinned to the column rather than the window. */
.topbar,
.bottom-nav,
.modal-overlay {
  left: var(--shell-inset);
  right: var(--shell-inset);
}

.topbar {
  padding: 0 14px;
}

.topbar-brand {
  min-width: 0;
  margin-right: auto;
  gap: 8px;
}

.topbar-account {
  gap: 8px;
}

.topbar-signin {
  height: 32px;
  padding: 0 13px;
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  z-index: 90;
  display: flex;
  height: calc(var(--bottomnav-height) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--bg);
  border-top: 1px solid var(--border);
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  padding: 0 2px;
  text-decoration: none;
  color: var(--text-tertiary);
  font-size: 10px;
  font-weight: 600;
}

.bottom-nav-item i {
  font-size: 21px;
  line-height: 1;
}

.bottom-nav-item span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bottom-nav-item:hover {
  color: var(--text-secondary);
}

.bottom-nav-item.active {
  color: var(--primary);
}

/* Toasts are centred on the column instead of pinned to a window corner. */
.toast,
.history-toast {
  left: 50%;
  right: auto;
  bottom: calc(var(--bottomnav-height) + 16px);
  transform: translateX(-50%);
  max-width: calc(var(--shell-width) - 32px);
  text-align: center;
}

/* Page shells stop managing their own height; the scroll lives one level up. */
.page-plain,
.auth-page,
.page-history,
.page-settings {
  height: auto;
  min-height: 0;
  overflow: visible;
}

.page-plain {
  padding: 22px 16px 40px;
}

.page-plain > * {
  max-width: none;
}

.auth-page {
  min-height: 0;
  padding: 32px 16px 40px;
}

.price-packages,
.pricing-columns,
.package-grid,
.stat-row,
.rate-grid {
  grid-template-columns: 1fr;
}

.stat-row {
  grid-template-columns: 1fr 1fr;
}

.admin-tabs {
  overflow-x: auto;
  scrollbar-width: none;
}

.admin-tabs::-webkit-scrollbar {
  display: none;
}

.admin-tab {
  white-space: nowrap;
}

.admin-row {
  flex-wrap: wrap;
}

.settings-row-3 {
  grid-template-columns: 1fr;
}

.price-table {
  min-width: 380px;
}/* ============================================================
   Home — template feed
   One template per screen, swiped vertically. The clip fills the whole
   viewport between the top bar and the tab bar; every label sits on top of it.
   ============================================================ */

/* On the feed the page itself must not scroll: the feed owns the scroll so
   snapping has a container to snap inside. */
.main-content-flush {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.home-feed {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scroll-snap-type: y mandatory;
  background: #000;
  scrollbar-width: none;
}

.home-feed::-webkit-scrollbar {
  display: none;
}

.feed-slide {
  position: relative;
  height: 100%;
  scroll-snap-align: start;
  /* Never skip past a template when the swipe carries momentum. */
  scroll-snap-stop: always;
  overflow: hidden;
  background: #000;
}

.feed-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.feed-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #151515;
  color: rgba(255, 255, 255, 0.35);
}

.feed-placeholder i {
  font-size: 44px;
}

.feed-placeholder span {
  font-size: 12px;
  letter-spacing: 0.02em;
}

.feed-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.35) 34%, rgba(0, 0, 0, 0) 62%);
  pointer-events: none;
}

/* Caption ---------------------------------------------------------------- */

.feed-body {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0 16px 22px;
}

.feed-category {
  display: inline-block;
  margin-bottom: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.feed-title {
  font-size: 27px;
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
}

.feed-tagline {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.82);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.4);
}

.feed-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 46px;
  margin-top: 16px;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
}

.feed-cta:active {
  transform: scale(0.985);
}

.feed-cta i {
  font-size: 17px;
}

/* Right rail ------------------------------------------------------------- */

.feed-sound {
  position: absolute;
  right: 14px;
  bottom: 178px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 19px;
  cursor: pointer;
}

.feed-sound.is-on {
  background: var(--primary);
}

/* Position rail ---------------------------------------------------------- */

.feed-dots {
  position: absolute;
  top: 50%;
  right: 7px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transform: translateY(-50%);
  pointer-events: none;
}

.feed-dot {
  width: 3px;
  height: 12px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.28);
  transition: background 0.2s ease, height 0.2s ease;
}

.feed-dot.is-current {
  height: 20px;
  background: #fff;
}

/* Swipe hint ------------------------------------------------------------- */

.feed-hint {
  position: absolute;
  left: 50%;
  bottom: 128px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(6px);
  color: rgba(255, 255, 255, 0.9);
  font-size: 11px;
  font-weight: 600;
  transform: translateX(-50%);
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.feed-hint i {
  font-size: 14px;
  animation: feed-hint-bob 1.6s ease-in-out infinite;
}

.feed-hint.is-gone {
  opacity: 0;
}

@keyframes feed-hint-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@media (prefers-reduced-motion: reduce) {
  .feed-hint i {
    animation: none;
  }
}

/* Closing slide ---------------------------------------------------------- */

.feed-slide-blank {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 0 28px;
  background: var(--bg-page);
  text-align: center;
}

.feed-slide-blank i {
  font-size: 34px;
  color: var(--text-tertiary);
}

.feed-slide-blank h2 {
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
}

.feed-slide-blank p {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ============================================================
   Creator avatar generation
   ============================================================ */

.ugc-step-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar-gen-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.avatar-gen-switch i {
  font-size: 14px;
}

.spin {
  display: inline-block;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .spin {
    animation-duration: 2.4s;
  }
}

/* ============================================================
   Character builder page
   ============================================================ */

.char-page {
  padding: 16px 16px 40px;
}

.char-crumbs {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 20px;
  font-size: 12px;
  color: var(--text-tertiary);
}

.char-crumb {
  color: var(--text-tertiary);
  text-decoration: none;
}

a.char-crumb:hover {
  color: var(--text-secondary);
}

.char-crumb.is-current {
  color: var(--text);
  font-weight: 600;
}

.char-field {
  margin-bottom: 20px;
}

.char-label {
  margin-bottom: 9px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

/* Gender ----------------------------------------------------------------- */

.char-segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--surface);
  border: var(--border-w) solid var(--border);
}

.char-segment {
  padding: 11px 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.char-segment.is-active {
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Chips ------------------------------------------------------------------ */

.char-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.char-chip {
  padding: 8px 14px;
  border: var(--border-w) solid var(--border);
  border-radius: 9px;
  background: var(--bg);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.char-chip:hover {
  border-color: var(--border-strong);
}

.char-chip.is-active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--tint-soft);
}

.char-custom {
  margin-top: 8px;
}

/* Age -------------------------------------------------------------------- */

.char-age-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.char-age-value {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.char-slider {
  width: 100%;
  margin: 6px 0 2px;
  accent-color: var(--primary);
}

.char-age-scale {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-tertiary);
}

/* Accordions ------------------------------------------------------------- */

.char-accordions {
  margin-bottom: 20px;
  border: var(--border-w) solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg);
}

.char-accordion + .char-accordion {
  border-top: var(--border-w) solid var(--border);
}

.char-accordion > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  list-style: none;
}

.char-accordion > summary::-webkit-details-marker {
  display: none;
}

.char-accordion > summary i {
  color: var(--text-tertiary);
  transition: transform 0.2s ease;
}

.char-accordion[open] > summary i {
  transform: rotate(180deg);
}

.char-accordion-body {
  padding: 0 14px 15px;
}

/* Submit ----------------------------------------------------------------- */

.char-submit {
  width: 100%;
  height: 54px;
  gap: 8px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
}

.char-submit i {
  font-size: 19px;
}

.char-note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-tertiary);
}

.char-note i {
  flex: none;
  margin-top: 1px;
  font-size: 14px;
}

/* Gallery ---------------------------------------------------------------- */

.char-gallery {
  margin-top: 28px;
}

.char-gallery-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.char-gallery-head h2 {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text);
}

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

.char-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  aspect-ratio: 3 / 4;
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  color: var(--text-tertiary);
}

.char-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.char-card i {
  font-size: 20px;
}

.char-card > span {
  font-size: 10px;
  font-weight: 600;
}

.char-card.is-failed {
  color: var(--danger);
}

.char-card figcaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px 7px 6px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0));
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* A placeholder or failed card has no picture to darken behind its caption. */
.char-card.is-generating figcaption,
.char-card.is-failed figcaption {
  background: none;
  color: var(--text-tertiary);
}

/* The empty state spans the whole grid rather than sitting in one cell. */
.char-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 40px 20px;
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  text-align: center;
}

.char-empty i {
  margin-bottom: 4px;
  font-size: 30px;
  color: var(--text-tertiary);
}

.char-empty strong {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.char-empty span {
  font-size: 13px;
  color: var(--text-secondary);
}

.char-empty .btn {
  margin-top: 8px;
}

.char-foot {
  margin-top: 26px;
  font-size: 13px;
  text-align: center;
  color: var(--text-secondary);
}

.char-foot a {
  color: var(--primary);
  font-weight: 600;
}

/* ============================================================
   Sharing a finished video as a template
   ============================================================ */

.share-offer {
  margin-top: 12px;
  padding: 12px;
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  background: var(--tint-paper);
}

.share-offer-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text);
}

.share-offer-head i {
  font-size: 16px;
  color: var(--primary);
}

.share-offer-body {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* The clip becomes public, so that has to be said before the button, not
   discovered afterwards. */
.share-offer-warn {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  margin-top: 8px;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-secondary);
}

.share-offer-warn i {
  flex: none;
  margin-top: 1px;
  font-size: 13px;
  color: var(--text-tertiary);
}

.share-offer-title,
.share-offer-tagline {
  margin-top: 8px;
  font-size: 13px;
}

.share-offer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.share-offer.is-sent {
  border-color: var(--primary);
}

/* Community templates in the feed ---------------------------------------- */

.feed-author {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.78);
}

.feed-author i {
  font-size: 14px;
}

/* Admin review ----------------------------------------------------------- */

.template-review {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 12px;
  padding: 12px;
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.template-review + .template-review {
  margin-top: 10px;
}

.template-review video {
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: #000;
}

.template-review-main h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.template-review-meta {
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-tertiary);
}

.template-review-preset {
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-secondary);
  word-break: break-word;
}

.template-review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

/* ============================================================
   Prompt interstitial
   Sits between pressing Generate Prompt and the prompt appearing. The ad is
   on screen during the wait and nothing asks for it to be engaged with.
   ============================================================ */

.prompt-gate {
  padding: 18px 14px 22px;
}

.prompt-gate-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px 14px;
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  text-align: center;
}

.prompt-gate-card h2 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.prompt-gate-note {
  font-size: 13px;
  color: var(--text-secondary);
}

.prompt-gate-note span {
  font-weight: 700;
  color: var(--text);
}

.prompt-gate-ad {
  width: 100%;
  min-height: 250px;
  margin: 4px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.prompt-gate-ad ins.adsbygoogle {
  width: 100%;
}

.prompt-gate-btn {
  width: 100%;
  max-width: 260px;
}

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

/* ============================================================
   Public template pages
   The one part of the app meant to be found from a search engine, so it reads
   as a page about a style rather than as another tool screen.
   ============================================================ */

.tpl-page-head {
  margin-bottom: 18px;
}

.tpl-page-head h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.tpl-page-head p {
  margin-top: 5px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.tpl-page-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 40px 20px;
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  text-align: center;
}

.tpl-page-empty i {
  font-size: 30px;
  color: var(--text-tertiary);
}

.tpl-page-empty strong {
  font-size: 15px;
  color: var(--text);
}

.tpl-page-empty span {
  font-size: 13px;
  color: var(--text-secondary);
}

.tpl-page-empty .btn {
  margin-top: 8px;
}

/* Index ------------------------------------------------------------------ */

.tpl-index-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.tpl-index-card {
  display: flex;
  flex-direction: column;
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.tpl-index-card:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 122, 95, 0.08);
}

.tpl-index-media {
  position: relative;
  aspect-ratio: 9 / 16;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.3);
  font-size: 26px;
}

.tpl-index-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tpl-index-body {
  padding: 10px;
}

.tpl-index-body h2 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.tpl-index-body p {
  margin-top: 3px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-secondary);
}

.tpl-index-meta {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-tertiary);
}

/* Detail ----------------------------------------------------------------- */

.tpl-detail-media {
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
}

.tpl-detail-media video {
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  display: block;
}

.tpl-detail-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 9 / 16;
  color: rgba(255, 255, 255, 0.3);
  font-size: 40px;
}

.tpl-detail-body {
  padding-top: 16px;
}

.tpl-detail-body h1 {
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.tpl-detail-lead {
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.tpl-detail-by {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-tertiary);
}

.tpl-detail-by i {
  font-size: 15px;
}

.tpl-detail-by strong {
  color: var(--text-secondary);
}

.tpl-detail-cta {
  width: 100%;
  height: 48px;
  gap: 6px;
  margin-top: 16px;
  border-radius: 12px;
  font-size: 15px;
}

.tpl-detail-note {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-tertiary);
  text-align: center;
}

.tpl-detail-subtitle {
  margin: 24px 0 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.tpl-detail-specs > div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

.tpl-detail-specs > div:last-child {
  border-bottom: 0;
}

.tpl-detail-specs dt {
  flex: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
}

.tpl-detail-specs dd {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text);
  text-align: right;
}

.tpl-detail-foot {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.tpl-detail-foot p {
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--text-secondary);
}

.feed-slide-link {
  margin-top: 2px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* The author line on a community slide leads to that template's own page. */
a.feed-author {
  position: relative;
  z-index: 2;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ============================================================
   Navigation progress
   Every page change is a full load, so the browser shows nothing between the
   click and the next paint. This is what fills that gap.
   ============================================================ */

.nav-progress {
  position: fixed;
  top: 0;
  left: var(--shell-inset);
  right: var(--shell-inset);
  height: 3px;
  z-index: 200;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.nav-progress.is-active {
  opacity: 1;
}

.nav-progress span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--primary);
  transform: translateX(-100%);
}

/* Indeterminate: how long the server takes is unknown, so the bar reports
   that something is happening rather than pretending to know how far along. */
.nav-progress.is-active span {
  animation: nav-progress-slide 1.1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes nav-progress-slide {
  0% { transform: translateX(-100%); }
  60% { transform: translateX(0); }
  100% { transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) {
  .nav-progress.is-active span {
    animation: none;
    transform: translateX(0);
    opacity: 0.6;
  }
}

/* ============================================================
   Legal pages and the footer that links to them
   ============================================================ */

.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px 16px 26px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-tertiary);
}

.site-footer a {
  color: var(--text-secondary);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.legal-page {
  max-width: 720px;
}

.legal-page h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.legal-updated {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-tertiary);
}

.legal-lead {
  margin-top: 14px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.legal-page h2 {
  margin: 28px 0 8px;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.legal-page h3 {
  margin: 18px 0 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.legal-page p {
  margin-bottom: 10px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-secondary);
}

.legal-page strong {
  color: var(--text);
}

.legal-page ul {
  margin: 0 0 12px 18px;
}

.legal-page li {
  margin-bottom: 6px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.legal-page a {
  color: var(--primary);
}

.legal-page code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
}

/* Wide on purpose, so it scrolls inside itself instead of the page. */
.legal-table {
  width: 100%;
  margin: 10px 0 14px;
  border-collapse: collapse;
  display: block;
  overflow-x: auto;
}

.legal-table th,
.legal-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  line-height: 1.55;
  text-align: left;
  vertical-align: top;
}

.legal-table th {
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.legal-table td {
  color: var(--text-secondary);
}

.legal-foot {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
