html {
  scroll-behavior: smooth;
  scroll-snap-type: y proximity;
}

body {
  margin: 0;
  font-family: monospace;
  color: #fff;
  background: #000;
}

/* ========== SCROLLBAR (arcade style - desktop only) ========== */
@media (min-width: 769px) {
  html {
    scrollbar-width: auto;
    scrollbar-color: #3fa9f5 #000;
  }
  ::-webkit-scrollbar {
    width: 20px;
    height: 20px;
  }
  ::-webkit-scrollbar-track {
    background: #000;
    border-left: 4px double #3fa9f5;
  }
  ::-webkit-scrollbar-thumb {
    background: #000;
    border: 4px double #3fa9f5;
    border-radius: 0;
  }
  ::-webkit-scrollbar-thumb:hover {
    border-color: #6ac0ff;
  }
  ::-webkit-scrollbar-corner {
    background: #000;
  }
}

@media (max-width: 768px) {
  html {
    scrollbar-width: none;
  }
  ::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
  }
}

/* ========== HEADINGS (unified across pages) ========== */
h1, h2, h3 {
  font-size: 26px;
}

/* ========== NAVIGATION ========== */
nav {
  position: fixed;
  top: 0;
  width: 100%;
  background: #000c;
  border-bottom: 3px solid #3fa9f5;
  padding: 12px 0;
  text-align: center;
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* CRT scanlines over the nav bar */
nav::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent 0 2px, rgba(0, 0, 0, 0.3) 2px 4px);
}

/* Hamburger icon (only visible on mobile for index) */
.hamburger {
  display: none;
  flex-direction: column;
  cursor: pointer;
  gap: 5px;
  position: absolute;
  left: 20px;
  z-index: 1;
}

.hamburger span {
  width: 30px;
  height: 3px;
  background: #3fa9f5;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.5);
}

/* Current page indicator (only visible on mobile for index) */
.current-page {
  display: none;
  color: #f5d76e;
  font-size: 18px;
  letter-spacing: 2px;
  text-shadow: 2px 2px 0 #7a6a2e;
}

/* Navigation menu container */
.nav-menu {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* All navigation links - arcade buttons */
nav a {
  color: #f5d76e;
  margin: 0 6px;
  text-decoration: none;
  font-size: 17px;
  letter-spacing: 2px;
  padding: 9px 16px;
  display: inline-block;
  border: 2px solid #f5d76e;
  background: #111;
  box-shadow: 0 4px 0 #7a6a2e;
  transition: transform 0.1s, box-shadow 0.1s, background 0.15s, color 0.15s;
}

/* Pressed in on hover */
nav a:hover {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #7a6a2e;
  background: #f5d76e;
  color: #000;
}

/* Selected menu option */
nav a.active {
  background: #f5d76e;
  color: #000;
  box-shadow: 0 4px 0 #7a6a2e, inset 0 0 14px rgba(255, 255, 255, 0.35);
}

/* Blinking game cursor on the active item */
nav a.active::before {
  content: '▶';
  margin-right: 8px;
  animation: blinkCursor 1s steps(1) infinite;
}

@keyframes blinkCursor {
  50% { opacity: 0; }
}

/* ========== SECTIONS ========== */
.section {
  min-height: 100vh;
  padding-top: 90px;
  display: flex;
  justify-content: center;
  align-items: center;
  background-size: cover;
  background-position: center;
  position: relative;
  overflow: hidden;
  scroll-snap-align: start;
}

#portfolio {
  padding-top: 70px;
  padding-bottom: 40px;
  overflow: visible;
  align-items: flex-start;
}

/* Parallax desktop only */
.bg-home, .bg-portfolio, .bg-skills, .bg-contact {
  background-attachment: fixed;
}

.bg-home { background-image: url('img/0_1B.jpg'); }
.bg-portfolio { background-image: url('img/0_22.jpg'); }
.bg-skills { background-image: url('img/0_0.jpg'); }
.bg-contact { background-image: url('img/0_3.jpg'); }

/* ========== CLOUDS ========== */
.cloud {
  position: absolute;
  width: clamp(260px, 45vw, 520px);
  image-rendering: pixelated;
  pointer-events: none;
  z-index: 1;
}

