:root {
  color-scheme: dark;
  --fzj-blue: #023d6b;
  --fzj-cyan: #007eb1;
  --fzj-magenta: #e40166;
  --bg: #081523;
  --panel: #101f30;
  --panel-2: #172a3f;
  --text: #edf1f2;
  --muted: #b7c8d5;
  --accent: #86c8ec;
  --accent-2: #80c2eb;
  --win: #007eb1;
  --error: #ff91ac;
  --border: #2b4660;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

header {
  padding: 28px 32px 12px;
  border-bottom: 1px solid var(--border);
}

h1 { margin: 0 0 4px; font-size: 24px; }
.subtitle { margin: 0; color: var(--muted); }
.subtitle a { color: var(--accent-2); }

main {
  display: grid;
  grid-template-columns: minmax(380px, 1fr) minmax(380px, 1fr);
  gap: 20px;
  padding: 20px 32px 40px;
  align-items: start;
}

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

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
}

.row { margin-bottom: 16px; }
.row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}
.row-head label { margin-bottom: 0; }

.hint { color: var(--muted); font-size: 12.5px; margin: 4px 0 0; }

input, textarea, select {
  width: 100%;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
}

textarea { resize: vertical; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; }
input:focus, textarea:focus, select:focus { outline: 1px solid var(--accent-2); }

.row-head select { width: auto; }

button {
  background: var(--fzj-cyan);
  color: #ffffff;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 15px;
  cursor: pointer;
}
button:hover { filter: brightness(1.08); }
button:disabled { opacity: 0.5; cursor: default; }

button.ghost {
  background: transparent;
  color: var(--accent-2);
  border: 1px dashed var(--border);
  font-weight: 600;
}
button.small { padding: 4px 10px; font-size: 12.5px; }
#run { width: 100%; }

/* question cards */
.q-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
}

