body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #fafafa;
  display: flex;
  height: 100vh;
}

.app {
  display: flex;
  width: 100%;
}

.journal-panel, .image-panel {
  flex: 1;
  padding: 20px;
  box-sizing: border-box;
}

.journal-panel {
  display: flex;
  flex-direction: column;
  border-right: 1px solid #ccc;
}

.journal-panel textarea {
  flex: 1;
  margin-top: 10px;
  resize: none;
  font-size: 16px;
  padding: 10px;
}

.controls {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.image-panel {
  position: relative;
  overflow: hidden;
}

#puzzleContainer {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(6, 1fr);
}

.piece {
  background: #eee;
  opacity: 1;
  transition: opacity 0.5s ease;
  width: 100%;
  height: 100%;
}

#dailyImage {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -1;
}

.hidden {
  display: none;
}

#burnBtn {
  position: absolute;
  z-index:20;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 20px;
  font-size: 16px;
  background: #f44336;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

#dailyImage {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.journal-panel { order: -1; }

#keepBtn {
  position: absolute;
  z-index: 20;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 20px;
  font-size: 16px;
  background: #2E6B3A;   /* forest green */
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #2E6B3A;   /* OOTW forest green */
  color: #fff;
  padding: 12px 16px;
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
  font-size: 16px;
  z-index: 1000;
}

/* --- Mobile layout + image fix --- */
@media (max-width: 768px) {
  html, body {
    height: auto;
    overflow-y: auto;      /* allow scrolling */
  }

  .app {
    flex-direction: column;
    min-height: auto;
  }

  .journal-panel {
    border-right: none;
    border-bottom: 1px solid #ccc;
  }

  .journal-panel textarea {
    min-height: 35vh;      /* keeps editor usable but leaves room for reveal */
  }

  .image-panel {
    height: 60vh;
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* === Mobile fix starts here === */
  #puzzleContainer {
    width: 94vw;
    height: auto;
    aspect-ratio: 5 / 6;   /* slightly portrait; prevents side cropping */
  }

  #dailyImage {
    object-fit: contain;   /* ensures full image shows on mobile */
    background: #000;      /* soft letterbox fill behind image */
  }
  /* === Mobile fix ends here === */
}
