:root {
  --ink: #1d2b24;
  --muted: #5e7066;
  --line: #dbe4d1;
  --leaf: #1f7a4d;
  --leaf-dark: #15593a;
  --berry: #c73755;
  --sun: #f5b84b;
  --sky: #dff2f0;
  --paper: #fbfcf7;
  --white: #ffffff;
  --shadow: 0 18px 50px rgba(43, 70, 53, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family:
    Inter, Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(18px, 5vw, 64px);
  border-bottom: 1px solid rgba(219, 228, 209, 0.85);
  background: rgba(251, 252, 247, 0.92);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  color: var(--white);
  background: var(--leaf);
  font-weight: 800;
}

.brand p,
.brand span {
  margin: 0;
}

.brand p {
  font-weight: 800;
}

.brand span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

nav {
  display: flex;
  gap: 8px;
}

nav a {
  padding: 9px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

nav a:hover {
  color: var(--leaf-dark);
  background: #edf5e8;
}

main {
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--berry);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 760px;
  font-size: clamp(30px, 4.2vw, 52px);
  line-height: 1.02;
}

h2 {
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.08;
}

h3 {
  font-size: 22px;
}

.section-heading p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.primary-action,
.secondary-action,
button,
.file-button {
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

.primary-action,
button {
  color: var(--white);
  background: var(--leaf);
}

.primary-action:hover,
button:hover {
  background: var(--leaf-dark);
}

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

.secondary-action,
.file-button {
  color: var(--leaf-dark);
  background: var(--white);
  border-color: var(--line);
}

.ad-section,
.scanner-section,
.guide-section {
  padding: clamp(26px, 4.5vw, 54px) clamp(14px, 4vw, 52px);
}

.ad-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-height: 144px;
  background: #eef6ea;
}

.secondary-ad {
  background: var(--white);
}

.shopping-ad {
  min-height: 132px;
  padding-top: 24px;
  padding-bottom: 24px;
  background: #f7fbf4;
}

.ad-label {
  width: min(100%, 320px);
  color: #7d897a;
  font-size: 11px;
  font-weight: 800;
  text-align: left;
}

.responsive-ad {
  display: grid;
  width: 320px;
  height: 100px;
  place-items: center;
  overflow: hidden;
  background: transparent;
}

.ad-search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  width: 320px;
}

.keyword-copy {
  display: inline-grid;
  grid-template-columns: auto auto auto;
  align-items: center;
  gap: 7px;
  width: fit-content;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--white);
  font-size: 12px;
}

.keyword-copy code {
  color: var(--ink);
  font-family: inherit;
  font-weight: 900;
}

.keyword-copy button {
  min-height: 26px;
  padding: 4px 7px;
  color: var(--leaf-dark);
  background: #edf5e8;
  font-size: 11px;
}

.ad-keyword-copy {
  width: 320px;
}

.ad-search-form input {
  min-width: 0;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--white);
}

.ad-search-form button {
  min-height: 38px;
  padding: 8px 11px;
  background: var(--berry);
}

.responsive-ad iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.scanner-section,
.guide-section {
  background: var(--white);
}

.primary-tool {
  padding-top: clamp(18px, 3vw, 34px);
  background:
    linear-gradient(180deg, rgba(223, 242, 240, 0.75), rgba(255, 255, 255, 0) 280px),
    var(--white);
}

.capture-shell,
.analysis-page,
.guide-shell {
  max-width: 720px;
  margin: 0 auto;
}

.result-page {
  width: min(100% - 32px, 1120px);
  margin: 0 auto;
}

.result-layout {
  display: grid;
  grid-template-columns: minmax(0, 720px) 300px;
  justify-content: center;
  gap: 40px;
}

.result-main {
  min-width: 0;
}

