/* 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; }
button:disabled { cursor: default; opacity: 0.4; }
[hidden] { display: none !important; }

header { max-width: 1500px; 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; }

#modes {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  max-width: 1500px; margin: 0 auto 16px;
}
#modes 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;
}
#modes button b { display: block; font-size: 1.15rem; }
#modes button span { font-size: 0.9rem; color: #666; }
#modes 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) 330px; gap: 20px;
  max-width: 1500px; 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 small { display: block; color: #666; line-height: 1.25; margin-top: 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, .make 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; }
.seg.ops button { min-width: 4.6em; font-size: 1.1rem; }
button.play { width: 100%; background: var(--green); color: #fff; box-shadow: 3px 3px 0 var(--ink); }
.small { width: 100%; }
.make { display: flex; gap: 6px; }
.make input { flex: 1; min-width: 0; padding: 5px 8px; border: 2px solid var(--ink); border-radius: 8px; font-weight: 700; }
.tip { color: #555; font-size: 0.95rem; line-height: 1.3; margin: 0; }

#view { border: 2px dashed var(--line); border-radius: 10px; overflow: hidden; }
#view svg, #view canvas { display: block; width: 100%; height: auto; user-select: none; }
#view .btn, #view .breaks { cursor: pointer; }
#view .btn.off { cursor: default; }
#view .btn:not(.off):hover rect { filter: brightness(0.94); }
#view .trade:hover rect { filter: brightness(1.12); }
#view .breaks:hover { filter: brightness(1.08); }
.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: #8a3b12; font-weight: 700; }

#panel h2 { margin: 14px 0 4px; font-size: 1.2rem; }
#panel p { margin: 0 0 8px; line-height: 1.3; }
#panel .numeral { font-family: Arial, Helvetica, sans-serif; font-weight: 700; font-size: 3.2rem; line-height: 1.1; }
#panel .words { font-size: 1.2rem; font-weight: 700; color: #3f3a33; }
#panel .eq { font-family: Arial, Helvetica, sans-serif; font-weight: 700; font-size: 1.35rem; line-height: 1.5; }
#panel .eq span[style] { border-bottom: 5px solid var(--c); }
#panel .eq.names-line { font-size: 1rem; font-weight: 400; }
#panel .note { font-weight: 700; color: #a8361f; }
#panel .blank { display: inline-block; width: 3em; border-bottom: 2px solid var(--ink); }
#panel .numeral .blank { width: 4em; height: 0.9em; }
#panel .names { margin: 0; padding-left: 1.1em; line-height: 1.35; font-size: 1.05rem; }
.ladder { width: 100%; border-collapse: collapse; font-size: 0.98rem; line-height: 1.2; }
.ladder th { text-align: left; font-size: 0.85rem; color: #666; padding: 0 6px 4px; }
.ladder td { padding: 6px; border-top: 1px solid var(--line); vertical-align: top; }
.ladder td b { font-family: Arial, Helvetica, sans-serif; font-size: 1.05rem; }
.ladder tr.on td { background: #fff3c4; }
.ladder tr.later { color: #a39d93; }
#working > #panel > p:last-child { margin-top: 12px; }

/* Full screen for the board: the picture fills the space, panel beside it */
main:fullscreen { max-width: none; padding: 20px; background: #f6f3ee; grid-template-columns: minmax(0, 1fr) 330px; align-content: center; }
main:fullscreen #side { display: none; }

@media (max-width: 1200px) {
  main { grid-template-columns: 230px minmax(0, 1fr); }
  #working { grid-column: 1 / -1; }
}
@media (max-width: 800px) {
  #modes { grid-template-columns: 1fr 1fr; }
  main { grid-template-columns: 1fr; }
}
