:root {
  color-scheme: light;
  --bg: #f4f6fb;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --ink: #172033;
  --muted: #667085;
  --line: #d9e2ef;
  --blue: #2563eb;
  --blue-soft: #eef5ff;
  --green: #0f9f6e;
  --green-soft: #ecfdf5;
  --amber: #d97706;
  --amber-soft: #fff8eb;
  --red: #dc2626;
  --shadow: 0 18px 48px rgba(31, 45, 71, 0.1);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(37, 99, 235, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
  }
}

@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

@keyframes scoreCountup {
  from {
    opacity: 0.5;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
input,
textarea,
summary {
  font: inherit;
}

.app-shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.workspace {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 30px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, #ffffff 0%, #f6f9ff 100%);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 690px;
  margin-bottom: 10px;
  font-size: clamp(2rem, 4vw, 3.8rem);
  line-height: 1.02;
  letter-spacing: 0;
  animation: slideIn 600ms ease-out;
}

h2 {
  margin-bottom: 5px;
  font-size: 1.06rem;
}

.hero-copy,
.panel-title p,
.section-heading p,
.score-note,
.drop-zone small,
.input-help,
.results-hero p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.hero-copy {
  max-width: 650px;
  font-size: 1rem;
}

.score-pill,
.mini-score {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  animation: slideIn 600ms ease-out;
}

.score-pill {
  width: 116px;
  height: 116px;
}

.score-pill span,
.mini-score span {
  font-size: 2rem;
  font-weight: 900;
  animation: scoreCountup 500ms ease-out 200ms both;
}

.score-pill small,
.mini-score small {
  color: var(--muted);
  font-size: 0.78rem;
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(330px, 440px) 1fr;
  min-height: 720px;
}

.input-panel,
.results-panel {
  padding: 26px;
}

.input-panel {
  border-right: 1px solid var(--line);
  background: var(--panel-soft);
}

.panel-title {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.panel-title span {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 850;
}

.secondary-step {
  margin-top: 24px;
}

.secondary-step span {
  background: #335c8f;
}

.drop-zone {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin: 18px 0 4px;
  padding: 24px;
  text-align: center;
  border: 1px dashed #9aa8bd;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: all 240ms ease;
}

.drop-zone:hover,
.drop-zone.is-dragging {
  border-color: var(--blue);
  background: var(--blue-soft);
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(37, 99, 235, 0.15);
}

.drop-zone input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 1.45rem;
  font-weight: 900;
  animation: bounce 2s infinite;
}

.drop-zone:hover .upload-icon {
  animation: bounce 1s infinite;
}

.field-grid {
  margin-top: 14px;
}

.field-label {
  display: block;
  margin: 0 0 8px;
  color: #39465d;
  font-size: 0.88rem;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: all 240ms ease;
}

input {
  height: 46px;
  padding: 0 13px;
}

textarea {
  min-height: 240px;
  resize: vertical;
  padding: 13px;
  line-height: 1.5;
}

.short-textarea {
  min-height: 118px;
}

input:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  outline: 2px solid transparent;
  outline-offset: 2px;
}

.input-help {
  min-height: 22px;
  margin-top: 8px;
  font-size: 0.88rem;
}

.input-help.warning {
  color: var(--red);
  font-weight: 750;
}

.primary-button {
  width: 100%;
  height: 50px;
  margin-top: 18px;
  border: 0;
  border-radius: 10px;
  background: var(--blue);
  color: #fff;
  font-weight: 850;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.22);
  transition: all 240ms cubic-bezier(0.4, 0, 0.2, 1);
}

.primary-button:hover {
  background: #1d4ed8;
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.35);
}

.primary-button:active {
  transform: translateY(0);
}

.results-panel {
  display: grid;
  gap: 16px;
  align-content: start;
  background: #fff;
  animation: fadeIn 400ms ease-out;
}

.results-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-soft);
  animation: slideIn 500ms ease-out;
}

.results-hero h2 {
  margin-bottom: 4px;
  font-size: 1.35rem;
}