.page-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.module-block {
  display: grid;
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.module-block:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.module-header {
  display: grid;
  gap: 3px;
}

.module-header strong {
  color: var(--ink);
  font-size: 14px;
}

.module-header span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.camera-panel .module-header {
  margin-bottom: 10px;
}

.uploaded-preview {
  width: 100%;
  max-height: 420px;
  border-radius: 8px;
  object-fit: cover;
  background: #17251e;
}

.result-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 10px;
}

.side-ad {
  display: grid;
  align-content: start;
  gap: 6px;
  padding-top: 8px;
}

.side-ad .ad-label {
  width: 300px;
}

.side-ad iframe {
  display: block;
  width: 300px;
  height: 250px;
  border: 0;
  background: var(--paper);
}

.result-card h2 {
  font-size: 24px;
}

.result-hero-block h2 {
  margin-top: 2px;
}

.result-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.result-checks {
  display: grid;
  gap: 8px;
  margin: 0;
}

.result-checks div {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.result-checks dt {
  color: var(--muted);
  font-weight: 800;
}

.result-checks dd {
  margin: 0;
  color: var(--ink);
  font-weight: 800;
}

.result-disclaimer {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--white);
  font-size: 12px;
}

.result-shop-link {
  display: inline-flex;
  width: fit-content;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  border-radius: 8px;
  color: var(--white);
  background: var(--berry);
  font-weight: 900;
}

.commerce-block {
  align-items: start;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.section-heading {
  max-width: 760px;
  margin-bottom: 16px;
}

.scanner-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 14px;
}

.camera-panel,
.result-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.camera-panel {
  padding: 12px;
}

.camera-stage {
  position: relative;
  display: grid;
  min-height: 340px;
  overflow: hidden;
  place-items: center;
  border-radius: 8px;
  background: #17251e;
}

video,
canvas,
#preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.placeholder {
  display: grid;
  gap: 8px;
  max-width: 360px;
  padding: 20px;
  color: #e9f3eb;
  text-align: center;
}

.placeholder strong {
  font-size: 19px;
}

.placeholder span {
  color: #bfd0c6;
}

.camera-controls,
.guide-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.file-button input {
  display: none;
}

.result-panel {
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 16px;
}

.result-label {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.score-ring {
  display: grid;
  width: 132px;
  height: 132px;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle closest-side, var(--paper) 72%, transparent 73%),
    conic-gradient(var(--leaf) calc(var(--score) * 1%), #dfe8db 0);
}

.score-ring span {
  font-size: 40px;
  font-weight: 900;
}

.score-ring small {
  margin-top: -32px;
  color: var(--muted);
  font-weight: 800;
}

.score-caption {
  margin: -10px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.result-tips,
.fruit-detail-card ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.season-badge {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--white);
  font-size: 12px;
  line-height: 1.45;
}

.season-badge strong {
  color: var(--ink);
  font-size: 13px;
}

.season-badge.in-season {
  border-color: rgba(31, 122, 77, 0.28);
  background: #f1f8ed;
}

.analysis-panel {
  display: grid;
  gap: 9px;
  padding: 14px;
  border: 1px solid rgba(31, 122, 77, 0.22);
  border-radius: 8px;
  background: #f7fbf4;
}

.analysis-panel[hidden] {
  display: none;
}

.analysis-panel strong {
  font-size: 16px;
}

.analysis-panel span,
.analysis-panel p,
.analysis-panel small,
.analysis-panel em {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.45;
}

.loading-dots {
  display: flex;
  gap: 5px;
  padding: 2px 0;
}

.loading-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--leaf);
  animation: dotPulse 900ms ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
  animation-delay: 120ms;
}

.loading-dots span:nth-child(3) {
  animation-delay: 240ms;
}

.analysis-shopping {
  display: grid;
  gap: 8px;
}

.analysis-shopping[hidden] {
  display: none;
}

.analysis-shopping a,
.analysis-shopping button {
  display: inline-flex;
  width: fit-content;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  padding: 8px 11px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
}

.analysis-shopping a {
  color: var(--white);
  background: var(--berry);
}

