* {
  box-sizing: border-box;
}

#loading-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  overflow: hidden;
  background: #172b1d;
  color: #fff7d1;
  transition:
    opacity 0.45s ease,
    visibility 0.45s ease;
}

.page-loaded #loading-screen {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#star-trail {
  position: fixed;
  inset: 0;
  z-index: 250;
  pointer-events: none;
  overflow: hidden;
}

.cursor-star {
  position: fixed;
  display: block;
  color: #d6a43c;
  font-size: 1.1rem;
  line-height: 1;
  text-shadow: 0 0 8px rgba(214, 164, 60, 0.75);
  pointer-events: none;
  animation: star-follow 0.9s ease-out forwards;
}

@keyframes star-follow {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.35) rotate(0deg);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotate(25deg);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, calc(-50% - 28px)) scale(0.2) rotate(90deg);
  }
}

.loading-photo {
  position: relative;
  width: min(78vw, 760px);
  height: min(52vw, 430px);
  border: 6px solid rgba(255, 247, 209, 0.85);
  border-radius: 18px;
  background:
    linear-gradient(rgba(20, 37, 25, 0.18), rgba(20, 37, 25, 0.48)),
    url("https://images.unsplash.com/photo-1566577739112-5180d4bf9390?auto=format&fit=crop&w=1200&q=85")
      center / cover;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  animation: loader-entrance 0.8s ease-out both;
}

.loader-title {
  font-size: 0.9rem;
  font-weight: 900;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  animation: loader-title-pulse 1.2s ease-in-out infinite alternate;
}

.loader-bar {
  width: 180px;
  height: 7px;
  overflow: hidden;
  border: 2px solid #7a5e20;
  background: rgba(255, 247, 209, 0.35);
}

.loader-bar span {
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: left;
  background: #d6a43c;
  animation: banana-progress 3s linear forwards;
}

@keyframes player-left-hit {
  0%,
  18% {
    transform: translateX(-18px) rotate(-8deg);
  }
  45%,
  62% {
    transform: translateX(38px) rotate(10deg);
  }
  82%,
  100% {
    transform: translateX(-18px) rotate(-8deg);
  }
}

@keyframes player-right-hit {
  0%,
  18% {
    transform: translateX(18px) rotate(8deg);
  }
  45%,
  62% {
    transform: translateX(-38px) rotate(-10deg);
  }
  82%,
  100% {
    transform: translateX(18px) rotate(8deg);
  }
}

@keyframes impact-flash {
  0%,
  38%,
  70%,
  100% {
    opacity: 0;
    transform: scale(0.6);
  }
  48%,
  58% {
    opacity: 1;
    transform: scale(1.2);
  }
}

@keyframes loader-entrance {
  from {
    transform: scale(0.65) translateY(24px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

@keyframes loader-title-pulse {
  from {
    opacity: 0.55;
  }
  to {
    opacity: 1;
  }
}

@keyframes banana-progress {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

body {
  margin: 0;
  background-color: #f4e6b8;
  background-image:
    radial-gradient(
      circle at 15% 10%,
      rgba(255, 255, 255, 0.7),
      transparent 32%
    ),
    linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(214, 178, 67, 0.2));
  color: #222;
  font-family: "Helvetica Neue", Arial, sans-serif;
}

#all-contents {
  max-width: 1500px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 32px 40px;
}
main {
  display: grid;
  grid-template-columns: minmax(280px, 1.2fr) minmax(420px, 1fr);
  align-items: center;
  min-height: calc(100vh - 160px);
  gap: clamp(32px, 5vw, 80px);
}

.sidebar {
  width: 100%;
}

.content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}
h2 {
  margin: 0;
  font-size: clamp(4rem, 10vw, 7rem);
  line-height: 0.9;
  font-weight: 900;
  letter-spacing: -0.04em;
  text-transform: uppercase;
  color: #020202;
}

.content > p {
  margin: 0;
  color: #7a5e20;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  line-height: 1.4;
}
h2 {
  color: #7a5e20; /* bright accent */
}

.content p {
  color: #7a5e20;
}

.image-upload-box {
  width: 100%;
  max-width: 560px;
  margin-top: 24px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.92);
  border: 2px solid #7a5e20;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.image-upload-box h3 {
  margin: 0 0 12px;
  color: #7a5e20;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.image-upload-box label {
  display: block;
  margin-bottom: 8px;
  color: #555;
  font-size: 0.85rem;
  font-weight: 700;
}

