/* webapp4 — Stage-2 visualizer (matches Artifact-Finder aesthetic) */

:root {
  --bg: #0a0a0d;
  --bg2: #131319;
  --panel: #16161e;
  --line: #25252e;
  --text: #f0f0f3;
  --muted: #8a8a96;
  --accent: #6ea8ff;
  --accent2: #b48bff;
  --warn-bg: #2a230f;
  --warn-bd: #4b3a14;
  --warn-fg: #fbe7b3;
  --danger: #ff5d6a;
  --ok: #4ce0a4;
  --pos-fill: #ff5d6a;
  --neg-fill: #5da4ff;
  --delta-up: #ff8a93;
  --delta-down: #7ce0a4;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%;
  background: radial-gradient(circle at 30% 0%, #1a1530 0%, var(--bg) 60%) fixed;
  color: var(--text);
  font: 13px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Pretendard", sans-serif;
  overflow: hidden;
}
a { color: inherit; text-decoration: none; }
code, .mono { font-family: ui-monospace, SFMono-Regular, "JetBrains Mono", Consolas, monospace; font-size: 12px; }

/* topbar */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 22px; border-bottom: 1px solid var(--line);
  background: rgba(10, 10, 13, .6); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
}
.brand a {
  font-weight: 800; letter-spacing: .12em; font-size: 18px;
  background: linear-gradient(90deg, #fff, var(--accent2) 60%, var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand span { color: var(--accent2); padding: 0 4px; }
.brand-sub { color: var(--muted); font-size: 11px; letter-spacing: .04em; }
.topbar-spacer { flex: 1; }
.status { color: var(--muted); font-size: 12px; }

main { height: calc(100vh - 49px); overflow: auto; }
.screen { display: none; min-height: 100%; }
.screen.active { display: flex; }

/* drop screen */
#screen-drop.active {
  flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  padding: 24px;
}

.banner {
  padding: 10px 14px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line);
  font-size: 12px; max-width: 760px;
}
.banner--warn { background: var(--warn-bg); border-color: var(--warn-bd); color: var(--warn-fg); }
.banner code { background: rgba(255,255,255,.06); padding: 1px 4px; border-radius: 3px; }
.ckpt-line { font-size: 11px; letter-spacing: .04em; }
.info { color: var(--muted); font-size: 12px; }
.info b { color: var(--text); font-weight: 600; }

.dropzone {
  width: min(620px, 80%); padding: 70px 40px;
  background: var(--panel); border: 2px dashed var(--line); border-radius: 18px;
  text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
}
.dropzone:hover { border-color: var(--accent); background: #1a1a26; }
.dropzone.dragging { border-color: var(--accent2); background: #21172e; transform: scale(1.01); }
.dz-inner { pointer-events: none; }
.dz-icon { font-size: 56px; opacity: .55; margin-bottom: 0; line-height: 1; color: var(--accent2); }
.dz-title { font-size: 18px; font-weight: 600; letter-spacing: .04em; margin-top: 6px; }

.dz-preview { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.dz-preview img {
  max-width: 360px; max-height: 360px;
  border-radius: 8px; border: 1px solid var(--line);
  background: #000;
}
.dz-filename { color: var(--muted); font-size: 12px; }

.dz-actions { display: flex; align-items: center; gap: 14px; }

/* buttons */
.btn-primary {
  padding: 10px 22px; border: none; cursor: pointer;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  color: white; font-weight: 700; letter-spacing: .04em; border-radius: 8px;
  font-size: 13px; transition: transform .1s, box-shadow .1s, opacity .1s;
}
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(110, 168, 255, .3); }
.btn-primary:disabled { background: #2a2a35; cursor: not-allowed; opacity: .55; }

.btn-secondary {
  padding: 8px 16px; background: #20202a; border: 1px solid var(--line); border-radius: 6px;
  color: var(--text); cursor: pointer; font-size: 12px;
  transition: background .12s;
}
.btn-secondary:hover { background: #2a2a36; }

/* results */
#screen-results.active { flex-direction: column; }

.results-top {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  padding: 14px 18px 0;
}
.results-triple {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px;
  padding: 14px 18px;
}
@media (max-width: 1100px) {
  .results-triple { grid-template-columns: 1fr; }
}

.cell {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  position: relative; overflow: hidden; padding: 28px 12px 12px; min-height: 0;
}
.cell-title {
  position: absolute; top: 8px; left: 12px; right: 12px;
  font-size: 11px; letter-spacing: .06em;
  color: var(--muted); text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cell img {
  width: 100%; height: auto; aspect-ratio: 1; max-height: 420px;
  object-fit: contain; display: block; background: #000; border-radius: 6px;
}

/* prediction tables */
.pred-cell { padding-top: 32px; }
table.pred { width: 100%; border-collapse: collapse; }
table.pred th, table.pred td {
  padding: 6px 8px; text-align: left; font-size: 12.5px; vertical-align: middle;
}
table.pred thead th {
  color: var(--muted); font-weight: 500; font-size: 11px; letter-spacing: .04em;
  text-transform: uppercase; border-bottom: 1px solid var(--line);
}
table.pred .bar-h, table.pred .delta-h { width: 38%; }
table.pred .delta-h { width: 12%; text-align: right; }
table.pred tbody tr { border-bottom: 1px dashed #1f1f27; }
table.pred tbody tr:last-child { border-bottom: none; }
table.pred .lab { font-weight: 600; }
table.pred .num { width: 70px; }
table.pred .bar { width: auto; }
table.pred .delta { width: 70px; text-align: right; }
table.pred .delta.up { color: var(--delta-up); }
table.pred .delta.down { color: var(--delta-down); }
table.pred .num-pos { color: var(--pos-fill); font-weight: 600; }
table.pred .delta-h { width: 70px; text-align: right; }

.bar-fill {
  height: 8px; border-radius: 4px;
  background: var(--neg-fill); opacity: .6;
}
.bar-fill.pos { background: var(--pos-fill); opacity: .9; }

tr.row-pos td.lab { color: var(--pos-fill); }

.pred-empty {
  padding: 20px; color: var(--muted); font-style: italic; text-align: center;
}

/* ckpt info cards on index page */
.ckpt-cards {
  display: flex; gap: 10px; flex-wrap: wrap; justify-content: center;
  margin-bottom: 8px;
}
.ckpt-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 14px; min-width: 130px; text-align: center;
}
.ckpt-card--missing { opacity: 0.45; }
.ckpt-card--m1 { border-color: #2c3447; }
.ckpt-name { font-size: 11px; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; margin-bottom: 4px; }
.ckpt-detail { font-size: 12px; }
.ckpt-detail b { color: var(--accent); }

.meta-details summary { cursor: pointer; }
.meta-details[open] { padding: 8px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; }
.meta-details code { background: rgba(255,255,255,0.04); padding: 1px 4px; border-radius: 3px; word-break: break-all; }

.results-toolbar {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 20px; border-top: 1px solid var(--line); background: var(--bg2);
  flex-wrap: wrap;
}
