@import url("https://fonts.googleapis.com/css2?family=Heebo:wght@400;500;600;700;800&family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@400;500;600;700;800&display=swap");
:root {
  font-family: "DM Sans", sans-serif;
  color: #213d36;
  background: #f7f8f2;
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
a,
input {
  -webkit-tap-highlight-color: transparent;
}
button,
input {
  font: inherit;
}
button {
  cursor: pointer;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid #dfad46;
  outline-offset: 5px;
}
[hidden] {
  display: none !important;
}
header {
  max-width: 1320px;
  margin: auto;
  padding: 28px 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #dde3d7;
}
header a {
  color: #285c47;
  text-decoration: none;
  font-size: 28px;
  display: flex;
  gap: 12px;
  align-items: center;
}
header a span {
  font-size: 19px;
  font-weight: 700;
}
.header-note {
  font-size: 13px;
  color: #77867b;
}
main {
  max-width: 1320px;
  margin: auto;
  padding: 64px 48px;
  min-height: calc(100vh - 170px);
}
.eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.7px;
  color: #678b68;
}
h1 {
  font-family: Manrope, sans-serif;
  font-size: 54px;
  line-height: 1.13;
  letter-spacing: -2.4px;
  margin: 20px 0;
}
p {
  line-height: 1.6;
  color: #6e7d71;
}
.intro {
  font-size: 17px;
  max-width: 450px;
}
.game-card {
  margin-top: 36px;
  width: 530px;
  max-width: 100%;
  padding: 0;
  display: flex;
  text-align: left;
  border: 1px solid #d7dfce;
  background: #fff;
  border-radius: 20px;
  overflow: hidden;
  color: inherit;
  box-shadow: 0 8px 20px #304c3710;
  transition: transform 0.2s;
}
.game-card:hover {
  transform: translateY(-4px);
}
.card-art {
  background: #e6eddc;
  width: 180px;
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(2, 42px);
  gap: 10px;
  align-content: center;
  justify-content: center;
  padding: 30px;
  transform: none;
}
.card-art i {
  height: 42px;
  background: #77a76c;
  border-radius: 7px;
  box-shadow: 0 3px 0 #588650;
}
.card-art i:nth-child(3n) {
  background: #abc791;
}
.card-content {
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tag {
  font-size: 9px;
  letter-spacing: 1.1px;
  font-weight: 700;
  color: #69805f;
}
.card-content strong {
  font:
    800 23px Manrope,
    sans-serif;
  letter-spacing: -0.8px;
}
.card-content > span:not(.tag):not(.card-link) {
  font-size: 14px;
  color: #74816e;
  line-height: 1.6;
}
.card-link {
  font-weight: 700;
  font-size: 14px;
  margin-top: 15px;
  display: flex;
  justify-content: space-between;
}
.small-note {
  font-size: 12px;
  margin-top: 24px;
}
.back {
  border: 0;
  background: none;
  padding: 0;
  color: #69806d;
  font-size: 13px;
  margin-bottom: 30px;
}
.game-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}
.game-heading h1 {
  font-size: 40px;
  margin: 10px 0;
}
.game-heading p {
  margin: 0;
  font-size: 14px;
}
.secondary {
  border: 1px solid #cdd8c7;
  border-radius: 10px;
  background: #fff;
  padding: 12px 18px;
  color: #3f6045;
}
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 26px;
}
.board-panel {
  background: #fff;
  border: 1px solid #dbe3d6;
  border-radius: 18px;
  overflow: hidden;
  align-self: start;
}
.board-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #899581;
}
#count {
  background: #eff3e9;
  padding: 6px 10px;
  border-radius: 20px;
  color: #66825d;
  letter-spacing: 0;
}
canvas {
  display: block;
  width: 100%;
  height: 420px;
  touch-action: none;
  background-color: #fcfdf9;
  background-image: radial-gradient(#dae2d1 1px, transparent 1px);
  background-size: 20px 20px;
  cursor: grab;
}
canvas.dragging {
  cursor: grabbing;
}
.board-footer {
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #819079;
  font-size: 11px;
  border-top: 1px solid #e8eddf;
}
.board-footer button {
  border: 0;
  background: none;
  color: #65805d;
  font-size: 11px;
  text-decoration: underline;
}
.legend {
  background: #eaf0df;
  padding: 24px;
  border-radius: 16px;
}
.legend .eyebrow {
  font-size: 9px;
  letter-spacing: 1px;
}
.legend-value {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 22px 0 12px;
  font-size: 26px;
}
.legend-value strong {
  font:
    800 38px Manrope,
    sans-serif;
}
.sample {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  background: #7ba76b;
  box-shadow: 0 3px 0 #5b864e;
}
.legend p {
  font-size: 12px;
  margin: 0;
}
form {
  margin-top: 26px;
}
label {
  font-weight: 700;
  font-size: 18px;
}
form p {
  font-size: 12px;
  margin: 8px 0 14px;
}
input {
  width: 100%;
  padding: 15px 14px;
  border: 1px solid #cbd7c1;
  background: #fff;
  border-radius: 10px;
  font-size: 18px;
  color: #284532;
  outline: none;
}
input:focus {
  border-color: #6d9960;
  box-shadow: 0 0 0 3px #7aa36520;
}
#input-help {
  display: block;
  font-size: 10px;
  color: #899580;
  margin: 10px 0 18px;
}
.primary {
  background: #315c45;
  color: white;
  border: 0;
  border-radius: 10px;
  width: 100%;
  padding: 15px;
  font-size: 13px;
  font-weight: 600;
}
.primary:hover {
  background: #234832;
}
#feedback {
  font-size: 13px;
  line-height: 1.6;
  margin-top: 14px;
}
#feedback.success {
  color: #326831;
  background: #e3f1da;
  padding: 14px;
  border-radius: 10px;
}
#feedback.error {
  color: #90632d;
}
.hint {
  display: flex;
  gap: 12px;
  margin-top: 22px;
  color: #bc984d;
}
.hint p {
  font-size: 12px;
  margin: 0;
}
footer {
  padding: 22px 48px;
  text-align: center;
  font-size: 11px;
  color: #8a9581;
}
footer span {
  margin-left: 10px;
  color: #ba9b5f;
}
@media (max-width: 800px) {
  header {
    padding: 22px;
  }
  .header-note {
    display: none;
  }
  main {
    padding: 36px 22px;
  }
  .workspace {
    grid-template-columns: 1fr;
  }
  aside {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }
  form {
    margin: 0;
  }
  .hint {
    grid-column: 1/-1;
  }
  h1 {
    font-size: 44px;
  }
  .game-heading {
    gap: 18px;
  }
  .game-heading h1 {
    font-size: 32px;
  }
}
@media (max-width: 500px) {
  aside {
    display: block;
  }
  form {
    margin-top: 24px;
  }
  .card-art {
    width: 115px;
    grid-template-columns: repeat(2, 30px);
    gap: 8px;
    padding: 16px;
  }
  .card-art i {
    height: 30px;
  }
  .card-content {
    padding: 22px;
  }
  .game-heading {
    align-items: start;
  }
  .secondary {
    font-size: 11px;
    padding: 10px;
    white-space: nowrap;
  }
  canvas {
    height: 380px;
  }
  .board-heading,
  .board-footer {
    padding: 16px;
  }
}

