:root {
  color-scheme: light;
  font-family: "Aptos", "Segoe UI", system-ui, sans-serif;
  color: #182e27;
  background: #f3f5ef;
  font-synthesis: none;
  --ink: #182e27;
  --muted: #5c6c61;
  --line: #dde4d8;
  --surface: #fffefa;
  --green: #245442;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
.login-shell { max-width: 540px; }
.login-error { color: #a52b2b; margin-bottom: 16px; }
.logout { margin-left: auto; }
.logout button { padding: 8px 14px; }
.metadata-description { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; margin-block: 12px; font-size: .9rem; }
#metadata-preview { padding-bottom: 20px; }
#metadata-title { margin-top: 12px; }
summary { cursor: pointer; font-weight: 650; margin-block: 10px; }
.shell { width: min(1200px, calc(100% - 64px)); margin-inline: auto; }

.site-header {
  border-bottom: 1px solid var(--line);
  background: #fafbf7;
}

.brand {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 68px;
}

.brand img { display: block; width: 142px; height: auto; }
.brand span { border-left: 1px solid var(--line); padding-left: 20px; font-size: .92rem; font-weight: 650; }

main { padding-block: 40px 60px; }
.intro { margin-bottom: 28px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2.25rem, 5vw, 3.55rem); font-weight: 730; line-height: 1.05; letter-spacing: -.064em; }
.intro p { margin-top: 12px; color: var(--muted); font-size: 1rem; line-height: 1.55; }

.workspace {
  display: grid;
  grid-template-columns: minmax(310px, .85fr) minmax(0, 1.6fr);
  gap: 20px;
  align-items: start;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 3px 5px #182e2705, 0 14px 30px #182e2706;
}

.panel-header {
  min-height: 68px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
}

h2 { font-size: 1.15rem; letter-spacing: -.025em; }
.form-body { padding: 20px 24px 24px; }
label { display: block; margin-bottom: 7px; font-size: .83rem; font-weight: 680; }

textarea, input, select {
  width: 100%;
  min-height: 44px;
  margin: 0 0 16px;
  border: 1px solid #cfd8cc;
  border-radius: 10px;
  background: #fafbf7;
  color: var(--ink);
  padding: 10px 12px;
  font: inherit;
  font-size: .9rem;
  transition: border-color .15s, background-color .15s;
}

textarea { min-height: 174px; margin-bottom: 8px; resize: vertical; font-family: ui-monospace, monospace; line-height: 1.5; }
input[type="file"] { max-width: 100%; font-size: .82rem; padding: 7px; }
input::file-selector-button { border: 0; border-radius: 6px; padding: 6px 8px; margin-right: 8px; background: #e9efe4; color: var(--green); font-weight: 650; cursor: pointer; }
select { padding-right: 26px; }
textarea:hover, input:hover, select:hover { border-color: #8ea998; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.timing { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 4px 0 18px; }
#template-note { margin: -4px 0 17px; font-size: .79rem; color: var(--muted); }
.publishing { border-top: 1px solid var(--line); padding-top: 13px; margin-bottom: 16px; }
.publishing legend { margin-bottom: 8px; font-size: .83rem; font-weight: 700; }
.destination { display: flex; align-items: center; gap: 9px; padding: 5px 0; margin: 0; }
.destination input { width: 17px; height: 17px; min-height: 0; margin: 0; accent-color: var(--green); }
.destination small { margin-left: auto; color: var(--muted); font-size: .73rem; font-weight: 500; }
.publish-note { margin-block: 8px; color: var(--muted); font-size: .78rem; line-height: 1.45; }
.optional { color: var(--muted); font-weight: 400; }
#caption { min-height: 68px; }
.publish-results { margin: 0 0 12px; padding: 0; list-style: none; font-size: .78rem; line-height: 1.5; }
.publish-results li[data-state="error"] { color: #9b3526; }
.publish-results a { color: var(--green); }

button, .download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: inherit;
  font: inherit;
  font-size: .88rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s, border-color .15s;
}

button[type="submit"] { width: 100%; background: var(--green); color: white; }
button[type="submit"]:hover:not(:disabled) { background: #1b4333; }
button:disabled { cursor: progress; opacity: .65; }
:focus-visible { outline: 2px solid #3e865f; outline-offset: 3px; }
#sample { margin: 0 0 14px; min-height: 32px; padding: 4px 9px; background: #eef3e9; color: var(--green); }
#sample:hover { background: #e0ebd9; }
#status { margin: 12px 0 0; color: var(--muted); font-size: .84rem; line-height: 1.45; }
#status:empty { margin: 0; }
#status[data-error] { color: #9b3526; }
progress { width: 100%; height: 7px; margin-top: 12px; accent-color: var(--green); }

.result-meta { font-size: .8rem; font-weight: 650; color: var(--muted); }
.result-body { padding: 14px; container-type: inline-size; }

.preview-stage {
  display: grid;
  place-items: center;
  min-height: 450px;
  padding: 20px;
  border-radius: 15px;
  background-color: #122a22;
  background-image:
    radial-gradient(ellipse at 50% 45%, #38634bab 0%, transparent 68%),
    linear-gradient(#a2c5a213 1px, transparent 1px),
    linear-gradient(90deg, #a2c5a213 1px, transparent 1px);
  background-size: auto, 28px 28px, 28px 28px;
}

.sample-frame { margin: 0; max-width: 100%; text-align: center; }
.sample-frame img {
  display: block;
  width: min(224px, 100%);
  height: auto;
  margin-inline: auto;
  border: 4px solid #fffefa45;
  border-radius: 13px;
  box-shadow: 0 16px 40px #06170ec9;
}
.sample-frame[data-landscape] img { width: min(500px, 100%); }
.sample-frame figcaption { margin-top: 12px; color: #d8e5d7; font-size: .8rem; }

#exports { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.export { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #f8faf5; }
.export-content { display: flex; flex-direction: column; min-width: 0; }
.export-label { color: var(--muted); font-size: .75rem; font-weight: 700; }
.export h3 { margin: 6px 0 18px; font-size: 1rem; line-height: 1.45; overflow-wrap: anywhere; }
.export .metadata-description { margin: 6px 0 18px; }
.video-well { display: grid; place-items: center; align-self: start; min-width: 0; overflow: hidden; border-radius: 8px; background: #11291f; }
video { display: block; width: 100%; max-width: 100%; max-height: min(560px, 70svh); object-fit: contain; }
@container (min-width: 540px) {
  .export { grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); }
}
.download { width: 100%; margin-top: auto; border-color: #ccdcca; background: #f0f5ec; color: #214c3a; }
.download::after { content: "↓"; font-size: 1.15em; }
.download:hover { background: #e3eedf; border-color: #9ab59e; }

@media (max-width: 760px) {
  .shell { width: calc(100% - 32px); }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  main { padding-top: 28px; }
  .panel-header { padding-inline: 18px; }
  .form-body { padding-inline: 18px; }
  .preview-stage { min-height: 360px; }
  .sample-frame img { width: min(175px, 100%); }
  .brand { flex-wrap: wrap; gap: 10px; padding-block: 12px; }
  .brand img { width: 120px; }
  .brand span { padding-left: 10px; }
  .logout { flex-shrink: 0; }
  .export { padding: 12px; }
  .metadata-description { font-size: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
