/* Base */
body {
  background: #f5f5f5 url();
  font-family: "Pixelify Sans", Lato, Calibri, Verdana, Arial, Helvetica, sans-serif;
  font-size: 10px;
  font-weight: 400;
  text-shadow: 0px 0px 1px #bbb;
  color: #222;
  letter-spacing: 1px;
  line-height: 13px;
}

/* Desktop layout (was inline on elements) */
#header {
  position: absolute;
  top: 60px;
  left: 200px;

  text-align: left;
  color: #2F498C;
  background: #D4D0C8;
  font-size: 20px;
  letter-spacing: 2px;
  padding-left: 4px;
  border-left: 2px solid #666;
  border-right: 2px solid #aaa;
  border-bottom: 2px solid #928F88;
  border-top: 2px solid #666;
  width: 600px;
  height: 90px;
  line-height: 90px;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
}

.siteurl {
  position: absolute;
  top: 158px;
  left: 200px;

  text-align: left;
  color: #000;
  background: #D4D0C8;
  letter-spacing: 2px;
  padding-left: 4px;
  border-left: 2px solid #666;
  border-right: 2px solid #aaa;
  border-bottom: 2px solid #928F88;
  border-top: 2px solid #666;
  width: 600px;
  height: 15px;
  line-height: 15px;
}

#navigation {
  position: absolute;
  top: 180px;
  left: 200px;
  width: 608px;
  background: #DDDAD3;
}

.navi {
  float: left;
  display: block;
  font: 9px "Arial Black", Calibri, sans-serif;
  border-left: 2px solid #666;
  border-right: 2px solid #aaa;
  border-bottom: 2px solid #928F88;
  border-top: 2px solid #666;
  margin-right: 4px;
  padding: 5px;
  min-width: 80px;
  text-align: center;
  background: #D4D0C8;
  text-transform: uppercase;
}

#left {
  position: absolute;
  top: 209px;
  left: 200px;

  width: 190px;
  background: #eee url();
  margin: 0;
  padding: 0;
  border: 0px solid #666;
}

#content {
  position: absolute;
  top: 209px;
  left: 394px;

  width: 415px;
  background: #eee url();
  margin: 0;
  padding: 0;
  border: 0px solid #666;
}

.box {
  background: #D4D0C8;
  border-left: 2px solid #666;
  border-right: 2px solid #aaa;
  border-bottom: 2px solid #928F88;
  border-top: 2px solid #666;
  padding: 4px;
  margin-bottom: 4px;
}

.title {
  font: 9px "Arial Black", Calibri, sans-serif;
  text-transform: uppercase;
  color: #FFF;
  background: #E3F4E2 url(https://64.media.tumblr.com/24edcf69b43d44676493a5b517aa225e/9aa6415c11a612ea-90/s640x960/e6ee5ec70e3166f12308004fc1b3c5b742dc8e0e.pnj);
  letter-spacing: 3px;
  padding-left: 4px;
  border-bottom: 1px solid #fff;
  padding-top: 2px;
}

/* Links */
a:link,
a:visited,
a:active {
  color: #2F498C;
  text-decoration: none;
}
a:hover {
  color: #444;
}

/* Form controls */
textarea {
  font: 10px Calibri, sans-serif;
  letter-spacing: 1px;
}

/* --- Desktop centering (no HTML changes) --- */
:root {
  --page-total-width: 608px; /* navigation width (left + content + ~gap) */
  --left-width: 190px;
  --content-width: 415px; /* 190 + 415 + ~3px gap ≈ 608 */
  --half-page: calc(var(--page-total-width) / 2);
  --left-start: calc(-1 * var(--half-page));            /* -304px */
  --content-start: calc(var(--left-start) + var(--left-width) + 3px); /* ~-111px */
}

/* Center the top bars exactly */
#header,
.siteurl,
#navigation {
  left: 50% !important;
  transform: translateX(-50%);
}

/* Keep their intended widths */
#header,
.siteurl { width: 600px; }  /* as defined above */
#navigation { width: var(--page-total-width); } /* 608px */

/* Center the two columns as a pair */
#left {
  left: 50% !important;
  transform: translateX(var(--left-start)); /* -304px */
}

#content {
  left: 50% !important;
  transform: translateX(var(--content-start)); /* ~-111px */
}

/* --- Mobile overrides: stack everything and make it fluid, with content before sidebar --- */
@media (max-width: 680px) {
  /* Make the page a vertical flex stack */
  body {
    display: flex;
    flex-direction: column;
    gap: 10px; /* space between sections */
    font-size: 14px;
    line-height: 1.35;
    letter-spacing: 0.5px;
    text-shadow: none;
    padding: 12px;
    background: #f5f5f5;
  }

  /* All main sections full-width and back to normal flow */
  #header,
  .siteurl,
  #navigation,
  #left,
  #content {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0; /* spacing handled by body gap */
    position: static !important; /* override desktop absolute positioning */
    left: auto !important;
    top: auto !important;
    transform: none !important; /* undo desktop centering transforms */
  }

  /* Explicit stacking order */
  #header { order: 1; }
  .siteurl { order: 2; }
  #navigation { order: 3; }
  #content { order: 4; } /* right column first */
  #left { order: 5; }    /* sidebar after content */

  /* Header tweaks */
  #header {
    height: auto;
    line-height: 1.2;
    padding: 16px 12px;
    font-size: 22px;
    border-radius: 10px 10px 0 0;
    text-align: center;
  }

  /* URL bar */
  .siteurl {
    height: auto;
    line-height: 1.2;
    padding: 8px 12px;
  }

  /* Navigation becomes wrapping row of buttons */
  #navigation {
    padding: 6px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    background: #DDDAD3;
  }

  .navi {
    min-width: 0;
    flex: 1 1 120px;
    padding: 8px 10px;
    font: 11px "Arial Black", Calibri, sans-serif;
    text-align: center;
  }

  /* Panels */
  #left,
  #content { width: 100%; }

  .title { padding: 6px 8px; letter-spacing: 2px; }
  .box { padding: 10px; }

  /* Responsive images */
  #content img,
  .box img { max-width: 100%; height: auto; }

  /* Prevent the tiny right-aligned icons from clipping */
  .title img[align="right"] { height: 12px; }
}