.canvas-wrap {
  position: relative;
}
.canvas-tools {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  gap: 8px;
  z-index: 1;
}
.canvas-tools button {
  border: 1px solid #cad8bd;
  border-radius: 9px;
  padding: 9px 12px;
  background: #fffffff0;
  color: #36533b;
  font-size: 12px;
  box-shadow: 0 2px 5px #304c3710;
}
.formula {
  display: flex;
  gap: 5px;
}
.formula input {
  min-width: 0;
  padding: 12px 2px;
  text-align: center;
  width: 24%;
  font-size: 17px;
}
.formula .operator-field {
  width: 14%;
  background: #eaf0df;
  cursor: pointer;
}
.formula input.active {
  border-color: #648858;
  box-shadow: 0 0 0 2px #87a96c44;
}
#keypad {
  margin: 12px 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
#keypad.operators {
  grid-template-columns: repeat(4, 1fr);
}
#keypad button {
  border: 1px solid #d1ddc6;
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  color: #315c45;
  font-size: 20px;
}
#keypad button:last-child {
  font-size: 14px;
}
#keypad button:hover {
  background: #eaf0df;
}

/* Hebrew copy follows RTL; math expressions and keypads keep their familiar order. */
:root {
  font-family: "Heebo", sans-serif;
}
h1,
.card-content strong,
.legend-value strong {
  font-family: "Heebo", sans-serif;
}
h1,
.card-content strong {
  letter-spacing: 0;
}
.eyebrow,
.tag {
  letter-spacing: 0;
}
.game-card {
  text-align: start;
}
.canvas-tools {
  left: auto;
  inset-inline-start: 12px;
}
.formula,
#keypad {
  direction: ltr;
}
.formula input {
  direction: ltr;
}
.legend-value {
  justify-content: flex-end;
}
.card-link b {
  direction: ltr;
}
footer span {
  margin-left: 0;
  margin-inline-start: 10px;
}
.game-heading h1 {
  line-height: 1.3;
}
.game-heading p {
  max-width: 650px;
}
#feedback {
  overflow-wrap: anywhere;
}

