/* Light (default) and dark themes; the same palettes as Holomag Live
   (holography-redux, web/src/style.css). The choice is kept in localStorage
   under "theme", which both tools share when they are on the same site. */
:root {
  --bg: #f3f4f6;
  --panel: #ffffff;
  --line: #d3d7de;
  --text: #1c2330;
  --muted: #626b7a;
  --accent: #2563c9;
  --warn: #9a5b00;
  --bar: #c9d8ec;
  --bar-mark: #5b7fa6;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #16181c;
  --panel: #1f2228;
  --line: #343841;
  --text: #e4e6ea;
  --muted: #9aa0aa;
  --accent: #5aa2ff;
  --warn: #f2b84b;
  --bar: #2f3d52;
  --bar-mark: #7d93b3;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
}

header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 24px;
  padding: 10px 12px 2px;
}

h1 { margin: 0; font-size: 16px; }
h1 span { color: var(--accent); font-weight: 600; }
header p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
h2 { margin: 0; font-size: 13px; font-weight: 600; }

.header-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px 12px; margin-left: auto; }
#datasetBar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }

/* Buttons and inputs are the browser's own dark controls, as in Holomag Live. */
button, input { font: inherit; }
button.link { background: none; border: none; color: var(--muted); padding: 0; font-size: 12px; font-weight: 400; text-decoration: underline; cursor: pointer; }
button.link:hover { color: var(--accent); }

#welcome { max-width: 640px; margin: 6vh auto; padding: 0 12px; }

#dropZone {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  padding: 44px 28px;
  color: var(--muted);
  text-align: center;
  cursor: pointer;
}
#dropZone:hover, #dropZone:focus-visible { outline: 2px dashed var(--accent); outline-offset: -6px; }
#dropZone h2 { font-size: 16px; font-weight: 400; margin-bottom: 6px; color: var(--text); }
#dropZone p { margin: 4px 0; color: var(--muted); }
.drop-icon { font-size: 32px; line-height: 1; color: var(--accent); margin-bottom: 10px; }
.small { font-size: 12px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.92em; }
a { color: var(--accent); }

#progress { margin-top: 18px; }
#progressLabel { color: var(--muted); margin-bottom: 6px; }
.bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
#progressFill { height: 100%; width: 0; background: var(--accent); }

.error {
  margin-top: 16px;
  padding: 10px 12px;
  border: 1px solid var(--warn);
  border-radius: 6px;
  color: var(--warn);
  background: var(--panel);
}

main {
  display: grid;
  grid-template-columns: minmax(340px, 460px) minmax(0, 1fr);
  gap: 12px;
  padding: 10px 12px 12px;
  align-items: start;
}

.column { display: grid; gap: 12px; min-width: 0; }
.column.wide { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); align-items: start; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px 10px;
  min-width: 0;
}
/* The header strip of a Holomag Live panel. */
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 0 -10px 10px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
}
.muted { color: var(--muted); font-size: 12px; font-weight: 400; }

canvas { display: block; width: 100%; }
canvas.dist { height: 210px; touch-action: none; cursor: grab; }
#loopsChart { height: 420px; }
#forcChart { height: 420px; }

.params, .controls, .actions { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.params { margin-top: 8px; }
.controls { margin-bottom: 10px; }
.actions { margin-top: 10px; }

label { color: var(--muted); font-size: 12px; display: inline-flex; align-items: center; gap: 6px; }
label.check { cursor: pointer; }

input[type="number"] { width: 78px; font-variant-numeric: tabular-nums; }
input[type="checkbox"] { accent-color: var(--accent); }
.actions button { font-size: 12px; }
input[type="range"] { width: 110px; accent-color: var(--accent); }
output { min-width: 1ch; color: var(--text); font-variant-numeric: tabular-nums; }

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

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 5px 4px; border-top: 1px solid var(--line); text-align: left; font-weight: 400; }
tr:first-child th, tr:first-child td { border-top: none; }
td:nth-child(2) { text-align: right; font-weight: 600; }
td:nth-child(3) { color: var(--muted); width: 4em; padding-left: 10px; }

#dropOverlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(22, 24, 28, 0.7);
  z-index: 10;
  pointer-events: none;
}
#dropOverlay div {
  padding: 22px 34px;
  border-radius: 6px;
  border: 2px dashed var(--accent);
  background: var(--panel);
  color: var(--text);
  font-size: 16px;
}

[hidden] { display: none !important; }

@media (max-width: 860px) {
  main { grid-template-columns: minmax(0, 1fr); }
}