.analysis-shopping button {
  color: var(--leaf-dark);
  background: var(--white);
  border-color: var(--line);
}

@keyframes dotPulse {
  0%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }

  50% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

.deal-search {
  display: grid;
  gap: 9px;
  padding-top: 4px;
}

.deal-search label {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.deal-search p,
.deal-search small {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.deal-search div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.deal-search input {
  min-width: 0;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--white);
}

.deal-search button {
  min-height: 38px;
  padding: 8px 11px;
  background: var(--berry);
}

.deal-search button:hover {
  background: #a82d47;
}

.guide-tools input {
  flex: 1 1 280px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--paper);
}

.category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.category-filters button {
  color: var(--leaf-dark);
  background: #edf5e8;
  border-color: var(--line);
}

.category-filters button.active {
  color: var(--white);
  background: var(--leaf);
}

.fruit-grid {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.fruit-card.empty-state {
  grid-column: 1 / -1;
  gap: 8px;
  padding: 20px;
}

.fruit-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.fruit-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 4px 9px 4px 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: var(--paper);
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
}

.fruit-badge:hover,
.fruit-badge.active {
  color: var(--leaf-dark);
  background: #edf5e8;
  border-color: rgba(31, 122, 77, 0.42);
}

.fruit-badge.active {
  box-shadow: inset 0 0 0 1px rgba(31, 122, 77, 0.18);
}

.fruit-badge img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--white);
}

.fruit-detail-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.guide-shell {
  display: grid;
  gap: 14px;
}

.fruit-detail-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.fruit-detail-card h3 {
  font-size: 17px;
}

.fruit-detail-card p,
.fruit-card.empty-state p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.pick-button {
  min-height: 30px;
  padding: 6px 8px;
  color: var(--white);
  background: var(--berry);
  font-size: 11px;
}

.pick-button:hover {
  background: #a82d47;
}

.tag {
  display: inline-flex;
  width: fit-content;
  padding: 4px 7px;
  border-radius: 999px;
  color: var(--leaf-dark);
  background: #e7f3df;
  font-size: 10px;
  font-weight: 800;
}

footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  padding: 26px clamp(18px, 5vw, 64px);
  color: var(--muted);
  background: #14251d;
}

@media (max-width: 860px) {
  .app-header,
  .scanner-layout {
    grid-template-columns: 1fr;
  }

  .app-header {
    align-items: flex-start;
  }

  nav {
    display: none;
  }

  .camera-stage {
    min-height: 320px;
  }
}

@media (max-width: 1050px) {
  .result-layout {
    grid-template-columns: minmax(0, 720px);
  }

  .side-ad {
    display: none;
  }
}

@media (min-width: 500px) {
  .ad-label,
  .responsive-ad,
  .ad-search-form,
  .ad-keyword-copy {
    width: 468px;
  }

  .responsive-ad {
    height: 60px;
  }
}

@media (min-width: 800px) {
  .ad-label,
  .responsive-ad,
  .ad-search-form,
  .ad-keyword-copy {
    width: 728px;
  }

  .responsive-ad {
    height: 90px;
  }
}

@media (min-width: 1200px) {
  .ad-label,
  .responsive-ad,
  .ad-search-form,
  .ad-keyword-copy {
    width: 970px;
  }
}

@media (max-width: 520px) {
  h1 {
    font-size: 28px;
  }

  .fruit-badge {
    min-height: 31px;
    padding-right: 8px;
    font-size: 12px;
  }

  .fruit-badge img {
    width: 22px;
    height: 22px;
  }

  .brand span {
    display: none;
  }

  .camera-controls > *,
  .ad-search-form,
  .ad-keyword-copy,
  .ad-search-form input,
  .ad-search-form button,
  .deal-search div,
  .deal-search input,
  .deal-search button {
    width: 100%;
    text-align: center;
  }

  .ad-search-form {
    grid-template-columns: 1fr;
  }

  .deal-search div {
    grid-template-columns: 1fr;
  }
}
