:root {
  --bg-base: #f3f5ef;
  --bg-panel: #fffffe;
  --ink-primary: #1d2c1c;
  --ink-muted: #4f5d4d;
  --accent: #2d7f5e;
  --accent-soft: #d9efe5;
  --danger: #9f342f;
  --border: #d4dbcf;
  --shadow: 0 18px 40px rgba(31, 52, 29, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink-primary);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  background: var(--bg-base);
}

.site-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.site-shell > :first-child {
  flex: 1;
}

.page {
  width: min(1120px, 100% - 2rem);
  margin: 2rem auto;
  padding-bottom: 2rem;
}

.hero {
  border: 1px solid var(--border);
  background: var(--bg-panel);
  box-shadow: var(--shadow);
  padding: 1.8rem;
  border-radius: 20px;
  margin-bottom: 1.5rem;
}

.hero h1 {
  margin: 0;
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  letter-spacing: -0.03em;
}

.hero p {
  margin: 0.8rem 0 0;
  max-width: 90ch;
  color: var(--ink-muted);
  line-height: 1.45;
}

.grid {
  display: grid;
  grid-template-columns: 2.1fr 1fr;
  gap: 1rem;
}

.card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.1rem;
  box-shadow: var(--shadow);
}

.card h2 {
  margin: 0;
  font-size: 1.1rem;
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
}

.card p {
  margin: 0.5rem 0 1rem;
  color: var(--ink-muted);
}

.mode-fieldset {
  margin: 0 0 1rem;
  padding: 0;
  border: 0;
}

.mode-fieldset legend {
  margin-bottom: 0.45rem;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  color: var(--ink-muted);
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

.mode-option {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.7rem;
  cursor: pointer;
  background: #ffffff;
}

.mode-option strong {
  display: block;
  font-size: 0.92rem;
}

.mode-option small {
  display: block;
  margin-top: 0.18rem;
  color: var(--ink-muted);
  line-height: 1.35;
}

.mode-option:has(input:checked) {
  border-color: #95c9b2;
  background: #f4faf7;
}

.submission-copy {
  margin: 0 0 0.75rem;
  color: var(--ink-muted);
}

.model-select-field {
  margin-top: 0.8rem;
  max-width: 340px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field label {
  font-size: 0.78rem;
  color: var(--ink-muted);
  letter-spacing: 0.02em;
}

input[type="text"],
input[type="file"],
select {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.56rem 0.62rem;
  font-size: 0.92rem;
  color: var(--ink-primary);
  background: #ffffff;
}

input[type="text"]:focus,
input[type="file"]:focus,
select:focus {
  outline: 2px solid #8bc6af;
  outline-offset: 1px;
}

.actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.actions-sticky-random {
  position: sticky;
  top: 0.75rem;
  z-index: 2;
  margin-top: 0.5rem;
  margin-bottom: 0.75rem;
  border-radius: 12px;

  button {
    padding: 1rem;

    &:disabled {
      opacity: 1;
    }
  }
}

.button {
  border: 0;
  border-radius: 12px;
  padding: 0.6rem 1rem;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
}

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.button-primary {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 2px 8px rgba(45, 127, 94, 0.2);
  width: 100%;
}

.button-primary:hover:not(:disabled) {
  box-shadow: 0 4px 12px rgba(45, 127, 94, 0.28);
}

.button-secondary {
  color: #17422f;
  background: var(--accent-soft);
}

.error {
  margin-top: 1rem;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  border: 1px solid #dfbbb8;
  background: #fef5f5;
  color: var(--danger);
}

.result-panel {
  min-height: 9rem;
}

.model-grid {
  margin-top: 0.8rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.result-model-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.85rem;
  background: #fcfefb;
  min-height: 8rem;
}

.result-model-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.7rem;
}

.result-model-header h3 {
  margin: 0;
  font-size: 1rem;
}

.model-key {
  color: var(--ink-muted);
  font-size: 0.8rem;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}

.result-empty {
  color: var(--ink-muted);
}

.auto-scroll-anchor {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.loading-indicator {
  margin-top: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 0.95rem;
  border-radius: 12px;
  border: 1px solid #dbe6d3;
  background: #f8fbf6;
}

.spinner {
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 999px;
  border: 2px solid #bdd3c2;
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

.loading-title {
  margin: 0;
  font-weight: 600;
}

.loading-copy {
  margin: 0.1rem 0 0;
  font-size: 0.88rem;
  color: var(--ink-muted);
}

.upload-progress {
  margin-top: 0.55rem;
}

.upload-progress-text {
  margin: 0;
  font-size: 0.86rem;
  color: var(--ink-muted);
}

.upload-progress-text-error {
  color: var(--danger);
}

.upload-progress-track {
  margin-top: 0.45rem;
  width: 100%;
  height: 0.45rem;
  border-radius: 999px;
  background: #e3eee0;
  overflow: hidden;
}

.upload-progress-fill {
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 0.18s ease;
}

.upload-progress-percent {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  color: var(--ink-muted);
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.result-label {
  margin-top: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #f6faf3;
  padding: 0.45rem 0.72rem;
  font-weight: 600;
}

.result-table {
  margin-top: 0.8rem;
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.result-table th,
.result-table td {
  text-align: left;
  border-bottom: 1px solid #e6ebdf;
  padding: 0.45rem 0;
}

.metrics {
  margin-top: 1rem;
  padding: 0.9rem;
  border-radius: 12px;
  background: #f8fbf6;
  border: 1px solid #dfe8d6;
}

.metrics h3 {
  margin: 0 0 0.45rem;
  font-size: 0.96rem;
}

.metrics h4 {
  margin: 0 0 0.45rem;
  font-size: 0.9rem;
}

.metrics-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.3rem;
}

.confusion-matrix {
  margin-top: 0.8rem;
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.confusion-matrix th,
.confusion-matrix td {
  border: 1px solid #e0e8d9;
  padding: 0.45rem 0.55rem;
}

.confusion-matrix thead th {
  font-weight: 600;
  text-align: center;
  background: #f4f8ef;
}

.confusion-matrix tbody th {
  text-align: left;
  font-weight: 500;
  white-space: nowrap;
  background: #f9fcf6;
}

.confusion-matrix td {
  text-align: center;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}

.help-list {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--ink-muted);
  display: grid;
  gap: 0.45rem;
}

.site-footer {
  margin-top: auto;
  padding: 1.25rem 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--bg-panel);
  box-shadow: 0 -4px 20px rgba(31, 52, 29, 0.04);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.65rem 1.25rem;
}

.site-footer-label {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink-muted);
}

.site-footer-stack {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.85rem 1.35rem;
}

.site-footer-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--ink-muted);
  font-size: 0.84rem;
  text-decoration: none;
  transition: color 0.15s ease;
}

.site-footer-link:hover {
  color: var(--ink-primary);
}

.site-footer-logo {
  width: 1.15rem;
  height: 1.15rem;
  flex-shrink: 0;
}

@keyframes input-value-flash {
  0%,
  100% {
    background-color: #ffffff;
  }

  40% {
    background-color: var(--accent-soft);
  }
}

input.input-value-flash {
  animation: input-value-flash 0.55s ease-out;
}

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

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

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

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