:root {
  color-scheme: light;
  --bg: #eef2f0;
  --ink: #15211d;
  --muted: #63716b;
  --line: #d5ddd8;
  --panel: #ffffff;
  --primary: #176b58;
  --primary-dark: #105142;
  --accent: #d89a2b;
  --blue: #315f97;
  --danger: #b84b44;
  --shadow: 0 24px 70px rgba(25, 39, 34, 0.16);
  font-family: Inter, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(23, 107, 88, 0.14), transparent 34%),
    linear-gradient(315deg, rgba(216, 154, 43, 0.18), transparent 34%),
    var(--bg);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

.hidden {
  display: none !important;
}

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

.shell {
  width: min(1120px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(360px, 0.76fr);
  align-items: center;
  gap: 28px;
  padding: 42px 0;
}

.brand-panel {
  display: grid;
  gap: 28px;
  padding: 16px 18px 16px 0;
}

.back-to-site {
  width: fit-content;
  color: var(--primary);
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
}

.back-to-site:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.brand-mark {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark.small {
  width: 44px;
  height: 44px;
  font-size: 18px;
}

.eyebrow,
.panel-heading p {
  margin: 0 0 10px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  max-width: 700px;
  font-size: clamp(42px, 7vw, 76px);
  line-height: 0.98;
}

h2 {
  font-size: 28px;
  line-height: 1.2;
}

.intro {
  max-width: 620px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.8;
}

.tool-preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  max-width: 620px;
}

.tool-preview span {
  min-height: 54px;
  display: flex;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid rgba(21, 33, 29, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  color: #26342f;
  font-size: 14px;
  font-weight: 700;
}

.auth-panel {
  width: 100%;
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5f7f6;
}

.tab {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.tab.active {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 6px 18px rgba(25, 39, 34, 0.1);
}

.panel-heading {
  margin: 28px 0 22px;
}

.auth-form {
  display: none;
  gap: 16px;
}

.auth-form.active {
  display: grid;
}

label {
  display: grid;
  gap: 8px;
  color: #304039;
  font-size: 14px;
  font-weight: 800;
}

input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  background: #fbfcfb;
  color: var(--ink);
  outline: none;
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(23, 107, 88, 0.14);
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 52px;
}

.icon-button {
  position: absolute;
  top: 50%;
  right: 8px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  transform: translateY(-50%);
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.icon-button:hover {
  background: #eef3f0;
  color: var(--ink);
}

.icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.icon-button.is-visible {
  color: var(--primary);
}

.form-row,
.code-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.form-row {
  justify-content: space-between;
}

.check {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.check input {
  width: 16px;
  height: 16px;
  min-height: 16px;
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
  font-weight: 800;
}

.primary-button,
.secondary-button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 900;
}

.primary-button {
  width: 100%;
  margin-top: 4px;
  background: var(--primary);
  color: #fff;
}

.primary-button:hover {
  background: var(--primary-dark);
}

.secondary-button {
  flex: 0 0 148px;
  background: #e7ece9;
  color: var(--ink);
  line-height: 1.25;
  padding: 0 12px;
}

.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.status {
  min-height: 22px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.status.success {
  color: var(--primary);
}

.status.error {
  color: var(--danger);
}

.dashboard {
  width: min(1280px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 248px;
  gap: 24px;
  padding: 28px 0;
}

.workspace {
  min-width: 0;
  padding: 28px;
}

.workspace-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.workspace-header h2 {
  font-size: 30px;
}

.workspace-user {
  max-width: 280px;
  overflow: hidden;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
  border-bottom: 1px solid rgba(21, 33, 29, 0.12);
}

.workspace-tab {
  min-width: 92px;
  min-height: 44px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 900;
}

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

.tab-panel {
  display: none;
}

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

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 4px 0 18px;
}

.section-heading h3 {
  margin: 0;
  font-size: 24px;
}

.section-heading span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

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

.tool-card {
  min-height: 260px;
  display: grid;
  grid-template-rows: 148px 1fr;
  overflow: hidden;
  padding: 0;
  border: 1px solid rgba(21, 33, 29, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
}

.tool-card.is-clickable {
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.tool-card.is-clickable:hover,
.tool-card.is-clickable:focus-visible {
  border-color: rgba(23, 107, 88, 0.42);
  box-shadow: 0 16px 42px rgba(25, 39, 34, 0.16);
  outline: none;
  transform: translateY(-2px);
}

.tool-preview-animation {
  position: relative;
  width: 100%;
  min-height: 148px;
  background:
    linear-gradient(135deg, rgba(23, 107, 88, 0.16), transparent 38%),
    linear-gradient(315deg, rgba(216, 154, 43, 0.18), transparent 42%),
    #eef3f0;
  overflow: hidden;
}

.comparison-stage,
.preview-pane,
.preview-slider {
  position: absolute;
}

.comparison-stage {
  inset: 0;
}

.preview-pane {
  inset: 0;
}

.preview-pane.before {
  background:
    linear-gradient(90deg, rgba(21, 33, 29, 0.13) 1px, transparent 1px),
    linear-gradient(rgba(21, 33, 29, 0.13) 1px, transparent 1px),
    linear-gradient(135deg, #f7faf8, #dfe8e3);
  background-size: 24px 24px, 24px 24px, auto;
}

.preview-pane.after {
  clip-path: inset(0 0 0 48%);
  background:
    radial-gradient(circle at 28% 28%, rgba(216, 154, 43, 0.9) 0 8px, transparent 9px),
    linear-gradient(135deg, rgba(49, 95, 151, 0.9), rgba(23, 107, 88, 0.92));
  animation: preview-reveal 3.2s ease-in-out infinite;
}

.preview-pane.after::before,
.preview-pane.after::after {
  content: "";
  position: absolute;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
}

.preview-pane.after::before {
  width: 56px;
  height: 40px;
  left: 22px;
  bottom: 24px;
}

.preview-pane.after::after {
  width: 78px;
  height: 54px;
  right: 20px;
  bottom: 22px;
  opacity: 0.78;
}

.preview-slider {
  top: 0;
  bottom: 0;
  left: 48%;
  width: 3px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(21, 33, 29, 0.12), 0 0 24px rgba(255, 255, 255, 0.8);
  animation: preview-slider 3.2s ease-in-out infinite;
}

.preview-slider::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 30px;
  height: 30px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(21, 33, 29, 0.18);
}

.preview-slider::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 11px;
  height: 11px;
  transform: translate(-50%, -50%) rotate(45deg);
  border-top: 2px solid var(--primary);
  border-right: 2px solid var(--primary);
}

@keyframes preview-reveal {
  0%,
  100% {
    clip-path: inset(0 0 0 32%);
  }
  50% {
    clip-path: inset(0 0 0 68%);
  }
}

@keyframes preview-slider {
  0%,
  100% {
    left: 32%;
  }
  50% {
    left: 68%;
  }
}

.tool-card-body {
  padding: 16px 18px 18px;
}

.tool-card h4 {
  margin: 0 0 10px;
  font-size: 17px;
  line-height: 1.35;
}

.tool-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.side-nav {
  position: sticky;
  top: 28px;
  align-self: start;
  min-height: calc(100vh - 56px);
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.side-brand strong,
.side-brand span {
  display: block;
}

.side-brand strong {
  font-size: 17px;
}

.side-brand span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.side-menu {
  display: grid;
  gap: 10px;
  margin-top: auto;
}

.side-menu button {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(21, 33, 29, 0.08);
  border-radius: 8px;
  padding: 10px;
  background: rgba(247, 250, 248, 0.72);
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
  text-align: left;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.side-menu button:hover {
  border-color: rgba(23, 107, 88, 0.26);
  background: #fff;
  transform: translateY(-1px);
}

.nav-label {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-icon {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #e7ece9;
  color: var(--primary);
}

.nav-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.points-button {
  align-items: center !important;
  flex-direction: row;
  gap: 12px !important;
  background: rgba(247, 250, 248, 0.72) !important;
}

.points-button strong {
  margin-left: auto;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--primary);
  font-size: 16px;
  line-height: 1;
}

.tool-shell {
  min-height: 100vh;
  padding: 28px 0;
  background:
    linear-gradient(135deg, rgba(23, 107, 88, 0.14), transparent 34%),
    linear-gradient(315deg, rgba(216, 154, 43, 0.18), transparent 34%),
    var(--bg);
  color: var(--ink);
}

.tool-topbar {
  height: 58px;
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 18px;
  margin: 0 auto 20px;
  width: min(1280px, calc(100% - 32px));
}

.tool-back,
.tool-open {
  min-height: 42px;
  border: 1px solid rgba(21, 33, 29, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(25, 39, 34, 0.08);
}

.tool-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  font-weight: 800;
}

.tool-open {
  display: grid;
  place-items: center;
}

.tool-back svg,
.tool-open svg,
.tool-title-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.tool-title {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.tool-title h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
}

.tool-title-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
}

.tool-workbench {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 430px minmax(0, 1fr);
  gap: 24px;
}

.tool-control-panel,
.tool-result-panel {
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.tool-control-panel {
  display: grid;
  align-content: start;
  gap: 20px;
  padding: 20px;
}

.tool-control-section {
  display: grid;
  gap: 12px;
}

.tool-control-section h2,
.tool-result-panel h2 {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
}

.upload-button {
  min-height: 42px;
  border: 1px solid rgba(23, 107, 88, 0.18);
  border-radius: 8px;
  background: #e7ece9;
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
}

.upload-button:hover {
  background: #f7faf8;
}

.drop-zone {
  position: relative;
  min-height: 220px;
  display: grid;
  place-items: center;
  gap: 8px;
  overflow: hidden;
  border: 1px dashed rgba(21, 33, 29, 0.24);
  border-radius: 8px;
  padding: 20px;
  background:
    linear-gradient(90deg, rgba(21, 33, 29, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(21, 33, 29, 0.05) 1px, transparent 1px),
    rgba(247, 250, 248, 0.74);
  background-size: 24px 24px, 24px 24px, auto;
  color: var(--muted);
  cursor: pointer;
  text-align: center;
}

.drop-zone.has-file {
  padding: 10px;
}

.drop-zone.has-file .drop-icon,
.drop-zone.has-file strong,
.drop-zone.has-file span,
.drop-zone.has-file small {
  display: none;
}

.upload-preview-image {
  width: 100%;
  height: 100%;
  max-height: 320px;
  object-fit: contain;
  border-radius: 6px;
}

.drop-zone.is-dragging {
  border-color: var(--primary);
  background: rgba(23, 107, 88, 0.08);
}

.drop-zone strong {
  color: var(--ink);
  font-size: 17px;
}

.drop-zone small {
  color: var(--muted);
}

.upload-file-meta {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid rgba(21, 33, 29, 0.1);
  border-radius: 8px;
  background: rgba(247, 250, 248, 0.86);
}

.upload-file-meta strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-file-meta span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.drop-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #e7ece9;
  color: var(--primary);
}

.drop-icon svg,
.result-icon svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.aspect-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.aspect-button {
  min-height: 38px;
  border: 1px solid rgba(21, 33, 29, 0.1);
  border-radius: 8px;
  background: rgba(247, 250, 248, 0.86);
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
}

.aspect-button.active {
  border-color: rgba(23, 107, 88, 0.32);
  background: var(--primary);
  color: #fff;
}

.tool-control-section textarea {
  width: 100%;
  min-height: 230px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: #fbfcfb;
  color: var(--ink);
  outline: none;
  line-height: 1.65;
}

.tool-control-section textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(23, 107, 88, 0.14);
}

.tool-cost-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.generate-button {
  min-height: 52px;
  border: 0;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-size: 16px;
  font-weight: 950;
}

.generate-button:hover {
  background: var(--primary-dark);
}

.generate-button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.tool-status {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.55;
}

.tool-status.success {
  color: var(--primary);
}

.tool-status.error {
  color: var(--danger);
}

.tool-result-panel {
  min-height: calc(100vh - 100px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
  padding: 20px;
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.result-download {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(23, 107, 88, 0.18);
  border-radius: 8px;
  padding: 0 12px;
  background: #e7ece9;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
}

.result-download:hover {
  background: #f7faf8;
}

.result-download svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.result-stage {
  min-height: 620px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px dashed rgba(21, 33, 29, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(21, 33, 29, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(21, 33, 29, 0.05) 1px, transparent 1px),
    rgba(247, 250, 248, 0.76);
  background-size: 28px 28px;
}

.result-stage img {
  width: 100%;
  height: 100%;
  max-height: calc(100vh - 170px);
  object-fit: contain;
}

.result-placeholder {
  display: grid;
  justify-items: center;
  gap: 14px;
  color: var(--muted);
  font-weight: 900;
}

.result-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #e7ece9;
  color: var(--primary);
}

.video-workbench,
.workflow-workbench {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(420px, 0.95fr) minmax(0, 1fr);
  gap: 24px;
}

.video-control-panel,
.video-result-panel,
.workflow-control-panel,
.workflow-result-panel {
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.video-control-panel,
.workflow-control-panel {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 20px;
}

.video-upload-grid,
.workflow-upload-grid {
  display: grid;
  gap: 16px;
}

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

.video-control-section,
.workflow-control-section {
  display: grid;
  gap: 10px;
}

.video-control-section h2,
.video-option-group h3,
.workflow-control-section h2,
.workflow-option-group h3 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
}

.video-option-group h3 span,
.workflow-option-group h3 span {
  color: var(--accent);
  font-size: 12px;
}

.section-icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: var(--primary);
}

.section-icon svg,
.video-generate-button svg,
.workflow-generate-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.video-upload-helper,
.workflow-upload-helper {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.video-file-button,
.workflow-file-button {
  min-height: 34px;
  display: grid;
  place-items: center;
  font-size: 13px;
}

.video-drop-zone,
.workflow-drop-zone {
  min-height: 112px;
  padding: 12px;
}

.video-drop-zone strong,
.workflow-drop-zone strong {
  font-size: 14px;
}

.video-drop-zone.has-file,
.workflow-drop-zone.has-file {
  min-height: 132px;
}

.video-preview-strip,
.workflow-preview-strip {
  width: 100%;
  height: 112px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(88px, 1fr);
  gap: 8px;
  overflow-x: auto;
}

.video-preview-strip img,
.workflow-preview-strip img,
.workflow-preview-strip video {
  width: 100%;
  height: 112px;
  object-fit: contain;
  border: 1px solid rgba(21, 33, 29, 0.1);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.74);
}

.video-control-section textarea,
.workflow-control-section textarea {
  width: 100%;
  min-height: 270px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfcfb;
  color: var(--ink);
  outline: none;
  line-height: 1.7;
}

.video-control-section textarea:focus,
.video-option-input:focus,
.workflow-control-section textarea:focus,
.workflow-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(23, 107, 88, 0.14);
}

.video-options,
.workflow-options {
  display: grid;
  gap: 16px;
}

.video-option-group,
.workflow-option-group {
  display: grid;
  gap: 9px;
}

.video-option-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

.video-option-input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: #fbfcfb;
  color: var(--ink);
  outline: none;
}

.workflow-select-wrap {
  position: relative;
  display: block;
}

.workflow-select {
  width: 100%;
  min-height: 44px;
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 42px 11px 12px;
  background: #fbfcfb;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  outline: none;
}

.workflow-select-wrap span {
  position: absolute;
  top: 50%;
  right: 13px;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.workflow-select-wrap svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.video-cost-row {
  border: 1px solid rgba(23, 107, 88, 0.12);
  border-radius: 8px;
  padding: 12px;
  background: rgba(247, 250, 248, 0.84);
}

.video-generate-button,
.workflow-generate-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.video-result-stage,
.workflow-result-stage {
  min-height: calc(100vh - 170px);
}

.video-result-stage video,
.workflow-result-stage video {
  width: 100%;
  max-height: calc(100vh - 190px);
  border-radius: 8px;
  background: #000;
}

@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
    align-items: start;
    padding: 28px 0;
  }

  .brand-panel {
    padding: 0;
    gap: 20px;
  }

  h1 {
    font-size: 42px;
  }

  .intro {
    font-size: 16px;
  }

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

  .auth-panel {
    padding: 22px;
  }

  .dashboard {
    grid-template-columns: 1fr;
    width: min(100% - 20px, 1280px);
    padding: 12px 0 24px;
  }

  .side-nav {
    position: static;
    min-height: auto;
    order: -1;
  }

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

  .points-button {
    grid-column: span 2;
  }

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

  .tool-shell {
    padding: 14px;
  }

  .tool-topbar {
    grid-template-columns: 104px minmax(0, 1fr) 42px;
    gap: 10px;
  }

  .tool-workbench {
    grid-template-columns: 1fr;
  }

  .video-workbench,
  .workflow-workbench {
    grid-template-columns: 1fr;
    width: min(100% - 20px, 1280px);
  }

  .tool-result-panel {
    min-height: 520px;
  }

  .result-stage {
    min-height: 420px;
  }
}

@media (max-width: 520px) {
  .shell {
    width: min(100% - 20px, 1120px);
  }

  h1 {
    font-size: 35px;
  }

  .tool-preview {
    grid-template-columns: 1fr;
  }

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

  .form-row,
  .code-row {
    align-items: stretch;
    flex-direction: column;
  }

  .secondary-button {
    flex-basis: auto;
    width: 100%;
  }

  .tool-topbar {
    grid-template-columns: 1fr auto;
  }

  .tool-title {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
  }

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

  .video-upload-grid.two-columns,
  .workflow-upload-grid.two-columns,
  .video-option-buttons {
    grid-template-columns: 1fr;
  }
}