.mini-score {
  width: 82px;
  height: 82px;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.summary-strip > div,
.analysis-block,
.details-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.summary-strip > div {
  padding: 18px;
  animation: slideIn 500ms ease-out;
  animation-fill-mode: both;
}

.summary-strip > div:nth-child(1) {
  animation-delay: 0ms;
}

.summary-strip > div:nth-child(2) {
  animation-delay: 100ms;
}

.summary-strip > div:nth-child(3) {
  animation-delay: 200ms;
}

.metric {
  display: block;
  margin-bottom: 4px;
  font-size: 1.75rem;
  font-weight: 900;
}

.summary-strip small {
  color: var(--muted);
  font-weight: 650;
}

.analysis-block,
.details-card {
  padding: 20px;
  animation: slideIn 500ms ease-out;
  animation-fill-mode: both;
}

.analysis-block:nth-child(1) {
  animation-delay: 0ms;
}

.analysis-block:nth-child(2) {
  animation-delay: 100ms;
}

.analysis-block:nth-child(3) {
  animation-delay: 200ms;
}

.analysis-block:nth-child(4) {
  animation-delay: 300ms;
}

.details-card {
  animation-delay: 400ms;
}

.primary-result {
  border-color: #c7d7f5;
  background: #fbfdff;
  border-left: 4px solid var(--blue);
  position: relative;
}

.primary-result::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--blue), transparent);
  animation: shimmer 2s infinite;
}

.compact {
  margin-bottom: 14px;
}

.suggestion-list {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.suggestion-list li {
  padding: 13px 14px;
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  background: var(--blue-soft);
  line-height: 1.45;
  animation: slideInLeft 400ms ease-out;
  animation-fill-mode: both;
}

.suggestion-list li:nth-child(1) {
  animation-delay: 50ms;
}

.suggestion-list li:nth-child(2) {
  animation-delay: 100ms;
}

.suggestion-list li:nth-child(3) {
  animation-delay: 150ms;
}

.suggestion-list li:nth-child(n+4) {
  animation-delay: 200ms;
}

.score-bar {
  width: 100%;
  height: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef7;
}

.score-bar span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width 1200ms cubic-bezier(0.32, 0, 0.67, 0), background 400ms ease;
  box-shadow: 0 0 20px rgba(37, 99, 235, 0.4);
}

.two-column-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag-list span {
  padding: 8px 10px;
  border: 1px solid #c8d7ee;
  border-radius: 999px;
  background: #f7fbff;
  color: #24466f;
  font-size: 0.9rem;
  font-weight: 750;
  animation: slideIn 400ms ease-out;
  animation-fill-mode: both;
  transition: all 240ms ease;
}

.tag-list span:nth-child(1) {
  animation-delay: 0ms;
}

.tag-list span:nth-child(2) {
  animation-delay: 50ms;
}

.tag-list span:nth-child(3) {
  animation-delay: 100ms;
}

.tag-list span:nth-child(n+4) {
  animation-delay: 150ms;
}

.tag-list span:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.warning-tags span {
  border-color: #f1c77f;
  background: var(--amber-soft);
  color: #8a4c05;
}

.details-card summary {
  cursor: pointer;
  color: var(--ink);
  font-weight: 850;
  transition: all 240ms ease;
  user-select: none;
}

.details-card summary:hover {
  color: var(--blue);
}

.parsed-grid {
  display: grid;
  grid-template-columns: 130px 1fr 80px;
  gap: 12px 16px;
  margin: 18px 0 0;
  align-items: center;
}

.parsed-grid dt {
  color: #39465d;
  font-weight: 850;
}

.parsed-grid dd {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.copy-btn {
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 650;
  color: var(--blue);
  background: var(--blue-soft);
  border: 1px solid #c7d7f5;
  border-radius: 6px;
  cursor: pointer;
  transition: all 240ms cubic-bezier(0.4, 0, 0.2, 1);
  height: fit-content;
  animation: slideIn 500ms ease-out;
}

.copy-btn:hover {
  background: #dde9ff;
  border-color: var(--blue);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.2);
}

.copy-btn:active {
  transform: scale(0.95) translateY(1px);
}

.export-btn {
  margin-top: 16px;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 650;
  color: #fff;
  background: var(--green);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 240ms cubic-bezier(0.4, 0, 0.2, 1);
  animation: slideIn 500ms ease-out 50ms both;
}

