.doubao-page [hidden] {
  display: none !important;
}

.doubao-page {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 56px 0 80px;
}

.doubao-intro {
  max-width: 760px;
  margin: 0 auto 36px;
  text-align: center;
}

.doubao-intro h1 {
  margin: 10px 0 16px;
  color: #0f172a;
  font-size: 4.25rem;
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: 0;
}

.doubao-intro h1 span {
  background: linear-gradient(90deg, #f5c344, #f28482, #b567c2);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.doubao-intro .lead {
  color: #64748b;
  font-size: 1.08rem;
  line-height: 1.75;
}

.privacy-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  color: #475569;
  font-size: 0.86rem;
  font-weight: 500;
}

.privacy-note::before {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  content: "";
}

.editor-shell {
  overflow: hidden;
  background: #f4f8f9;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 18px 46px -28px rgba(15, 23, 42, 0.28);
}

.editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}

.editor-status {
  min-width: 0;
}

.editor-status strong,
.editor-status span {
  display: block;
}

.editor-status strong {
  color: #1e293b;
  font-size: 0.92rem;
  font-weight: 600;
}

.editor-status span {
  margin-top: 2px;
  overflow: hidden;
  color: #64748b;
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#statusText[data-tone="working"] {
  color: #9a6700;
}

#statusText[data-tone="notice"] {
  color: #9a6700;
}

#statusText[data-tone="error"] {
  color: #be123c;
}

