:root {
  --bg: #f4f7f6;
  --text: #17201d;
  --muted: #5d6c66;
  --panel: #ffffff;
  --line: #cfdad5;
  --accent: #16735b;
  --accent-strong: #0f5f4b;
  --warning: #8b5b00;
  --error: #b3261e;
  --success: #176b31;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(22, 115, 91, 0.08), rgba(22, 115, 91, 0) 320px),
    var(--bg);
}

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

.intro {
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 760px;
  margin: 0;
  font-size: 44px;
  line-height: 1.08;
}

.lead {
  max-width: 640px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.5;
}

.upload-panel {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.upload-panel h2,
.notes h2 {
  margin: 0 0 16px;
  font-size: 22px;
}

.upload-form {
  display: grid;
  gap: 16px;
}

.drop-zone {
  display: grid;
  gap: 8px;
  min-height: 210px;
  align-content: center;
  justify-items: center;
  padding: 24px;
  border: 2px dashed var(--line);
  border-radius: 8px;
  background: #f9fbfa;
  cursor: pointer;
  text-align: center;
}

.drop-zone.is-dragging {
  border-color: var(--accent);
  background: #eef8f4;
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.drop-title {
  font-size: 20px;
  font-weight: 700;
}

.drop-meta,
.file-name {
  color: var(--muted);
}

.file-name {
  max-width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  background: #eef2f0;
  font-size: 14px;
}

button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  padding: 12px 18px;
  color: #ffffff;
  background: var(--accent);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

button:disabled {
  opacity: 0.65;
  cursor: wait;
}

.cancel-button {
  color: var(--error);
  background: #ffffff;
  border: 1px solid var(--error);
}

.cancel-button:hover {
  color: #ffffff;
  background: var(--error);
}

.cancel-button[hidden] {
  display: none;
}

.model-panel {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.model-panel label {
  font-weight: 700;
}

.model-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.model-row select {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
}

.model-row button {
  width: auto;
}

.model-status {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.status {
  margin-top: 16px;
  min-height: 44px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #f8faf9;
}

.status[data-type="progress"] {
  color: var(--warning);
}

.status[data-type="success"] {
  color: var(--success);
}

.status[data-type="error"] {
  color: var(--error);
}

.progress-panel {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

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

.progress-head,
.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.progress-head {
  font-weight: 700;
}

.progress-meta {
  color: var(--muted);
  font-size: 14px;
}

.progress-track {
  height: 12px;
  overflow: hidden;
  border-radius: 8px;
  background: #e1e8e5;
}

.progress-bar {
  width: 35%;
  height: 100%;
  border-radius: 8px;
  background: var(--accent);
  animation: progress-slide 1.4s ease-in-out infinite;
}

.progress-panel[data-state="done"] .progress-bar {
  width: 100%;
  animation: none;
  transform: none;
}

.download-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4fbf8;
}

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

.download-panel p {
  margin: 6px 0 0;
  color: var(--muted);
}

.download-link {
  flex: 0 0 auto;
  min-height: 46px;
  padding: 13px 18px;
  border-radius: 8px;
  color: #ffffff;
  background: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.download-link:hover {
  background: var(--accent-strong);
}

@keyframes progress-slide {
  0% {
    transform: translateX(-110%);
  }

  50% {
    transform: translateX(95%);
  }

  100% {
    transform: translateX(300%);
  }
}

.notes {
  margin-top: 28px;
}

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

.note-grid article {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.note-grid h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.note-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

@media (max-width: 680px) {
  .app {
    width: min(100% - 24px, 980px);
    padding: 28px 0;
  }

  h1 {
    font-size: 34px;
  }

  .lead {
    font-size: 16px;
  }

  .upload-panel {
    padding: 16px;
  }

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

  .progress-head,
  .progress-meta {
    display: grid;
  }

  .download-panel {
    display: grid;
  }

  .download-link {
    text-align: center;
  }

  .model-row {
    grid-template-columns: 1fr;
  }
}
