:root {
  --ink: #19211d;
  --muted: #69736d;
  --paper: #f4f2eb;
  --card: #fbfaf6;
  --line: #d9d9ce;
  --green: #214d3c;
  --lime: #d2f15c;
  --orange: #e8753d;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: "Avenir Next", Avenir, "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
}
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.noise {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: .18;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.12'/%3E%3C/svg%3E");
}

.topbar, main, footer {
  width: min(1240px, calc(100% - 48px));
  margin-inline: auto;
}
.topbar {
  height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  font-size: 15px;
}
.brand b { font-weight: 700; }
.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: var(--green);
  color: var(--lime);
  border-radius: 9px;
}
.brand-mark svg { width: 23px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.privacy-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 500 11px var(--mono);
  letter-spacing: .05em;
  text-transform: uppercase;
}
.privacy-badge span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #53a96d;
  box-shadow: 0 0 0 4px #53a96d1c;
}

.hero {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  align-items: end;
  gap: 72px;
  padding: 70px 0 56px;
}
.eyebrow, .result-kicker {
  margin: 0 0 18px;
  color: var(--orange);
  font: 500 11px var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}
h1 {
  margin: 0;
  font-size: clamp(48px, 6vw, 78px);
  line-height: .98;
  letter-spacing: -.06em;
  font-weight: 600;
}
h1 em {
  color: var(--green);
  font-family: Georgia, serif;
  font-weight: 400;
}
.intro {
  max-width: 470px;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr);
  min-height: 720px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  box-shadow: 0 24px 80px #19211d0b;
  overflow: hidden;
}
.input-panel, .results-panel { padding: 38px; }
.results-panel {
  position: relative;
  background: #ebe9e1;
  border-left: 1px solid var(--line);
}
.section-heading { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 28px; }
.step {
  padding-top: 4px;
  color: var(--orange);
  font: 500 10px var(--mono);
}
.section-heading h2 { margin: 0 0 5px; font-size: 18px; letter-spacing: -.02em; }
.section-heading p { margin: 0; color: var(--muted); font-size: 12px; }

.dropzone {
  min-height: 294px;
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1.5px dashed #b6b9af;
  border-radius: 13px;
  background: #f4f3ed;
  outline: none;
  transition: .2s ease;
}
.dropzone:hover, .dropzone:focus-visible, .dropzone.dragover {
  border-color: var(--green);
  background: #f0f4e7;
  box-shadow: inset 0 0 0 1px var(--green);
}
.empty-state { display: flex; flex-direction: column; align-items: center; }
.upload-icon {
  width: 55px;
  height: 55px;
  display: grid;
  place-items: center;
  margin-bottom: 20px;
  background: var(--lime);
  border-radius: 50%;
}
.upload-icon svg { width: 24px; fill: none; stroke: var(--green); stroke-width: 1.6; }
.empty-state strong { font-size: 15px; }
.empty-state span { margin-top: 7px; color: var(--muted); font-size: 12px; }
.empty-state u { color: var(--green); font-weight: 600; text-underline-offset: 3px; }
.preview-state { position: absolute; inset: 0; }
.preview-state > img { width: 100%; height: 100%; object-fit: cover; }
.preview-state::after {
  content: "";
  position: absolute;
  inset: 55% 0 0;
  background: linear-gradient(transparent, #121a16cc);
}
.remove-button {
  position: absolute;
  z-index: 2;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #fcfbf7e8;
}
.remove-button svg { width: 17px; fill: none; stroke: var(--ink); stroke-width: 1.6; }
.file-card {
  position: absolute;
  z-index: 2;
  left: 18px;
  right: 18px;
  bottom: 18px;
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  color: white;
}
.file-card span { max-width: 70%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 600; }
.file-card small { font: 10px var(--mono); opacity: .8; }

.controls { display: grid; gap: 18px; margin: 28px 0; }
.controls label { display: grid; gap: 9px; color: var(--muted); font-size: 11px; font-weight: 600; }
.controls label > span { display: flex; justify-content: space-between; }
.controls output { color: var(--green); font: 500 10px var(--mono); }
select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefa;
  color: var(--ink);
  font-size: 12px;
}
input[type="range"] {
  appearance: none;
  height: 3px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--green) 35%, var(--line) 35%);
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 15px;
  height: 15px;
  border: 3px solid var(--card);
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 1px var(--green);
}
.analyze-button {
  width: 100%;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 0;
  border-radius: 9px;
  background: var(--green);
  color: white;
  font-weight: 700;
  transition: .2s ease;
}
.analyze-button:hover:not(:disabled) { background: #163c2d; transform: translateY(-1px); }
.analyze-button:disabled { opacity: .35; cursor: not-allowed; }
.analyze-button svg { width: 19px; fill: none; stroke: var(--lime); stroke-width: 1.7; }
.privacy-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 10px;
}
.privacy-note svg { width: 13px; fill: none; stroke: currentColor; stroke-width: 1.3; }

