:root {
  color-scheme: light;
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-soft: #fbfaf7;
  --ink: #1e2524;
  --muted: #66706c;
  --line: #ddd8ce;
  --teal: #107c74;
  --teal-dark: #0d5f59;
  --coral: #e16f52;
  --amber: #d59a2b;
  --mint: #dff1ed;
  --rose: #f8e4dc;
  --green: #7bb36a;
  --shadow: 0 16px 40px rgba(31, 38, 35, 0.08);
  --radius: 8px;
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, rgba(223, 241, 237, 0.8), rgba(246, 244, 239, 0) 420px),
    var(--bg);
  color: var(--ink);
}

.access-gate[hidden] {
  display: none;
}

.access-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(23, 36, 33, 0.82);
  backdrop-filter: blur(8px);
}

.access-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 28px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.access-card h2,
.access-card p {
  margin: 0;
}

.access-card input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.access-error {
  min-height: 20px;
  color: #b33b2e;
  font-size: 14px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 26px 22px;
  background: #172421;
  color: #f8f3ea;
}

.brand {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

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

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

.brand strong {
  font-size: 16px;
}

.brand small {
  margin-top: 4px;
  color: #bcd4ce;
  font-size: 12px;
}

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

.nav-list a {
  display: flex;
  min-height: 42px;
  align-items: center;
  border-radius: 8px;
  padding: 0 14px;
  color: #dbe7e2;
  font-size: 14px;
}

.nav-list a:hover,
.nav-list a.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.side-note {
  margin-top: auto;
  display: grid;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 14px;
  color: #dbe7e2;
  font-size: 13px;
  line-height: 1.65;
}

.side-note strong {
  color: #fff;
}

.main {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 28px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 24px;
  padding: 10px 0 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 860px;
  margin-bottom: 0;
  font-size: 34px;
  line-height: 1.18;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 16px;
}

.topbar-actions,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.icon-button,
.primary-link,
.primary-button,
.ghost-button,
.copy-button,
.danger-button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease;
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  background: var(--surface);
  color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 22px;
}

.primary-link,
.primary-button,
.ghost-button,
.copy-button,
.danger-button {
  min-height: 42px;
  padding: 0 16px;
  font-size: 14px;
}

.primary-link,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--teal);
  color: #fff;
  box-shadow: 0 10px 22px rgba(16, 124, 116, 0.2);
}

.ghost-button,
.copy-button {
  background: var(--surface);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}

.danger-button {
  background: #fff2ed;
  color: #b84224;
  box-shadow: inset 0 0 0 1px #f0c6b8;
}

.primary-link:hover,
.primary-button:hover,
.ghost-button:hover,
.copy-button:hover,
.danger-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.primary-button:disabled,
.ghost-button:disabled,
.copy-button:disabled,
.danger-button:disabled,
.icon-button:disabled {
  cursor: wait;
  opacity: 0.62;
  transform: none;
}

.primary-link:focus-visible,
.primary-button:focus-visible,
.ghost-button:focus-visible,
.copy-button:focus-visible,
.danger-button:focus-visible,
.icon-button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(225, 111, 82, 0.35);
  outline-offset: 2px;
}

.metrics-band {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
  box-shadow: var(--shadow);
}

.metrics-band div {
  min-height: 98px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 18px;
  background: var(--surface);
}

.metrics-band span {
  font-size: 28px;
  font-weight: 900;
}

.metrics-band small {
  color: var(--muted);
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.8fr);
  gap: 18px;
  margin-top: 18px;
}

.tool-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.full-panel {
  margin-top: 18px;
}

.panel-heading,
.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
}

.panel-heading.compact {
  margin-bottom: 14px;
}

.free-pill,
.hint {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  white-space: nowrap;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.free-pill {
  background: var(--rose);
  color: #a54127;
}

.hint {
  background: var(--mint);
  color: var(--teal-dark);
}

.field-label,
label {
  color: #39433f;
  font-size: 13px;
  font-weight: 800;
}

.field-label {
  display: block;
  margin-bottom: 8px;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
}

textarea {
  min-height: 128px;
  resize: vertical;
  padding: 12px;
  line-height: 1.6;
}

input,
select {
  min-height: 42px;
  padding: 0 11px;
}

input[type="range"] {
  padding: 0;
}

.button-row {
  margin-top: 14px;
}

.result-list,
.media-results,
.copy-results,
.task-list,
.image-grid,
.resource-grid {
  display: grid;
  gap: 12px;
}

.result-list {
  margin-top: 16px;
}

.media-results {
  margin-top: 16px;
}

.result-item,
.media-result,
.media-card,
.copy-card,
.task-item,
.resource-card,
.image-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.result-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 14px;
}

.result-item p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
  word-break: break-word;
}

.media-result {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.media-result-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
}

.media-result-head h3 {
  margin-bottom: 6px;
}

.media-result-head p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.6;
  word-break: break-word;
}

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

.media-card {
  overflow: hidden;
  margin: 0;
  background: #fff;
}

.media-preview {
  display: block;
  width: 100%;
  height: auto;
  max-height: 520px;
  object-fit: contain;
  background: #ece7dc;
}

video.media-preview {
  background: #111c19;
}

