:root {
  --bg: #ffffff;
  --surface: #f8f9fa;
  --surface-2: #f0f1f3;
  --border: #e2e4e8;
  --border-hover: #c8ccd2;
  --text: #3d4249;
  --text-dim: #8b919a;
  --text-bright: #1a1d22;
  --accent-a: #0891b2;
  --accent-a-dim: rgba(8, 145, 178, 0.06);
  --positive: #059669;
  --negative: #dc2626;
  --radius: 6px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'IBM Plex Mono', 'JetBrains Mono', monospace;
  min-height: 100vh;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(8, 145, 178, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(8, 145, 178, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
}

.app {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.header { margin-bottom: 40px; }

.header-label {
  font-size: 10px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--accent-a);
  margin-bottom: 12px;
  opacity: 0.7;
}

.header h1 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 10px;
}

.header-author {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.header-author a {
  color: var(--accent-a);
  text-decoration: none;
}

.header-author a:hover {
  text-decoration: underline;
}

.header > p:last-of-type {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
  max-width: 620px;
}

.header > p:last-of-type a {
  color: var(--accent-a);
  text-decoration: none;
}

.header > p:last-of-type a:hover {
  text-decoration: underline;
}

.examples-panel {
  margin-bottom: 32px;
}

.examples-header {
  margin-bottom: 10px;
}

.examples-label {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.examples-meta {
  font-size: 10px;
  color: var(--text-dim);
  line-height: 1.5;
}

.examples-intro {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.65;
  max-width: 720px;
  margin-bottom: 20px;
}

.examples-intro a {
  color: var(--accent-a);
  text-decoration: none;
}

.examples-intro a:hover {
  text-decoration: underline;
}

.examples-intro strong {
  color: var(--text);
  font-weight: 600;
}

.examples-load-error {
  font-size: 12px;
  color: var(--negative);
  line-height: 1.5;
}

.example-section {
  margin-bottom: 28px;
}

.section-header {
  margin-bottom: 12px;
}

.section-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 6px;
}

.section-blurb {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.55;
  max-width: 720px;
}

.examples-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.example-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
  overflow: hidden;
}

.example-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--accent-a);
  opacity: 0;
  transition: opacity 0.2s;
}

.example-card:hover {
  border-color: var(--border-hover);
  background: var(--surface-2);
}

.example-card:hover::before,
.example-card.is-selected::before { opacity: 1; }

.example-card.is-selected {
  border-color: var(--accent-a);
  background: var(--accent-a-dim);
  box-shadow: 0 0 0 2px var(--accent-a-dim);
}

.card-action-hint {
  margin-top: 10px;
  font-size: 9px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--accent-a);
  opacity: 0.55;
  transition: opacity 0.2s;
}

.example-card:hover .card-action-hint,
.example-card.is-selected .card-action-hint,
.example-card:focus-visible .card-action-hint {
  opacity: 1;
}

.example-card:focus-visible {
  outline: 2px solid var(--accent-a);
  outline-offset: 2px;
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-bright);
}

.label-badge {
  font-size: 9px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 600;
}

.label-badge.positive {
  color: var(--positive);
  background: rgba(5, 150, 105, 0.08);
  border: 1px solid rgba(5, 150, 105, 0.25);
}

.label-badge.negative {
  color: var(--negative);
  background: rgba(220, 38, 38, 0.06);
  border: 1px solid rgba(220, 38, 38, 0.2);
}

.card-name {
  font-size: 10px;
  color: var(--text-dim);
  margin-bottom: 8px;
  line-height: 1.4;
  word-break: break-all;
}

.card-seq {
  font-size: 11px;
  letter-spacing: 1px;
  word-break: break-all;
  line-height: 1.6;
  opacity: 0.75;
}

.input-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.input-section.input-highlight {
  border-color: var(--accent-a);
  box-shadow: 0 0 0 3px var(--accent-a-dim);
}

.input-section label {
  display: block;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.input-hint {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.45;
  margin-bottom: 10px;
}

.seq-fill-status {
  min-height: 1.2em;
  margin-top: 8px;
  font-size: 11px;
  color: var(--accent-a);
  line-height: 1.4;
}

.seq-fill-status:empty {
  display: none;
}

.seq-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-bright);
  font-family: inherit;
  font-size: 13px;
  padding: 14px 16px;
  resize: vertical;
  min-height: 100px;
  outline: none;
  letter-spacing: 1px;
}

.seq-input:focus {
  border-color: var(--accent-a);
  box-shadow: 0 0 0 2px var(--accent-a-dim);
}

.seq-input.seq-flash {
  animation: seqFlash 0.9s ease;
}

@keyframes seqFlash {
  0%, 100% { background: var(--bg); }
  25% { background: var(--accent-a-dim); }
}

.input-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  gap: 12px;
  flex-wrap: wrap;
}

.seq-length { font-size: 11px; color: var(--text-dim); }

.classify-btn {
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  background: transparent;
  color: var(--accent-a);
  border: 1px solid var(--accent-a);
  border-radius: 4px;
  padding: 10px 28px;
  cursor: pointer;
  transition: all 0.2s;
}

.classify-btn:hover:not(:disabled) {
  background: var(--accent-a);
  color: var(--bg);
}

.classify-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.loading-bar {
  height: 2px;
  background: var(--surface-2);
  border-radius: 1px;
  overflow: hidden;
  margin-top: 16px;
}

.loading-bar::after {
  content: '';
  display: block;
  height: 100%;
  width: 40%;
  background: var(--accent-a);
  animation: loadSlide 1s ease-in-out infinite;
}

@keyframes loadSlide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

.wait-hint {
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.4;
}

.error-msg {
  margin-top: 12px;
  font-size: 12px;
  color: var(--negative);
  line-height: 1.5;
}

.results { animation: fadeUp 0.35s ease; }

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

.results-header {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.prediction-row {
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.prediction-label {
  font-size: 22px;
  font-weight: 700;
}

.prediction-label.positive { color: var(--positive); }
.prediction-label.negative { color: var(--negative); }

.logit-badge {
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.heatmap-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.heatmap-title {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.heatmap-note {
  font-size: 10px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.attn-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.attn-row {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
}

.attn-block {
  min-height: 36px;
  padding: 4px 2px;
  border-radius: 3px;
  border: 1px solid var(--border);
  font-size: 10px;
  line-height: 1.2;
  text-align: center;
  word-break: break-all;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-bright);
}

.attn-block.empty {
  opacity: 0.25;
  background: var(--surface-2);
}

.attn-block .weight {
  display: block;
  font-size: 8px;
  color: var(--text-dim);
  margin-top: 2px;
}

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 10px;
  color: var(--text-dim);
}

.heatmap-legend-bar {
  flex: 1;
  max-width: 200px;
  height: 8px;
  border-radius: 2px;
  background: linear-gradient(to right, rgb(49, 54, 149), rgb(255, 255, 255), rgb(165, 0, 38));
}

@media (max-width: 600px) {
  .app { padding: 24px 16px 60px; }
  .header h1 { font-size: 20px; }
  .examples-grid { grid-template-columns: 1fr; }
  .attn-block { font-size: 9px; min-height: 32px; }
}