.result-empty, .loading-state, .error-state {
  min-height: 540px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}
.radar {
  width: 110px;
  height: 110px;
  position: relative;
  display: grid;
  place-items: center;
  margin-bottom: 28px;
  border: 1px solid #c7c9c0;
  border-radius: 50%;
}
.radar::before, .radar::after, .radar span {
  content: "";
  position: absolute;
  border: 1px solid #d4d4cc;
  border-radius: 50%;
}
.radar::before { inset: 14px; }
.radar::after { inset: 34px; background: var(--lime); border: 0; }
.radar svg { width: 76px; fill: none; stroke: #c8cac1; stroke-width: .5; }
.result-empty strong, .loading-state strong, .error-state strong { font-size: 17px; }
.result-empty p, .loading-state p, .error-state p {
  max-width: 320px;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
.scanner {
  width: 160px;
  height: 160px;
  position: relative;
  margin-bottom: 30px;
  overflow: hidden;
  border-radius: 20px;
  background: repeating-linear-gradient(45deg, #dde0d5 0 8px, #e9e9e2 8px 16px);
}
.scanner span {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--lime);
  box-shadow: 0 0 20px var(--green);
  animation: scan 1.5s ease-in-out infinite alternate;
}
@keyframes scan { from { top: 8%; } to { top: 92%; } }

.result-content { animation: appear .35s ease; }
@keyframes appear { from { opacity: 0; transform: translateY(8px); } }
.result-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 20px;
  border-radius: 12px;
  background: var(--green);
  color: white;
}
.result-kicker { display: block; margin-bottom: 8px; color: var(--lime); font-size: 9px; }
.result-header p { margin: 0; font: 11px/1.65 var(--mono); overflow-wrap: anywhere; }
.copy-button {
  flex: none;
  padding: 7px 10px;
  border: 1px solid #ffffff40;
  border-radius: 6px;
  background: transparent;
  color: white;
  font-size: 10px;
}
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin: 20px 0; background: var(--line); border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.stat { padding: 13px 12px; background: #f5f3ed; }
.stat span { display: block; margin-bottom: 5px; color: var(--muted); font: 8px var(--mono); text-transform: uppercase; }
.stat strong { font-size: 11px; }
.result-section { padding: 21px 0; border-top: 1px solid var(--line); }
.result-section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.result-section-title h3 { margin: 0; font-size: 13px; }
.result-section-title h3 span { color: var(--muted); font: 9px var(--mono); }
.result-section-title button { border: 0; background: transparent; color: var(--green); font-size: 10px; font-weight: 700; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 7px; max-height: 170px; overflow: auto; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  border: 1px solid #d7d6cc;
  border-radius: 6px;
  background: #f8f7f2;
  font: 9px var(--mono);
}
.tag b { color: var(--green); font-weight: 500; }
.character-cloud .tag { border-color: #d9aa91; background: #faeee7; }
.ratings { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px 22px; }
.rating-top { display: flex; justify-content: space-between; margin-bottom: 6px; font: 9px var(--mono); text-transform: capitalize; }
.rating-track { height: 5px; overflow: hidden; border-radius: 5px; background: #d7d6cf; }
.rating-track span { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.rating:nth-child(2) .rating-track span { background: #b5a148; }
.rating:nth-child(3) .rating-track span { background: var(--orange); }
.rating:nth-child(4) .rating-track span { background: #a34b44; }

.error-state > div {
  width: 55px;
  height: 55px;
  display: grid;
  place-items: center;
  margin-bottom: 20px;
  border-radius: 50%;
  background: #f0d4c7;
  color: #a84032;
  font: 600 22px var(--mono);
}
.error-state button { margin-top: 20px; padding: 9px 15px; border: 1px solid var(--ink); border-radius: 7px; background: transparent; font-size: 11px; }
footer {
  min-height: 100px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font: 9px var(--mono);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 10;
  padding: 10px 15px;
  border-radius: 7px;
  background: var(--ink);
  color: white;
  font-size: 11px;
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 26px; padding-top: 50px; }
  .workspace { grid-template-columns: 1fr; }
  .results-panel { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 560px) {
  .topbar, main, footer { width: min(100% - 24px, 1240px); }
  .privacy-badge { display: none; }
  .hero { padding: 42px 4px 36px; }
  h1 { font-size: 47px; }
  .input-panel, .results-panel { padding: 24px 18px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .ratings { grid-template-columns: 1fr; }
  footer { align-items: flex-start; flex-direction: column; justify-content: center; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
