/* ============================================
   Coral Hero AI — Sketch Style
   ============================================ */

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

:root {
  --paper: #f4f4f4;
  --ink: #333;
  --ink-soft: #5a5a5a;
  --ink-faint: #8a8a8a;
  --accent: #99e2b4;
  --accent-deep: #6cc991;
  --tape: rgba(255, 220, 130, 0.55);
  --shadow: 0 6px 0 rgba(0,0,0,0.05), 0 12px 24px rgba(0,0,0,0.06);
  --sketch-radius-a: 255px 15px 225px 15px / 15px 225px 15px 255px;
  --sketch-radius-b: 15px 225px 15px 255px / 225px 15px 255px 15px;
  --sketch-radius-c: 125px 25px 200px 30px / 25px 175px 30px 145px;
  --sketch-radius-btn: 30px 4px 24px 8px / 8px 22px 6px 28px;
}

html, body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'Nunito', system-ui, -apple-system, sans-serif;
  font-weight: 600;
  min-height: 100%;
  cursor: none;
  /* Notebook lines */
  background-image:
    radial-gradient(rgba(0,0,0,0.04) 1px, transparent 1px);
  background-size: 22px 22px;
  background-attachment: fixed;
}

@media (max-width: 640px) {
  html, body { cursor: auto; }
  .pencil-cursor { display: none; }
}

a { color: var(--ink); text-decoration: underline wavy var(--accent-deep); text-underline-offset: 4px; }
a:hover { color: var(--accent-deep); }

button { font-family: inherit; cursor: none; }

/* ----- Pencil cursor ----- */
.pencil-cursor {
  position: fixed;
  top: 0; left: 0;
  width: 32px; height: 32px;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-4px, -28px) rotate(-12deg);
  transition: transform 0.08s ease-out;
  will-change: transform;
}
.pencil-cursor.click { transform: translate(-4px, -28px) rotate(-30deg) scale(0.85); }

/* ----- SVG defs hidden ----- */
.svg-defs { position: absolute; width: 0; height: 0; }

/* ----- Layout ----- */
.paper {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 24px 64px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

main {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  grid-template-areas:
    "scanner findings"
    "guide   guide";
  gap: 24px;
}
.scanner-card { grid-area: scanner; }
.findings-card { grid-area: findings; }
.field-guide   { grid-area: guide; }

@media (max-width: 860px) {
  main {
    grid-template-columns: 1fr;
    grid-template-areas: "scanner" "findings" "guide";
  }
}

/* ----- Headings ----- */
h1, h2, h3, .brand, .dz-title, .card-tag, .verdict-label, .note-title {
  font-family: 'Indie Flower', 'Comic Sans MS', cursive;
  letter-spacing: 0.5px;
}

h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 1.1; }
h2 { font-size: 1.6rem; margin-bottom: 0.4rem; }

.muted { color: var(--ink-soft); font-weight: 600; }

/* ----- Taped header note ----- */
.taped-note {
  position: relative;
  background: #fdfdf7;
  padding: 28px 28px 24px;
  border-radius: var(--sketch-radius-a);
  border: 2px solid var(--ink);
  box-shadow: var(--shadow);
  text-align: center;
  transform: rotate(-0.6deg);
  animation: boil 6s ease-in-out infinite alternate;
}
.taped-note .brand {
  display: inline-block;
  font-size: 1.15rem;
  color: var(--accent-deep);
  background: rgba(153,226,180,0.25);
  padding: 2px 12px;
  border-radius: 18px 6px 16px 8px / 8px 14px 6px 18px;
  margin-bottom: 8px;
}
.taped-note .brief {
  max-width: 620px;
  margin: 14px auto 0;
  color: var(--ink-soft);
  font-weight: 600;
  font-family: 'Nunito', sans-serif;
  font-size: 0.98rem;
  line-height: 1.55;
}

.tape {
  position: absolute;
  width: 96px; height: 22px;
  background: var(--tape);
  border: 1px dashed rgba(0,0,0,0.2);
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}
.tape-left  { top: -10px; left: 18px; transform: rotate(-8deg); }
.tape-right { top: -10px; right: 18px; transform: rotate(7deg); }
.tape-center{ top: -12px; left: 50%; transform: translateX(-50%) rotate(-3deg); }

/* ----- Sketch cards ----- */
.card {
  position: relative;
  background: #fffefb;
  border: 2px solid var(--ink);
  border-radius: var(--sketch-radius-a);
  padding: 26px 26px 22px;
  box-shadow: var(--shadow);
  animation: boil 7s ease-in-out infinite alternate;
}
.card + .card { animation-delay: -1.5s; }
.scanner-card  { border-radius: var(--sketch-radius-b); }
.findings-card { border-radius: var(--sketch-radius-c); animation-duration: 8s; }
.field-guide   { border-radius: var(--sketch-radius-a); animation-duration: 9s; }

.card-tag {
  position: absolute;
  top: -14px; left: 22px;
  background: var(--accent);
  color: var(--ink);
  padding: 2px 14px;
  border: 2px solid var(--ink);
  border-radius: 16px 4px 14px 6px / 6px 12px 4px 18px;
  font-size: 1rem;
  transform: rotate(-2deg);
}

/* "boiling" animation — subtle border radius shift */
@keyframes boil {
  0%   { border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px; }
  50%  { border-radius: 220px 25px 245px 18px / 22px 200px 18px 240px; }
  100% { border-radius: 240px 20px 235px 12px / 18px 215px 22px 250px; }
}