.image-upload-controls {
  display: flex;
  gap: 8px;
}

#image-url {
  min-width: 0;
  flex: 1;
  padding: 11px 12px;
  border: 1px solid #c8b86a;
  border-radius: 8px;
  font: inherit;
}

#load-image {
  padding: 11px 16px;
  border: 0;
  border-radius: 8px;
  background: #7a5e20;
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

#load-image:hover {
  background: #a57721;
}

.image-error {
  min-height: 1.2em;
  margin: 8px 0 0;
  color: #a12645;
  font-size: 0.85rem;
}

#preview-image {
  display: block;
  width: 100%;
  max-height: 360px;
  margin-top: 8px;
  object-fit: contain;
  border-radius: 8px;
}

#preview-image[hidden] {
  display: none;
}

#interests {
  margin-top: 32px;
  width: 100%;
}

#interests h3 {
  margin: 0 0 12px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: #aaa;
}

#interests ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#interests li {
  color: #555;
  font-size: 1rem;
  font-weight: 600;
  padding: 10px 20px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 100px;
  transition:
    background 0.25s ease,
    color 0.25s ease,
    transform 0.25s ease;
  cursor: default;
}

#interests li:hover {
  background: #000;
  color: #fff;
  border-color: #000;
  transform: translateY(-2px);
}
#interests h3 {
  color: #7a5e20;
}

#interests li {
  background: #ffe8ec;
  border-color: #7a5e20;
  color: #7a5e20;
}

#interests li:hover {
  background: #7a5e20;
  color: #fff;
}
.sidebar-img {
  width: 100%;
  max-width: 900px;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
  border-radius: 16px;
  filter: grayscale(0%);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  transition:
    filter 0.4s ease,
    transform 0.4s ease,
    box-shadow 0.4s ease;
}

.sidebar-img:hover {
  filter: grayscale(100%);
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
}
nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 48px;
  padding: 16px 24px;
  background: #fff;
  border: 1px solid #9e9545;
  border-radius: 12px;
}

nav h1 {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: #797701;
}

#nav-ul {
  list-style: none;
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 0;
}

.nav-li a {
  color: #666;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 8px;
  transition:
    background 0.25s ease,
    color 0.25s ease;
}

.nav-li a:hover {
  background: #bda53a;
  color: #7a5e20;
}
nav {
  background: #868131;
  border-color: #1a1a2e;
}

nav h1 {
  color: #030303;
}

.nav-li a {
  color: #a8b2d8;
}

.nav-li a:hover {
  background: #a57721;
  color: #fff;
}
/* Portfolio styles */
.portfolio-main {
  align-items: start;
}

.portfolio-main > .content {
  grid-column: 1;
}

.portfolio-main > .flappy-game {
  grid-column: 2;
  grid-row: 1;
  margin: 0;
}

.content h1 {
  color: black;
}

#portfolio {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#portfolio li {
  border-radius: 12px;
  overflow: hidden;
}

#portfolio a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-decoration: none;
  color: #444;
  padding: 16px 20px;
  font-size: 1.1rem;
  font-weight: 500;
  background: rgb(168, 168, 61);
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  transition:
    background 0.25s ease,
    color 0.25s ease,
    transform 0.25s ease;
}

#portfolio a:hover {
  background: #000;
  color: #fff;
  transform: translateX(4px);
}

#portfolio a::after {
  content: "->";
  font-size: 0.85rem;
  opacity: 0.4;
  transition: opacity 0.25s ease;
  white-space: nowrap;
}

#portfolio a:hover::after {
  opacity: 1;
}

.flappy-game {
  width: 100%;
  max-width: 760px;
  margin: 24px 0 32px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid #7a5e20;
  border-radius: 14px;
  box-shadow: 0 12px 28px rgba(48, 23, 13, 0.14);
}

@media (max-width: 900px) {
  .portfolio-main {
    grid-template-columns: 1fr;
  }

  .portfolio-main > .flappy-game {
    grid-column: 1;
    grid-row: auto;
    margin-top: 24px;
  }
}

.flappy-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.flappy-heading h2 {
  margin: 0;
  color: #7a5e20;
  font-size: 1.45rem;
  line-height: 1;
  text-transform: uppercase;
}