.cloud-1 {
  top: 10%;
  transform: translateX(-140%);
  animation: cloudSlow 140s linear infinite;
}

.cloud-2 {
  top: 20%;
  transform: translateX(-60%);
  animation: cloudFast 70s linear infinite;
}

@keyframes cloudSlow {
  from { transform: translateX(-140%); }
  to   { transform: translateX(120%); }
}

@keyframes cloudFast {
  from { transform: translateX(-60%); }
  to   { transform: translateX(120%); }
}

/* ========== PANELS ========== */
.panel {
  background: #000a;
  border: 4px solid #3fa9f5;
  padding: 30px;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
  z-index: 2;
}

/* ========== PAC-MAN RUNNER ========== */
#homePanel {
  position: relative;
}

.pacman {
  position: absolute;
  top: 0;
  left: 0;
  width: 36px;
  height: 36px;
  z-index: 6;
  pointer-events: none;
  will-change: transform;
  filter: drop-shadow(0 0 3px rgba(0,0,0,.6));
}

.pacman svg {
  width: 100%;
  height: 100%;
  display: block;
}

.coin {
  position: absolute;
  top: 0;
  left: 0;
  width: 20px;
  height: 20px;
  z-index: 5;
  pointer-events: none;
  filter: drop-shadow(0 0 4px rgba(255,217,63,.7));
}

.coin svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* ========== TITLE ROW (detail pages) ========== */
.title-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.title-row h1 {
  margin: 0;
}

.gp-badge {
  height: 48px;
  width: auto;
  object-fit: contain;
}

.project .gp-badge {
  height: 48px;
  width: auto;
  object-fit: contain;
}

/* ========== PROJECT LAYOUT (detail pages) ========== */
.project-layout {
  display: flex;
  gap: 40px;
  margin-top: 32px;
  align-items: flex-start;
}

.project-info {
  flex: 1;
  min-width: 0;
}

.project-text {
  max-width: 520px;
  margin-top: 16px;
}

/* ========== ROCKET (COSMIC MUSHROOMS) ========== */
.rocket-panel {
  position: relative;
}

.rocket {
  position: absolute;
  top: 0;
  left: 0;
  z-index: -1;
  pointer-events: none;
  will-change: transform;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.35));
}

.project-images {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.project-images img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
  cursor: pointer;
}

/* ========== PROJECTS (index portfolio section) ========== */
.tabs {
  display: flex;
  gap: 6px;
  margin-top: 20px;
  border-bottom: 3px solid #3fa9f5;
}

.tab {
  padding: 10px 22px;
  font-size: 16px;
  font-family: inherit;
  letter-spacing: 1px;
  color: #3fa9f5;
  background: transparent;
  border: 2px solid #3fa9f5;
  border-bottom: none;
  cursor: pointer;
  touch-action: manipulation;
  min-height: 42px;
  white-space: nowrap;
  box-sizing: border-box;
}

.tab:hover {
  background: rgba(63, 169, 245, 0.15);
}

.tab.active {
  background: #3fa9f5;
  color: #000;
}

.tab-content {
  margin-top: 20px;
}

.tab-wrapper {
  display: grid;
  margin-top: 20px;
}

.tab-wrapper > .tab-content {
  grid-row: 1;
  grid-column: 1;
  margin-top: 0;
}

.tab-wrapper > .tab-content[hidden] {
  display: none !important;
}

.tab-content .project {
  margin-top: 0;
}

#tab-apps .project + .project {
  margin-top: 32px;
  padding-top: 28px;
  border-top: 2px solid rgba(63,169,245,0.35);
}

#tab-games .project + .project {
  margin-top: 20px;
}

.tab-content .project:last-child {
  margin-bottom: 0;
}

.project {
  display: flex;
  gap: 20px;
  margin-top: 20px;
  align-items: center;
}

.project.align-top {
  align-items: flex-start;
}

.project img:not(.gp-badge) {
  width: 200px;
  height: 150px;
  object-fit: cover;
  border-radius: 6px;
}

.project img.uncropped:not(.gp-badge) {
  width: 200px;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
}

