:root {
  color-scheme: light;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: #f5f5f7;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #f5f5f7;
  color: #111827;
  display: flex;
  flex-direction: column;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 1.5rem;
  padding: 1.2rem clamp(1.5rem, 4vw, 3rem);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  position: sticky;
  top: 0;
  z-index: 20;
}

.top-bar__left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex: 1 1 auto;
  min-width: 0;
}

.top-bar__center {
  display: flex;
  justify-content: center;
  min-width: 0;
}

.top-bar__title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(55, 65, 81, 0.75);
}

.top-bar__right {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
}

.top-bar__actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: nowrap;
}

.top-bar__balance {
  display: none;
  align-items: center;
  gap: 0.65rem;
  padding-right: 0.65rem;
  border-right: 1px solid rgba(15, 23, 42, 0.12);
}

.top-bar-balance-amount {
  font-weight: 600;
  color: #0f172a;
  letter-spacing: 0.01em;
  min-width: 4.25rem;
  text-align: right;
}

.avatar-button {
  appearance: none;
  border: none;
  background: transparent;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 999px;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.avatar-button:hover {
  transform: translateY(-1px);
}

.avatar-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.28);
}

.avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5, #0f172a);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  box-shadow: 0 12px 28px rgba(79, 70, 229, 0.25);
}

.avatar-image {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
}

.top-bar-button {
  appearance: none;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.6);
  color: #111827;
  border-radius: 999px;
  padding: 0.45rem 1.2rem;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}

.top-bar-button:hover {
  background: rgba(17, 24, 39, 0.08);
}

.top-bar-button:focus-visible {
  outline: 3px solid rgba(59, 130, 246, 0.45);
  outline-offset: 2px;
}

.top-bar-button.ghost {
  border-radius: 999px;
}

.top-bar__logo {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: #0f172a;
  flex: 1 1 auto;
  min-width: 0;
}

.logo-text {
  display: inline-flex;
  align-items: center;
  font-size: clamp(0.9rem, 2.4vw, 1.05rem);
  letter-spacing: 0.08em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  max-width: 100%;
}