.media-card figcaption {
  display: grid;
  gap: 6px;
  padding: 10px;
}

.media-card strong,
.media-card span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-card span {
  color: var(--muted);
  font-size: 12px;
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.result-actions .primary-button,
.result-actions .copy-button {
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  font-size: 13px;
}

.error-note {
  border-left: 3px solid var(--amber);
  margin-bottom: 0;
  padding: 8px 10px;
  background: #fff8ea;
  color: #76540e;
  line-height: 1.65;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border-radius: 999px;
  padding: 0 8px;
  background: #eef4f0;
  color: #36564f;
  font-size: 12px;
  font-weight: 800;
}

.badge.coral {
  background: var(--rose);
  color: #a54127;
}

.badge.amber {
  background: #fbefd8;
  color: #815c12;
}

.workflow-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.workflow-list li {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.workflow-list span {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 8px;
  background: var(--mint);
  color: var(--teal-dark);
  font-weight: 900;
}

.workflow-list strong {
  display: block;
  margin-bottom: 4px;
}

.workflow-list p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.image-tool-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.1fr);
  gap: 18px;
}

.dropzone {
  position: relative;
  min-height: 210px;
  display: grid;
  place-items: center;
  border: 2px dashed #b8c8c2;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(16, 124, 116, 0.09), rgba(225, 111, 82, 0.09)),
    var(--surface-soft);
}

.dropzone.dragover {
  border-color: var(--teal);
  background: #eef8f5;
}

.dropzone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.dropzone-copy {
  display: grid;
  gap: 8px;
  padding: 24px;
  text-align: center;
  pointer-events: none;
}

.dropzone-copy strong {
  font-size: 20px;
}

.dropzone-copy span {
  color: var(--muted);
  line-height: 1.6;
}

.settings-grid,
.copy-form,
.task-form {
  display: grid;
  gap: 12px;
}

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

.settings-grid label,
.copy-form label,
.task-form label {
  display: grid;
  gap: 7px;
}

.image-grid {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  margin-top: 16px;
}

.image-card {
  overflow: hidden;
}

.image-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #ece7dc;
}

.image-card div {
  display: grid;
  gap: 4px;
  padding: 10px;
}

.image-card strong,
.image-card span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-card span {
  color: var(--muted);
  font-size: 12px;
}

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

.copy-results {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 18px;
}

.copy-card {
  padding: 16px;
}

.copy-card p {
  margin-bottom: 10px;
  color: #47514d;
  line-height: 1.75;
}

.copy-card pre {
  min-height: 190px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0 0 12px;
  color: #2f3935;
  font: inherit;
  line-height: 1.65;
}

.tag-output {
  min-height: 88px;
  display: flex;
  flex-wrap: wrap;
  align-content: start;
  gap: 8px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-soft);
}

.tag-chip {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  background: #eef4f0;
  color: #34514c;
  font-size: 13px;
  font-weight: 800;
}

.task-form {
  grid-template-columns: 150px 140px minmax(220px, 1fr) 140px auto;
  align-items: end;
}

.task-list {
  margin-top: 16px;
}

.task-item {
  display: grid;
  grid-template-columns: 44px 140px 120px minmax(0, 1fr) 112px auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
}

.task-item.done {
  opacity: 0.72;
}

.task-item.done .task-title {
  text-decoration: line-through;
}

.task-date,
.task-platform,
.task-stage {
  color: var(--muted);
  font-size: 13px;
}

.check-button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--teal);
  cursor: pointer;
  font-weight: 900;
}

.resources-section {
  margin-top: 28px;
  padding-bottom: 40px;
}

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

.resource-card {
  display: grid;
  min-height: 148px;
  align-content: space-between;
  gap: 16px;
  padding: 16px;
}

.resource-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.resource-card a {
  color: var(--teal-dark);
  font-weight: 900;
}

.resource-card .resource-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: var(--mint);
  color: var(--teal-dark);
  font-weight: 900;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 36px));
  border-radius: 8px;
  padding: 12px 14px;
  background: #172421;
  color: #fff;
  box-shadow: var(--shadow);
  font-size: 14px;
}

.empty-state {
  border: 1px dashed #cfc8bb;
  border-radius: 8px;
  padding: 16px;
  color: var(--muted);
  line-height: 1.65;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
  }

  .nav-list {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .nav-list a {
    justify-content: center;
    padding: 0 8px;
    text-align: center;
  }

  .side-note {
    margin-top: 0;
  }

  .workspace-grid,
  .image-tool-layout {
    grid-template-columns: 1fr;
  }

  .copy-results,
  .resource-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .task-form,
  .task-item {
    grid-template-columns: 1fr 1fr;
  }

  .task-title {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .main {
    padding: 18px 14px;
  }

  .topbar {
    grid-template-columns: 1fr;
    align-items: start;
  }

  h1 {
    font-size: 27px;
  }

  h2 {
    font-size: 20px;
  }

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

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

  .settings-grid,
  .copy-form,
  .task-form,
  .task-item,
  .copy-results,
  .resource-grid,
  .media-result-head,
  .result-item {
    grid-template-columns: 1fr;
  }

  .result-item .copy-button,
  .media-result-head .copy-button,
  .task-item .danger-button {
    width: 100%;
  }
}
