:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --surface-warm: #fef9f0;
  --ink: #111111;
  --ink-mid: #555555;
  --ink-light: #999999;
  --ink-faint: #cccccc;
  --border: #e8e4df;
  --blue: #0058a3;
  --blue-light: #e8f1fa;
  --yellow: #ffdb00;
  --yellow-soft: #fff8d6;
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* ── Background photo ── */
.bg-photo {
  position: fixed;
  inset: 0;
  background: url('/images/kourosh-qaffari-RrhhzitYizg-unsplash.jpg') center/cover no-repeat;
  opacity: 0.04;
  z-index: 0;
  pointer-events: none;
}

/* ── App ── */
.app {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 40px;
}

/* ── Hero ── */
.hero {
  text-align: center;
  padding: 32px 0 20px;
  flex-shrink: 0;
}

.hero-badge {
  display: inline-block;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: var(--yellow);
  padding: 7px 22px;
  border-radius: 980px;
  margin-bottom: 14px;
}

.hero-title {
  font-size: 28px;
  font-weight: 900;
  line-height: 1.35;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.hero-desc {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.7;
  color: var(--ink-mid);
  margin-top: 10px;
}

/* ── Writer bar ── */
.writer-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.bar-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-light);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
  flex-shrink: 0;
}

.writers {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ── Writer chips ── */
.writer-chip {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-light);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 980px;
  padding: 7px 16px 7px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.chip-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.3;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.writer-chip:hover {
  border-color: var(--ink-faint);
  color: var(--ink-mid);
}

.writer-chip.active {
  color: var(--ink);
  font-weight: 700;
  border-color: var(--ink);
  background: var(--yellow-soft);
}

.writer-chip.active .chip-dot {
  opacity: 1;
}

/* Dot colors */
.writer-chip[data-color="#fb7185"] .chip-dot { color: #fb7185; }
.writer-chip[data-color="#38bdf8"] .chip-dot { color: #38bdf8; }
.writer-chip[data-color="#64748b"] .chip-dot { color: #64748b; }
.writer-chip[data-color="#a78bfa"] .chip-dot { color: #a78bfa; }
.writer-chip[data-color="#f59e0b"] .chip-dot { color: #f59e0b; }
.writer-chip[data-color="#10b981"] .chip-dot { color: #10b981; }
.writer-chip[data-color="#ec4899"] .chip-dot { color: #ec4899; }

.writer-chip.full {
  opacity: 0.3;
  pointer-events: none;
}

/* ── Workspace ── */
.workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 0 24px;
  min-height: 0;
  position: relative;
}

/* ── Input card ── */
.input-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  max-height: 180px;
  overflow: hidden;
  position: relative;
  transition: border-color 0.2s ease;
}

.input-card:focus-within {
  border-color: var(--blue);
}

.card-label {
  position: absolute;
  top: 12px;
  left: 18px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-light);
  pointer-events: none;
}

.input-area {
  flex: 1;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.75;
  color: var(--ink);
  border: none;
  padding: 34px 18px 10px;
  resize: none;
  background: transparent;
  min-height: 90px;
}

.input-area:focus { outline: none; }
.input-area::placeholder { color: var(--ink-faint); }

.input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px 8px 18px;
  border-top: 1px solid var(--border);
}

.char-count {
  font-size: 11px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.btn-wash {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  background: var(--yellow);
  border: none;
  padding: 9px 22px;
  border-radius: 980px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: all 0.15s ease;
}

.btn-wash:hover:not(:disabled) {
  background: #ffe54c;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(255, 219, 0, 0.35);
}

.btn-wash:active:not(:disabled) {
  transform: translateY(0);
}

.btn-wash:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.wash-icon {
  width: 16px;
  height: 16px;
  animation: none;
}

.btn-wash:disabled .wash-icon {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Results ── */
.results {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0;
  min-height: 0;
}

.result-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.result-card:hover {
  border-color: var(--ink-faint);
}

.result-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.result-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.result-writer {
  font-size: 14px;
  font-weight: 900;
  color: var(--ink);
  flex: 1;
}

.btn-copy {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-light);
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  padding: 3px 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  opacity: 0;
}

.result-card:hover .btn-copy {
  opacity: 1;
}

.btn-copy:hover {
  color: var(--ink);
  border-color: var(--ink-faint);
  background: var(--yellow-soft);
}

.result-body {
  flex: 1;
  overflow-y: auto;
  position: relative;
  min-height: 0;
}

.result-body::-webkit-scrollbar { width: 3px; }
.result-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.result-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--ink-faint);
  font-size: 13px;
  font-weight: 500;
}

.result-empty.hidden { display: none; }

.empty-hanger {
  color: var(--ink-faint);
  opacity: 0.4;
}

.result-text {
  padding: 18px;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.85;
  color: var(--ink);
  white-space: pre-wrap;
  animation: slideUp 0.4s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── VS divider ── */
.results-vs {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 900;
  color: var(--ink-faint);
  letter-spacing: 0.1em;
}

/* ── Loading bar ── */
.loading-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.loading-bar.hidden { display: none; }

.loading-progress {
  height: 100%;
  width: 35%;
  background: linear-gradient(90deg, transparent, var(--yellow), var(--blue), transparent);
  border-radius: 3px;
  animation: loadSlide 1.4s ease-in-out infinite;
}

@keyframes loadSlide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(380%); }
}

/* ── Error ── */
.error-msg {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  font-weight: 500;
  color: #dc2626;
  background: #fef2f2;
  border: 1.5px solid #fecaca;
  border-radius: var(--radius-sm);
  padding: 8px 20px;
  animation: fadeUp 0.3s ease;
  white-space: nowrap;
}

.error-msg.hidden { display: none; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Utility ── */
.hidden { display: none !important; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .app {
    padding: 0 16px;
  }

  .hero {
    padding: 20px 0 14px;
  }

  .hero-title {
    font-size: 22px;
  }

  .hero-desc {
    font-size: 13px;
  }

  .writer-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .writers {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .writers::-webkit-scrollbar { display: none; }

  .workspace {
    padding: 12px 0 16px;
    gap: 10px;
  }

  .results {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto 1fr;
  }

  .results-vs {
    width: 100%;
    height: 28px;
  }

  .input-card {
    max-height: 140px;
  }
}