.export-btn:hover {
  background: #0a7c5e;
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(15, 159, 110, 0.3);
}

.export-btn:active {
  transform: translateY(0);
}

@media (max-width: 480px) {
  :root {
    --shadow: 0 10px 24px rgba(31, 45, 71, 0.08);
  }

  .app-shell {
    width: calc(100% - 16px);
    padding: 12px 0;
  }

  .workspace {
    border-radius: 12px;
  }

  .topbar {
    flex-direction: column;
    gap: 16px;
    padding: 16px;
    border-radius: 12px 12px 0 0;
  }

  .topbar > div:first-child {
    text-align: center;
  }

  h1 {
    font-size: clamp(1.5rem, 5vw, 2.2rem);
    margin-bottom: 8px;
  }

  .hero-copy {
    font-size: 0.9rem;
    max-width: none;
  }

  .score-pill {
    width: 80px;
    height: 80px;
    margin: 0;
    flex: 0 0 80px;
  }

  .score-pill span {
    font-size: 1.6rem;
  }

  .score-pill small {
    font-size: 0.7rem;
  }

  .main-grid {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .input-panel,
  .results-panel {
    padding: 16px;
    border-right: 0 !important;
    border-bottom: 1px solid var(--line);
  }

  .input-panel:last-child,
  .results-panel:last-child {
    border-bottom: 0;
  }

  .panel-title {
    gap: 10px;
  }

  .panel-title span {
    width: 26px;
    height: 26px;
    font-size: 0.8rem;
  }

  .panel-title h2 {
    font-size: 1rem;
  }

  .drop-zone {
    margin: 12px 0 0;
    padding: 16px;
  }

  .upload-icon {
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
  }

  .field-grid {
    margin-top: 12px;
  }

  .field-label {
    font-size: 0.8rem;
    margin-bottom: 6px;
  }

  input,
  textarea {
    border-radius: 8px;
    font-size: 16px;
  }

  input {
    height: 42px;
    padding: 0 10px;
  }

  textarea {
    min-height: 120px;
    padding: 10px;
    font-size: 16px;
  }

  .short-textarea {
    min-height: 100px;
  }

  .primary-button {
    height: 48px;
    margin-top: 14px;
    font-size: 0.95rem;
    border-radius: 8px;
  }

  .results-hero {
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    border-radius: 10px;
  }

  .results-hero h2 {
    font-size: 1.1rem;
    margin-bottom: 2px;
  }

  .results-hero p {
    font-size: 0.85rem;
  }

  .mini-score {
    width: 70px;
    height: 70px;
    align-self: center;
  }

  .mini-score span {
    font-size: 1.5rem;
  }

  .mini-score small {
    font-size: 0.7rem;
  }

  .summary-strip,
  .two-column-results {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .summary-strip > div {
    padding: 12px;
  }

  .metric {
    font-size: 1.4rem;
    margin-bottom: 2px;
  }

  .summary-strip small {
    font-size: 0.8rem;
  }

  .analysis-block,
  .details-card {
    padding: 14px;
    border-radius: 10px;
    margin-bottom: 8px;
  }

  .section-heading {
    margin-bottom: 10px;
  }

  .section-heading h2 {
    font-size: 1rem;
  }

  .section-heading p {
    font-size: 0.8rem;
  }

  .suggestion-list li {
    padding: 10px 12px;
    font-size: 0.9rem;
    line-height: 1.4;
  }

  .score-bar {
    height: 14px;
  }

  .score-note {
    font-size: 0.85rem;
    line-height: 1.4;
  }

  .tag-list {
    gap: 8px;
  }

  .tag-list span {
    padding: 6px 8px;
    font-size: 0.8rem;
  }

  .copy-btn {
    padding: 5px 10px;
    font-size: 0.75rem;
  }

  .export-btn {
    width: 100%;
    padding: 10px 12px;
    font-size: 0.85rem;
  }

  .parsed-grid {
    grid-template-columns: 1fr;
    gap: 10px 12px;
  }

  .parsed-grid dt {
    grid-column: 1;
    font-size: 0.85rem;
  }

  .parsed-grid dd {
    grid-column: 1;
    font-size: 0.85rem;
    padding-bottom: 10px;
  }

  .copy-btn {
    grid-column: 1;
    margin-bottom: 8px;
  }

  .eyebrow {
    font-size: 0.7rem;
    margin-bottom: 6px;
  }

  details > :not(summary) {
    font-size: 0.9rem;
  }
}

@media (min-width: 481px) and (max-width: 768px) {
  .app-shell {
    width: calc(100% - 20px);
    padding: 12px 0;
  }

  .topbar {
    gap: 18px;
    padding: 22px;
  }

  h1 {
    font-size: clamp(1.8rem, 5vw, 2.6rem);
    margin-bottom: 8px;
  }

  .hero-copy {
    font-size: 0.95rem;
    max-width: 100%;
  }

  .score-pill {
    width: 100px;
    height: 100px;
  }

  .main-grid {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .input-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .input-panel,
  .results-panel {
    padding: 20px;
  }

  .panel-title h2 {
    font-size: 1.05rem;
  }

  input,
  textarea {
    font-size: 16px;
    border-radius: 9px;
  }

  input {
    height: 44px;
    padding: 0 12px;
  }

  textarea {
    min-height: 150px;
    padding: 12px;
  }

  .primary-button {
    height: 48px;
    font-size: 1rem;
  }

  .summary-strip,
  .two-column-results {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .summary-strip > div:nth-child(3) {
    grid-column: 1 / -1;
  }

  .analysis-block,
  .details-card {
    padding: 18px;
  }

  .metric {
    font-size: 1.6rem;
  }

  .parsed-grid {
    grid-template-columns: 1fr;
  }

  .copy-btn {
    grid-column: 1;
  }
}

@media (min-width: 769px) and (max-width: 920px) {
  .app-shell {
    width: min(100% - 24px, 680px);
    padding: 14px 0;
  }

  .main-grid {
    grid-template-columns: minmax(300px, 380px) 1fr;
    min-height: 700px;
  }

  .input-panel {
    padding: 22px;
  }

  .results-panel {
    padding: 20px;
  }

  h1 {
    font-size: clamp(2rem, 4vw, 2.8rem);
  }

  .summary-strip,
  .two-column-results {
    grid-template-columns: 1fr;
  }

  .parsed-grid {
    grid-template-columns: 1fr;
  }

  .copy-btn {
    grid-column: 1;
  }
}

@media (min-width: 921px) and (max-width: 1240px) {
  .main-grid {
    grid-template-columns: minmax(350px, 460px) 1fr;
  }

  .input-panel,
  .results-panel {
    padding: 24px;
  }

  h1 {
    font-size: clamp(2.2rem, 4vw, 3.2rem);
  }

  .topbar {
    padding: 28px;
  }
}

@media (min-width: 1241px) {
  .main-grid {
    grid-template-columns: minmax(400px, 480px) 1fr;
  }

  h1 {
    font-size: 3.8rem;
  }
}

@media (hover: none) and (pointer: coarse) {
  button,
  .copy-btn,
  .export-btn {
    min-height: 48px;
    padding: 12px 16px;
  }

  input,
  textarea {
    font-size: 16px;
    min-height: 48px;
  }

  .drop-zone {
    padding: 20px;
  }

  .primary-button:active {
    background: #1d4ed8;
  }

  .copy-btn:active {
    background: #dde9ff;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (orientation: landscape) and (max-height: 600px) {
  .topbar {
    padding: 12px 20px;
    gap: 12px;
  }

  h1 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    margin-bottom: 4px;
  }

  .hero-copy {
    display: none;
  }

  .score-pill {
    width: 70px;
    height: 70px;
  }

  .score-pill span {
    font-size: 1.4rem;
  }

  .input-panel,
  .results-panel {
    padding: 12px;
  }

  .drop-zone {
    margin: 8px 0 0;
    padding: 12px;
  }

  textarea {
    min-height: 100px;
  }
}

@media (max-width: 600px) {
  .topbar {
    flex-direction: column;
  }

  .main-grid {
    grid-template-columns: 1fr;
  }

  .summary-strip > div:nth-child(3) {
    grid-column: 1;
  }
}
