:root {
  color-scheme: light;
  --bg: #f5f6f2;
  --panel: #ffffff;
  --ink: #242724;
  --muted: #676c62;
  --line: #d9dfd2;
  --line-strong: #b9c5ad;
  --green: #465f35;
  --green-soft: #eef3e9;
  --red: #c8242b;
  --red-dark: #a91d23;
  --gold: #98723d;
  --shadow: 0 10px 28px rgba(40, 48, 35, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(135deg, rgba(70, 95, 53, 0.08), transparent 34%),
    linear-gradient(225deg, rgba(200, 36, 43, 0.08), transparent 30%),
    var(--bg);
  color: var(--ink);
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  border-bottom: 1px solid rgba(185, 197, 173, 0.75);
  background: rgba(245, 246, 242, 0.92);
  backdrop-filter: blur(18px);
}

.topbar__inner,
.page-shell,
.site-footer {
  width: min(1680px, calc(100% - 36px));
  margin: 0 auto;
}

.topbar__inner {
  display: grid;
  grid-template-columns: minmax(430px, 1fr) auto minmax(520px, 1.35fr);
  gap: 16px;
  align-items: center;
  padding: 14px 0;
}

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

.brand-logo {
  display: block;
  width: 168px;
  height: auto;
}

.brand-title {
  margin: 0 0 3px;
  color: var(--ink);
  font-size: clamp(16px, 1.25vw, 21px);
  font-weight: 800;
  line-height: 1.2;
}

h1 {
  margin: 0;
  color: var(--green);
  font-size: clamp(20px, 1.55vw, 28px);
  line-height: 1.08;
  font-weight: 900;
}

.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.quick-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid rgba(185, 197, 173, 0.9);
  border-radius: var(--radius);
  background: #fff;
  color: var(--green);
  font-size: 14px;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.quick-link:hover {
  border-color: var(--line-strong);
  background: var(--green-soft);
}

.quick-link:active {
  transform: translateY(1px) scale(0.99);
}

.quick-link--line {
  border-color: rgba(20, 160, 85, 0.22);
  background: #10b65b;
  color: #fff;
}

.quick-link--line:hover {
  border-color: rgba(20, 160, 85, 0.36);
  background: #0f9f50;
}

.quick-link--icon {
  width: 42px;
  min-width: 42px;
  padding: 9px;
}

.quick-link svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.field {
  display: grid;
  gap: 7px;
}

.field span,
.canva-label {
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

input {
  min-height: 46px;
  padding: 11px 13px;
}

input:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(70, 95, 53, 0.14);
  background: #fff;
}

.page-shell {
  padding: 16px 0 24px;
}

.status-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(185, 197, 173, 0.78);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
}

.status-strip div {
  display: flex;
  gap: 10px;
  align-items: baseline;
  flex-wrap: wrap;
}

.status-strip strong {
  color: var(--ink);
  font-size: 15px;
}

.status-strip span {
  color: var(--muted);
  font-size: 14px;
}

.ad-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
  align-items: start;
}

.ad-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(185, 197, 173, 0.8);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.ad-card__media {
  display: grid;
  place-items: center;
  height: clamp(205px, 16vw, 250px);
  overflow: hidden;
  background:
    linear-gradient(45deg, rgba(185, 197, 173, 0.25) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(185, 197, 173, 0.25) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(185, 197, 173, 0.25) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(185, 197, 173, 0.25) 75%),
    #f1f2ed;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
  border-bottom: 1px solid var(--line);
}

.media-button {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 10px;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.media-button:focus-visible {
  outline: 3px solid rgba(70, 95, 53, 0.26);
  outline-offset: -4px;
}

.media-button img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: top center;
  background: #fff;
  box-shadow: 0 6px 18px rgba(40, 48, 35, 0.1);
  transition: transform 180ms ease;
}

.media-button:hover img {
  transform: scale(0.985);
}

