/* vr.phylab.uk — shared styles (from learn.phylab.uk) */
:root {
  color-scheme: light;
  --paper: #f7f5ef;
  --card: #ffffff;
  --ink: #1a2030;
  --ink-soft: #55607a;
  --rule: #dcd8cc;
  --pos: #c0392b;      /* positive charge */
  --neg: #1f5fbf;      /* negative charge */
  --accent: #0d6b5f;   /* actions, progress */
  --accent-soft: #e3f1ee;
  --warn: #9a5b00;
  --warn-soft: #fbf1dc;
  --radius: 10px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 17px/1.55 var(--sans);
}
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0; }
h1 { font-size: clamp(1.8rem, 4.5vw, 2.6rem); letter-spacing: -0.01em; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 0.9em; }
math { font-size: 1.12em; }
math[display="block"] { margin: 16px 0 18px; }

.wrap { max-width: 920px; margin: 0 auto; padding: 0 20px; }

/* top bar */
.topbar { border-bottom: 1px solid var(--rule); background: var(--paper); }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; height: 54px; gap: 12px; }
.brand { font-family: var(--serif); font-weight: 600; font-size: 1.05rem; color: var(--ink); text-decoration: none; }
.brand span { color: var(--ink-soft); font-weight: 400; }
.topbar .where { font-size: 0.86rem; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .where { flex: 1; min-width: 0; }
/* the three parts of the lesson, so a visitor can move between them from any page */
.topbar .parts { display: flex; gap: 4px; flex-shrink: 0; }
.topbar .parts a { font-size: 0.86rem; color: var(--ink-soft); text-decoration: none; padding: 5px 10px; border-radius: 6px; white-space: nowrap; }
.topbar .parts a:hover { color: var(--ink); background: #ece9df; }
.topbar .parts a[aria-current] { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
@media (max-width: 720px) { .topbar .where { display: none; } }
@media (max-width: 420px) { .topbar .parts a { padding: 5px 6px; font-size: 0.8rem; } }

/* cards and buttons */
.card { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 22px; }
.btn {
  appearance: none; border: 1px solid var(--accent); background: var(--accent); color: #fff;
  font: 600 1rem var(--sans); padding: 10px 18px; border-radius: 8px; cursor: pointer; text-decoration: none; display: inline-block;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { background: #b9c2c0; border-color: #b9c2c0; cursor: not-allowed; filter: none; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.small { padding: 6px 12px; font-size: 0.9rem; }
.btn.pos { background: var(--pos); border-color: var(--pos); }
.btn.neg { background: var(--neg); border-color: var(--neg); }
.btn:focus-visible, .choice:focus-visible, a:focus-visible, textarea:focus-visible { outline: 3px solid #f0b429; outline-offset: 2px; }

.muted { color: var(--ink-soft); }
.small { font-size: 0.88rem; }
.tag { display: inline-block; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); }
.note { background: var(--accent-soft); border-radius: 8px; padding: 12px 14px; font-size: 0.95rem; }
.note.warn { background: var(--warn-soft); }

footer.site { margin: 56px 0 32px; padding-top: 18px; border-top: 1px solid var(--rule); color: var(--ink-soft); font-size: 0.85rem; }

/* field canvases */
.fieldbox { position: relative; background: #fff; border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.fieldbox canvas { display: block; width: 100%; touch-action: none; }
.readout { font: 0.92rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--ink); min-height: 1.4em; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 0.95rem; padding: 6px 10px; border: 1px solid var(--rule); border-radius: 8px; background: #fff; cursor: pointer; user-select: none; }
.toggle input { accent-color: var(--accent); width: 17px; height: 17px; }

/* asking the AI (assets/ask.js) */
.ask { margin-top: 14px; }
.ask-thread > * { margin-top: 10px; }
.ask-q { margin-left: auto; max-width: 85%; width: fit-content; background: #ece9df; border-radius: 10px; padding: 7px 12px; font-size: 0.95rem; }
.ask-a p { margin: 0 0 6px; } .ask-a p:last-child { margin-bottom: 0; }
.ask-a math[display="block"] { margin: 6px 0; }
.ask-form { display: flex; gap: 8px; margin-top: 10px; }
.ask-form input { flex: 1; min-width: 0; font: inherit; font-size: 0.95rem; padding: 7px 10px; border: 1px solid var(--rule); border-radius: 8px; background: #fff; }
.ask-form input:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.ask-note { color: var(--ink-soft); font-size: 0.78rem; margin: 6px 0 0; }
.mum.ask-a { border-left: 4px solid #7a5a3c; padding-left: 14px; }
.mum.ask-a .tag { color: #7a5a3c; display: block; margin-bottom: 4px; font-size: 0.85rem; }
