/* diary.css — polaroids, notebook screens, album */
.dia-book { background: url(../assets/diary-bg.webp) center / cover no-repeat,
  linear-gradient(90deg, transparent calc(50% - 4px), rgba(160,120,110,.35) 50%, transparent calc(50% + 4px)),
  repeating-linear-gradient(0deg, transparent 0 29px, rgba(122,209,192,.18) 29px 30px), #fff3e2; }
.dia-paper { position: absolute; top: 62px; width: 402px; height: 406px; border-radius: 12px; background: rgba(255,252,246,.62); box-shadow: 0 2px 8px rgba(74,47,63,.12); pointer-events: none !important; }
.dia-abs { position: absolute; box-sizing: border-box; }
.dia-head { font: 900 30px/38px "Segoe Print","Bradley Hand","Chalkboard SE","Comic Sans MS",var(--font); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border-bottom: 3px dotted var(--coral); }

/* polaroid */
.dia-pol { position: relative; box-sizing: border-box; background: #fff; border-radius: 3px; color: var(--ink);
  box-shadow: 0 6px 14px rgba(74,47,63,.28), 0 1px 2px rgba(74,47,63,.3);
  font-family: "Segoe Print","Bradley Hand","Chalkboard SE","Comic Sans MS",var(--font); }
.dia-pol .dia-ph { background: #f2e8da; overflow: hidden; }
.dia-pol .dia-ph img { display: block; width: 100%; height: 100%; object-fit: cover; }
.dia-pol .dia-cap { display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 0 3px; overflow: hidden; text-align: left; }
.dia-pol .dc { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; min-height: 1.2em; }
.dia-pol .dd { font: 700 17px/1.1 var(--font); color: #d08a6a; text-align: right; letter-spacing: .5px; }
.dia-pol.tape::before { content: ""; position: absolute; left: 50%; top: -12px; width: 64px; height: 22px; z-index: 2;
  transform: translateX(-50%) rotate(-4deg); opacity: .92; box-shadow: 0 1px 2px rgba(74,47,63,.25);
  background: repeating-linear-gradient(45deg, rgba(255,201,168,.9) 0 8px, rgba(122,209,192,.85) 8px 16px); }

/* placed photo card (polaroid-like white frame) */
.dia-cardit { box-sizing: border-box; background: #fff; padding: 5px 5px 10px; border-radius: 3px; box-shadow: 0 4px 10px rgba(74,47,63,.3), 0 1px 2px rgba(74,47,63,.3); }
.dia-cardit img { display: block; width: 100%; height: auto; border-radius: 2px; pointer-events: none; }
.dia-st.dia-cardit { filter: none; }
.dia-st.dia-cardit.sel { filter: drop-shadow(0 0 5px var(--coral)) drop-shadow(0 0 2px #fff); }
.dia-cardit.thumb { width: 90px; }
.dia-cardit.thumb.wide { width: 150px; }
.dia-cpick { border-radius: 8px; }

/* snap modal */
.dia-printer { position: relative; width: 380px; height: 240px; overflow: hidden; display: flex; justify-content: center; padding-top: 14px; box-sizing: border-box; margin: 0 auto; }
.dia-slot { position: absolute; top: 0; left: 50%; width: 290px; height: 14px; transform: translateX(-50%); background: var(--ink); border-radius: 7px; z-index: 3; }
.dia-pol.print { transform: rotate(-2deg); animation: diaPrint .95s cubic-bezier(.3,1.2,.5,1) both; }
.dia-pol.print .dia-ph img { animation: diaDev 1.4s ease-out .8s both; }
@keyframes diaPrint { from { transform: translateY(-105%) rotate(-2deg); } 70% { transform: translateY(3%) rotate(-2deg); } to { transform: translateY(0) rotate(-2deg); } }
@keyframes diaDev { from { filter: brightness(2.4) contrast(.3) saturate(0) sepia(.4); opacity: .3; } to { filter: none; opacity: 1; } }
.dia-snapin { margin-top: 6px; }
.dia-promptbox { display: flex; align-items: center; gap: 16px; text-align: left; }
.dia-promptbox img { width: 120px; height: 120px; object-fit: contain; flex: none; animation: diaBob 1.6s ease-in-out infinite; }
@keyframes diaBob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* edit page */
.dia-mood { position: absolute; box-sizing: border-box; width: 70px; height: 60px; padding: 2px 0; border-radius: 18px; background: rgba(255,255,255,.8); border: 3px solid transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  color: var(--ink); font: 800 17px/1 var(--font); cursor: pointer; transition: transform .12s; opacity: .75; }
.dia-mood .ci { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.dia-mood .ci svg { width: 22px; height: 22px; }
.dia-mood.on { opacity: 1; border-color: var(--ink); transform: rotate(-4deg) scale(1.06); background: #fff; box-shadow: 0 3px 0 rgba(74,47,63,.25); }
.dia-mood.big { position: static; opacity: 1; transform: rotate(6deg); border-color: var(--ink); background: #fff; cursor: default; width: 74px; }
.dia-text.ui-input { position: absolute; box-sizing: border-box; border: 0; border-radius: 10px; min-height: 0; padding: 0 12px; background-color: rgba(255,255,255,.55);
  background-image: repeating-linear-gradient(transparent 0 29px, rgba(122,209,192,.7) 29px 30px); background-attachment: local; font: 700 20px/30px var(--font); color: var(--ink); overflow-y: auto; scrollbar-width: none; }
.dia-text.ui-input::-webkit-scrollbar { display: none; }
.dia-text.ui-input:focus { box-shadow: 0 0 0 3px var(--coral); }
.dia-count { position: absolute; font: 700 17px/1 var(--font); color: var(--ink-soft); pointer-events: none; }
.dia-sg { display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; }
.dia-sg .chip { white-space: normal; text-align: left; align-items: flex-start; font-size: 18px; line-height: 1.15; padding: 6px 14px; border-radius: 22px; max-width: 100%; border-color: var(--peach); }
.dia-sg .chip:active { background: var(--peach); }
.dia-slotbtn { position: absolute; width: 233px; height: 188px; padding: 0; border: 0; background: none; cursor: pointer; transition: transform .12s; }
.dia-slotbtn.focus { transform: scale(1.05) rotate(0deg) !important; }
.dia-empty-slot { box-sizing: border-box; width: 225px; height: 180px; margin: 4px; border: 4px dashed var(--coral); border-radius: 10px; background: rgba(255,255,255,.55); display: flex; align-items: center; justify-content: center; text-align: center; padding: 6px;
  font: 900 21px/1.2 var(--font); color: var(--coral); }
.dia-x { position: absolute; width: 60px; height: 60px; border-radius: 50%; border: 4px solid var(--coral); background: var(--cream); color: var(--coral); font: 900 26px/1 var(--font); padding: 0; cursor: pointer; z-index: 5; box-shadow: 0 3px 0 rgba(150,60,50,.4); }
.dia-x:active { transform: scale(.92); }
.dia-tray { position: absolute; width: 64px; height: 64px; padding: 4px; border: 0; background: rgba(255,255,255,.55); border-radius: 16px; touch-action: none; cursor: grab; }
.dia-tray img { width: 56px; height: 56px; object-fit: contain; pointer-events: none; display: block; }
.dia-layer { position: absolute; inset: 0; pointer-events: none !important; z-index: 6; }
.dia-st { position: absolute; transform: translate(-50%,-50%); pointer-events: auto; touch-action: none; user-select: none; -webkit-user-drag: none; cursor: grab; filter: drop-shadow(0 2px 2px rgba(74,47,63,.35)); }
.dia-st.sel { filter: drop-shadow(0 0 5px var(--coral)) drop-shadow(0 0 2px #fff); z-index: 2; }
.dia-st.ro { pointer-events: none; cursor: default; }
.dia-st.ghost { pointer-events: none; opacity: .9; z-index: 9; }
.dia-tbar { position: absolute; display: flex; gap: 6px; pointer-events: auto; z-index: 8; animation: pop .18s both; }
.dia-tb { width: 60px; height: 60px; padding: 0; border-radius: 50%; border: 4px solid var(--coral); background: var(--cream); color: var(--ink); font: 900 28px/1 var(--font); cursor: pointer; box-shadow: 0 3px 0 rgba(150,60,50,.4); }
.dia-tb.del { background: var(--coral); color: #fff; }
.dia-tb:active { transform: scale(.92); }
.dia-foot { position: absolute; left: 50%; top: 468px; transform: translateX(-50%); display: flex; gap: 12px; align-items: center; white-space: nowrap; z-index: 7; }

/* pick modal / album */
.dia-pgrid { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; max-height: 262px; width: 640px; max-width: 100%; padding: 8px 4px; box-sizing: border-box; }
.dia-pick { padding: 4px; border: 0; background: none; cursor: pointer; transition: transform .12s; }
.dia-pick:active { transform: scale(.94); }
.dia-emptytxt { padding: 40px 10px; font: 800 22px/1.3 var(--font); color: var(--ink-soft); text-align: center; }
.dia-agrid { display: flex; flex-wrap: wrap; gap: 14px 12px; justify-content: center; padding: 14px 4px 8px; }
.dia-aitem { padding: 6px; border: 0; background: none; cursor: pointer; transition: transform .12s; animation: pop .3s both; }
.dia-aitem:active { transform: scale(.94) !important; }
.dia-tip { display: flex; align-items: center; justify-content: center; gap: 8px; font: 800 20px/1.2 var(--font); color: var(--ink-soft); }
.dia-tip img { width: 34px; height: 34px; object-fit: contain; }
.dia-count-chip { padding: 4px 16px; border-radius: 22px; background: #fff; border: 3px solid var(--mint); font: 900 22px/1.2 var(--font); }

/* read view */
.dia-readtext { position: absolute; box-sizing: border-box; padding: 0 12px; border-radius: 10px; background-color: rgba(255,255,255,.55);
  background-image: repeating-linear-gradient(transparent 0 29px, rgba(122,209,192,.7) 29px 30px); background-attachment: local;
  font: 700 20px/30px var(--font); color: var(--ink); white-space: pre-wrap; word-break: break-word; overflow-y: auto; scrollbar-width: none; touch-action: pan-y; }
.dia-readtext::-webkit-scrollbar { display: none; }
.dia-nav.btn { position: absolute; top: 240px; width: 60px; min-width: 60px; padding: 0; font-size: 40px; z-index: 5; }
.dia-bar { position: absolute; left: 50%; top: 468px; transform: translateX(-50%); display: flex; gap: 10px; align-items: center; white-space: nowrap; z-index: 7; }
.dia-bar .btn { font-size: 20px; }
.dia-pagechip { padding: 4px 14px; border-radius: 22px; background: rgba(255,255,255,.9); border: 3px solid var(--peach); font: 900 20px/1.2 var(--font); }
.dia-sheet { position: absolute; top: 62px; width: 402px; height: 406px; border-radius: 10px; z-index: 4; pointer-events: none !important;
  background: linear-gradient(90deg, #fff8ee, #ffeedd); box-shadow: 0 6px 18px rgba(74,47,63,.35); backface-visibility: hidden; }
.dia-sheet.next { left: 504px; transform-origin: 0 50%; animation: diaFlipN .56s ease-in-out both; }
.dia-sheet.prev { left: 54px; transform-origin: 100% 50%; animation: diaFlipP .56s ease-in-out both; }
@keyframes diaFlipN { 0% { transform: perspective(1400px) rotateY(0); opacity: 1; } 75% { opacity: 1; } 100% { transform: perspective(1400px) rotateY(-180deg); opacity: 0; } }
@keyframes diaFlipP { 0% { transform: perspective(1400px) rotateY(0); opacity: 1; } 75% { opacity: 1; } 100% { transform: perspective(1400px) rotateY(180deg); opacity: 0; } }
.dia-cover { position: absolute; left: 250px; top: 84px; width: 460px; height: 370px; box-sizing: border-box; border-radius: 22px; background: linear-gradient(160deg, #ffd6e0, #ffc9a8); border: 6px solid #fff; box-shadow: 0 8px 20px rgba(74,47,63,.3);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 16px; text-align: center; }
.dia-cover img { width: 130px; height: 130px; object-fit: contain; animation: diaBob 1.8s ease-in-out infinite; }
.dia-cover .hint { font: 800 21px/1.35 var(--font); color: var(--ink); }
