:root {
  --paper: #f8f1e6;
  --ink: #1f1a14;
  --ink-soft: #40352a;
  --accent: #c06b3e;
  --accent-2: #4f7f73;
  --glass: rgba(255, 255, 255, 0.72);
  --shadow: 0 24px 60px rgba(31, 26, 20, 0.18);
  --radius-lg: 26px;
  --radius-md: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans KR", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, #f4d8ba 0%, transparent 55%),
    radial-gradient(circle at 20% 20%, #f9efe0 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, #d7e6da 0%, transparent 55%),
    var(--paper);
  min-height: 100vh;
  padding: 24px clamp(16px, 5vw, 56px) 36px;
  position: relative;
  overflow-x: hidden;
}

.ambient span {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.3;
  z-index: 0;
}

.ambient span:nth-child(1) {
  width: 220px;
  height: 220px;
  background: #e6b48a;
  top: -80px;
  left: -60px;
}

.ambient span:nth-child(2) {
  width: 260px;
  height: 260px;
  background: #9bc0a1;
  bottom: 20%;
  right: -120px;
}

.ambient span:nth-child(3) {
  width: 180px;
  height: 180px;
  background: #f1cbb0;
  top: 55%;
  left: 15%;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  position: relative;
  z-index: 2;
  margin-bottom: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 700;
  font-family: "Playfair Display", serif;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}

.brand-sub {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--ink-soft);
}

.header-actions {
  display: flex;
  gap: 12px;
}

.layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-2);
  margin: 0;
}

.panel {
  background: var(--glass);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(8px);
  animation: rise 0.9s ease forwards;
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 20px;
}

.panel h1 {
  font-family: "Playfair Display", serif;
  font-size: clamp(28px, 4vw, 40px);
  margin: 8px 0 12px;
  line-height: 1.15;
}

.panel p {
  margin: 0;
  color: var(--ink-soft);
}

.upload-panel .panel-header {
  margin-bottom: 18px;
}

.upload-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed rgba(64, 53, 42, 0.3);
  border-radius: var(--radius-md);
  padding: 22px;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.upload-zone:hover {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.8);
}

.upload-zone input {
  display: none;
}

.upload-copy {
  text-align: center;
}

.upload-title {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

.upload-sub {
  font-size: 13px;
  color: var(--ink-soft);
}

.preview-card {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr 160px;
  gap: 16px;
  align-items: center;
  background: rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-md);
  padding: 14px;
  border: 1px solid rgba(64, 53, 42, 0.08);
}

.preview-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 6px;
}

.preview-sub {
  font-size: 13px;
  margin: 0;
  color: var(--ink-soft);
}

.preview-image {
  width: 160px;
  height: auto;
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  background: #efe4d6;
  overflow: hidden;
  display: grid;
  place-items: center;
  position: relative;
  max-height: 240px;
}

.preview-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: none;
}

.preview-image img.visible {
  display: block;
}

.preview-image canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: none;
  pointer-events: none;
}

.preview-image canvas.visible {
  display: block;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

button {
  font-family: "Noto Sans KR", sans-serif;
}

.primary,
.ghost {
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 20px rgba(192, 107, 62, 0.3);
}

.primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.primary:hover:not(:disabled),
.ghost:hover {
  transform: translateY(-1px);
}

.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid rgba(64, 53, 42, 0.2);
}

.status {
  margin-top: 18px;
}

.status-bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(64, 53, 42, 0.12);
  overflow: hidden;
}

.status-progress {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), #efb07d);
  transition: width 0.3s ease;
}

.status p {
  margin-top: 10px;
  font-size: 13px;
  color: var(--ink-soft);
}

.result-panel {
  animation-delay: 0.2s;
}

.result-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 18px;
}

.result-chip {
  background: #1f1a14;
  color: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
}

.line-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.line-card {
  background: rgba(255, 255, 255, 0.8);
  border-radius: 18px;
  padding: 16px;
  border: 1px solid rgba(64, 53, 42, 0.1);
}

.line-card h4 {
  margin: 0 0 8px;
  font-size: 16px;
}

.line-card p {
  font-size: 14px;
  line-height: 1.6;
}

.keyword-box {
  margin-top: 22px;
  background: linear-gradient(120deg, #f1d3b5, #f9efe2);
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(192, 107, 62, 0.2);
}

.keyword-title {
  font-size: 13px;
  margin-bottom: 6px;
  color: var(--ink-soft);
}

.keyword {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
}

.result-footer {
  margin-top: 18px;
  font-size: 12px;
  color: var(--ink-soft);
}

.site-footer {
  margin-top: 32px;
  font-size: 12px;
  color: var(--ink-soft);
  text-align: center;
}

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

@media (max-width: 920px) {
  .layout {
    max-width: 720px;
  }
}

@media (max-width: 720px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .preview-card {
    grid-template-columns: 1fr;
  }

  .preview-image {
    width: 100%;
    height: auto;
    max-height: 45vh;
  }
}

.is-hidden {
  display: none;
}