.q-head { display: flex; gap: 8px; margin-bottom: 8px; }
.q-head .q-id { font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.q-head .q-type { width: 150px; }
.q-del {
  width: 32px;
  padding: 0;
  font-size: 16px;
  line-height: 1;
  border-style: solid;
  color: var(--muted);
}
.q-del:hover { color: var(--error); border-color: var(--error); }

.crit-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.crit-row { display: flex; gap: 8px; align-items: center; }
.crit-row .c-key { width: 34%; font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.crit-row .c-val { flex: 1; }
.lvl {
  width: 32px;
  text-align: center;
  color: var(--muted);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
}

/* results */
h2 { margin: 0 0 14px; font-size: 18px; }
.empty { color: var(--muted); }

.answer {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 14px;
}

.answer h3 {
  margin: 0 0 10px;
  font-size: 14px;
  display: flex;
  gap: 8px;
  align-items: baseline;
}
.qname { font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.tag {
  background: var(--panel);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1px 10px;
  font-size: 11px;
  font-weight: 600;
}

.big { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.big strong { font-size: 22px; color: var(--accent); }
.big .sub { color: var(--muted); font-size: 13px; }

.bar-row {
  display: grid;
  grid-template-columns: minmax(90px, 34%) 1fr 52px;
  gap: 10px;
  align-items: center;
  margin-bottom: 6px;
  font-size: 13px;
}
.bar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bar-row.win .bar-label { color: var(--accent); font-weight: 700; }
.bar {
  background: var(--panel);
  border-radius: 6px;
  height: 14px;
  overflow: hidden;
}
.fill {
  height: 100%;
  background: var(--accent-2);
  border-radius: 6px;
  min-width: 2px;
}
.bar-row.win .fill { background: var(--win); }
.bar-pct { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

.meta { color: var(--muted); font-size: 13px; }

.error {
  background: rgba(228, 1, 102, 0.12);
  border: 1px solid var(--error);
  color: var(--error);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

details { margin-top: 10px; }
summary { cursor: pointer; color: var(--muted); font-size: 13px; }
pre {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  overflow: auto;
  font-size: 12.5px;
}
/* Playground layout */
body { background: radial-gradient(ellipse at 15% 0%, #0b2d4a 0%, transparent 45%), var(--bg); }
header { max-width: 1600px; margin: auto; padding: 36px 32px 28px; display: flex; justify-content: space-between; align-items: center; gap: 24px; }
h1 { font-size: clamp(25px, 3vw, 36px); letter-spacing: -1px; margin-bottom: 10px; }
.eyebrow { font-size: 10px; font-weight: 700; letter-spacing: 2px; color: var(--accent); margin: 0 0 8px; }
.header-badge { flex-shrink: 0; border: 1px solid #2e6088; border-radius: 24px; padding: 8px 14px; color: var(--accent); font-size: 12px; }
main { max-width: 1600px; margin: auto; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 24px; padding-top: 28px; }
.panel { padding: 24px; box-shadow: 0 12px 40px #0002; min-width: 0; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 22px; }
.panel-heading h2 { margin: 0; font-size: 20px; }
#results { position: sticky; top: 24px; }
#run-status { margin: -6px 0 20px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px #007eb140; }
#results[aria-busy="true"] .status-dot { animation: pulse 1s infinite alternate; }
@keyframes pulse { to { opacity: .3; } }
.model-settings { margin: 0 0 20px; }
.model-settings .row { margin: 12px 0 0; }
.section-hint { margin: -2px 0 12px; }
.example-browser { padding: 16px; border: 1px solid var(--border); border-radius: 10px; background: #0b1b2c; }
.example-filters, .example-picker { display: flex; gap: 8px; margin-bottom: 10px; }
.example-filters select { width: 42%; }
.example-picker button { flex-shrink: 0; }
.q-head .q-id { min-width: 0; }
.q-head .q-type { flex-shrink: 0; }
.q-del { flex-shrink: 0; min-height: 32px; }
.crit-row { align-items: start; }
.crit-row .c-key { min-width: 0; }
.crit-row .c-val { min-width: 0; font-family: inherit; }
.criteria-details { margin: 12px 0 0; }
.criteria-details summary { padding: 4px 0 12px; color: var(--accent-2); }
.empty { text-align: center; padding: 44px 14px; border: 1px dashed var(--border); border-radius: 12px; }
.empty-symbol { color: var(--accent); font-size: 36px; }
.empty h3 { color: var(--text); font-size: 18px; font-weight: 500; }
.empty p { max-width: 340px; margin: auto; }
.run-footer .hint { text-align: center; margin-top: 8px; }
.big { flex-wrap: wrap; }
.big strong { overflow-wrap: anywhere; }
.winner-description { font-size: 13px; color: var(--muted); margin: 6px 0 16px; line-height: 1.65; }
.decision-note { font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 12px; }
.close-call { color: #f6c779; }
.bar-label { white-space: normal; overflow-wrap: anywhere; line-height: 1.45; }
.bar-row { grid-template-columns: minmax(0, 1.2fr) minmax(50px, 1fr) 52px; gap: 12px; margin-bottom: 12px; }
button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; }
[hidden] { display: none !important; }
@media (max-width: 1000px) { main { grid-template-columns: 1fr; } #results { position: static; } }
@media (max-width: 560px) {
  header { padding: 24px 16px; align-items: start; flex-direction: column; gap: 12px; }
  main { padding: 16px; gap: 16px; }
  .panel { padding: 16px; }
  .panel-heading .tag { display: none; }
  .q-head { flex-wrap: wrap; }
  .q-head .q-id { flex: 1; width: calc(100% - 48px); }
  .q-head .q-type { width: 100%; order: 3; }
  .example-picker { flex-direction: column; }
  .crit-row { flex-wrap: wrap; }
  .crit-row .c-key { flex: 1; }
  .crit-row textarea.c-val { flex-basis: 100%; order: 3; }
  .bar-row { grid-template-columns: minmax(0, 1fr) 52px; gap: 6px; }
  .bar-label { grid-column: 1 / -1; }
  .bar-pct { grid-column: 2; }
}
@media (prefers-reduced-motion: reduce) { #results[aria-busy="true"] .status-dot { animation: none; } }
.run-footer { position: sticky; bottom: 12px; padding: 12px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 -8px 24px #0002; }
@media (min-width: 1001px) { #result-body { max-height: calc(100vh - 210px); overflow-y: auto; padding-right: 4px; } }

.header-badge { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; padding: 7px 14px 7px 8px; }
.header-badge img { display: block; width: 36px; height: 36px; object-fit: contain; }
.header-badge:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; }
