/* Self-hosted so the page works behind school web filters.
   Variable font, SIL Open Font License, latin subset. */
@font-face {
  font-family: 'Baloo 2';
  font-weight: 400 800;
  font-display: swap;
  src: url(../fonts/baloo2.woff2) format('woff2');
}

:root { --ink: #1d1a17; --green: #3d7a4a; --line: #d9d4cc; }
* { box-sizing: border-box; }
body {
  margin: 0; padding: 24px; background: #f6f3ee; color: var(--ink);
  font-family: 'Baloo 2', system-ui, sans-serif;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

header { max-width: 1400px; margin: 0 auto 16px; }
header h1 { margin: 0; font-size: 2.2rem; line-height: 1.1; }
header p { margin: 4px 0 0; color: #555; }
.home { color: #666; font-weight: 700; text-decoration: none; }

#figures {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px;
  max-width: 1400px; margin: 0 auto 16px;
}
#figures button {
  display: flex; flex-direction: column; justify-content: flex-start;
  text-align: left; padding: 10px 12px; line-height: 1.25;
  background: #fff; border: 3px solid var(--line); border-radius: 12px;
}
#figures button b { display: block; font-size: 1.1rem; }
#figures button span { font-size: 0.85rem; color: #666; }
#figures button[aria-pressed="true"] { border-color: var(--ink); box-shadow: 3px 3px 0 var(--ink); }

main {
  display: grid; grid-template-columns: 250px minmax(0, 1fr) 340px; gap: 20px;
  max-width: 1400px; margin: 0 auto; align-items: start;
}
#side, #out, #working { background: #fff; border: 3px solid var(--ink); border-radius: 14px; padding: 16px; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-weight: 800; margin-bottom: 4px; }
.field.check label { display: flex; gap: 8px; align-items: baseline; line-height: 1.25; cursor: pointer; }
.field.check input { width: auto; flex: none; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button, .small, button.play, .actions button {
  padding: 5px 12px; border: 2px solid var(--ink); border-radius: 8px; background: #fff; font-weight: 700;
}
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
button.play { width: 100%; background: var(--green); color: #fff; box-shadow: 3px 3px 0 var(--ink); }
.small { width: 100%; }

#view { border: 2px dashed var(--line); border-radius: 10px; overflow: hidden; touch-action: none; }
#view svg { display: block; width: 100%; height: auto; user-select: none; }
#view .handle { cursor: grab; }
#view.dragging, #view.dragging .handle { cursor: grabbing; }
#view .mark, #view .hint { cursor: pointer; }
#view .mark:hover path { filter: brightness(1.06); }
#view .hint:hover circle { stroke: var(--green); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; }
.actions .primary { background: var(--green); color: #fff; box-shadow: 3px 3px 0 var(--ink); }
#status { color: #2a5634; font-weight: 700; }

#working h2 { margin: 0 0 8px; font-size: 1.3rem; }
#work p { margin: 0 0 8px; line-height: 1.3; }
#work .rule { font-weight: 800; }
#work .eq { font-size: 1.2rem; font-weight: 700; font-family: Arial, Helvetica, sans-serif; }
#work .why { color: #555; font-size: 0.95rem; }
#work .note { font-weight: 700; color: var(--green); }
#work .ans { color: #2f7d3f; }
#work .blank { display: inline-block; width: 3em; border-bottom: 2px solid var(--ink); }
.types { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0 0 8px; list-style: none; }
.types li { padding: 1px 10px; border: 2px solid var(--line); border-radius: 999px; color: #777; font-weight: 700; }
.types li.on { border-color: var(--ink); background: var(--ink); color: #fff; }

/* Full screen for the board: the figure fills the space, working beside it */
main:fullscreen { max-width: none; padding: 20px; background: #f6f3ee; grid-template-columns: minmax(0, 1fr) 340px; }
main:fullscreen #side { display: none; }
main:fullscreen #work .eq { font-size: 1.6rem; }

@media (max-width: 1150px) {
  main { grid-template-columns: 250px minmax(0, 1fr); }
  #working { grid-column: 1 / -1; }
}
@media (max-width: 800px) {
  #figures { grid-template-columns: repeat(2, 1fr); }
  main { grid-template-columns: 1fr; }
}
