body {
  font-family: "Comic Sans MS", cursive, sans-serif;
  background-color: #d0f0ff;
  background: url('background-16x9.png') no-repeat center center fixed;
  background-size: cover;
  color: #333;
  text-align: center;
  padding: 20px;
  margin: 0;
}

/* 3:2 screens (e.g. some tablets and older monitors) */
@media (max-aspect-ratio: 3/2) {
  body {
    background-image: url('background-3x2.png');
  }
}

/* Square-ish screens */
@media (max-aspect-ratio: 1/1) {
  body {
    background-image: url('background-2x3.png');
  }
}

/* Portrait mode (e.g. phones) */
@media (orientation: portrait) {
  body {
    background-image: url('background-9x16.png');
  }
}

/* Card-style game container */
#game {
  background-color: #fff8fd;
  border: 4px solid #ffccdd;
  border-radius: 20px;
  padding: 24px;
  max-width: 480px;
  margin: 20px auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

#game {
  position: relative;
  overflow: hidden;
}

.flower-bg {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 140px;
  background-image: url('flowers.jpg');
  background-repeat: repeat-x;
  background-position: bottom center;
  background-size: cover;
  opacity: 0.2;
  z-index: 0; /* ensures it's behind everything */
  pointer-events: none;
}


/* Wrapper around canvas + digits */
.math-wrapper {
  position: relative;
  width: 100%;
  margin: 0 auto;
}

/* Container for math + canvas */
.math-container {
  position: relative;
  display: inline-block;
  padding-top: 50px;  /* room above for writing borrow/carry */
  padding-bottom: 10px; /* room below to avoid overlap with inputs */
}

/* Inner digits only */
#math-inner {
  position: relative;
  z-index: 1;
}

/* Drawing canvas */
#scratchpad {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: auto;
  z-index: 2;
  cursor: url('pencil.cur'), auto;
}

#eraser-btn {
  position: absolute;
  top: 0px;        /* move it above the math rows */
  right: -50px;      /* slightly outside the container */
  background: url('eraser.png') no-repeat center;
  background-size: contain;
  width: 40px;
  height: 40px;
  border: none;
  cursor: pointer;
  z-index: 3;
}


/* Digit rows and boxes */
.digit-row {
  display: flex;
  justify-content: center;
  font-size: 1.8em;
  font-family: monospace;
  margin: 0.1em 0;
}


.digit-box {
  width: 1.5em;
  height: 2em;
  text-align: center;
  vertical-align: middle;
}

/* Horizontal line */
.line-bar {
  width: calc(1.5em * 6); /* match digit box width x max digits */
  height: 2px;
  background-color: #444;
  border-radius: 2px;
  /*margin: 0.5em auto;*/
  margin: 0.1em auto 2.0em auto;
  align-self: flex-start; 
}


/* Answer input box */
input[type="text"] {
  font-size: 1.2em;
  padding: 6px 12px;
  border: 2px solid #ffb3cc;
  border-radius: 8px;
  background-color: #fff0f6;
  width: 140px;
  margin-top: 8px;
  text-align: right;
  box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.2); /* NEW */
}

/* Check/Next buttons */
button {
  background-color: #ff99cc;
  color: white;
  font-weight: bold;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  margin-top: 12px;
  cursor: pointer;
  font-size: 1.1em;
  box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.25); /* NEW */
  transition: box-shadow 0.2s ease;
}

button:hover {
  background-color: #ff66b2;
  box-shadow: 2px 4px 10px rgba(0, 0, 0, 0.35); /* Stronger on hover */
}

#next-btn-container {
  margin-top: -20px; /* try negative margin to move it up */
}



/* Feedback styling */
.correct {
  color: green;
  font-weight: bold;
  margin-top: 12px;
}

.wrong {
  color: red;
  font-weight: bold;
  margin-top: 12px;
}

#answer-input,
button,
#feedback {
  position: relative;
  z-index: 1;
}

.logo-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 10px;
}

.logo-img {
  height: 100px;
  width: auto;
}

.logo-text {
  font-size: 3em;
  font-weight: bold;
  font-family: "Comic Sans MS", cursive, sans-serif;
  color: #ff66b2;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4); /* dark soft shadow */
}

.game-footer {
  max-width: 480px;
  margin: 4px auto 0;
  padding-right: 10px;
  text-align: right;
}

.footer-note {
  font-size: 0.85em;
  color: #777;
}
