/* Widget kit: shared tokens and controls for sandboxed simulations.
   Tokens mirror static/css/course.css so widgets read as part of the page. */

@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-style: normal; font-display: swap;
  src: url("../vendor/fonts/ibm-plex-sans-cyrillic-400-normal.7dec1409f343.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-style: normal; font-display: swap;
  src: url("../vendor/fonts/ibm-plex-sans-latin-400-normal.77bc02670657.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-weight: 700; font-style: normal; font-display: swap;
  src: url("../vendor/fonts/ibm-plex-sans-cyrillic-700-normal.fe1b8353cdd7.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "IBM Plex Sans"; font-weight: 700; font-style: normal; font-display: swap;
  src: url("../vendor/fonts/ibm-plex-sans-latin-700-normal.c277d7b83f8a.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-style: normal; font-display: swap;
  src: url("../vendor/fonts/ibm-plex-mono-cyrillic-400-normal.2f3900b11191.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-style: normal; font-display: swap;
  src: url("../vendor/fonts/ibm-plex-mono-latin-400-normal.79936b18df9f.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --paper: #F8F8F8;
  --white: #FFFFFF;
  --ink: #141414;
  --ink-2: #474747;
  --rule: #D4D4D4;
  --muted: #8C8C8C;
  --gold: #B8913A;
  --gold-ink: #7A5C1E;
  --gold-soft: #EFE3C8;
  --blue: #3E5C76;
  --blue-soft: #D8E0E8;
  --bad: #A33A2B;
  --bad-soft: #F2DCD8;
  --font: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  --radius: 2px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--white); color: var(--ink); }
body { font: 400 17px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
.w { padding: 18px 20px 20px; }

/* Layout: plot beside controls, stacked on narrow frames */
.w-row { display: flex; gap: 24px; align-items: flex-start; }
.w-row > .w-plot { flex: 1 1 60%; min-width: 0; }
.w-row > .w-side { flex: 0 0 280px; }
@media (max-width: 640px) {
  .w { padding: 14px 12px 16px; }
  .w-row { flex-direction: column; gap: 14px; }
  .w-row > .w-plot { flex: 1 1 auto; width: 100%; align-self: stretch; }
  .w-row > .w-side { flex: 1 1 auto; width: 100%; }
}

.w h3, .w-title { font-size: 19px; font-weight: 700; margin: 0 0 10px; line-height: 1.3; }
.w p { margin: 0 0 10px; }
.w-note { color: var(--ink-2); font-size: 15px; }
.w-num, .w-mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* Sliders */
.w-slider { margin: 0 0 14px; }
.w-slider label { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 15px; color: var(--ink-2); margin-bottom: 4px; }
.w-slider output { font-family: var(--mono); color: var(--ink); font-size: 16px; white-space: nowrap; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; margin: 0; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; background: var(--rule); }
input[type=range]::-moz-range-track { height: 4px; background: var(--rule); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -8px; background: var(--ink); border: 3px solid var(--white); outline: 1px solid var(--ink); border-radius: 50%; cursor: pointer; }
input[type=range]::-moz-range-thumb { width: 16px; height: 16px; background: var(--ink); border: 3px solid var(--white); outline: 1px solid var(--ink); border-radius: 50%; cursor: pointer; }
input[type=range]:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* Buttons and inputs */
.w-btn { font: 700 15px/1 var(--font); padding: 11px 16px; border: 1.5px solid var(--ink); background: var(--white); color: var(--ink); border-radius: var(--radius); cursor: pointer; }
.w-btn:hover { background: var(--paper); }
.w-btn.primary { background: var(--ink); color: var(--white); }
.w-btn.primary:hover { background: #333; }
.w-btn:disabled { opacity: .45; cursor: default; }
.w-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.w-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.w-input { font: 400 17px var(--mono); padding: 8px 10px; border: 1.5px solid var(--ink-2); border-radius: var(--radius); width: 9em; background: var(--white); color: var(--ink); }
.w-input:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.w-seg { display: inline-flex; border: 1.5px solid var(--ink); border-radius: var(--radius); overflow: hidden; }
.w-seg button { font: 400 15px var(--font); padding: 8px 12px; border: 0; background: var(--white); color: var(--ink); cursor: pointer; }
.w-seg button + button { border-left: 1.5px solid var(--ink); }
.w-seg button[aria-pressed=true] { background: var(--ink); color: var(--white); }

/* Readouts: label left, value right, ruled rows */
.w-readout { border-top: 1px solid var(--rule); margin: 6px 0 0; }
.w-readout div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--rule); font-size: 15px; }
.w-readout dt, .w-readout .k { color: var(--ink-2); }
.w-readout dd, .w-readout .v { margin: 0; font-family: var(--mono); font-size: 15px; color: var(--ink); text-align: right; }
.w-readout .em .v, .w-readout .em dd { font-weight: 700; }

/* Messages inside a widget */
.w-msg { margin-top: 12px; padding: 10px 12px; border-left: 4px solid var(--rule); background: var(--paper); font-size: 15px; }
.w-msg.good { border-left-color: var(--gold); background: var(--gold-soft); }
.w-msg.bad { border-left-color: var(--bad); background: var(--bad-soft); }
.w-msg:empty { display: none; }

/* Tables (payoff matrices etc.) */
.w-table { border-collapse: collapse; font-size: 15px; }
.w-table th, .w-table td { border: 1px solid var(--rule); padding: 8px 10px; text-align: center; }
.w-table th { font-weight: 700; background: var(--paper); }
.w-table td.hl { background: var(--gold-soft); }

/* Chart styling (used by W.chart) */
.w-chart { display: block; width: 100%; height: auto; overflow: visible; user-select: none; -webkit-user-select: none; touch-action: none; }
.w-chart text { font-family: var(--font); font-size: 13px; fill: var(--ink-2); }
.w-chart .axis path, .w-chart .axis line { stroke: var(--ink-2); }
.w-chart .axis text { font-family: var(--mono); font-size: 12px; }
.w-chart .grid line { stroke: #ECECEC; }
.w-chart .grid path { display: none; }
.w-chart .axis-label { font-size: 14px; fill: var(--ink); }
.w-chart .curve { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.w-chart .c-ink { stroke: var(--ink); } .w-chart .f-ink { fill: var(--ink); }
.w-chart .c-accent { stroke: var(--gold); } .w-chart .f-accent { fill: var(--gold); }
.w-chart .c-blue { stroke: var(--blue); } .w-chart .f-blue { fill: var(--blue); }
.w-chart .c-muted { stroke: var(--muted); } .w-chart .f-muted { fill: var(--muted); }
.w-chart .c-bad { stroke: var(--bad); } .w-chart .f-bad { fill: var(--bad); }
.w-chart .a-cs { fill: var(--gold-soft); }
.w-chart .a-ps { fill: var(--blue-soft); }
.w-chart .a-dwl { fill: var(--bad-soft); }
.w-chart .a-ink { fill: rgba(20,20,20,.08); }
.w-chart .guide { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 4; fill: none; }
.w-chart .dot { stroke: var(--white); stroke-width: 2; }
.w-chart .handle { cursor: grab; }
.w-chart .handle:active { cursor: grabbing; }
.w-chart .handle-ring { fill: transparent; stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 3 3; }
.w-chart .lbl { font-size: 14px; fill: var(--ink); }
.w-chart .lbl.accent { fill: var(--gold-ink); font-weight: 700; }
.w-chart .lbl.blue { fill: var(--blue); font-weight: 700; }
.w-chart .lbl.muted { fill: var(--muted); }
.w-chart .lbl.bold { font-weight: 700; }
/* Halo keeps labels readable where they cross curves or areas. */
.w-chart .lbl.halo, .w-chart .halo { paint-order: stroke; stroke: var(--white); stroke-width: 4px; stroke-linejoin: round; }
.w-chart .bar { stroke: none; }

/* MathJax output inside widgets */
mjx-container[jax="SVG"] { font-size: 105%; }
mjx-container[display="true"] { margin: 8px 0 !important; }
