:root {
  --bg: #14151a;
  --surface: #20222b;
  --surface-strong: #2b2e38;
  --line: #3c414d;
  --text: #f4f5f7;
  --muted: #aeb4c0;
  --accent: #28d17c;
  --accent-strong: #1fb86b;
  --rose: #ec4f92;
  --blue: #53a7ff;
  --warning: #f0b84c;
  --danger: #ff6a6a;
  --radius: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

.site-footer {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 22px 0 8px;
  font-size: 13px;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--text);
}

button,
input,
textarea {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.site-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.input-panel {
  position: sticky;
  top: 24px;
  padding: 22px;
}

.result-panel {
  min-height: 560px;
  padding: 18px;
}

.topline,
.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 30px;
}

h2 {
  font-size: 22px;
}

.status-stack {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.language-switch {
  display: flex;
  gap: 4px;
}

.language-switch button {
  min-width: 34px;
  height: 28px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #171922;
  color: var(--muted);
  cursor: pointer;
}

.language-switch button[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

.account-button {
  min-height: 34px;
  max-width: 148px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #171922;
  color: var(--text);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-panel {
  margin: 0 0 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #181b23;
}

.account-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border-radius: var(--radius);
  background: #11131a;
}

.account-tabs button {
  height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.account-tabs button.active {
  background: var(--surface-strong);
  color: var(--text);
}

.account-actions {
  display: grid;
  grid-template-columns: 1fr 90px;
  gap: 10px;
  margin-top: 14px;
}

.account-message {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.account-message.ok {
  color: #8df0ba;
}

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

.api-settings {
  margin: 0 0 18px;
}

.api-settings summary {
  width: fit-content;
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
}

.api-settings .api-row {
  margin-top: 8px;
}

.debug-status {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.debug-status.ok {
  color: #8df0ba;
}

.debug-status.error {
  color: #ff9b9b;
}

.field-label {
  display: block;
  margin: 18px 0 8px;
  color: var(--muted);
  font-size: 13px;
}

.api-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 8px;
}

.input,
.textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #171922;
  color: var(--text);
  outline: none;
}

.input {
  height: 44px;
  padding: 0 12px;
}

.textarea {
  min-height: 210px;
  resize: vertical;
  padding: 12px;
  line-height: 1.55;
}

.input:focus,
.textarea:focus {
  border-color: var(--blue);
}

.actions {
  display: grid;
  grid-template-columns: 1fr 90px;
  gap: 10px;
  margin-top: 16px;
}

.primary-button,
.secondary-button,
.icon-button,
.download-link {
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
}

.primary-button {
  height: 48px;
  background: var(--accent);
  color: #0b2f1d;
  font-weight: 700;
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.secondary-button,
.icon-button {
  background: var(--surface-strong);
  color: var(--text);
}

.secondary-button {
  height: 48px;
}

.secondary-button.small {
  width: 86px;
  height: 36px;
  font-size: 13px;
}

.icon-button {
  height: 44px;
}

.progress {
  height: 3px;
  margin-top: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: #151820;
  opacity: 0;
}

.progress.active {
  opacity: 1;
}

.progress-inner {
  width: 42%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--rose), var(--blue));
  animation: progress 1.1s ease-in-out infinite;
}

@keyframes progress {
  0% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(250%);
  }
}

.empty-state {
  min-height: 520px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
  color: var(--muted);
}

.empty-mark {
  width: 92px;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(40, 209, 124, 0.16), rgba(83, 167, 255, 0.12)),
    var(--surface-strong);
}

.hidden {
  display: none;
}

.text-output {
  max-height: 220px;
  overflow: auto;
  margin: 0 0 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #171922;
  color: var(--text);
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.media-item {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #181b23;
}

.preview {
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  background: #101219;
  color: var(--muted);
}

.preview img,
.preview video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #101219;
}

.media-body {
  padding: 12px;
}

.media-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.format-count {
  color: var(--muted);
  font-size: 13px;
}

.format-list {
  display: grid;
  gap: 8px;
}

.download-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 8px 10px;
  background: var(--surface-strong);
  color: var(--text);
  font-size: 13px;
}

.download-link span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.download-link em {
  color: var(--muted);
  font-style: normal;
}

.notice {
  margin: 0 0 16px;
  padding: 11px 12px;
  border-radius: var(--radius);
  border: 1px solid rgba(240, 184, 76, 0.38);
  background: rgba(240, 184, 76, 0.12);
  color: #f7d99c;
}

@media (max-width: 820px) {
  .shell {
    width: min(100vw - 20px, 680px);
    padding: 16px 0;
  }

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

  .input-panel {
    position: static;
  }

  .topline {
    align-items: start;
  }

  .status-stack {
    min-width: 96px;
  }
}
