body {
  background-color: #a2d5d5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100vw;
  height: 100vh;
}

#all {
  display: flex;
  flex-direction: row;
  gap: 16px;
}

#right {
  width: 230px;
  height: 545px;
}

#leftbox {
  background-color: #ffbfce;
  border-radius: 10px;
  height: 525px;
  padding: 10px;
}

#leftcontent {
  height: 525px;
  background-color: #fff;
  border-radius: 10px;
  box-shadow: 0px 0px 5px #d48aa8;
}

#contentbox {
  /* width: 345px; */
  height: 385px;
  padding: 10px;
}

#content {
  /* width: 1000px; */
  height: 355px;
  border-radius: 10px;
  border: 2px solid #ffbfce;
  color: #425757;
  font-size: 18px;
  text-align: left;
  padding: 15px;
  overflow: scroll;
  overflow-x: hidden;
}

#content h1 {
  margin: 0px;
  border-bottom: 2px dotted #7ecca1;
  color: #ffbfce;
  text-align: left;
  font-weight: normal;
  font-size: 26px;
}

#imgbox {
  padding: 10px;
}

#img {
  width: 345px;
  height: 100px;
  border-radius: 10px;
  background-image: url("https://i.imgur.com/As3Tqh2.png"); /*345x100*/
  background-size: 100%;
}

#righttop {
  width: 198px;
  height: 160px;
  border: 6px solid #ffbfce;
  border-radius: 10px;
  margin-bottom: 10px;
  background-color: #fff;
  padding: 10px;
}

#righttopimg {
  width: 198px;
  height: 160px;
  background-color: #a2d5d5;
  border-radius: 5px;
  background-image: url("https://i.imgur.com/yoquBAL.png"); /*198x160*/
  background-size: 100% 100%;
}

#rightmiddle {
  width: 198px;
  height: 90px;
  border: 6px solid #ffbfce;
  border-radius: 10px;
  background-color: #fff;
  padding: 10px;
  margin-bottom: 10px;
  font-size: 16px;
  letter-spacing: 1px;
}

#nav {
  padding-top: 2px;
}

#nav a:hover {
  color: #67947b;
}

.link1 {
  background-color: #7ecca1;
  padding: 1px 1px 1px 1px;
  display: inline-block;
  margin-bottom: 2px;
  width: 95px;
  text-align: center;
  color: #fff;
  float: left;
}

.link2 {
  background-color: #7ecca1;
  padding: 1px 1px 1px 1px;
  display: inline-block;
  margin-bottom: 2px;
  width: 95px;
  text-align: center;
  color: #fff;
  float: right;
}

#rightbottom {
  width: 198px;
  height: 178px;
  border: 6px solid #ffbfce;
  border-radius: 10px;
  background-color: #fff;
  padding: 10px;
  color: #425757;
  font-size: 14px;
  text-align: justify;
  overflow: scroll;
  overflow-x: hidden;
}

#rightbottom h1 {
  margin: 0px;
  border-bottom: 2px dotted #7ecca1;
  color: #ffbfce;
  text-align: right;
  font-weight: normal;
  font-size: 26px;
}

a {
  color: #7ecca1;
  text-decoration: none;
}

a:hover {
  color: #a2d5d5;
}

::-webkit-scrollbar {
  width: 7px;
}

::-webkit-scrollbar-track {
  background-color: transparent;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background-color: #a2d5d5;
  border-radius: 10px;
}

#credit {
  font-size: 13px;
  position: fixed;
  bottom: 0;
  right: 0;
}

#credit a {
  color: #e7f0f0;
}

#credit a:hover {
  color: #e7f0f0;
}

article {
  width: 1000px;
}

#base-content {
  width: 305px;
}

/* --- responsive fixes --- */
*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  /* let the page scroll; avoid 100vh trap on mobile */
  min-height: 100dvh;
  width: 100%;
  /* optional: center the whole layout and give it breathing room */
  display: block;
  background-color: #a2d5d5;
  padding: 16px;
}

/* Use a responsive grid for main + sidebar */
#all {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px; /* content grows, sidebar fixed */
  gap: 16px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  align-items: start;
}

/* Let boxes size themselves by content (no fixed heights) */
#leftbox,
#leftcontent,
#contentbox,
#content,
#right,
#righttop,
#rightmiddle,
#rightbottom {
  height: auto;
  max-width: 100%;
}

/* Make the main article nicely fluid */
article {
  width: 100%;
  max-width: clamp(320px, 90vw, 70ch); /* 70ch ≈ comfy reading line-length */
}

/* Let content flow; avoid inner scrollbars cutting text off */
#content {
  overflow: visible;        /* was scroll */
  border-radius: 10px;
  border: 2px solid #ffbfce;
  color: #425757;
  font-size: 18px;
  text-align: left;
  padding: 15px;
  /* break long words/URLs on small screens */
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Make images scale down on narrow viewports */
img, #righttop img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Sidebar blocks should expand to container width */
#right { width: 100%; }
#righttop, #rightmiddle, #rightbottom {
  width: 100%;
}

/* Optional: make nav links full-width rows on mobile & desktop */
#nav a {
  display: inline-block;
}
.link1, .link2 {
  width: 100%;
  float: none;
}

/* --- mobile layout: stack sidebar under content --- */
@media (max-width: 900px) {
  #all {
    grid-template-columns: 1fr;        /* single column */
  }
  /* ensure main column appears first, then sidebar */
  #leftbox { order: 1; }
  #right   { order: 2; }

  /* remove any leftover fixed heights & add spacing */
  #righttop, #rightmiddle, #rightbottom {
    margin-bottom: 12px;
  }
}

/* (Nice to have) reduce giant paddings/heights that were fixed earlier */
#leftbox { padding: 10px; background-color: #ffbfce; border-radius: 10px; }
#leftcontent { background-color: #fff; border-radius: 10px; box-shadow: 0 0 5px #d48aa8; }
#content h1 {
  margin: 0 0 10px 0;
  border-bottom: 2px dotted #7ecca1;
  color: #ffbfce;
  font-weight: normal;
  font-size: 26px;
}

/* Keep your custom scrollbar if you like; no change needed */