:root {
  color-scheme: light dark;
  font-family: 'SF Pro Text', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
  color: #16223b;
  line-height: 1.5;
  background: radial-gradient(circle at 20% 15%, #dfe9ff 0%, transparent 48%),
    radial-gradient(circle at 80% 80%, #e9dbff 0%, transparent 42%),
    linear-gradient(155deg, #f7f9ff 0%, #eef2fb 52%, #e9edf7 100%);
}

.app {
  width: min(100%, 430px);
  min-height: min(860px, calc(100vh - 36px));
  padding: 12px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.46);
  box-shadow: 0 28px 55px rgba(35, 60, 122, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(20px);
}

.card {
  min-height: 100%;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(248, 251, 255, 0.62);
  box-shadow: 0 18px 42px rgba(61, 83, 142, 0.16), inset 0 1px 1px rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(18px);
  padding: 24px 20px;
}

.hidden {
  display: none;
}

.file-label {
  display: inline-block;
  margin: 20px 0 8px;
  font-weight: 600;
  color: #30497a;
}

input[type='file'] {
  display: block;
  width: 100%;
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(156, 172, 220, 0.45);
  color: #173364;
  background: rgba(247, 250, 255, 0.72);
}

button {
  border: none;
  border-radius: 999px;
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.01em;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, #5f7fff 0%, #8a70ff 100%);
  box-shadow: 0 10px 22px rgba(88, 104, 226, 0.28), 0 0 0 1px rgba(255, 255, 255, 0.3) inset;
  transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.24s ease, filter 0.24s ease;
}

button:hover:not(:disabled) {
  transform: scale(1.01);
  box-shadow: 0 14px 30px rgba(87, 103, 225, 0.34);
}

button:active:not(:disabled) {
  transform: scale(0.97);
}

button:disabled {
  background: linear-gradient(135deg, #9fa9c5 0%, #afb7cb 100%);
  box-shadow: none;
  cursor: not-allowed;
}

#analyzeBtn {
  width: 100%;
  margin-top: 6px;
}

.status {
  min-height: 20px;
  margin-top: 12px;
  color: #566b93;
}

#results-section {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#results-section.hidden {
  display: none;
}

.nav-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: 20px;
  background: rgba(250, 252, 255, 0.58);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.52);
}

#prevBtn {
  justify-self: start;
}

#nextBtn {
  justify-self: end;
}

.result-card {
  display: none;
  min-height: 540px;
}

.result-card.active-card {
  display: block;
}

.result-card.slide-in-right {
  animation: slideFadeRight 0.36s cubic-bezier(0.16, 1, 0.3, 1);
}

.result-card.slide-in-left {
  animation: slideFadeLeft 0.36s cubic-bezier(0.16, 1, 0.3, 1);
}

h1,
h2 {
  margin-top: 0;
  letter-spacing: -0.02em;
  color: #12244a;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(1.7rem, 5.8vw, 2.1rem);
}

h2 {
  font-size: clamp(1.45rem, 4.6vw, 1.7rem);
  margin-bottom: 12px;
}

p {
  margin-top: 0;
}

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

.stat-list li {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.5);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.65);
}

.stat-list strong {
  color: #4563d8;
  font-size: 1.03em;
}

.small {
  color: #54698f;
  font-size: 13px;
  margin-bottom: 10px;
}

#cardCounter {
  font-weight: 600;
  color: #334a77;
  border-radius: 999px;
  padding: 8px 14px;
  background: rgba(232, 238, 255, 0.75);
  box-shadow: inset 0 0 0 1px rgba(153, 173, 233, 0.3);
}

code {
  color: #294cc6;
  background: rgba(228, 236, 255, 0.95);
  padding: 2px 7px;
  border-radius: 7px;
}

@keyframes slideFadeRight {
  from {
    opacity: 0;
    transform: translateX(18px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes slideFadeLeft {
  from {
    opacity: 0;
    transform: translateX(-18px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@media (prefers-color-scheme: dark) {
  body {
    color: #e6ebff;
    background: radial-gradient(circle at 18% 18%, #273f75 0%, transparent 42%),
      radial-gradient(circle at 82% 88%, #3d2c66 0%, transparent 38%),
      linear-gradient(160deg, #0f1322 0%, #13182b 55%, #181428 100%);
  }

  .app {
    background: rgba(20, 26, 44, 0.52);
    border-color: rgba(177, 196, 255, 0.2);
    box-shadow: 0 30px 58px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  }

  .card {
    background: rgba(18, 25, 45, 0.62);
    border-color: rgba(177, 196, 255, 0.18);
    box-shadow: 0 20px 44px rgba(0, 0, 0, 0.3), inset 0 1px 1px rgba(255, 255, 255, 0.06);
  }

  h1,
  h2 {
    color: #f0f4ff;
  }

  .file-label,
  .status,
  .small {
    color: #aebde7;
  }

  .nav-row {
    background: rgba(28, 35, 58, 0.72);
    box-shadow: inset 0 0 0 1px rgba(176, 195, 255, 0.16);
  }

  .stat-list li {
    background: rgba(33, 42, 69, 0.72);
    box-shadow: inset 0 0 0 1px rgba(179, 197, 255, 0.15);
  }

  .stat-list strong {
    color: #97adff;
  }

  #cardCounter {
    color: #dbe3ff;
    background: rgba(56, 69, 111, 0.62);
    box-shadow: inset 0 0 0 1px rgba(176, 195, 255, 0.22);
  }

  input[type='file'] {
    color: #dce6ff;
    border-color: rgba(176, 196, 255, 0.26);
    background: rgba(35, 44, 70, 0.68);
  }

  code {
    color: #bad0ff;
    background: rgba(54, 66, 106, 0.66);
  }
}
