:root {
  --bg-1: #f7f3ea;
  --bg-2: #e7d8c2;
  --ink: #1f1e1a;
  --muted: #5a554a;
  --card: rgba(255, 249, 240, 0.78);
  --line: rgba(63, 53, 37, 0.18);
  --accent: #0f766e;
  --accent-2: #155e75;
  --error: #a11f2d;
  --radius-lg: 24px;
  --radius-md: 14px;
  --shadow: 0 18px 60px rgba(61, 52, 35, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 18%, rgba(15, 118, 110, 0.2), transparent 34%),
    radial-gradient(circle at 85% 12%, rgba(21, 94, 117, 0.16), transparent 30%),
    linear-gradient(145deg, var(--bg-1), var(--bg-2));
  overflow-x: hidden;
}

.scene-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent 28px,
      rgba(89, 77, 57, 0.04) 28px,
      rgba(89, 77, 57, 0.04) 29px
    );
}

.page {
  width: min(1100px, 92vw);
  margin: 42px auto;
  animation: rise-in 0.65s ease;
}

.hero {
  margin-bottom: 28px;
}

.kicker {
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.76rem;
  color: var(--accent-2);
  margin: 0 0 12px;
}

h1 {
  font-family: "Sora", sans-serif;
  margin: 0;
  font-size: clamp(1.9rem, 4vw, 3rem);
  line-height: 1.08;
  max-width: 700px;
}

.subtitle {
  margin: 14px 0 0;
  max-width: 640px;
  color: var(--muted);
  font-size: 1.05rem;
}

.panel-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 20px;
}

.card {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.upload-card {
  padding: 22px;
}

.notes-card {
  padding: 24px;
  display: grid;
  align-content: start;
  gap: 14px;
}

.notes-card h2 {
  margin: 0;
  font-family: "Sora", sans-serif;
  font-size: 1.2rem;
}

.notes-card ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 10px;
  color: #3a362d;
}

.notes-footer {
  margin: 4px 0 0;
  color: #4a463d;
  font-size: 0.94rem;
}

.drop-area {
  border: 2px dashed rgba(15, 118, 110, 0.45);
  background: rgba(255, 255, 255, 0.5);
  padding: 22px;
  border-radius: 18px;
  margin-bottom: 16px;
  cursor: pointer;
  text-align: center;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.drop-area:hover,
.drop-area.drag-active {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(15, 118, 110, 0.85);
}

.drop-title {
  margin: 0;
  font-weight: 800;
  font-size: 1.02rem;
}

.drop-subtitle {
  margin: 5px 0 12px;
  color: var(--muted);
}

input[type="file"] {
  width: 100%;
  font: inherit;
  color: #2f2b24;
}

.input-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.secondary-btn,
.capture-btn {
  width: 100%;
  padding: 10px;
  border-radius: 11px;
  font-weight: 700;
  font-size: 0.92rem;
}

.secondary-btn {
  border: 1px solid rgba(15, 118, 110, 0.35);
  color: #0f5a54;
  background: rgba(255, 255, 255, 0.62);
}

.secondary-btn:hover {
  box-shadow: none;
  transform: translateY(-1px);
}

.camera-box {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.56);
  overflow: hidden;
  margin-bottom: 14px;
  animation: rise-in 0.2s ease;
}

#cameraFeed {
  width: 100%;
  height: 230px;
  object-fit: cover;
  display: block;
  background: rgba(0, 0, 0, 0.2);
}

.camera-actions {
  padding: 10px;
}

.capture-btn {
  border: 0;
  color: #ecfffb;
  background: linear-gradient(110deg, #0b8a80, #0f766e);
}

#preview {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  margin-bottom: 14px;
  animation: pop-in 0.28s ease;
}

button {
  width: 100%;
  padding: 12px;
  border: 0;
  border-radius: 13px;
  background: linear-gradient(110deg, var(--accent), var(--accent-2));
  color: #ecfffb;
  font-weight: 700;
  font-size: 0.98rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 20px rgba(15, 118, 110, 0.22);
}

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

.loader {
  margin: 16px auto;
  border: 4px solid rgba(15, 118, 110, 0.16);
  border-top: 4px solid var(--accent);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  animation: spin 0.95s linear infinite;
}

.hidden {
  display: none;
}

.result-panel {
  margin-top: 15px;
  text-align: left;
  display: grid;
  gap: 10px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  animation: rise-in 0.3s ease;
}

.result-item,
.scores-section {
  display: grid;
  gap: 4px;
}

.result-label {
  font-size: 0.73rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #5d574c;
}

.scores-list {
  display: grid;
  gap: 8px;
}

.score-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 10px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(63, 53, 37, 0.14);
}

.result-error {
  color: var(--error);
  font-weight: 700;
}

.progress-container {
  width: 100%;
  height: 9px;
  background: rgba(15, 118, 110, 0.14);
  border-radius: 99px;
  margin-top: 12px;
}

#progressBar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #14b8a6, #22c55e);
  border-radius: 99px;
  transition: width 0.45s ease;
}

@keyframes spin {
  100% {
    transform: rotate(360deg);
  }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 920px) {
  .panel-grid {
    grid-template-columns: 1fr;
  }

  .page {
    margin-top: 28px;
  }
}

@media (max-width: 540px) {
  .page {
    width: 94vw;
  }

  .upload-card,
  .notes-card {
    padding: 16px;
  }

  .drop-area {
    padding: 16px;
  }

  #preview {
    height: 184px;
  }

  .input-actions {
    flex-direction: column;
  }

  #cameraFeed {
    height: 200px;
  }
}