:root {
  --bg: #f2f3ec;
  --panel: #fffef8;
  --surface: #ffffff;
  --text: #152539;
  --muted: #5c6a78;
  --accent: #007a73;
  --accent-strong: #005b55;
  --accent-2: #cb6a03;
  --line: #d8d6cb;
  --ok: #0c6f4e;
  --danger: #a33737;
  --shadow-soft: 0 14px 36px rgba(21, 37, 57, 0.09);
  --shadow-strong: 0 18px 48px rgba(21, 37, 57, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 11% 13%, #fbe4be 0%, transparent 34%),
    radial-gradient(circle at 86% 18%, #c8ebdf 0%, transparent 40%),
    radial-gradient(circle at 72% 92%, #f8d9ae 0%, transparent 30%),
    var(--bg);
  font-family: "Source Sans 3", sans-serif;
  line-height: 1.45;
}

img {
  max-width: 100%;
  height: auto;
}

.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(21, 37, 57, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(21, 37, 57, 0.03) 1px, transparent 1px);
  background-size: 30px 30px;
  mask-image: radial-gradient(circle at center, black 52%, transparent 100%);
}

.glow {
  position: fixed;
  border-radius: 999px;
  filter: blur(76px);
  opacity: 0.48;
  pointer-events: none;
}

.glow-a {
  width: 300px;
  height: 300px;
  top: -60px;
  right: 6%;
  background: #e8ab50;
}

.glow-b {
  width: 260px;
  height: 260px;
  bottom: -50px;
  left: 8%;
  background: #0b8d82;
}

.app-shell {
  position: relative;
  max-width: 1100px;
  margin: 0 auto;
  padding: 38px 20px 54px;
}

.hero {
  margin-bottom: 24px;
  animation: slide-in 700ms ease-out;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.74rem;
}

h1,
h2,
h3,
h4 {
  font-family: "Space Grotesk", sans-serif;
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  max-width: 22ch;
  font-size: clamp(1.8rem, 3.2vw, 2.65rem);
  line-height: 1.1;
}

.subtitle {
  margin: 0;
  max-width: 70ch;
  color: var(--muted);
  font-size: 1.04rem;
}

.panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86) 0%, rgba(255, 255, 255, 0.78) 100%),
    var(--panel);
  border: 1px solid color-mix(in srgb, var(--line) 78%, #ffffff 22%);
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(5px);
}

.upload-panel {
  animation: fade-up 540ms ease-out both;
}

#analyzeForm {
  display: grid;
  gap: 10px;
}

.field-label {
  display: block;
  margin-bottom: 2px;
  font-weight: 700;
  font-size: 0.95rem;
}

input[type="file"] {
  width: 100%;
  padding: 12px;
  border: 1px solid #b6c3cd;
  border-radius: 12px;
  font: inherit;
  color: var(--text);
  background: #ffffff;
}

input[type="file"]::file-selector-button {
  margin-right: 12px;
  border: 0;
  border-radius: 10px;
  padding: 8px 12px;
  font: 700 0.9rem/1 "Space Grotesk", sans-serif;
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent), #13a49f);
}

input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 40%, white 60%);
  border-color: var(--accent);
}

.file-meta {
  margin: 0;
  color: var(--muted);
  min-height: 1.25rem;
}

button {
  justify-self: start;
  border: none;
  border-radius: 12px;
  padding: 12px 18px;
  color: #ffffff;
  font: 700 0.98rem/1 "Space Grotesk", sans-serif;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, var(--accent), #11a39d);
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
  box-shadow: 0 10px 18px rgba(0, 122, 115, 0.28);
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 26px rgba(0, 122, 115, 0.33);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.66;
  cursor: wait;
  transform: none;
}

.status {
  margin: 12px 0 0;
  min-height: 1.35rem;
  font-weight: 700;
}

.status.success {
  color: var(--ok);
}

.status.error {
  color: var(--danger);
}

.loading-wrap {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--line) 86%, #ffffff 14%);
  border-radius: 12px;
  background: #f8fbf8;
}

.loading-message {
  margin: 0 0 8px;
  color: #2f495f;
  font-weight: 700;
  font-size: 0.95rem;
}

.progress-track {
  position: relative;
  width: 100%;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: #dbe7e5;
  border: 1px solid #c2d5d1;
}

.progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0) 35%),
    linear-gradient(90deg, var(--accent), #13a49f 60%, #4fb7b2 100%);
  transition: width 180ms linear;
}

.progress-value {
  margin: 8px 0 0;
  font-weight: 800;
  font-size: 0.88rem;
  color: var(--accent-strong);
  letter-spacing: 0.04em;
}

.hidden {
  display: none;
}

.result-panel {
  margin-top: 20px;
  animation: fade-up 420ms ease-out both;
}

.result-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.result-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.meta-grid,
.lists-grid {
  display: grid;
  gap: 12px;
}

.meta-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 12px;
}

.meta-card {
  border: 1px solid color-mix(in srgb, var(--line) 84%, #ffffff 16%);
  border-radius: 13px;
  padding: 12px;
  background: var(--surface);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.meta-card h3 {
  margin: 0 0 8px;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
  color: #32465c;
}

.meta-card p {
  margin: 0;
  font-size: 1.04rem;
  font-weight: 700;
  word-break: break-word;
}

#shareCard {
  margin-bottom: 12px;
}

.stored-image {
  display: block;
  width: 100%;
  max-width: min(100%, 860px);
  max-height: 560px;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--line) 86%, #ffffff 14%);
  background: #f9faf7;
  box-shadow: var(--shadow-strong);
}

.result-link {
  display: inline-block;
  color: var(--accent-strong);
  font-weight: 700;
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
  word-break: break-word;
}

.result-link:hover {
  color: var(--accent);
}

.lists-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.component-list {
  display: grid;
  gap: 10px;
}

.component-card {
  border: 1px solid color-mix(in srgb, var(--line) 86%, #ffffff 14%);
  border-left: 4px solid var(--accent-2);
  border-radius: 12px;
  background: #ffffff;
  padding: 12px;
  box-shadow: 0 6px 14px rgba(21, 37, 57, 0.06);
}

.component-card h4 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.component-card p {
  margin: 0 0 6px;
  color: var(--muted);
  line-height: 1.45;
}

.component-card p:last-child {
  margin-bottom: 0;
}

.empty {
  margin: 0;
  color: var(--muted);
  font-style: italic;
}

.raw-panel {
  margin-top: 16px;
  border-top: 1px dashed var(--line);
  padding-top: 12px;
}

.raw-panel summary {
  cursor: pointer;
  font-weight: 700;
}

pre {
  margin: 10px 0 0;
  max-height: 310px;
  overflow: auto;
  padding: 11px;
  border-radius: 10px;
  background: #f2f0e5;
  border: 1px solid var(--line);
  color: #2c3f54;
  white-space: pre-wrap;
}

@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 860px) {
  .meta-grid,
  .lists-grid {
    grid-template-columns: 1fr;
  }

  .stored-image {
    max-height: 420px;
  }
}

@media (max-width: 620px) {
  .app-shell {
    padding: 22px 12px 36px;
  }

  .panel {
    padding: 16px;
    border-radius: 14px;
  }

  h1 {
    font-size: 1.62rem;
  }

  button {
    width: 100%;
    justify-self: stretch;
  }

  .stored-image {
    max-height: 320px;
  }
}