/* ----- Dropzone ----- */
.dropzone {
  position: relative;
  margin-top: 18px;
  height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: none;
  overflow: hidden;
  border-radius: 14px;
}
.dropzone-frame {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
.dropzone-inner {
  text-align: center;
  pointer-events: none;
  transition: transform 0.25s ease;
}
.dropzone:hover .dropzone-inner { transform: translateY(-3px) rotate(-0.8deg); }
.dz-title { font-size: 1.5rem; margin-top: 12px; }
.dz-sub { color: var(--ink-soft); margin-top: 4px; font-weight: 600; }
.dz-sub .link { color: var(--accent-deep); text-decoration: underline wavy var(--accent-deep); }
.dropzone.is-dragging .dropzone-inner { transform: scale(1.08) rotate(-2deg); color: var(--accent-deep); }
.dropzone.is-dragging { background: rgba(153,226,180,0.15); }

#preview {
  position: absolute;
  inset: 12px;
  width: calc(100% - 24px);
  height: calc(100% - 24px);
  object-fit: cover;
  border-radius: 12px;
  display: none;
  filter: saturate(1.05);
}
.dropzone.has-image #preview { display: block; }
.dropzone.has-image .dropzone-inner { display: none; }

/* ----- Scan progress ----- */
.scan-line {
  margin-top: 14px;
  display: none;
  text-align: center;
}
.scan-line.active { display: block; }
.scan-line svg { width: 100%; height: 36px; display: block; }
.scan-text {
  font-family: 'Indie Flower', cursive;
  font-size: 1.15rem;
  color: var(--ink-soft);
  margin-top: 4px;
}

/* ----- Sketch buttons ----- */
.scan-actions {
  display: flex;
  gap: 12px;
  margin-top: 18px;
  flex-wrap: wrap;
}
.sketch-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 22px;
  font-family: 'Indie Flower', cursive;
  font-size: 1.2rem;
  background: #fff;
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: var(--sketch-radius-btn);
  transition: transform 0.18s cubic-bezier(.34,1.56,.64,1);
  overflow: hidden;
  z-index: 1;
}
.sketch-btn .label { position: relative; z-index: 2; }
.sketch-btn .scribble {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(135deg, transparent 0 5px, rgba(153,226,180,0.0) 5px 10px);
  transform: translateX(-105%) rotate(-2deg);
  transition: transform 0.25s ease;
  z-index: 1;
}
.sketch-btn:hover .scribble {
  background:
    repeating-linear-gradient(135deg, var(--accent) 0 4px, rgba(153,226,180,0) 4px 9px);
  transform: translateX(0) rotate(-2deg);
}
.sketch-btn:hover { transform: translateY(-2px) rotate(-1deg) scale(1.03); }
.sketch-btn:active { transform: translateY(1px) scale(0.97); }
.sketch-btn.primary { background: var(--accent); }
.sketch-btn.ghost { background: transparent; }
.sketch-btn[disabled] { opacity: 0.5; pointer-events: none; }

.model-hint {
  margin-top: 14px;
  font-size: 0.82rem;
  color: var(--ink-faint);
  font-family: 'Nunito', sans-serif;
}
.model-hint code {
  background: #efeee7;
  padding: 1px 6px;
  border-radius: 4px;
  font-family: ui-monospace, Menlo, monospace;
  color: var(--ink);
}

/* ----- Findings / Verdicts ----- */
.verdict-empty { padding: 14px 0; }
.verdict-list { list-style: none; display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.verdict-item {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 2px solid var(--ink);
  border-radius: var(--sketch-radius-btn);
  background: #fffefb;
  animation: popIn 0.45s cubic-bezier(.34,1.56,.64,1);
}
.verdict-item.top { background: rgba(153,226,180,0.25); }
.verdict-emoji { font-size: 2rem; line-height: 1; }
.verdict-label { font-size: 1.4rem; }
.verdict-bar {
  position: relative;
  height: 14px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 4px;
  background: #fff;
}
.verdict-bar-fill {
  height: 100%;
  background: var(--accent);
  width: 0;
  transition: width 0.8s cubic-bezier(.4,0,.2,1);
}
.verdict-pct {
  font-family: 'Nunito', sans-serif;
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-top: 2px;
}
.verdict-blurb {
  font-family: 'Nunito', sans-serif;
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-top: 4px;
  line-height: 1.5;
}

@keyframes popIn {
  from { opacity: 0; transform: translateY(8px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

/* ----- Field Guide notes ----- */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-top: 14px;
}
.note {
  position: relative;
  padding: 18px 16px 16px;
  background: #fdfdf7;
  border: 2px solid var(--ink);
  border-radius: var(--sketch-radius-c);
  transition: transform 0.25s cubic-bezier(.34,1.56,.64,1);
  animation: boil 8s ease-in-out infinite alternate;
}
.note:nth-child(2) { animation-delay: -1.2s; transform: rotate(0.6deg); }
.note:nth-child(3) { animation-delay: -2.4s; transform: rotate(-0.5deg); }
.note:nth-child(4) { animation-delay: -3.6s; transform: rotate(0.3deg); }
.note:hover { transform: translateY(-4px) rotate(-1.5deg) scale(1.02); }
.note .icon {
  width: 48px; height: 48px;
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
}
.note-title { font-size: 1.25rem; margin-bottom: 4px; }
.note-body {
  font-family: 'Nunito', sans-serif;
  font-size: 0.88rem;
  color: var(--ink-soft);
  line-height: 1.55;
}

/* ----- Footer ----- */
.footer {
  position: relative;
  text-align: center;
  padding: 22px 18px 16px;
  background: #fdfdf7;
  border: 2px solid var(--ink);
  border-radius: var(--sketch-radius-b);
  box-shadow: var(--shadow);
  font-family: 'Indie Flower', cursive;
  font-size: 1.1rem;
}
.footer .links { margin-top: 6px; display: flex; gap: 10px; justify-content: center; align-items: center; }
.footer .links a { font-family: 'Indie Flower', cursive; font-size: 1.1rem; }