.segmented-control {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 2px;
  padding: 3px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.segmented-control button {
  min-height: 34px;
  padding: 0 12px;
  color: #64748b;
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
}

.segmented-control button.active {
  color: #0f172a;
  background: #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.1);
}

.drop-zone {
  display: grid;
  min-height: 470px;
  place-items: center;
  padding: 32px;
  background:
    linear-gradient(#fff, #fff) padding-box,
    linear-gradient(90deg, #f5c344, #f28482, #b567c2) border-box;
  border: 1px solid transparent;
  transition: background-color 160ms ease;
}

.drop-zone.dragging {
  background:
    linear-gradient(#fff7fb, #fff7fb) padding-box,
    linear-gradient(90deg, #f5c344, #f28482, #b567c2) border-box;
}

.drop-content {
  max-width: 480px;
  text-align: center;
}

.upload-mark {
  display: grid;
  width: 58px;
  height: 58px;
  margin: 0 auto 20px;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #f5c344, #f28482 55%, #b567c2);
  border-radius: 8px;
  box-shadow: 0 12px 24px -14px rgba(181, 103, 194, 0.65);
}

.upload-mark svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.drop-content h2 {
  color: #0f172a;
  font-size: 1.45rem;
  font-weight: 600;
}

.drop-content p {
  margin: 10px 0 22px;
  color: #64748b;
  line-height: 1.6;
}

.file-button {
  position: relative;
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  padding: 0 22px;
  overflow: hidden;
  color: #fff;
  background: #0f172a;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 600;
}

.file-button input {
  position: absolute;
  inset: 0;
  cursor: pointer;
  opacity: 0;
}

.file-types {
  display: block;
  margin-top: 14px;
  color: #94a3b8;
  font-size: 0.76rem;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  min-height: 560px;
}

.canvas-area {
  display: grid;
  min-width: 0;
  place-items: center;
  padding: 24px;
  background-color: #e9eef0;
  background-image:
    linear-gradient(45deg, rgba(148, 163, 184, 0.12) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(148, 163, 184, 0.12) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(148, 163, 184, 0.12) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(148, 163, 184, 0.12) 75%);
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
}

.canvas-wrap {
  position: relative;
  width: 100%;
  max-height: 72vh;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 10px 30px -16px rgba(15, 23, 42, 0.35);
}

.canvas-wrap canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#maskCanvas {
  cursor: crosshair;
  touch-action: none;
}

.editor-tools {
  padding: 18px;
  background: #fff;
  border-left: 1px solid #e5e7eb;
}

.tool-group + .tool-group {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid #e5e7eb;
}

.tool-label {
  display: block;
  margin-bottom: 10px;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
}

.tool-stack {
  display: grid;
  gap: 8px;
}

.tool-button,
.action-button {
  display: inline-flex;
  width: 100%;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  color: #334155;
  background: #fff;
  border: 1px solid #dbe2e8;
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
}

.tool-button:hover,
.tool-button.active {
  color: #0f172a;
  background: #f8fafc;
  border-color: #94a3b8;
}

.tool-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.brush-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}

.brush-row input {
  width: 100%;
  accent-color: #b567c2;
}

.brush-row output {
  min-width: 38px;
  color: #64748b;
  font-size: 0.76rem;
  text-align: right;
}

.action-button.primary {
  color: #fff;
  background: #0f172a;
  border-color: #0f172a;
}

.action-button.copy {
  color: #7c3aed;
  background: #faf7ff;
  border-color: #e9d5ff;
}

.tool-help {
  margin-top: 12px;
  color: #64748b;
  font-size: 0.74rem;
  line-height: 1.55;
}

.seo-section {
  padding: 88px 0 0;
}

.section-heading {
  max-width: 680px;
  margin-bottom: 30px;
}

.section-heading h2 {
  margin: 8px 0 12px;
  color: #0f172a;
  font-size: 2.15rem;
  font-weight: 500;
  line-height: 1.15;
}

.section-heading p:last-child {
  color: #64748b;
  line-height: 1.7;
}

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

.example-pair figure {
  overflow: hidden;
  background: #f4f8f9;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.example-pair img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
}

.example-pair figcaption {
  padding: 14px 16px;
  color: #475569;
  font-size: 0.86rem;
  font-weight: 500;
}

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

.info-grid article {
  padding: 24px;
  background: #f4f8f9;
  border-top: 3px solid transparent;
  border-image: linear-gradient(90deg, #f5c344, #f28482, #b567c2) 1;
}

.info-grid h3 {
  margin-bottom: 10px;
  color: #1e293b;
  font-size: 1rem;
  font-weight: 600;
}

.info-grid p {
  color: #64748b;
  font-size: 0.9rem;
  line-height: 1.7;
}

.doubao-faq {
  display: grid;
  gap: 10px;
}

.doubao-faq details {
  padding: 0 18px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 7px;
}

.doubao-faq summary {
  padding: 17px 0;
  color: #1e293b;
  cursor: pointer;
  font-weight: 600;
}

.doubao-faq p {
  padding: 0 0 18px;
  color: #64748b;
  line-height: 1.7;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  padding: 11px 16px;
  color: #fff;
  background: #0f172a;
  border-radius: 7px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.25);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 160ms ease, transform 160ms ease;
}

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

@media (max-width: 820px) {
  .doubao-page {
    width: min(100% - 28px, 720px);
    padding-top: 36px;
  }

  .doubao-intro h1 {
    font-size: 2.6rem;
  }

  .workspace-grid {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .canvas-area {
    min-height: 320px;
    padding: 14px;
  }

  .editor-tools {
    border-top: 1px solid #e5e7eb;
    border-left: 0;
  }

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

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

@media (max-width: 560px) {
  .doubao-page {
    width: min(100% - 20px, 520px);
    padding-bottom: 56px;
  }

  .doubao-intro {
    margin-bottom: 26px;
    text-align: left;
  }

  .doubao-intro h1 {
    font-size: 2.15rem;
  }

  .doubao-intro .lead {
    font-size: 0.98rem;
  }

  .editor-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .segmented-control {
    width: 100%;
  }

  .segmented-control button {
    flex: 1;
  }

  .drop-zone {
    min-height: 380px;
    padding: 24px 18px;
  }

  .canvas-area {
    min-height: 240px;
  }

  .seo-section {
    padding-top: 62px;
  }

  .section-heading h2 {
    font-size: 1.7rem;
  }

  .example-pair {
    grid-template-columns: 1fr;
  }
}