.flappy-heading p {
  margin: 6px 0 0;
  color: #666;
  font-size: 0.85rem;
}

#flappy-score {
  min-width: 48px;
  color: #a12645;
  font-size: 2rem;
  line-height: 1;
  text-align: right;
}

#flappy-canvas {
  display: block;
  width: 100%;
  height: auto;
  border: 2px solid #7a5e20;
  border-radius: 10px;
  cursor: pointer;
  touch-action: manipulation;
}

#flappy-action {
  margin-top: 12px;
  padding: 10px 16px;
  border: 0;
  border-radius: 8px;
  background: #7a5e20;
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

#flappy-action:hover {
  background: #a57721;
}

.media-page {
  display: block;
  min-height: auto;
}

.media-page .content {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
}

.media-page h1 {
  margin: 0;
  color: #7a5e20;
  font-size: clamp(2.5rem, 8vw, 5rem);
  line-height: 1;
  text-transform: uppercase;
}

.media-page .content > p {
  margin: 0;
}

.media-section {
  width: 100%;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 2px solid rgba(255, 255, 255, 0.55);
}

.media-section h2 {
  margin: 0 0 16px;
  color: #fff;
  font-size: 1.5rem;
  letter-spacing: 0.08em;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.media-placeholder {
  display: grid;
  min-height: 180px;
  place-items: center;
  padding: 24px;
  border: 2px dashed rgba(255, 255, 255, 0.75);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-weight: 700;
  text-align: center;
}

.media-link {
  text-decoration: none;
  transition:
    background 0.25s ease,
    transform 0.25s ease;
}

.media-link:hover {
  background: rgba(255, 255, 255, 0.24);
  transform: translateY(-3px);
}

@media (max-width: 700px) {
  .media-grid {
    grid-template-columns: 1fr;
  }
}

/* Final layout polish */
body {
  min-width: 320px;
  color: #302316;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  line-height: 1.5;
}

#all-contents {
  width: min(100% - 32px, 1420px);
  padding: 24px 0 48px;
}

nav {
  position: sticky;
  top: 16px;
  z-index: 10;
  margin-bottom: 40px;
  padding: 14px 18px;
  background: rgba(48, 35, 22, 0.94);
  border: 1px solid rgba(255, 247, 209, 0.35);
  border-radius: 14px;
  box-shadow: 0 12px 28px rgba(48, 35, 22, 0.16);
  backdrop-filter: blur(12px);
}

nav h1 {
  color: #fff7d1;
  font-size: 0.82rem;
  letter-spacing: 0.16em;
}

#nav-ul {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-li a {
  display: block;
  color: #f4e6b8;
  border-radius: 7px;
}

.nav-li a:hover,
.nav-li a:focus-visible {
  background: #d6a43c;
  color: #302316;
  outline: none;
}

main:not(.media-page) {
  min-height: calc(100vh - 150px);
}

.content h1 {
  margin: 0;
  color: #302316;
  font-size: clamp(2.8rem, 7vw, 5.5rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
  text-transform: uppercase;
}

.content > h3 {
  margin: 0;
  color: #7a5e20;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.image-upload-box,
.flappy-game {
  border-color: rgba(122, 94, 32, 0.6);
  box-shadow: 0 16px 34px rgba(48, 35, 22, 0.14);
}

#portfolio a {
  background: rgba(255, 255, 255, 0.75);
  border-color: rgba(122, 94, 32, 0.24);
  color: #302316;
}

#portfolio a:hover,
#portfolio a:focus-visible {
  background: #302316;
  color: #fff7d1;
  border-color: #302316;
  outline: none;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(161, 38, 69, 0.55);
  outline-offset: 3px;
}

@media (max-width: 900px) {
  main:not(.media-page) {
    min-height: auto;
  }
}

@media (max-width: 640px) {
  #all-contents {
    width: min(100% - 20px, 560px);
    padding-top: 10px;
  }

  nav {
    position: static;
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 28px;
  }

  #nav-ul {
    justify-content: flex-start;
    width: 100%;
  }

  .home-main,
  .portfolio-main {
    gap: 28px;
  }

  .image-upload-controls {
    flex-direction: column;
  }

  #load-image,
  #flappy-action {
    width: 100%;
  }

  .loading-photo {
    width: min(90vw, 560px);
    height: min(60vw, 340px);
  }
}
