@import url("https://fonts.googleapis.com/css2?family=Mali:wght@400;500;600;700&family=Patrick+Hand&display=swap");
:root {
  font-family: "Mali", "Noto Sans Thai", sans-serif;
  font-synthesis: none;
  color: #423446;
  --ink: #44364b;
  --muted: #8b7b72;
  --pink: #ecd0dd;
}
* {
  box-sizing: border-box;
}
html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}
body {
  overflow: hidden;
  overflow-y: auto;
  background: transparent;
}
button,
textarea,
input {
  font: inherit;
  outline: none;
}
button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
/* The desktop application itself ALWAYS fills the viewport. Stage scaling never applies to this grid. */
.desk {
  width: 100dvw;
  min-height: 100dvh;
  /* background: #dec09b url("assets/desk.webp") center center/cover no-repeat; */
  background: transparent;
  backdrop-filter: blur(10px);
  display: flex;
}
.app {
  display: grid;
  grid-template-columns: minmax(0, 46.6fr) minmax(0, 53.4fr);
  width: 100%;
  height: 100%;
  min-height: 0;
  max-width: 1485px;
  aspect-ratio: 1485 / 1169;
  margin: auto;
  position: relative;
}
.left-column,
.right-column {
  position: relative;
  height: 100%;
  width: 100%;
  min-width: 0;
}
.left-column {
  overflow: visible;
  z-index: 1;
}
.right-column {
  z-index: 2;
}
.left-page-surface,
.right-page-surface {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  user-select: none;
}
.left-page-surface {
  z-index: 0;
  left: 0;
  top: 0;
  width: 100%;
  max-width: none;
  filter: drop-shadow(3px 3px 5px #7a5b4129);
}
.right-page-surface {
  z-index: 0;
  filter: drop-shadow(5px 5px 6px #7a5b4140);
}
/* Each column has its own centered stage, unlike the former fixed 1536px-wide canvas. */
.stage-shell {
  --stage-scale: 1;
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: calc(var(--base-w) * var(--stage-scale));
  height: calc(1024px * var(--stage-scale));
}
.left-column .stage-shell {
  --base-w: 716px;
}
.right-column .stage-shell {
  --base-w: 820px;
}
.stage {
  position: relative;
  width: var(--base-w);
  height: 1024px;
  transform: scale(var(--stage-scale));
  transform-origin: top left;
}
.stage img {
  pointer-events: none;
  user-select: none;
  z-index: 13;
}
/* LEFT: title / art / mood / toolbar */
.brand {
  position: absolute;
  z-index: 5;
  left: 106px;
  top: 43px;
  width: 412px;
  text-align: center;
  transform: rotate(-5deg);
}
.brand h1 {
  font:
    700 63px/1.28 "Patrick Hand",
    "Mali",
    sans-serif;
  letter-spacing: 0.1px;
  white-space: nowrap;
  margin: 0;
}
.brand p {
  font-size: 21px;
  font-weight: 600;
  line-height: 1.38;
  white-space: nowrap;
  margin: 0;
  position: relative;
  left: 7px;
  letter-spacing: -0.1px;
}
.brand-heart {
  position: absolute;
  font:
    700 39px/1 "Patrick Hand",
    "Mali",
    sans-serif;
  top: 77px;
  right: 31px;
  transform: rotate(17deg);
}
.asset-note-left {
  position: absolute;
  z-index: 7;
  left: 505px;
  top: 15px;
  width: 164px;
  height: 195px;
  object-fit: contain;
  filter: drop-shadow(2px 5px 2px #73503933);
}
.asset-leaves-left {
  position: absolute;
  z-index: 4;
  left: 0;
  top: 173px;
  width: 103px;
  height: 230px;
  object-fit: contain;
}
.asset-sparkles-left {
  position: absolute;
  z-index: 3;
  left: 157px;
  top: 224px;
  width: 95px;
  height: 105px;
  object-fit: contain;
}
.asset-sparkles-right {
  position: absolute;
  z-index: 3;
  left: 514px;
  top: 266px;
  width: 92px;
  height: 122px;
  object-fit: contain;
}
.left-stage::before {
  position: absolute;
  content: "";
  left: 57px;
  top: 501px;
  width: 606px;
  height: 45px;
  border-radius: 50%;
  background: radial-gradient(
    ellipse,
    #baa08340 30%,
    #bba4881a 62%,
    transparent 80%
  );
  pointer-events: none;
}
.hero {
  position: absolute;
  z-index: 4;
  left: 58px;
  top: 205px;
  width: 620px;
  height: 355px;
  object-fit: contain;
}
.mood-picker {
  position: absolute;
  z-index: 5;
  left: 42px;
  right: 29px;
  top: 571px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0;
}
.mood-choice {
  position: relative;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 18px;
  line-height: 1.32;
  color: #2c282b;
  white-space: nowrap;
}
.mood-choice::before {
  position: absolute;
  z-index: -1;
  content: "";
  left: 50%;
  top: 9px;
  width: 142px;
  height: 147px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: transparent;
}
.mood-choice.selected::before {
  background: radial-gradient(ellipse at 35% 30%, #fad9ca, #edcadd 82%);
}
.mood-choice:hover::before {
  background: #f1d6e0b0;
}
.mood-art {
  height: 125px;
  width: 128px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.mood-art img {
  max-width: 122px;
  max-height: 108px;
  width: auto;
  height: auto;
  object-fit: contain;
}
.affirmation {
  position: absolute;
  z-index: 4;
  left: 208px;
  top: 748px;
  width: 333px;
  min-height: 116px;
  border-radius: 58px;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at 30% 25%, #f2e0f1, #e9cbdf);
}
.affirmation p {
  font-size: 21px;
  font-weight: 600;
  line-height: 1.56;
  text-align: center;
  margin: 0;
  padding: 15px 14px;
  white-space: pre-line;
  letter-spacing: -0.1px;
}
.doodle-rays {
  position: absolute;
  font-size: 60px;
  color: #dcb16e;
}
.left-rays {
  left: -44px;
  top: 9px;
  transform: rotate(-40deg);
}
.right-rays {
  right: -43px;
  top: 27px;
  transform: rotate(42deg);
}
.asset-green-tape {
  position: absolute;
  z-index: 6;
  left: 0;
  top: 804px;
  width: 159px;
  height: 125px;
  object-fit: contain;
}
.toolbar {
  position: absolute;
  z-index: 10;
  left: 17px;
  right: 0;
  bottom: 14px;
  height: 125px;
  padding: 15px 25px 0;
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 1px;
}
.toolbar-paper {
  position: absolute;
  z-index: -1;
  inset: 0;
  background: url("assets/footer-strip.webp") center/100% 100% no-repeat;
  filter: drop-shadow(1px 3px 3px #76584233);
}
.toolbar button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 600;
  padding: 10px 5px;
  border: 0;
  background: none;
  color: #37312f;
  transition: all 0.5s;
}
.toolbar button:hover {
  transition: all 0.5s;
  transform: translateY(-2px);
}
.toolbar svg {
  width: 31px;
  height: 31px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* RIGHT: isolated decorative assets + true form/history. The page is ONE background asset outside the stage. */
.notebook-rings {
  position: absolute;
  z-index: 6;
  left: -24px;
  top: 133px;
  display: flex;
  flex-direction: column;
  gap: 29px;
  pointer-events: none;
}
.notebook-rings i {
  display: block;
  width: 73px;
  height: 35px;
  background: url("assets/binding-ring-original.webp") center/100% 100%
    no-repeat;
}
.asset-peach-tape {
  position: absolute;
  z-index: 6;
  left: 292px;
  top: -68px;
  width: 260px;
  height: auto;
  object-fit: contain;
}
.asset-note-right {
  position: absolute;
  z-index: 9;
  right: -18px;
  top: -62px;
  width: 162px;
  height: 180px;
  object-fit: contain;
  filter: drop-shadow(2px 5px 2px #7251372e);
}
.asset-paperclip {
  position: absolute;
  z-index: 8;
  right: 18px;
  top: 227px;
  width: 76px;
  height: 126px;
  object-fit: contain;
}
.asset-pencil {
  position: absolute;
  z-index: 8;
  right: 4px;
  top: 359px;
  width: 124px;
  height: 387px;
  object-fit: contain;
  object-position: center center;
  filter: drop-shadow(1px 3px 2px #68543d40);
}
.notebook-content {
  position: absolute;
  z-index: 5;
  width: 100%;
  padding-top: 40px;
  padding-left: 110px;
  padding-right: 110px;
  /* left: 102px;
  right: 85px;
  top: 132px;
  bottom: 70px; */
}
.entry-header {
  height: 76px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  position: relative;
  top: 20px;
}
.entry-header h2 {
  font-size: 33px;
  line-height: 1.36;
  margin: 0;
  font-weight: 600;
  white-space: nowrap;
}
.entry-header h2 span {
  font-size: 35px;
  font-family: "Patrick Hand", cursive;
  margin-left: 5px;
}
.date {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  font-size: 17px;
  font-weight: 500;
  margin: 11px 28px 0 0;
  color: #453d45;
}
.date svg {
  width: 27px;
  height: 28px;
  fill: none;
  stroke: #483b4d;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.entry-form {
  position: relative;
  margin-left: -6px;
  margin-right: 31px;
  padding-top: 20px;
}
#entry-text {
  display: block;
  width: 100%;
  height: 390px;
  border: 0;
  border-radius: 23px;
  resize: none;
  outline: none;
  padding: 21px 29px 28px;
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 44px,
      rgba(139, 103, 79, 0.12) 45px,
      transparent 46px
    ),
    rgba(255, 247, 235, 0.12);
  background-position: 0 21px;
  line-height: 46px;
  font-size: 19px;
  font-weight: 500;
  color: #473a3f;
}
#entry-text::placeholder {
  color: #a59a8d;
  opacity: 1;
}
.counter {
  position: absolute;
  right: 25px;
  bottom: 115px;
  font-size: 14px;
  color: #938981;
}
.save-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  width: 323px;
  height: 69px;
  margin: 18px auto 0;
  border: 1px solid #d8b7d8;
  border-radius: 19px;
  background: linear-gradient(105deg, #dbc2de, #e8cedd);
  color: #43394b;
  font-size: 22px;
  font-weight: 600;
  transition: transform 0.12s;
}
.save-button:hover {
  transform: translateY(-2px);
}
.save-button svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.save-status {
  line-height: 21px;
  font-size: 13px;
  text-align: center;
  margin: 0;
  color: #7b6c63;
  position: relative;
  top: 25px;
}
.history {
  position: relative;
  margin: 105px -8px 0 7px;
}
.history-header {
  height: 57px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.history-header h2 {
  display: flex;
  align-items: center;
  gap: 13px;
  margin: 0;
  font-size: 26px;
  white-space: nowrap;
  font-weight: 700;
}
.history-header h2 svg {
  height: 35px;
  width: 35px;
  fill: none;
  stroke: #44384b;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.history-header button {
  border: 0;
  background: none;
  color: #4d4349;
  font-size: 17px;
  font-weight: 600;
  white-space: nowrap;
  padding: 5px 0 5px 10px;
}
.history-header button:hover {
  text-decoration: underline;
}
.history-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 256px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #bca78b transparent;
}
.history-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 76px;
  border-radius: 16px;
  border: 1px solid #d4b79a67;
  box-shadow: 0 1px 5px #a58a6c2b;
  background: rgba(255, 245, 230, 0.52);
  padding: 5px 13px;
}
.history-card .record-mood {
  width: 94px;
  height: 67px;
  object-fit: contain;
  flex: none;
}
.record-copy {
  flex: 1;
  min-width: 0;
}
.record-heading {
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.8;
  color: #3d363a;
}
.record-note {
  font-size: 13px;
  color: #898078;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  line-height: 1.35;
}
.record-date {
  align-self: flex-start;
  margin-top: 11px;
  font-size: 12px;
  white-space: nowrap;
  color: #8f857d;
}
.delete-entry {
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  background: none;
  border: 0;
  color: #c75b50;
  padding: 6px;
}
.delete-entry:hover {
  color: #9e3128;
}
.delete-entry svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.empty-history {
  font-size: 17px;
  text-align: center;
}
/* Accessible dialogs: keep outside the clipped art columns. */
.app-dialog {
  border: 1px solid #ceb399;
  border-radius: 19px;
  max-width: min(450px, calc(100vw - 32px));
  padding: 26px;
  background: #fff2dd;
  color: var(--ink);
  box-shadow: 0 15px 60px #39291964;
}
.app-dialog::backdrop {
  background: rgba(42, 31, 28, 0.4);
  backdrop-filter: blur(3px);
}
.app-dialog h2 {
  margin: 0 0 12px;
}
.app-dialog p {
  font-size: 15px;
}
.app-dialog label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}
.dialog-actions button {
  border: 0;
  padding: 11px 17px;
  border-radius: 12px;
  background: #e7c7d9;
  color: #48354b;
}
.dialog-actions button.danger {
  background: #b9544a;
  color: white;
}
/* Phones can scroll vertically; desktop remains strict viewport-sized with no page scroll. */
@media (max-width: 840px) {
  html,
  body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }
  .desk {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }
  .app {
    display: flex;
    flex-direction: column;
    height: auto;
  }
  .left-column,
  .right-column {
    width: 100%;
    height: auto;
    overflow: hidden;
    flex: none;
  }
  .left-page-surface,
  .right-page-surface {
    object-fit: fill;
  }
  .stage-shell {
    top: 11px;
    transform: translateX(-50%);
  }
  .mood-choice {
    min-width: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
