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

body{
  background:#111;
  color:white;
}


/* ==================================================
   HEADER
================================================== */

header{
  background:#1b1b1b;
  padding:20px;
  text-align:center;
}

header h1{
  color:#ff5722;
}


/* ==================================================
   TOP MENU
================================================== */

.topbar{
  background:#1b1b1b;

  padding:15px;

  position:sticky;

  top:0;

  z-index:10;

  display:flex;

  flex-wrap:wrap;

  justify-content:center;

  gap:8px;
}

.topbar a{
  color:white;

  text-decoration:none;

  padding:8px 12px;

  border-radius:8px;

  background:#2a2a2a;

  font-size:14px;

  transition:
    background 0.2s ease;
}

.topbar a:hover{
  background:#ff5722;
}


/* ==================================================
   SEARCH
================================================== */

.search-box{
  text-align:center;

  margin:20px;
}

.search-box input{
  width:90%;

  max-width:500px;

  padding:12px;

  border-radius:10px;

  border:none;

  outline:none;

  font-size:16px;
}


/* ==================================================
   GRID
================================================== */

.container{
  display:grid;

  grid-template-columns:
    repeat(6, 1fr);

  gap:15px;

  padding:15px;
}


/* ==================================================
   CARD
================================================== */

.book{
  background:#1e1e1e;

  border-radius:12px;

  overflow:hidden;

  transition:
    transform 0.2s ease;

  display:block;

  text-decoration:none;

  color:white;

  min-width:0;
}

.book:hover{
  transform:scale(1.03);
}


/* ==================================================
   ẢNH TRUYỆN
================================================== */

.book img{
  width:100%;

  height:250px;

  object-fit:cover;

  display:block;
}


/* ==================================================
   LƯỢT XEM
================================================== */

.view-count{
  display:block;

  margin:
    7px 10px 2px;

  color:#8f8f8f;

  font-size:11px;

  font-weight:normal;

  line-height:1.3;

  text-align:left;

  white-space:nowrap;

  overflow:hidden;

  text-overflow:ellipsis;
}

.view-count span{
  color:#a0a0a0;

  font-weight:normal;
}


/* ==================================================
   TÊN TRUYỆN

   JAVASCRIPT SẼ CẮT THỰC TẾ
   KHI TÊN VƯỢT QUÁ 2 DÒNG.

   Không dùng line-clamp ở đây.
================================================== */

.book h2{
  margin:0;

  padding:
    0 10px 12px;

  color:#ffffff;

  font-size:15px;

  font-weight:bold;

  line-height:21px;

  text-align:left;

  word-break:normal;

  overflow-wrap:normal;

  white-space:normal;

  /*
     Không để tên tự rơi
     xuống dòng thứ 3.
  */

  overflow:hidden;
}


/* ==================================================
   LINK CARD
================================================== */

.book-link{
  text-decoration:none;

  color:white;

  display:block;
}


/* ==================================================
   STORY
================================================== */

#story{
  white-space:pre-line;

  background:#151515;

  padding:20px;

  border-radius:12px;

  font-size:17px;

  line-height:1.9;

  color:#eaeaea;

  text-align:justify;

  word-break:break-word;

  max-width:800px;

  margin:auto;

  box-shadow:
    0 0 15px
    rgba(0,0,0,0.4);
}


/* ==================================================
   DETAIL
================================================== */

.detail{
  max-width:1000px;

  margin:auto;

  padding:30px;

  display:flex;

  gap:30px;

  flex-wrap:wrap;
}

.detail img{
  width:250px;

  border-radius:12px;
}

.info{
  flex:1;
}

.info h1{
  margin-bottom:20px;

  color:#ff5722;
}


/* ==================================================
   DETAIL PAGE
================================================== */

.detail-page{
  max-width:1000px;

  margin:auto;

  padding:30px;
}

.detail-card{
  display:flex;

  gap:30px;

  flex-wrap:wrap;

  background:#151515;

  padding:25px;

  border-radius:20px;
}