/* ========== CAROUSEL (VerbaCards - 3 screenshots) ========== */
.carousel {
  position: relative;
  width: 200px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.carousel-viewport {
  position: relative;
  width: 200px;
  overflow: hidden;
  border: none;
  background: transparent;
  touch-action: pan-y;
  border-radius: 6px;
}

.carousel-track {
  display: flex;
  transition: transform 0.35s ease;
  will-change: transform;
}

.carousel-slide {
  min-width: 200px;
  width: 200px;
  height: auto;
  display: block;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 6px;
}

.carousel-slide.uncropped {
  width: 200px;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
}

.carousel-slide[data-lightbox],
.project img[data-lightbox] {
  cursor: pointer;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: 2px solid #f5d76e;
  background: #111;
  color: #f5d76e;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 0 #7a6a2e;
  z-index: 2;
  transition: transform 0.1s, box-shadow 0.1s, background 0.15s, color 0.15s;
  padding: 0;
}

.carousel-btn:hover {
  background: #f5d76e;
  color: #000;
}

.carousel-btn:active {
  transform: translateY(-50%) translateY(2px);
  box-shadow: 0 1px 0 #7a6a2e;
}

.carousel-btn.prev { left: -14px; }
.carousel-btn.next { right: -14px; }

.carousel-dots {
  position: absolute;
  left: 50%;
  bottom: 6px;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  justify-content: center;
  background: rgba(0,0,0,0.55);
  padding: 4px 6px;
  border-radius: 2px;
  z-index: 2;
}

.carousel-dots .dot {
  width: 10px;
  height: 10px;
  border: 2px solid #3fa9f5;
  background: transparent;
  cursor: pointer;
  padding: 0;
  box-sizing: border-box;
  transition: background 0.2s;
}

.carousel-dots .dot.active {
  background: #3fa9f5;
  box-shadow: 0 0 6px rgba(63,169,245,0.7);
}

.project a {
  display: inline-block;
  margin-top: 10px;
  padding: 12px 20px;
  font-size: 18px;
  color: #f5d76e;
  border: 2px solid #f5d76e;
  text-decoration: none;
}

.project a:hover {
  background: #f5d76e;
  color: #000;
}

/* ========== CONTACT ========== */
.contact-layout {
  display: flex;
  gap: 20px;
  align-items: center;
}

.contact-layout img {
  max-width: 100%;
  height: auto;
  display: block;
}

.linkedin-link {
  display: block;
  margin: 16px 0;
}

.linkedin-icon {
  width: 67px;
  height: auto;
  max-width: none;
  display: block;
}

/* ========== BOMBERMAN (SKILLS) ========== */
.bomber-panel {
  position: relative;
}

#bomberCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  image-rendering: pixelated;
}

/* ========== GAME LAYERS (SNAKE/TETRIS) ========== */
.snake-panel,
.tetris-panel {
  position: relative;
}

#snakeCanvas,
#tetrisCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  image-rendering: pixelated;
}

/* ========== LIGHTBOX ========== */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.lightbox.active {
  display: flex;
}

.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 6px;
}

#lightboxVideo {
  display: none;
  aspect-ratio: 16 / 9;
  width: min(90vw, calc(90vh * 16 / 9));
  max-width: 960px;
  border: none;
  border-radius: 6px;
}

#lightboxVideo.active {
  display: block;
}

.video-thumb {
  position: relative;
  width: 100%;
  height: auto;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
}

.video-thumb img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 0;
}

.video-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 0;
  height: 0;
  border-left: 26px solid #fff;
  border-top: 17px solid transparent;
  border-bottom: 17px solid transparent;
  filter: drop-shadow(0 0 8px rgba(0, 0, 0, 0.85));
  opacity: 0.95;
  transition: opacity 0.2s;
}

.video-thumb:hover .video-play {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.1);
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  font-size: 32px;
  color: #fff;
  cursor: pointer;
  line-height: 1;
}

/* ========== GAME MODAL (portfolio games) ========== */
.game-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
  box-sizing: border-box;
}

.game-modal.active {
  display: flex;
}

.game-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(2px);
}

.game-modal-panel {
  position: relative;
  background: rgba(0,0,0,0.75);
  border: 4px solid #3fa9f5;
  padding: 30px;
  max-width: 1080px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-sizing: border-box;
  z-index: 1;
  box-shadow: 0 0 20px rgba(63,169,245,0.4);
}

