@import url("https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@500;700&display=swap");

:root {
  --primary: #991b1b;
  --primary-light: #fee2e2;
  --bg: #fdfbf7;
  --text: #1f2937;
  font-family: "Noto Serif SC", "PingFang SC", "Microsoft YaHei", serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 32px 20px 48px;
  background: linear-gradient(135deg, #faf6ef, #fce8e3 40%, #fff);
  color: var(--text);
}

.hero {
  max-width: 1200px;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  flex-wrap: wrap;
}

.hero h1 {
  margin: 0;
  font-size: clamp(24px, 3vw, 36px);
  color: var(--primary);
}

.hero p {
  margin: 0;
  font-size: 14px;
  color: #6b7280;
}

.hero-badge {
  border-radius: 999px;
  padding: 8px 16px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  letter-spacing: 0.08em;
}

.app-layout {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 24px;
}

.panel {
  background: #fff;
  border-radius: 22px;
  padding: 28px;
  box-shadow: 0 25px 80px rgba(153, 27, 27, 0.08);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

h2 {
  margin: 0;
  font-size: 20px;
  color: #374151;
}

.drop-zone {
  border: 2px dashed #e5e7eb;
  border-radius: 20px;
  padding: 30px;
  text-align: center;
  color: #9ca3af;
  background: linear-gradient(145deg, #fff, #fff6f4);
  transition: all 0.3s ease;
}

.drop-zone.has-image {
  border-color: var(--primary);
  color: var(--primary);
  background: #fff5f3;
}

.drop-zone strong {
  color: var(--primary);
}

#preview {
  width: 100%;
  border-radius: 14px;
  display: none;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.15);
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

label {
  font-weight: 700;
  font-size: 15px;
  color: #374151;
  display: block;
  margin-bottom: 6px;
}

.slider-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

input[type="range"] {
  width: 100%;
  appearance: none;
  height: 6px;
  border-radius: 999px;
  background: #f3d8d4;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(153, 27, 27, 0.35);
}

.ratio-value {
  font-size: 14px;
  color: var(--primary);
  font-weight: 600;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

button {
  font: inherit;
  border: none;
  border-radius: 12px;
  padding: 12px 18px;
  cursor: pointer;
  transition: transform 0.15s ease;
}

button:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-ghost {
  background: #f4f4f5;
  color: #4b5563;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  background: #f3f4f6;
  color: #4b5563;
}

.status-pill.busy {
  background: #fee2e2;
  color: var(--primary);
}

.status-pill.success {
  background: #dcfce7;
  color: #15803d;
}

.status-pill.error {
  background: #fee2e2;
  color: #b91c1c;
}

.log-board {
  border-radius: 18px;
  border: 1px solid #ffdcd4;
  background: linear-gradient(135deg, #fff9f8, #fff2ee);
  padding: 18px;
}

.log-board h3 {
  margin: 0 0 12px;
  font-size: 15px;
  color: #b45309;
}

.log-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 220px;
  overflow-y: auto;
}

.log-entry {
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff;
  border-left: 4px solid #fcd9d4;
  font-size: 14px;
  color: #6b7280;
}

.log-entry.success {
  border-color: #bbf7d0;
  color: #166534;
}

.log-entry.error {
  border-color: #fecaca;
  color: #b91c1c;
}

.result-panel {
  gap: 18px;
}

.result-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.result-card {
  position: relative;
  border-radius: 20px;
  border: 1px solid #ffe0d9;
  padding: 24px;
  min-height: 280px;
  background: linear-gradient(165deg, #fffaf8, #fff3f0);
}

.result-card::after {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 16px;
  border: 1px dashed rgba(153, 27, 27, 0.25);
  pointer-events: none;
}

.result-card .content {
  position: relative;
  z-index: 1;
  font-size: 18px;
  line-height: 1.75;
  color: #4b5563;
}

.kw-mask {
  background-color: var(--primary);
  color: transparent;
  border-radius: 4px;
  padding: 0 4px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 2px rgba(153, 27, 27, 0.2);
  user-select: none;
  margin: 0 2px;
  display: inline-flex;
  align-items: center;
}

.kw-mask::after {
  content: "✦";
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  margin-left: 4px;
}

.kw-mask:hover,
.kw-mask:focus,
.kw-mask.revealed {
  background-color: transparent;
  color: var(--primary);
  border-bottom: 2px solid #ef4444;
  box-shadow: none;
  font-weight: bold;
  outline: none;
}

.keyword-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 6px 12px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #f4c9c4;
  font-size: 13px;
  color: var(--primary);
}

@media (max-width: 640px) {
  body {
    padding: 20px 12px 32px;
  }
  .panel {
    padding: 22px;
  }
  .result-card .content {
    font-size: 16px;
  }
}
