*{
  margin:0;
  padding:0;
  box-sizing:border-box;
}

body{
  background:linear-gradient(135deg,#ffe4f3,#fff7fb);
  font-family:Arial,sans-serif;
  display:flex;
  justify-content:center;
  padding:20px; /* lebih lega */
}

.window{
  width:min(420px, calc(100% - 40px));
  max-width:100%;

  background:#fff;
  border:2px solid rgba(231,211,222,.9);
  border-radius:18px;
  overflow:hidden;
}

.topbar{
  display:flex;
  align-items:center;
  gap:10px;
  padding:12px 15px;
  background:#e8c7c7;
  border-bottom:2px solid #7c6666;
}

.back{
  text-decoration:none;
  color:#000;
  font-size:28px;
  font-weight:bold;
  line-height:1;
}

.title{
  flex:1;
  text-align:center;
  font-size:20px;
  font-weight:600;
  color:#8d6b78;
  margin-right:36px;
}

.content{
  padding:18px 18px 22px;
}

.heading{
  font-size:22px;
  margin-bottom:12px;
  color:#d9b8b8;
  text-align:center;
}

.letter-wrap{
  background:#fff;
  border:2px solid #efd1de;
  border-radius:16px;
  padding:14px;
  box-shadow:0 6px 20px rgba(0,0,0,.06);
  max-height:72vh;
  overflow:auto;
}

.letter{
  position:relative;
}

.letter-text{
  white-space:pre-wrap;
  line-height:1.9;
  letter-spacing:0.6px;
  text-align:left;
}

.bottom-actions{
  padding:10px 18px 16px;
  text-align:center;
  color:#7c6666;
  font-size:14px;
}

.hint{
  opacity:.9;
  font-size:16px;
}

.back img {
  width: 35px;
  height: 35px;
  object-fit: contain;
  cursor: pointer;
}

.footer{
  display:flex;
  justify-content:space-between;
  align-items:center;

  padding:8px 12px;
  border-top:2px solid #7c6666;
  background:#eed1d1;
}

.paw-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

/* Mobile layout tweaks */
@media (max-width:420px){

  body{
    padding:20px;
  }

  .window{
    width:100%;
    border-radius:14px;
  }

  .content{
    padding:14px 14px 18px;
  }

  .heading{
    font-size:20px;
    margin-bottom:10px;
  }

  .letter-wrap{
    padding:12px;
    max-height:68vh;
  }

  .letter-text{
    line-height:1.8;
    letter-spacing:0.4px;
  }

  .bottom-actions{
    font-size:11px;
    padding:8px 14px 12px;
  }

  .back img{
    width:35px;
    height:35px;
  }

  .paw-icon{
    width:20px;
    height:20px;
  }
}

@media (max-height: 700px){
  .letter-wrap{ max-height:64vh; }
}