.game-modal-close {
  position: absolute;
  top: 10px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: 2px solid #f5d76e;
  background: #111;
  color: #f5d76e;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 0 #7a6a2e;
  z-index: 2;
}

.game-modal-close:hover {
  background: #f5d76e;
  color: #000;
}

/* ========== DETAIL PAGES (not index) ========== */
/* Hide hamburger and current-page on detail pages */
body:not(:has(#home)) .hamburger {
  display: none;
}

body:not(:has(#home)) .current-page {
  display: none;
}

/* ========== MOBILE ========== */
@media (max-width: 768px) {
  /* Headings smaller on mobile, but same across all pages */
  h1, h2, h3 {
    font-size: 22px;
  }

  /* Panel spacing on mobile - zmenseno aby se vesly loga vedle sebe vetsi */
  .section {
    padding-left: 12px;
    padding-right: 12px;
  }

  #portfolio {
    min-height: 100vh;
    padding-top: 70px;
    padding-bottom: 200px;
  }

  .panel {
    padding: 14px;
    margin: 0;
    max-width: 100%;
  }

  /* Projects layout */
  .project {
    flex-direction: column;
    text-align: center;
    margin-bottom: 24px;
  }

  .project.align-top {
    align-items: center;
  }

  .tabs {
    gap: 4px;
  }

  .tab {
    padding: 10px 16px;
    font-size: 14px;
    min-height: 40px;
  }

  .contact-layout {
    flex-direction: column;
    text-align: center;
  }

  .cloud {
    width: clamp(220px, 70vw, 420px);
  }

  .project-layout {
    flex-direction: column;
    align-items: flex-start;
  }

  .project-info {
    order: 1;
  }

  .project-images {
    order: 2;
  }

  .project-text {
    max-width: none;
  }

  /* MOBILE NAVIGATION - INDEX ONLY */
  nav {
    height: 62px;
    padding: 0;
  }

  body:has(#home) .hamburger {
    display: flex;
  }

  /* Page name styled like the arcade buttons */
  body:has(#home) .current-page {
    display: block;
    border: 2px solid #f5d76e;
    background: #111;
    color: #f5d76e;
    box-shadow: 0 4px 0 #7a6a2e;
    font-size: 24px;
    letter-spacing: 2px;
    padding: 10px 16px;
    transition: opacity 0.3s;
  }

  /* Hide current page when menu is active */
  body:has(#home) .nav-menu.active ~ .current-page {
    opacity: 0;
    pointer-events: none;
  }

  body:has(#home) .nav-menu {
    position: fixed;
    left: -100%;
    top: 62px;
    flex-direction: column;
    background: #000c;
    width: 100%;
    text-align: center;
    transition: 0.3s;
    padding: 20px 0;
  }

  body:has(#home) .nav-menu.active {
    left: 0;
  }

  /* Uniform button width in the dropdown */
  body:has(#home) nav a {
    display: block;
    width: min(320px, 80%);
    margin: 8px auto;
    font-size: 24px;
    padding: 12px 20px;
    box-sizing: border-box;
  }

  .title-row {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  .title-row > div {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: center;
    width: 100%;
    max-width: 100%;
    justify-content: flex-start;
    box-sizing: border-box;
  }
  .gp-badge,
  .project .gp-badge {
    flex: 0 1 auto;
    height: 46px;
    width: auto;
    max-width: 170px;
    max-height: 46px;
    min-width: 0;
    object-fit: contain;
  }
  /* duo badges (Cosmic Mushrooms) - ruzny pomer stran 3.61 vs 2.68, nutny proporcionalni flex aby Google nebyl orizly na 50% */
  .title-row > div > a {
    flex: 1.35 1 0;
    min-width: 0;
    display: flex;
    align-items: center;
  }
  .title-row > div > a .gp-badge {
    flex: 1 1 auto;
    width: 100%;
    height: 46px;
    max-width: none;
    max-height: 46px;
  }
  .title-row > div > .gp-badge {
    flex: 1 1 0;
    width: 0;
    height: 46px;
    max-width: none;
    max-height: 46px;
  }
}