.game-card {
  text-decoration: none;
}
.back {
  display: inline-block;
  text-decoration: none;
}

.object-emoji,
.item-emoji {
  font-size: 38px;
  line-height: 1;
}
.legend-value {
  gap: 12px;
}
.warehouse-art i {
  background: none !important;
  box-shadow: none;
  font-style: normal;
  font-size: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.round-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
#daily-score {
  font-size: 13px;
  color: #52754b;
}
.answer-actions {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.answer-actions .primary {
  flex: 1;
  width: auto;
}
.answer-actions .secondary {
  flex: 1;
  padding: 12px 8px;
  font-size: 12px;
}

dialog {
  border: 1px solid #cdd8c7;
  border-radius: 18px;
  padding: 28px;
  width: 420px;
  max-width: calc(100% - 32px);
  color: #213d36;
  background: #f7f8f2;
}
dialog::backdrop {
  background: #213d3677;
}
dialog h2 {
  margin-top: 0;
}
dialog form {
  margin: 0;
}
dialog input {
  margin: 14px 0;
}
dialog .answer-actions {
  margin-top: 12px;
}

#prompt-dialog {
  width: 760px;
}
#prompt-text {
  box-sizing: border-box;
  width: 100%;
  height: 55vh;
  resize: vertical;
  padding: 16px;
  border: 1px solid #cbd7c1;
  border-radius: 10px;
  background: white;
  color: #213d36;
  font: 14px/1.6 monospace;
  text-align: left;
  margin-bottom: 16px;
}
#prompt-dialog .answer-actions {
  flex-wrap: wrap;
}

/* Keep the exercise and its controls visible together, including on small screens. */
.compact-game main {
  padding: 16px 28px;
  min-height: 0;
  max-width: 1400px;
}
.compact-game .back {
  margin-bottom: 8px;
  font-size: 12px;
}
.compact-game .game-heading {
  margin-bottom: 8px;
  gap: 16px;
  align-items: center;
}
.compact-game .game-heading h1 {
  font-size: 30px;
  margin: 0;
  line-height: 1.25;
}
.compact-game .round-controls {
  flex-direction: row;
  gap: 8px;
  flex-wrap: wrap;
}
.compact-game .round-controls button {
  padding: 9px 13px;
  min-height: 38px;
}
.question-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.question-row p {
  margin: 0;
  color: #36533b;
  font-size: 17px;
}
.question-row #daily-score {
  white-space: nowrap;
  font-size: 12px;
}
.compact-game .workspace {
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 16px;
}
.compact-game canvas {
  height: clamp(260px, calc(100dvh - 235px), 480px);
}
.compact-game .board-heading {
  padding: 10px 16px;
}
.compact-game .board-footer {
  padding: 10px 16px;
}
.compact-game .legend {
  padding: 12px 16px;
}
.compact-game .legend-value {
  margin: 8px 0;
  gap: 10px;
}
.compact-game .legend-value strong {
  font-size: 30px;
}
.compact-game .object-emoji,
.compact-game .item-emoji {
  font-size: 30px;
}
.compact-game #answer-form {
  margin-top: 14px;
}
.compact-game form p {
  margin: 4px 0 8px;
}
.compact-game .hint {
  margin-top: 10px;
}
.compact-game #input-help {
  margin: 6px 0 10px;
}
.compact-game #keypad {
  margin: 8px 0;
  gap: 4px;
}
.compact-game #keypad button {
  padding: 7px;
  font-size: 18px;
}
.compact-game footer {
  padding: 8px;
  font-size: 10px;
}
@media (max-width: 800px) {
  .compact-game main {
    padding: 12px 16px;
  }
  .compact-game .game-heading {
    flex-wrap: wrap;
    gap: 8px;
  }
  .compact-game .game-heading h1 {
    font-size: 25px;
  }
  .question-row {
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
  }
  .question-row p {
    font-size: 15px;
  }
  .compact-game .workspace {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .compact-game canvas {
    height: clamp(180px, 28dvh, 260px);
  }
  .compact-game aside {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
  }
  .compact-game .legend {
    padding: 10px;
  }
  .compact-game .legend-value {
    flex-wrap: wrap;
    gap: 5px;
  }
  .compact-game .legend p {
    font-size: 10px;
  }
  .compact-game #answer-form {
    margin-top: 0;
  }
  .compact-game .hint {
    display: none;
  }
  .compact-game .round-controls button {
    padding: 7px 10px;
    min-height: 34px;
    font-size: 12px;
  }
  .compact-game .formula input {
    padding: 9px 2px;
  }
  .compact-game .primary {
    padding: 11px;
  }
}

