body {
  font-family: 'Comic Sans MS', cursive;
  background: linear-gradient(135deg, #ff9a9e, #fecfef, #a8edea);
  padding: 20px;
}

h1, h2, h3 {
  color: #5a20cb;
}

.diary-card {
  background: white;
  border-radius: 15px;
  padding: 15px;
  margin: 10px 0;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

button {
  background: #ff6bcb;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-weight: bold;
}

button:hover {
  background: #ff3ca1;
}

input {
  padding: 8px;
  border-radius: 8px;
  border: 2px solid #ffb6c1;
  margin: 5px;
}

#content-editor:focus {
  outline: none;
  border-color: #ff6bcb;
}

#content-editor img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  margin: 10px 0;
}

#editor-toolbar button:active {
  transform: scale(0.95);
}
    body {
      font-family: "Segoe UI", sans-serif;
      background: #fefcfb;
      margin: 0;
      padding: 0;
    }
    h1 {
      text-align: center;
      margin-top: 60px;
      font-size: 28px;
      color: #444;
    }
    #diaryBoard {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
      gap: 20px;
      padding: 20px;
      max-width: 1200px;
      margin: auto;
    }
  .diary-card {
    position: relative;
    display: flex;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    border-left: 40px solid #4a90e2; /* สันหนังสือ */
  }

  .diary-card::before {
    content: "PUK DOC";
    position: absolute;
    top: 50%;
    left: -32px; /* อยู่ตรงสัน */
    transform: rotate(-90deg) translateY(-50%);
    transform-origin: left top;
    font-weight: bold;
    font-size: 12px;
    letter-spacing: 2px;
    color: #fff;
    font-family: "Georgia", serif;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
  }

  /* ให้ดูมีแสงเงาเหมือนหนังสือจริง */
  .diary-card::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 40px; /* ขอบสัน */
    height: 100%;
    background: linear-gradient(90deg, #3a78c2, #4a90e2, #3a78c2);
    z-index: -1;
  }

    .diary-card:hover {
      transform: translateY(-5px);
    }
    .diary-cover {
      height: 160px;
      background-size: cover;
      background-position: center;
    }
    .diary-info {
      padding: 10px;
    }
    .diary-info h3 {
      font-size: 16px;
      margin: 0 0 6px;
      color: #333;
    }
    .diary-info p {
      margin: 2px 0;
      font-size: 13px;
      color: #666;
    }
    .buy-btn {
      margin: 8px auto 12px;
      background: linear-gradient(135deg, #ff6bcb, #ffb86c);
      color: white;
      border: none;
      padding: 6px 12px;
      border-radius: 20px;
      cursor: pointer;
      font-size: 13px;
      font-weight: bold;
      box-shadow: 0 3px 6px rgba(0,0,0,0.1);
    }
    .buy-btn:hover {
      opacity: 0.9;
    }
    .puk-box {
      position: fixed;
      top: 20px;
      right: 20px;
      background: white;
      padding: 10px 15px;
      border-radius: 10px;
      box-shadow: 0 3px 10px rgba(0,0,0,0.1);
      font-size: 14px;
      z-index: 100;
    }
    .back-btn {
      display: inline-block;
      background: #a8edea;
      color: #333;
      text-decoration: none;
      padding: 8px 16px;
      border-radius: 20px;
      font-weight: bold;
      font-size: 14px;
      box-shadow: 0 2px 5px rgba(0,0,0,0.1);
      margin: 20px;
    }
    /* มินิเกม Minesweeper */
    #minesweeperContainer {
      position: fixed;
      bottom: 20px;
      left: 20px;
      background: #fff;
      border-radius: 15px;
      padding: 15px;
      box-shadow: 0 4px 15px rgba(0,0,0,0.2);
      z-index: 200;
      max-width: 90%;
    }
    #mineGrid {
      display: grid;
      gap: 2px;
      margin-top: 10px;
      touch-action: manipulation;
    }
    .cell {
      width: 30px;
      height: 30px;
      background: #ccc;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
      font-weight: bold;
      cursor: pointer;
      user-select: none;
    }
    .cell.revealed {
      background: #eee;
      cursor: default;
    }
    .cell.flagged {
      background: #ff6666;
      color: white;
    }
    .cell.bomb {
      background: #000;
      color: red;
    }
    #mineInfo {
      font-size: 14px;
      color: #333;
    }
    @media (max-width: 600px) {
      #diaryBoard {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        padding: 10px;
      }
      .cell {
        width: 25px;
        height: 25px;
        font-size: 16px;
      }
    }
    @media (max-width: 768px) {
  #diaryBoard {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
    padding: 10px;
  }
  .diary-card {
    flex-direction: column;
  }
  .diary-cover {
    height: 130px;
  }
  .diary-info h3 {
    font-size: 14px;
  }
  .diary-info p {
    font-size: 12px;
  }
  .buy-btn {
    font-size: 12px;
    padding: 5px 10px;
  }
}
@media (max-width: 480px) {
  #diaryBoard {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
  .diary-cover { height: 110px; }
  .diary-info h3 { font-size: 13px; }
  .diary-info p { font-size: 11px; }
  .buy-btn { font-size: 11px; padding: 4px 8px; }
  #minesweeperContainer {
    width: 90%;
    padding: 10px;
    bottom: 10px;
    left: 5%;
  }
  .cell { width: 22px; height: 22px; font-size: 14px; }
}
  body {
      background: linear-gradient(135deg, #d4f4dd, #fff3a3);
      padding: 20px;
      font-family: 'Comic Sans MS', cursive;
      margin: 0;
    }

    .container {
      max-width: 900px;
      margin: 0 auto;
      background: white;
      padding: 20px;
      border-radius: 20px;
      box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    }

    h1 {
      color: #5a20cb;
      text-align: center;
      font-size: 28px;
      margin-bottom: 15px;
    }

    .user-info {
      text-align: center;
      margin-bottom: 20px;
      font-size: 16px;
      color: #555;
    }

    .tabs {
      display: flex;
      justify-content: center;
      flex-wrap: wrap;
      margin-bottom: 20px;
      gap: 8px;
    }

    .tab {
      padding: 8px 18px;
      background: #ffe6f2;
      border: none;
      border-radius: 20px;
      cursor: pointer;
      font-weight: bold;
      font-size: 14px;
      transition: all 0.3s ease;
    }

    .tab.active {
      background: #ff6bcb;
      color: white;
      transform: scale(1.05);
      box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    }

    .tab-content {
      display: none;
    }

    .tab-content.active {
      display: block;
    }

    .diary-item {
      background: #f9f9f9;
      border-radius: 15px;
      padding: 15px;
      margin: 12px 0;
      box-shadow: 0 3px 6px rgba(0,0,0,0.05);
      border-left: 5px solid #ff6bcb;
      transition: all 0.3s ease;
    }

    .diary-item:hover {
      transform: scale(1.02);
      box-shadow: 0 8px 18px rgba(0,0,0,0.12);
    }

    .diary-content {
      margin: 10px 0;
      padding: 12px;
      background: #fff3f7;
      border-radius: 10px;
      line-height: 1.5;
      word-wrap: break-word;
    }

    .diary-meta {
      font-size: 13px;
      color: #777;
      margin: 4px 0;
    }

    .view-tx, .resell-btn {
      background: #a8edea;
      color: #333;
      border: none;
      padding: 6px 12px;
      border-radius: 10px;
      cursor: pointer;
      font-size: 12px;
      margin-top: 6px;
      transition: all 0.3s ease;
    }

    .view-tx:hover, .resell-btn:hover {
      background: #5ad9c9;
      transform: scale(1.05);
    }

    .tx-history {
      background: #f0f0f0;
      padding: 10px;
      border-radius: 8px;
      margin-top: 8px;
      font-family: monospace;
      font-size: 12px;
      max-height: 150px;
      overflow-y: auto;
    }

    /* Back button */
    .back-btn {
      display: inline-block;
      margin-bottom: 15px;
      color: #ff6bcb;
      text-decoration: underline;
      cursor: pointer;
      font-size: 14px;
    }

    /* Responsive สำหรับมือถือ */
    @media(max-width: 600px){
      body { padding: 10px; }
      .container { padding: 15px; }
      h1 { font-size: 24px; }
      .tab { padding: 6px 12px; font-size: 13px; }
      .diary-item { padding: 12px; }
      .diary-content { padding: 10px; font-size: 14px; }
      .view-tx, .resell-btn { padding: 5px 10px; font-size: 11px; }
    }