.logo-mark {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  background: linear-gradient(140deg, #111827, #6366f1);
  position: relative;
}

.logo-mark::after {
  content: '';
  position: absolute;
  inset: 0.4rem;
  border-radius: 50%;
  background: #f5f5f7;
  opacity: 0.9;
}

.logo-text {
  white-space: nowrap;
}

main.page {
  width: min(1080px, 100%);
  margin: 3rem auto 4rem;
  padding: 0 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.hero {
  text-align: center;
  margin-top: 1rem;
}

.brand {
  font-size: clamp(2.75rem, 4vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  color: #0f172a;
}

.tagline {
  color: rgba(55, 65, 81, 0.85);
  margin: 0.6rem 0 0;
  font-size: 1.05rem;
}

.generator {
  display: block;
}

.generator-card {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 24px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  padding: 1.8rem 2rem;
  box-shadow: 0 26px 52px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  width: 100%;
}

.prompt {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.prompt-label {
  font-weight: 600;
  color: #111827;
  font-size: clamp(0.88rem, 2.4vw, 1rem);
  line-height: 1.4;
}

.prompt-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.prompt input {
  flex: 1;
  min-width: 220px;
  font-size: clamp(0.95rem, 4vw, 1.15rem);
  padding: 0.85rem 1.1rem;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.prompt input:focus {
  outline: none;
  border-color: rgba(99, 102, 241, 0.65);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18);
}

.prompt button {
  appearance: none;
  border: none;
  background: linear-gradient(135deg, #111827, #6366f1);
  color: #ffffff;
  border-radius: 16px;
  padding: 0.85rem 1.8rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 22px 38px rgba(17, 24, 39, 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.prompt button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 28px 48px rgba(17, 24, 39, 0.3);
}

.prompt button:disabled {
  background: rgba(148, 163, 184, 0.6);
  box-shadow: none;
  cursor: wait;
}

.prompt-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
  padding: 0.25rem 0 0;
}

.prompt-option {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: rgba(55, 65, 81, 0.85);
}

.prompt-option__label {
  font-weight: 600;
  color: rgba(30, 41, 59, 0.85);
}

.prompt-option select {
  appearance: none;
  padding: 0.65rem 0.9rem;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(255, 255, 255, 0.95);
  font-size: 0.95rem;
  color: #0f172a;
}

.prompt-option select:focus {
  outline: none;
  border-color: rgba(99, 102, 241, 0.65);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.generator-locked {
  border-radius: 16px;
  border: 1px dashed rgba(99, 102, 241, 0.45);
  background: rgba(99, 102, 241, 0.08);
  color: #3730a3;
  padding: 0.9rem 1.1rem;
  font-size: 0.95rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

#generator-locked-message {
  flex: 1 1 auto;
}

.channel-status {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.status-label {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(100, 116, 139, 0.85);
}

.status-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.auth-channel {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 16px;
  background: rgba(79, 70, 229, 0.08);
}

.auth-channel-avatar {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 10px 22px rgba(79, 70, 229, 0.25);
}

.auth-channel-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.auth-channel-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(79, 70, 229, 0.75);
}

.auth-channel-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: #1f2937;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}

.badge-neutral {
  background: rgba(100, 116, 139, 0.16);
  color: #475569;
}

.badge-success {
  background: rgba(34, 197, 94, 0.18);
  color: #047857;
}

.badge-info {
  background: rgba(99, 102, 241, 0.18);
  color: #4338ca;
}

.badge-error {
  background: rgba(239, 68, 68, 0.18);
  color: #b91c1c;
}

.badge-warning {
  background: rgba(245, 158, 11, 0.18);
  color: #b45309;
}

.ghost {
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(255, 255, 255, 0.7);
  color: #111827;
  border-radius: 999px;
  padding: 0.45rem 1.1rem;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.ghost:hover {
  background: rgba(226, 232, 240, 0.6);
}

.button-spinner {
  width: 1rem;
  height: 1rem;
  display: inline-block;
  border-radius: 999px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-right-color: currentColor;
  animation: button-spinner-rotate 0.75s linear infinite;
  flex-shrink: 0;
}

@keyframes button-spinner-rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.hint {
  margin: 0;
  font-size: 0.9rem;
  color: rgba(55, 65, 81, 0.75);
}

.mode-panels {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.mode-panel {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 24px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  padding: 1.8rem 2rem;
  box-shadow: 0 26px 52px rgba(15, 23, 42, 0.06);
}

.panel-card {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.panel-card h3 {
  margin: 0;
  font-size: 1.35rem;
  color: #0f172a;
}

.panel-card p {
  margin: 0;
  color: rgba(55, 65, 81, 0.85);
  line-height: 1.55;
}

.panel-list {
  margin: 0;
  padding-left: 1.25rem;
  color: rgba(55, 65, 81, 0.85);
  line-height: 1.5;
}

.panel-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.panel-actions button,
#account-open-billing {
  appearance: none;
  border: none;
  background: linear-gradient(135deg, #111827, #4f46e5);
  color: #ffffff;
  border-radius: 999px;
  padding: 0.75rem 1.6rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.panel-actions button:hover,
#account-open-billing:hover {
  transform: translateY(-1px);
  box-shadow: 0 24px 44px rgba(15, 23, 42, 0.3);
}

.panel-note {
  margin: 0;
  font-size: 0.9rem;
  color: rgba(55, 65, 81, 0.75);
}

.config-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.config-field,
.config-subfield {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: #0f172a;
}

.config-field input,
.config-subfield input {
  padding: 0.75rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(255, 255, 255, 0.95);
  font-size: 0.95rem;
}

.config-field input:focus,
.config-subfield input:focus {
  outline: none;
  border-color: rgba(79, 70, 229, 0.6);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.16);
}

.config-field--stack {
  grid-column: 1 / -1;
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 18px;
  padding: 1rem 1.1rem;
  gap: 0.75rem;
}

.config-field--stack legend {
  font-weight: 600;
  color: #0f172a;
}

.config-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.config-actions .link-button {
  align-self: flex-start;
  padding: 0;
}

.config-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.config-buttons button {
  appearance: none;
  border-radius: 999px;
  padding: 0.6rem 1.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(255, 255, 255, 0.9);
  color: #0f172a;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.config-buttons button:hover {
  background: rgba(226, 232, 240, 0.7);
}

.config-buttons .primary {
  border: none;
  background: linear-gradient(135deg, #111827, #6366f1);
  color: #ffffff;
  box-shadow: 0 20px 36px rgba(17, 24, 39, 0.25);
}

.config-buttons .primary:hover {
  background: linear-gradient(135deg, #111827, #4f46e5);
}

.config-buttons .primary:disabled {
  opacity: 0.6;
  box-shadow: none;
  cursor: not-allowed;
}

.config-buttons .ghost {
  border-color: rgba(148, 163, 184, 0.4);
}

.config-status {
  margin: 0;
  font-size: 0.9rem;
  color: rgba(55, 65, 81, 0.75);
}

.history,
.progress,
.logs {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 24px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  padding: 1.75rem 2rem;
  box-shadow: 0 26px 52px rgba(15, 23, 42, 0.06);
}

.progress-meter {
  display: grid;
  gap: 0.5rem;
  margin: 0.75rem 0 1.4rem;
}

.progress-meter__track {
  position: relative;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.24);
  overflow: hidden;
}

.progress-meter__bar {
  position: absolute;
  inset: 0;
  transform-origin: left center;
  transform: scaleX(0);
  border-radius: inherit;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  transition: transform 0.25s ease;
}

.progress-meter__label {
  font-size: 0.9rem;
  font-weight: 500;
  color: rgba(30, 41, 59, 0.75);
  overflow-wrap: anywhere;
}

.history-list {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.history-body {
  margin-top: 1rem;
}

.history.collapsed .history-body {
  margin-top: 0;
}

.history-empty {
  margin: 0.5rem 0 0;
  color: rgba(55, 65, 81, 0.7);
  font-size: 0.95rem;
}

.history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(176px, 220px);
  gap: 1.2rem;
  padding: 0.9rem 1rem;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(248, 250, 252, 0.95);
  align-items: flex-start;
}

.history-details {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-width: 0;
}

.history-thumb {
  position: relative;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(226, 232, 240, 0.7);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.35);
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.history-thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.15), transparent 45%);
  pointer-events: none;
  z-index: 1;
}

.history-thumb-link {
  position: absolute;
  inset: 0;
  display: block;
  text-decoration: none;
  border: none;
  color: inherit;
  z-index: 2;
}

.history-thumb-link:focus-visible {
  outline: 3px solid rgba(79, 70, 229, 0.6);
  outline-offset: 2px;
}

.history-thumb-placeholder {
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(71, 85, 105, 0.8);
  text-align: center;
  padding: 0.5rem;
  position: relative;
  z-index: 2;
}

.history-item.is-active {
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.history-item.status-complete {
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(236, 253, 245, 0.8);
}

.history-item.status-error {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(254, 226, 226, 0.75);
}

.history-error {
  overflow-wrap: anywhere;
}

.history-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  overflow-wrap: anywhere;
  min-width: 0;
}

.history-topic {
  font-weight: 500;
  color: rgba(71, 85, 105, 0.85);
  overflow-wrap: anywhere;
}

.history-title {
  font-weight: 700;
  font-size: 1rem;
  color: #0f172a;
  overflow-wrap: anywhere;
}

.history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.85rem;
  color: rgba(55, 65, 81, 0.7);
  overflow-wrap: anywhere;
}

.history-stage {
  flex: 1 1 100%;
  overflow-wrap: anywhere;
}

.history-updated {
  font-size: 0.75rem;
  color: rgba(100, 116, 139, 0.75);
}

.history-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.5rem;
  min-width: 0;
  margin-top: auto;
}

.history-prompt {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-size: 0.88rem;
  color: rgba(30, 41, 59, 0.75);
}

.history-prompt-label {
  font-weight: 600;
  color: rgba(15, 23, 42, 0.75);
}

.history-prompt-text {
  overflow-wrap: anywhere;
}

.history-resume {
  border: 1px solid rgba(99, 102, 241, 0.45);
  background: rgba(99, 102, 241, 0.1);
  color: #3730a3;
  border-radius: 999px;
  padding: 0.5rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.history-resume:hover:not(:disabled) {
  background: rgba(99, 102, 241, 0.16);
  color: #312e81;
}

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

.back-button {
  margin: 0 auto;
  border: none;
  background: rgba(17, 24, 39, 0.85);
  color: #ffffff;
  padding: 0.65rem 1.8rem;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.progress-header .ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.progress-header .ghost[aria-busy='true'] {
  cursor: wait;
}

.cancel-label--pending {
  font-weight: 600;
  color: rgba(30, 41, 59, 0.85);
}

.progress-header h2,
.section-header h2 {
  margin: 0;
  color: #0f172a;
}

.stages {
  list-style: none;
  margin: 1.2rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.stage-item {
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 18px;
  padding: 1rem 1.1rem;
  background: rgba(248, 250, 252, 0.9);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 260px);
  gap: 0.75rem;
}

.stage-main {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  overflow-wrap: anywhere;
}

.stage-label {
  font-weight: 600;
  color: #0f172a;
}

.stage-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  overflow-wrap: anywhere;
}

.stage-status {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(71, 85, 105, 0.9);
  overflow-wrap: anywhere;
  word-break: break-word;
  text-align: right;
}

.stage-downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.stage-download {
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  font-size: 0.85rem;
  color: #0f172a;
  text-decoration: none;
}

.stage-item.complete {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(236, 253, 245, 0.85);
}

.stage-item.error {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(254, 226, 226, 0.75);
}

.stage-item.warning {
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(254, 243, 199, 0.75);
}

.stage-item.in-progress {
  border-color: rgba(99, 102, 241, 0.45);
}

.stage-item.skipped {
  opacity: 0.7;
}

.stage-detail {
  grid-column: 1 / -1;
  background: rgba(254, 226, 226, 0.7);
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  color: #b91c1c;
  overflow-wrap: anywhere;
}

.stage-item.warning .stage-detail {
  background: rgba(253, 230, 138, 0.82);
  border-color: rgba(245, 158, 11, 0.45);
  color: #b45309;
}

.log-stream {
  max-height: 300px;
  overflow-y: auto;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 1rem;
}

.log-entry {
  background: rgba(243, 244, 246, 0.95);
  border-radius: 10px;
  padding: 0.55rem 0.8rem;
  color: #1f2937;
  overflow-wrap: anywhere;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.icon-button {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(255, 255, 255, 0.7);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.chevron {
  width: 0.6rem;
  height: 0.6rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

.logs:not(.collapsed) .chevron {
  transform: rotate(-135deg);
}

.logs.collapsed .log-stream {
  display: none;
}

.history.collapsed .history-body {
  display: none;
}

.history:not(.collapsed) .chevron {
  transform: rotate(-135deg);
}

.account {
  display: grid;
  gap: 1.5rem;
}

.account-card {
  background: transparent;
  border-radius: 24px;
  border: none;
  padding: 1.6rem 1.9rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.account-banner {
  background: rgba(239, 68, 68, 0.1);
  color: #b91c1c;
  border-radius: 16px;
  padding: 0.85rem 1rem;
  font-size: 0.95rem;
}

.account-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.account-form .field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.account-form label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #0f172a;
}

.account-form input {
  font-size: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(255, 255, 255, 0.95);
}

.account-form input:focus {
  outline: none;
  border-color: rgba(79, 70, 229, 0.6);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.16);
}

.account-form button {
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #111827, #4f46e5);
  color: #ffffff;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.9rem 1.4rem;
  cursor: pointer;
  box-shadow: 0 20px 38px rgba(17, 24, 39, 0.28);
}

.account-links {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.link-button {
  background: none;
  border: none;
  padding: 0;
  color: #4338ca;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: underline;
}

.account-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(100, 116, 139, 0.9);
}

.account-divider::before,
.account-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(148, 163, 184, 0.6);
}

.account-providers {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.provider-button {
  flex: 1;
  min-width: 140px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(248, 250, 252, 0.95);
  padding: 0.75rem 1rem;
  font-weight: 600;
  cursor: pointer;
}

.provider-google {
  border-color: rgba(234, 67, 53, 0.35);
}

.provider-apple {
  border-color: rgba(17, 24, 39, 0.35);
}

.account-test {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: rgba(59, 130, 246, 0.1);
  border: 1px dashed rgba(59, 130, 246, 0.4);
  border-radius: 16px;
  padding: 0.85rem 1rem;
}

.account-messages {
  min-height: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.account-message {
  margin: 0;
  font-size: 0.9rem;
}

.account-message.error {
  color: #b91c1c;
}

.account-message.success {
  color: #047857;
}

.account-summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.account-summary-actions {
  display: flex;
  gap: 0.75rem;
}

.account-summary-identity {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.1rem 0 0.4rem;
}

.account-summary-avatar .avatar,
.account-summary-avatar .avatar-image {
  width: 3.4rem;
  height: 3.4rem;
  box-shadow: 0 16px 32px rgba(79, 70, 229, 0.25);
}

.account-summary-names {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.account-summary-name {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  color: #0f172a;
}

.account-summary-email {
  margin: 0;
  color: rgba(55, 65, 81, 0.75);
  font-size: 0.95rem;
}

.account-summary-list {
  display: grid;
  gap: 0.75rem;
}

.account-summary-list div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.95rem;
}

.account-summary-list dt {
  font-weight: 600;
  color: #0f172a;
}

.account-summary-list dd {
  margin: 0;
  color: rgba(55, 65, 81, 0.9);
}

.account-plan {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin: 0.5rem 0 0;
}

.account-plan-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
}

.account-plan-label {
  font-weight: 600;
  color: rgba(55, 65, 81, 0.85);
}

.account-plan-value {
  font-weight: 500;
  color: rgba(17, 24, 39, 0.9);
}

.account-warning {
  margin: 0.25rem 0 0.5rem;
  color: #b45309;
  font-weight: 500;
}

.account-top-up {
  margin: 0.75rem 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.account-top-up-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.account-top-up-row label {
  font-weight: 600;
  color: rgba(55, 65, 81, 0.85);
}

.account-top-up-row select {
  min-width: 140px;
  border-radius: 0.75rem;
  border: 1px solid rgba(15, 23, 42, 0.1);
  padding: 0.45rem 0.75rem;
  font-size: 0.95rem;
}

.account-top-up-row button {
  appearance: none;
  border: none;
  border-radius: 0.75rem;
  padding: 0.5rem 1rem;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(120deg, #4f46e5, #6366f1);
  color: white;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.account-top-up-row button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(79, 70, 229, 0.22);
}

.account-top-up-status {
  margin: 0;
  color: rgba(55, 65, 81, 0.75);
}

.balance-warning {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 0.85rem;
  background: rgba(251, 191, 36, 0.18);
  color: #92400e;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  font-size: 0.95rem;
}

.balance-warning button {
  margin-left: auto;
  font-weight: 600;
}

@media (max-width: 640px) {
  .account-top-up-row {
    flex-direction: column;
    align-items: stretch;
  }

  .account-top-up-row label {
    display: block;
    width: 100%;
    margin-bottom: 0.25rem;
  }

  .account-top-up-row select,
  .account-top-up-row button {
    width: 100%;
  }

  .balance-warning {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .balance-warning button {
    margin-left: 0;
    width: 100%;
  }
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.account-summary-note,
#account-billing-message {
  margin: 0.25rem 0 0;
  color: rgba(55, 65, 81, 0.75);
  font-size: 0.9rem;
}

.dialog-panel--wide {
  width: min(1080px, calc(100vw - 2rem));
  max-width: min(1080px, calc(100vw - 2rem));
}

.dialog-panel--form {
  width: min(720px, calc(100vw - 2.5rem));
  max-width: min(720px, calc(100vw - 2.5rem));
}

.pricing {
  width: 100%;
  background: transparent;
  border-radius: 0;
  border: none;
  padding: 0;
  display: grid;
  gap: 2.2rem;
  color: #0f172a;
  box-shadow: none;
}

.api-dialog {
  width: 100%;
  background: transparent;
  border-radius: 0;
  border: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  color: #0f172a;
  box-shadow: none;
}

.api-dialog__subtitle {
  margin: 0;
  font-size: 0.95rem;
  color: rgba(55, 65, 81, 0.8);
}

.api-dialog__note {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: rgba(55, 65, 81, 0.9);
  background: #f8fafc;
  border-left: 3px solid rgba(79, 70, 229, 0.45);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  line-height: 1.5;
}

.api-dialog__confirm {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: rgba(17, 24, 39, 0.95);
  background: rgba(99, 102, 241, 0.14);
  border-left: 3px solid rgba(99, 102, 241, 0.55);
  border-radius: 12px;
  padding: 0.85rem 1rem;
}

.pricing-header {
  display: grid;
  gap: 0.8rem;
}

.pricing-status {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  font-size: 0.95rem;
  color: rgba(15, 23, 42, 0.7);
}

.pricing-status-label {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.75rem;
  color: rgba(15, 23, 42, 0.5);
}

.pricing-status-value {
  font-weight: 600;
  color: rgba(15, 23, 42, 0.82);
}

.pricing-subtitle {
  margin: 0;
  font-size: 0.95rem;
  color: rgba(15, 23, 42, 0.68);
  max-width: 52ch;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.8rem;
}

.pricing-card {
  background: rgba(248, 250, 252, 0.8);
  border-radius: 24px;
  border: 1px solid rgba(15, 23, 42, 0.06);
  padding: 1.7rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: relative;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.pricing-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.14);
}

.pricing-card--highlight {
  background: rgba(79, 70, 229, 0.08);
  border-color: rgba(79, 70, 229, 0.32);
}

.pricing-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.pricing-card h3 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: #0f172a;
}

.pricing-price {
  margin: 0.35rem 0 0;
  font-weight: 600;
  color: rgba(15, 23, 42, 0.65);
  font-size: 1.05rem;
}

.pricing-chip {
  display: none;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.1);
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(15, 23, 42, 0.8);
  white-space: nowrap;
}

.pricing-card.is-current {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(79, 70, 229, 0.4);
  box-shadow: 0 20px 42px rgba(79, 70, 229, 0.22);
}

.pricing-card--highlight.is-current {
  background: rgba(79, 70, 229, 0.12);
}

.pricing-card.is-current .pricing-chip {
  display: inline-flex;
}

.pricing-description {
  margin: 0;
  font-size: 0.95rem;
  color: rgba(15, 23, 42, 0.72);
}

.pricing-features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
  font-size: 0.9rem;
  color: rgba(15, 23, 42, 0.7);
}

.pricing-features li {
  position: relative;
  padding-left: 1.3rem;
}

.pricing-features li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: rgba(79, 70, 229, 0.9);
  font-weight: 700;
}

.pricing-cost {
  margin-top: 1.25rem;
  padding: 1rem;
  border-radius: 1.1rem;
  background: rgba(79, 70, 229, 0.08);
  border: 1px solid rgba(79, 70, 229, 0.18);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.pricing-cost h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #312e81;
}

.pricing-cost-per-minute,
#pricing-cost-per-minute {
  font-size: 1.05rem;
  font-weight: 600;
  color: #1e1b4b;
  margin: 0;
}

.pricing-cost dl {
  margin: 0;
  display: grid;
  gap: 0.35rem;
}

.pricing-cost dl div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.95rem;
}

.pricing-cost dt {
  font-weight: 600;
  color: rgba(30, 27, 75, 0.85);
}

.pricing-cost dd {
  margin: 0;
  color: rgba(30, 27, 75, 0.75);
}

.pricing-footnote {
  margin: 0;
  font-size: 0.85rem;
  color: rgba(30, 27, 75, 0.7);
}

.pricing-card button {
  margin-top: auto;
  border-radius: 14px;
  padding: 0.75rem 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pricing-card button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.25);
}

.pricing-card button:hover {
  transform: translateY(-2px);
}

.pricing-card[data-plan='free'] button {
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(255, 255, 255, 0.85);
  color: #0f172a;
}

.pricing-card[data-plan='free'] button:hover {
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
}

.pricing-card[data-plan='pro'] button {
  border: none;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #fff;
}

.pricing-card[data-plan='pro'] button:hover {
  box-shadow: 0 16px 28px rgba(79, 70, 229, 0.35);
}

.pricing-notice {
  margin: 0;
  font-size: 0.9rem;
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.1);
  border-radius: 14px;
  padding: 0.85rem 1rem;
}

.pricing-notice.hidden {
  display: none;
}

@media (min-width: 900px) {
  .pricing-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pricing {
    gap: 2.4rem;
  }

  .top-bar__balance {
    display: inline-flex;
  }
}

@media (max-width: 720px) {
  .pricing {
    gap: 1.8rem;
  }

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

  .api-dialog {
    gap: 1.35rem;
  }
}

@media (max-width: 480px) {
  .pricing-card {
    padding: 1.35rem;
  }
}

@media (max-width: 1024px) {
  .history-item {
    grid-template-columns: minmax(0, 1fr) minmax(132px, 184px);
  }
}

@media (max-width: 780px) {
  .top-bar {
    padding: 0.85rem clamp(0.9rem, 4vw, 1.2rem);
    flex-wrap: nowrap;
    gap: 0.6rem;
  }

  .top-bar__left {
    flex: 1 1 auto;
    min-width: 0;
  }

  .top-bar__logo {
    gap: 0.5rem;
  }

  .top-bar__right {
    margin-left: auto;
    width: auto;
    justify-content: flex-end;
    gap: 0.5rem;
  }

  .top-bar__actions {
    gap: 0.5rem;
    flex-wrap: nowrap;
  }

  .top-bar-button {
    padding: 0.4rem 0.85rem;
    font-size: 0.82rem;
  }

  .avatar,
  .avatar-image {
    width: 2.1rem;
    height: 2.1rem;
    font-size: 0.85rem;
  }

  main.page {
    padding: 0 1.2rem;
  }

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

  .history-item {
    grid-template-columns: minmax(0, 1fr);
  }

  .history-thumbnail {
    aspect-ratio: 16 / 9;
  }

  .history-meta {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

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

  .pricing-card {
    padding: 1.4rem;
  }
}

.dialog {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding: clamp(1.5rem, 6vh, 3rem) clamp(1rem, 4vw, 2.5rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  z-index: 40;
  min-height: 100vh;
  scrollbar-gutter: stable both-edges;
}

.dialog.hidden {
  display: none;
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(10px);
  width: 100vw;
  height: 100vh;
}

.dialog-panel {
  position: relative;
  width: min(560px, 100%);
  max-width: min(560px, 100%);
  background: #ffffff;
  border-radius: 24px;
  border: none;
  box-shadow: 0 32px 70px rgba(15, 23, 42, 0.28);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: clamp(1.75rem, 2.5vw, 2.4rem) clamp(1.5rem, 3vw, 2.75rem);
  color: #0f172a;
  overflow-wrap: anywhere;
}

.dialog-panel.dialog-panel--wide {
  max-width: min(1080px, calc(100vw - 2rem));
  width: min(1080px, calc(100vw - 2rem));
  padding: clamp(1.5rem, 2vw, 2.5rem) clamp(1.25rem, 3vw, 3rem);
}

.dialog-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(255, 255, 255, 0.92);
  color: #0f172a;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.dialog-close:hover {
  background: rgba(248, 250, 252, 0.95);
  border-color: rgba(15, 23, 42, 0.35);
}

.dialog-close-icon {
  font-size: 1.35rem;
  line-height: 1;
  font-weight: 600;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hidden {
  display: none !important;
}

@media (max-width: 780px) {
  .logo-mark {
    display: none;
  }

  .logo-text {
    font-size: 0.84rem;
    letter-spacing: 0.06em;
    max-width: 11.5rem;
  }

  .dialog {
    padding: 1.25rem clamp(0.75rem, 5vw, 1.25rem);
  }

  .dialog-panel {
    width: 100%;
    max-width: none;
    border-radius: 20px;
    padding: 1.5rem 1.25rem;
  }

  .dialog-panel.dialog-panel--wide {
    width: 100%;
    max-width: none;
    padding: 1.5rem 1.25rem;
  }

  .mode-panel,
  .generator-card,
  .history,
  .progress,
  .logs {
    padding: 1.35rem 1.4rem;
  }

  .history-item {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      'thumb'
      'main'
      'actions';
  }

  .history-actions {
    justify-content: flex-start;
    align-items: flex-start;
  }

  .stage-item {
    grid-template-columns: minmax(0, 1fr);
  }

  .stage-actions {
    align-items: flex-start;
  }

  .stage-status {
    text-align: left;
  }

  .stage-downloads {
    justify-content: flex-start;
  }
}

@media (max-width: 520px) {
  .top-bar {
    padding: 0.75rem clamp(0.75rem, 6vw, 1rem);
    gap: 0.45rem;
  }

  .top-bar__actions {
    gap: 0.4rem;
  }

  .top-bar__right {
    gap: 0.4rem;
  }

  .top-bar-button {
    padding: 0.32rem 0.7rem;
    font-size: 0.76rem;
  }

  .logo-text {
    max-width: 10.75rem;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
  }

  .prompt-row {
    gap: 0.75rem;
  }

  .prompt input {
    min-width: 0;
  }

  .dialog {
    padding: 1rem 0.5rem;
  }

  .dialog-panel {
    margin-top: 2rem;
    padding: 1.3rem 1.1rem;
  }

  .logo-mark {
    display: none;
  }

  .avatar,
  .avatar-image {
    width: 1.9rem;
    height: 1.9rem;
    font-size: 0.8rem;
  }

  .pricing,
  .api-dialog {
    padding: 0;
  }
}

body.modal-open {
  overflow: hidden;
}