@media (max-width: 800px) {
  .compact-game:has(#keypad:not([hidden])) canvas {
    height: 160px;
  }
}

@media (max-width: 800px) {
  .compact-game #keypad:not(.operators) {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
  .compact-game #keypad button {
    padding: 5px 0;
    font-size: 16px;
  }
}

.batch-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 16px 0;
}
.batch-controls input {
  width: 90px;
  padding: 8px;
}
.equation-card {
  background: white;
  border: 1px solid #dbe3d6;
  border-radius: 12px;
  padding: 14px 18px;
  margin: 10px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.equation {
  direction: ltr;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 24px;
}
.equation input {
  width: 95px;
  padding: 9px;
  text-align: center;
}
.problem-note {
  font-size: 13px;
}
.equation-card.correct {
  border-color: #7aa76b;
  background: #f0f7e9;
}
.equation-card.incorrect {
  border-color: #caa36a;
}
#answers-form > .primary {
  width: auto;
  min-width: 220px;
}
#problems {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 10px;
}
@media (max-width: 450px) {
  #problems {
    grid-template-columns: 1fr;
  }
  .equation {
    gap: 8px;
    font-size: 21px;
  }
  .equation input {
    width: 75px;
  }
}

#problems {
  grid-template-columns: 1fr;
}
.equation input {
  width: 110px;
}

.geometry-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 24px;
  align-items: start;
}
.geometry-drawing {
  background: white;
  border: 1px solid #dbe3d6;
  border-radius: 18px;
}
.geometry-drawing svg {
  display: block;
  width: 100%;
  max-height: 480px;
}
.shape-options {
  display: grid;
  gap: 9px;
}
.shape-options button {
  text-align: start;
  padding: 14px;
  border: 1px solid #cad8bd;
  border-radius: 10px;
  background: white;
  color: #213d36;
}
.shape-options button.correct {
  background: #e2f1d9;
  border-color: #78a76b;
}
.shape-options button.incorrect {
  background: #fff1e2;
  border-color: #caa36a;
}
#shape-feedback {
  min-height: 30px;
}
@media (max-width: 700px) {
  .geometry-workspace {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .geometry-drawing svg {
    max-height: 290px;
  }
  .shape-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .shape-options button {
    padding: 10px;
    font-size: 13px;
  }
  .geometry-workspace h2 {
    font-size: 18px;
    margin: 8px 0;
  }
}

#shape {
  touch-action: none;
  cursor: grab;
  user-select: none;
}
#shape:active {
  cursor: grabbing;
}
#shape-feedback {
  border: 0;
  background: none;
  color: #315c45;
  font: inherit;
  text-align: start;
  padding: 12px 0;
}
#shape-feedback:enabled {
  cursor: pointer;
  text-decoration: underline;
  font-weight: 700;
}

#open-combined-pdf {
  float: left;
  margin-bottom: 16px;
}
#combined-pdf-dialog {
  width: 520px;
}
.subject-count {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: 10px 0;
}
.subject-count input {
  width: 100px;
  margin: 0;
  padding: 10px;
}
#subject-counts {
  margin: 18px 0;
}
.pdf-worker {
  position: absolute;
  width: 1000px;
  height: 800px;
  left: -10000px;
  top: 0;
  border: 0;
  visibility: hidden;
}