.ad-card__body {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.ad-card__head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.ad-card h2 {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.25;
  font-weight: 900;
}

.ad-card__subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.format-pill {
  flex: 0 0 auto;
  padding: 5px 8px;
  border: 1px solid rgba(152, 114, 61, 0.32);
  border-radius: 999px;
  background: rgba(152, 114, 61, 0.09);
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.icon-button,
.soft-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.icon-button:active,
.soft-button:active {
  transform: translateY(1px) scale(0.99);
}

.icon-button svg,
.soft-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button--primary {
  background: var(--red);
  color: #fff;
}

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

.icon-button--ghost,
.soft-button {
  border-color: var(--line);
  background: #fff;
  color: var(--green);
}

.icon-button--ghost:hover,
.soft-button:hover {
  border-color: var(--line-strong);
  background: var(--green-soft);
}

.canva-area {
  display: grid;
  gap: 6px;
  padding-top: 2px;
}

.canva-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.copy-area {
  display: grid;
  gap: 8px;
}

.copy-area__top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.copy-area__top span {
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
}

textarea {
  min-height: 190px;
  max-height: 240px;
  padding: 11px;
  resize: vertical;
  border-color: rgba(185, 197, 173, 0.82);
  background: #fbfcf8;
  color: #2d302c;
  font-size: 13px;
  line-height: 1.58;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  min-width: min(320px, calc(100% - 40px));
  padding: 13px 15px;
  border: 1px solid rgba(185, 197, 173, 0.8);
  border-radius: var(--radius);
  background: #263021;
  color: #fff;
  box-shadow: 0 14px 34px rgba(20, 25, 18, 0.24);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
  padding: 18px;
  background: rgba(30, 35, 27, 0.88);
  backdrop-filter: blur(14px);
}

.image-lightbox[hidden] {
  display: none;
}

.image-lightbox__close {
  justify-self: end;
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease;
}

.image-lightbox__close:active {
  transform: translateY(1px) scale(0.98);
}

.image-lightbox__close:hover {
  background: rgba(255, 255, 255, 0.18);
}

.image-lightbox__close svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.image-lightbox__stage {
  min-height: 0;
  display: grid;
  place-items: center;
}

.image-lightbox__stage img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(100%, 1180px);
  max-height: calc(100dvh - 126px);
  object-fit: contain;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 24px 80px rgba(7, 10, 6, 0.4);
}

.image-lightbox__caption {
  margin: 0;
  color: rgba(255, 255, 255, 0.86);
  text-align: center;
  font-size: 15px;
  font-weight: 800;
}

body.lightbox-open {
  overflow: hidden;
}

.site-footer {
  padding: 0 0 32px;
}

.site-footer p {
  margin: 0;
  padding: 14px 16px;
  border-top: 1px solid rgba(185, 197, 173, 0.7);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

@media (max-width: 1180px) {
  .topbar {
    position: static;
  }

  .topbar__inner {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .quick-links {
    justify-content: flex-start;
  }
}

@media (max-width: 980px) {
  .topbar {
    position: static;
  }

  .topbar__inner {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .ad-grid {
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  }
}

@media (max-width: 760px) {
  .topbar__inner,
  .page-shell,
  .site-footer {
    width: min(100% - 28px, 1440px);
  }

  .agent-form,
  .ad-grid,
  .canva-tools {
    grid-template-columns: 1fr;
  }

  .quick-links {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px;
  }

  .brand-block {
    grid-template-columns: 132px minmax(0, 1fr);
  }

  .brand-logo {
    width: 132px;
  }

  .ad-card__media {
    height: 290px;
  }

  .status-strip,
  .ad-card__head,
  .copy-area__top {
    align-items: stretch;
    flex-direction: column;
  }

  .status-strip div {
    display: grid;
  }

  .soft-button,
  .icon-button {
    width: 100%;
  }

  textarea {
    min-height: 220px;
    max-height: none;
  }
}
