:root {
  --bg-top: #f8f4e8;
  --bg-bottom: #f0d3b6;
  --surface: rgba(255, 249, 239, 0.92);
  --surface-strong: rgba(255, 255, 255, 0.88);
  --text: #201815;
  --muted: #6b5d56;
  --accent: #d96b33;
  --accent-dark: #8f3a18;
  --line: rgba(107, 93, 86, 0.16);
  --shadow: 0 24px 80px rgba(81, 42, 20, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Segoe UI", "Malgun Gothic", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.95), transparent 30%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

.page {
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: 40px 20px 72px;
}

.hero {
  text-align: center;
  padding: 24px 0 28px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-family: "Impact", "Malgun Gothic", sans-serif;
  font-size: clamp(2.6rem, 6vw, 4.8rem);
  font-weight: 400;
  line-height: 0.95;
}

h2 {
  font-size: clamp(1.4rem, 3vw, 2rem);
}

.lead {
  width: min(100%, 720px);
  margin: 18px auto 0;
  color: var(--muted);
  line-height: 1.7;
}

.panel {
  margin-top: 24px;
  padding: 28px;
  border-radius: 32px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.primary-button,
.upload-button {
  border: 0;
  border-radius: 999px;
  padding: 14px 22px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  box-shadow: 0 14px 28px rgba(143, 58, 24, 0.22);
}

.upload-button {
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(32, 24, 21, 0.08);
}

.primary-button:hover,
.upload-button:hover {
  transform: translateY(-2px);
}

.primary-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

#imageUpload {
  display: none;
}

.status {
  margin: 18px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.viewer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 24px;
}

.viewer-card,
.result-card {
  padding: 20px;
  border-radius: 24px;
  background: var(--surface-strong);
  box-shadow: inset 0 0 0 1px var(--line);
}

.viewer-card-wide {
  max-width: 720px;
  margin: 0 auto;
}

.viewer-card h2 {
  margin-bottom: 14px;
}

.viewer-frame {
  min-height: 320px;
  border-radius: 22px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(255, 227, 197, 0.9), rgba(251, 244, 234, 0.95));
}

.viewer-frame canvas,
.viewer-frame img {
  width: 100%;
  max-width: 360px;
  height: auto;
  border-radius: 18px;
  display: block;
}

.preview-frame img {
  object-fit: contain;
}

.viewer-placeholder {
  width: min(100%, 260px);
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  text-align: center;
}

.result-card {
  margin-top: 18px;
}

.result-head {
  text-align: center;
}

.result-summary {
  margin-top: 16px;
  padding: 18px 20px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(217, 107, 51, 0.12), rgba(255, 255, 255, 0.86));
  font-size: clamp(1.1rem, 2.6vw, 1.5rem);
  font-weight: 700;
  text-align: center;
}

.label-list {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.label-item {
  display: grid;
  gap: 8px;
}

.label-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-weight: 700;
}

.label-track {
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(32, 24, 21, 0.08);
}

.label-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #f0ab69);
  transition: width 0.18s ease;
}

.comments-panel {
  margin-top: 18px;
}

.contact-form {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

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

.field span {
  font-weight: 700;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid rgba(32, 24, 21, 0.12);
  border-radius: 18px;
  padding: 14px 16px;
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.92);
}

.field textarea {
  min-height: 140px;
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: rgba(217, 107, 51, 0.52);
  box-shadow: 0 0 0 4px rgba(217, 107, 51, 0.12);
}

.comments-shell {
  margin-top: 18px;
  padding: 20px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: inset 0 0 0 1px var(--line);
}

@media (max-width: 840px) {
  .viewer-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .page {
    padding: 28px 14px 48px;
  }

  .panel {
    padding: 20px;
    border-radius: 24px;
  }

  .viewer-frame {
    min-height: 260px;
  }

  .controls {
    align-items: stretch;
  }

  .primary-button,
  .upload-button {
    width: 100%;
    text-align: center;
  }
}