.detail-img{
  width:280px;

  border-radius:15px;

  object-fit:cover;
}

.detail-info{
  flex:1;
}

.detail-info h1{
  margin-top:0;

  color:#ff5722;
}


/* ==================================================
   DETAIL VIEW
================================================== */

.detail-view-count{
  margin:
    0 0 12px;

  color:#8f8f8f;

  font-size:13px;

  line-height:1.4;

  text-align:left;
}

.detail-view-count span{
  color:#a0a0a0;

  font-weight:normal;
}


/* ==================================================
   TAG
================================================== */

.tag{
  display:inline-block;

  background:#ff5722;

  color:white;

  padding:8px 15px;

  border-radius:30px;

  margin:15px 0 5px;

  text-decoration:none;

  transition:0.3s;
}

.tag:hover{
  opacity:0.8;

  transform:scale(1.05);
}


/* ==================================================
   DESCRIPTION
================================================== */

.desc{
  color:#ddd;

  line-height:1.9;

  white-space:pre-line;

  max-height:220px;

  overflow-y:auto;

  padding-right:10px;
}

.desc::-webkit-scrollbar{
  width:6px;
}

.desc::-webkit-scrollbar-thumb{
  background:#ff5722;

  border-radius:20px;
}


/* ==================================================
   UNLOCK INFO
================================================== */

.unlock-info{
  margin-top:25px;

  background:#222;

  padding:15px;

  border-radius:12px;
}


/* ==================================================
   READ BUTTON
================================================== */

.read-btn{
  display:inline-block;

  margin-top:20px;

  background:#ff5722;

  color:white;

  padding:14px 25px;

  border-radius:12px;

  text-decoration:none;

  font-weight:bold;
}


/* ==================================================
   TABLET
================================================== */

@media (max-width:1200px){

  .container{
    grid-template-columns:
      repeat(4,1fr);
  }

}


/* ==================================================
   TABLET NHỎ
================================================== */

@media (max-width:768px){

  .container{
    grid-template-columns:
      repeat(3,1fr);

    gap:12px;
  }


  .book img{
    height:220px;
  }


  .view-count{
    font-size:11px;
  }


  .book h2{
    font-size:14px;

    line-height:20px;
  }

}


/* ==================================================
   ĐIỆN THOẠI
================================================== */

@media (max-width:500px){

  .container{
    grid-template-columns:
      repeat(2,1fr);

    gap:10px;

    padding:10px;
  }


  .book{
    border-radius:10px;
  }


  .book img{
    height:180px;

    border-radius:
      10px 10px 0 0;
  }


  .view-count{
    margin:
      6px 8px 2px;

    font-size:10px;

    line-height:13px;
  }


  .book h2{
    margin:0;

    padding:
      0 8px 10px;

    font-size:13px;

    line-height:18px;
  }


  /* ==================================================
     DETAIL MOBILE
  ================================================== */

  .detail-page{
    padding:15px;
  }


  .detail-card{
    gap:18px;

    padding:15px;

    border-radius:15px;
  }


  .detail-img{
    width:100%;

    max-width:280px;

    margin:auto;
  }


  .detail-info{
    width:100%;
  }


  .detail-view-count{
    font-size:12px;

    margin:
      0 0 10px;
  }


  .read-btn{
    padding:
      12px 20px;
  }


  #story{
    padding:15px;

    font-size:16px;
  }

}


/* ==================================================
   MÀN HÌNH RẤT NHỎ
================================================== */

@media (max-width:380px){

  .container{
    gap:8px;

    padding-left:7px;

    padding-right:7px;
  }


  .book img{
    height:165px;
  }


  .view-count{
    margin:
      5px 7px 2px;

    font-size:10px;

    line-height:13px;
  }


  .book h2{
    margin:0;

    padding:
      0 7px 9px;

    font-size:12px;

    line-height:17px;
  }

}