:root {
  color-scheme: light;
  --ink: #111417;
  --muted: #5b6472;
  --line: #d8dde5;
  --surface: #ffffff;
  --surface-soft: #f5f7f9;
  --teal: #0f8f83;
  --coral: #e9583f;
  --gold: #d7a73f;
  --button: #111417;
  --button-hover: #263039;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(15, 143, 131, 0.12), transparent 320px),
    var(--surface-soft);
}

a {
  color: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px clamp(20px, 5vw, 64px);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  color: #ffffff;
  background: var(--ink);
  border-radius: 8px;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 18px;
  line-height: 1.1;
}

.brand small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  color: #ffffff;
  background: var(--coral);
  border: 0;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  white-space: normal;
  text-align: center;
  transition: background 160ms ease, transform 160ms ease;
}

.cta:hover {
  background: #c74631;
  transform: translateY(-1px);
}

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

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 28px;
  align-items: end;
  padding: 28px 0 26px;
}

.eyebrow,
.tool-label {
  margin: 0 0 10px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 880px;
  margin: 0;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.08;
  letter-spacing: 0;
}

.intro-copy {
  max-width: 850px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
}

.quota-card {
  min-height: 160px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(17, 20, 23, 0.08);
}

.quota-card span,
.quota-card small {
  display: block;
  color: var(--muted);
}

.quota-card strong {
  display: block;
  margin: 12px 0 8px;
  color: var(--teal);
  font-size: 42px;
  line-height: 1;
}

.limit-notice,
.service-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 18px;
  padding: 16px;
  background: #fff6f3;
  border: 1px solid #f1c5b9;
  border-radius: 8px;
}

.limit-notice strong,
.limit-notice span,
.service-strip strong,
.service-strip span {
  display: block;
}

.limit-notice span,
.service-strip span {
  margin-top: 4px;
  color: var(--muted);
}

.studio-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.tool-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(17, 20, 23, 0.08);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.15;
  letter-spacing: 0;
}

.mode-chip {
  flex: 0 0 auto;
  padding: 6px 9px;
  color: #6e4f07;
  background: #fff4d8;
  border: 1px solid #ead18f;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.mode-chip-live {
  color: #0a5f58;
  background: #e1f6f2;
  border-color: #9bd9cf;
}

.tool-form {
  display: grid;
  gap: 10px;
}

label {
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

textarea,
input,
select {
  width: 100%;
  min-width: 0;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid #c7ced8;
  border-radius: 8px;
  font: inherit;
}

textarea {
  resize: vertical;
  min-height: 126px;
  padding: 12px;
  line-height: 1.5;
}

input,
select {
  min-height: 44px;
  padding: 9px 11px;
}

.form-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  margin-top: 4px;
  padding: 0 16px;
  color: #ffffff;
  background: var(--button);
  border: 0;
  border-radius: 8px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
}

.primary-action:hover:not(:disabled) {
  background: var(--button-hover);
  transform: translateY(-1px);
}

.primary-action:disabled {
  cursor: wait;
  opacity: 0.66;
}

.result-box {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 16 / 11;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(15, 143, 131, 0.18), rgba(233, 88, 63, 0.15)),
    #eef2f5;
  border: 1px solid #d2d9e2;
  border-radius: 8px;
}

.placeholder {
  display: grid;
  place-items: center;
  width: calc(100% - 28px);
  height: calc(100% - 28px);
  border: 1px dashed rgba(17, 20, 23, 0.28);
  border-radius: 8px;
  color: var(--muted);
  font-weight: 800;
}

.result-box:has(img:not([hidden])),
.result-box:has(video:not([hidden])) {
  aspect-ratio: auto;
}

.result-box img,
.result-box video {
  display: block;
  width: 100%;
  height: auto;
  max-height: 75vh;
  object-fit: contain;
}

.result-box a.image-link {
  display: block;
  width: 100%;
  line-height: 0;
  cursor: zoom-in;
}

.result-box img[hidden],
.result-box video[hidden],
.result-box a.image-link[hidden],
.result-box .placeholder[hidden] {
  display: none;
}

.status-text {
  min-height: 24px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.status-text.error {
  color: #b8321f;
  font-weight: 800;
}

.status-text.success {
  color: #0a756b;
  font-weight: 800;
}

.status-text.loading {
  color: #6e4f07;
  font-weight: 800;
}

.inline-fallback {
  display: flex;
}

.inline-fallback[hidden] {
  display: none;
}

.inline-fallback .cta {
  width: 100%;
}

.service-strip {
  margin: 18px 0 0;
  background: #ffffff;
  border-color: var(--line);
}

@media (max-width: 860px) {
  .site-header,
  .intro,
  .studio-grid,
  .limit-notice,
  .service-strip {
    grid-template-columns: 1fr;
  }

  .site-header,
  .limit-notice,
  .service-strip {
    align-items: stretch;
  }

  .cta-header {
    width: 100%;
  }

  .intro {
    align-items: stretch;
  }
}

@media (max-width: 560px) {
  .site-header {
    position: static;
    padding: 16px;
  }

  .app-shell {
    width: min(100% - 24px, 1180px);
    padding-top: 18px;
  }

  h1 {
    font-size: 34px;
  }

  .tool-panel {
    padding: 16px;
  }

  .panel-heading {
    display: grid;
  }

  .mode-chip {
    width: max-content;
  }
}
