/* The Nernst Equation: Concentration and Equilibrium (CHM2001)
   Layout only - every colour comes from the model-shell palette at runtime, through inline styles
   and the --nrn-* custom properties that the script sets on the model container. Same pattern as
   the CHE7403 models (entropy-dispersal.css, beat-the-barrier.css). */

.nrn-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 0.9rem;
  align-items: start;
}

.nrn-layout > * {
  min-width: 0;
}

/* Elements with their own display value would otherwise ignore the hidden attribute. */
.nrn-layout [hidden] {
  display: none !important;
}

/* The key idea heads the results card. */
.nrn-key {
  margin: 0 0 0.5rem;
  text-align: center;
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  font-weight: 800;
  line-height: 1.25;
}

.nrn-key:empty {
  display: none;
}

.nrn-stage {
  display: block;
  width: 100%;
  height: 280px;
}

/* The potential axis (and, when discharging, the graph) sits under the controls, so the voltmeter, the controls
   and the electrodes read top to bottom. */
.nrn-axis {
  display: block;
  width: 100%;
  height: 210px;
  margin-top: 0.6rem;
}

.nrn-plot {
  display: block;
  width: 100%;
  height: 290px;
  margin-top: 0.5rem;
}

/* The live controls sit directly under the canvas, so the graph and its controls stay in view together. */
.nrn-strip {
  margin: 0.5rem 0 0;
  padding: 0.6rem 0.7rem 0.4rem;
  border: 2px solid var(--nrn-grid, #ccc);
  border-radius: 10px;
}

.nrn-strip > :first-child {
  margin-top: 0;
}

/* The verdict sits directly above the cell, next to the voltmeter it explains. */
.nrn-verdict {
  margin: 0 0 0.5rem;
  text-align: center;
  padding: 0.5rem 0.8rem;
  border: 3px solid;
  border-radius: 10px;
}

.nrn-verdict-main {
  display: block;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.2;
}

.nrn-verdict-sub {
  display: block;
  font-size: 1.02rem;
  margin-top: 0.2rem;
  line-height: 1.45;
}

.nrn-verdict-sub:empty {
  display: none;
}

/* The numbers substituted into the equation, updated live. */
.nrn-calc {
  margin-top: 0.6rem;
  padding: 0.5rem 0.8rem;
  border: 2px solid var(--nrn-grid, #ccc);
  border-radius: 10px;
  font-size: 1.02rem;
}

.nrn-calc-row {
  display: grid;
  grid-template-columns: 6.8rem minmax(0, 1fr);
  gap: 0.3rem;
  margin: 0.15rem 0;
  line-height: 1.45;
}

.nrn-bridge {
  margin: 0.4rem 0 0;
  padding: 0.5rem 0.8rem;
  border: 2px solid var(--nrn-red, red);
  border-radius: 10px;
  background: var(--nrn-red-t, #fff3f3);
  line-height: 1.5;
}

.nrn-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.8rem;
}

.nrn-tab {
  flex: 1 1 8rem;
  font: inherit;
  font-weight: 800;
  font-size: 0.92rem;
  padding: 0.45rem 0.5rem;
  border: 2px solid;
  border-radius: 999px;
  cursor: pointer;
}

.nrn-process {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  font-weight: 800;
}

.nrn-process:empty {
  display: none;
}

.nrn-guide {
  margin: 0 0 0.7rem;
  line-height: 1.5;
}

.nrn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.nrn-strong {
  font-weight: 800;
}

.nrn-go {
  display: block;
  width: 100%;
  margin-top: 0.9rem;
  padding: 0.55rem 0.8rem;
  font: inherit;
  font-weight: 800;
  border: 2px solid;
  border-radius: 999px;
  cursor: pointer;
}

.nrn-sub {
  margin: 0 0 0.3rem;
  font-weight: 700;
}

.nrn-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.8rem;
}

.nrn-chip {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.3rem 0.65rem;
  border: 2px solid;
  border-radius: 999px;
  cursor: pointer;
}

.nrn-slider {
  display: grid;
  grid-template-columns: 7.2rem minmax(0, 1fr) 5.4rem;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.5rem;
}

.nrn-slider label {
  font-weight: 800;
}

.nrn-slider input {
  width: 100%;
}

.nrn-val {
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}

.nrn-notes {
  margin: 0.4rem 0 0;
  padding-left: 1.2rem;
  line-height: 1.45;
}

.nrn-notes li {
  margin: 0.25rem 0;
}

/* Predict, then see: a box above the cell, so the question and the voltmeter are in view together. */
.nrn-predict {
  margin: 0 0 0.5rem;
  padding: 0.6rem 0.8rem 0.5rem;
  border: 3px solid var(--nrn-red, red);
  border-radius: 12px;
  background: var(--nrn-red-t, #fff3f3);
}

.nrn-predict-head {
  font-weight: 800;
  font-size: 1.05rem;
}

.nrn-qproc {
  margin: 0.2rem 0 0.5rem;
  font-weight: 800;
  font-size: 1.2rem;
  text-align: center;
}

.nrn-choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
}

.nrn-choices button {
  font: inherit;
  font-size: 1rem;
  font-weight: 800;
  text-align: center;
  padding: 0.55rem 0.4rem;
  border: 2px solid;
  border-radius: 10px;
  cursor: pointer;
}

.nrn-choices button:disabled {
  cursor: default;
}

.nrn-predict .nrn-feedback {
  min-height: 0;
  margin: 0.5rem 0 0;
}

.nrn-predict .nrn-feedback:empty {
  display: none;
}

.nrn-predict .nrn-row {
  justify-content: center;
}

/* Test your knowledge */
.nrn-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.nrn-progress {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.nrn-dot {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  border: 2px solid;
  display: inline-grid;
  place-items: center;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0;
  cursor: pointer;
}

.nrn-dot[aria-current="true"] {
  outline: 3px solid currentColor;
  outline-offset: 2px;
}

.nrn-score {
  font-weight: 800;
  font-size: 0.9rem;
}

.nrn-task {
  margin: 0.6rem 0 0.2rem;
  font-size: 1.1rem;
  font-weight: 800;
}

.nrn-intro {
  margin: 0 0 0.6rem;
  line-height: 1.5;
}

.nrn-step {
  margin-bottom: 0.4rem;
  padding: 0.35rem 0.5rem;
  border: 2px solid;
  border-radius: 8px;
}

.nrn-step-q {
  margin: 0 0 0.35rem;
  font-weight: 700;
}

.nrn-options {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.3rem;
}

.nrn-options button {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  text-align: left;
  padding: 0.4rem 0.6rem;
  border: 2px solid;
  border-radius: 8px;
  cursor: pointer;
}

.nrn-feedback {
  margin: 0.6rem 0 0;
  min-height: 2.6em;
  line-height: 1.45;
}

@media (max-width: 820px) {
  .nrn-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .nrn-verdict-main {
    font-size: 1.3rem;
  }
}

@media (max-width: 480px) {
  .nrn-slider {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "label value" "input input";
  }
  .nrn-slider label { grid-area: label; }
  .nrn-slider input { grid-area: input; }
  .nrn-val { grid-area: value; }
  .nrn-calc-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nrn-tab,
  .nrn-chip,
  .nrn-step-btn {
    transition: none;
  }
}


/* Concentration controls: one coloured group under each beaker (anode blue, cathode red). */
.nrn-pick {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.6rem 0.8rem;
  margin: 0.2rem 0 0;
}

.nrn-group {
  padding: 0.5rem 0.6rem 0.4rem;
  border: 3px solid var(--nrn-anode, #1f6fd1);
  border-radius: 12px;
  background: var(--nrn-anode-t, #eef4fd);
}

.nrn-group--cathode {
  border-color: var(--nrn-cathode, #d0121b);
  background: var(--nrn-cathode-t, #fdeeee);
}

.nrn-group-head {
  margin: 0 0 0.35rem;
  font-weight: 800;
  font-size: 1.02rem;
  text-align: center;
}

.nrn-conc {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.4rem;
}

.nrn-conc input {
  width: 100%;
}

/* Slider track and handle in the group's own colour. The site-wide track (pale grey to white)
   all but vanished on the light blue and light red panels. A 10px stripe is painted through the
   middle of the input, so the touch padding above and below stays clear at any input height. */
.nrn-group {
  --nrn-track-c: var(--nrn-anode, #1f6fd1);
}

.nrn-group--cathode {
  --nrn-track-c: var(--nrn-cathode, #d0121b);
}

.nrn-run {
  --nrn-track-c: var(--nrn-red, #d0121b);
}

.nrn-group input[type="range"],
.nrn-run input[type="range"] {
  background: linear-gradient(color-mix(in srgb, var(--nrn-track-c) 55%, #fff),
                              color-mix(in srgb, var(--nrn-track-c) 55%, #fff))
              center / 100% 10px no-repeat;
}

.nrn-group input[type="range"]::-webkit-slider-thumb,
.nrn-run input[type="range"]::-webkit-slider-thumb {
  background: var(--nrn-track-c);
  border: 3px solid #fff;
  box-shadow: 0 0 0 1px var(--nrn-track-c), 0 2px 4px rgba(0, 0, 0, 0.3);
}

.nrn-group input[type="range"]::-moz-range-thumb,
.nrn-run input[type="range"]::-moz-range-thumb {
  background: var(--nrn-track-c);
  border: 3px solid #fff;
  box-shadow: 0 0 0 1px var(--nrn-track-c), 0 2px 4px rgba(0, 0, 0, 0.3);
}

.nrn-step-btn {
  font: inherit;
  font-weight: 800;
  font-size: 0.95rem;
  min-width: 2.8rem;
  padding: 0.3rem 0.4rem;
  border: 2px solid;
  border-radius: 10px;
  cursor: pointer;
}

.nrn-step-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.nrn-conc-val {
  margin: 0.25rem 0 0;
  text-align: center;
  font-weight: 800;
  font-size: 1.25rem;
}

.nrn-row--centre {
  grid-column: 1 / -1;
  justify-content: center;
  margin-top: 0;
}

/* Discharge controls (stage 2) */
.nrn-run {
  margin: 0.2rem 0 0;
  padding: 0.6rem 0.7rem 0.5rem;
  border: 3px solid var(--nrn-red, red);
  border-radius: 12px;
  background: var(--nrn-red-t, #fff3f3);
}

.nrn-run .nrn-chips {
  justify-content: center;
  margin-bottom: 0.6rem;
}

.nrn-run .nrn-slider {
  grid-template-columns: 9.5rem minmax(0, 1fr) 8.5rem;
}

@media (max-width: 560px) {
  .nrn-pick {
    grid-template-columns: minmax(0, 1fr);
  }
  .nrn-choices {
    grid-template-columns: minmax(0, 1fr);
  }
  .nrn-run .nrn-slider {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "label value" "input input";
  }
  .nrn-run .nrn-slider label { grid-area: label; }
  .nrn-run .nrn-slider input { grid-area: input; }
  .nrn-run .nrn-val { grid-area: value; }
}

/* Whole cell or each electrode: the switch above the worked calculation */
.nrn-calc-tabs {
  align-items: center;
  margin: 0.6rem 0 0;
}

.nrn-calc-tabs-head {
  font-weight: 800;
  margin-right: 0.3rem;
}

/* The choice of cell in stage 1 spans both control groups */
.nrn-cells1 {
  justify-content: center;
  margin: 0 0 0.2rem;
}


/* ---------------- The equation, live (right-hand column) ---------------- */
.nrn-live {
  margin: 0 0 0.6rem;
  padding: 0.55rem 0.7rem 0.6rem;
  border: 3px solid var(--nrn-fg, #000);
  border-radius: 12px;
  background: var(--nrn-bg, #fff);
}

.nrn-live-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.nrn-live-title {
  font-weight: 800;
  font-size: 1.05rem;
}

.nrn-live .nrn-calc-tabs {
  margin: 0;
}

.nrn-live .nrn-chip {
  font-size: 0.82rem;
  padding: 0.15rem 0.55rem;
}

.nrn-live .nrn-process {
  margin: 0.2rem 0 0.1rem;
  font-size: 0.88rem;
  font-weight: 700;
}

/* symbols on top, this moment's numbers underneath */
.nrn-eqtab {
  border-collapse: collapse;
  margin: 0.2rem auto 0.35rem;
}

.nrn-eqtab td {
  padding: 0.05rem 0.22rem;
  text-align: center;
  white-space: nowrap;
}

.nrn-eqtab .nrn-sym td {
  font-size: 1.45rem;
  font-weight: 800;
}

.nrn-eqtab .nrn-num td {
  font-size: 1.05rem;
  font-weight: 700;
  border-top: 1px dashed var(--nrn-grid, #bbb);
  padding-top: 0.2rem;
}

/* the working: one step per line, as in the lectures */
.nrn-live .nrn-calc {
  margin: 0;
  padding: 0.3rem 0 0;
  border: 0;
  border-top: 2px solid var(--nrn-red, red);
  border-radius: 0;
  font-size: 0.98rem;
}

.nrn-live .nrn-calc-row {
  grid-template-columns: 4.6rem minmax(0, 1fr);
}

/* what has just changed */
.nrn-flash {
  background: #fff1a8;
  color: inherit;
  border-radius: 3px;
  box-shadow: 0 0 0 2px #e0b800;
}

.high-contrast .nrn-flash {
  background: transparent;
  box-shadow: 0 0 0 2px currentColor;
}

.nrn-so {
  margin: 0.4rem 0 0;
  padding: 0.35rem 0.55rem;
  border-left: 4px solid var(--nrn-grid, #999);
  background: var(--nrn-red-t, #f6f6f6);
  line-height: 1.45;
}

.nrn-so:empty {
  display: none;
}

/* text in drop-downs */
.nrn-more {
  margin: 0.5rem 0 0;
  padding: 0.35rem 0.6rem;
  border: 2px solid var(--nrn-grid, #ccc);
  border-radius: 10px;
}

.nrn-more > summary {
  font-weight: 800;
  cursor: pointer;
}

.nrn-more ul {
  margin: 0.35rem 0 0.2rem;
  padding-left: 1.1rem;
  line-height: 1.45;
}

.nrn-more li {
  margin: 0.2rem 0;
}

.nrn-more .nrn-go {
  margin-top: 0.5rem;
}

.nrn-small {
  font-size: 0.9rem;
  margin: 0.3rem 0 0.1rem;
}

.nrn-bridge-text {
  margin: 0.35rem 0 0.1rem;
  line-height: 1.5;
}

.nrn-plot {
  height: 240px;
}
