:root {
  --accent-yellow: #F9FF08;
  --header-height: 60px;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-family: Arial, sans-serif;
  background: var(--accent-yellow);
  color: #222;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

main {
  background-color: white;
  min-height: 100dvh; /* Use dynamic viewport height instead of vh */
  width: 100vw;
  display: flex;
  align-items: center;
  justify-content: center;
  /* padding-top: 20px; /* Add padding for header instead of margin */
  box-sizing: border-box; /* Include padding in height calculation */
  margin: 0; /* Remove any margin */
  flex: 1 0 auto;
  /* align-items: flex-start; */
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  min-height: 0;
  padding-top: 20px;
  padding-bottom: 80px; /* Remove later */
}

header {
  background: var(--accent-yellow);
  height: var(--header-height);
  min-height: var(--header-height);
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  padding: 0 0 0px 0;
  flex-shrink: 0;
  display: flex;
  align-items: center; /* Vertically center nav inside header */
}

nav {
  display: flex;
  align-items: center; /* Vertically center nav contents */
  justify-content: space-between;
  width: 100%;
  padding: 16px 32px;
  box-sizing: border-box;
}

nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0px; /* space between top-icons and hamburger */
}

.title-icon-text {
  display: flex;
  align-items: center; /* Align items vertically in the center */
}

.icon-ace-img {
  display: flex; /* Ensure the <a> tag is a flex container */
  align-items: center;
}

.icon-ace {
  width: auto; /* Adjust as necessary */
  height: 50px; /* Adjust as necessary */
  vertical-align: middle;
}

.title-text {
  text-align: left;
  font-family: "Anton", sans-serif;
  font-weight: 400;
  font-style: normal;
  text-transform: uppercase;
  color: #ffffff;
  font-size: 1.4em;
  padding-left: 5px;
  -webkit-text-stroke: 1.3px black;
}

.top-icons {
display: flex;
  align-items: center;
  gap: 10px;
  margin-right: 10px;
  display: none;
}

.top-icons img{
  width: auto;
  height: 20px;
  cursor: pointer;
  
}

hr {
  border: 0.1px solid rgba(0, 0, 0, 0.1);
}

  /* Start of Slide Puzzle Styles */

:root{ --size: 320px; --gap: 6px; --tile-size: calc((var(--size) - var(--gap)*3)/4); }

/* Remove the duplicate body styles that conflict */
wrap{ 
  width: var(--size); 
  background-color: white;
  padding: 20px;
  margin: 0; /* Remove any default margins */
}

/* Update responsive breakpoint */
@media (max-width: 420px) { 
  :root { --size: 85vw; } /* Changed from 92vw to 85vw for more margin */
  h1 { font-size: 14px; }
  
  header {
    height: 60px; /* Slightly taller header on mobile */
  }
  
  
  
  body {
    height: 100dvh; /* Use dynamic viewport height on mobile */
  }
}

h1{ 
  font-size: 16px; 
  text-align: center; 
  margin: 0 0 12px 0;
  color: #333; /* Dark text for white background */
}

  .meta{ 
    display:flex; 
    justify-content:center; 
    align-items:stretch; /* Changed from center to stretch to make all items same height */
    margin-bottom:10px; 
    gap:8px;
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
  }
  
  .meta .stat{ 
    font-size:13px; 
    background:#8d99ae; 
    padding:6px 10px; 
    border-radius:8px; 
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  
  /* Style the preview button in the meta section */
  .meta button{ 
    background:#0b84ff; 
    color:white; 
    border:0; 
    padding:6px 10px; /* Match the stat padding */
    border-radius:8px; 
    cursor:pointer; 
    font-weight:600;
    font-size:13px; /* Match the stat font size */
    display: flex;
    align-items: center;
    justify-content: center;
    /* Remove height: fit-content to allow stretching */
  }

 .tile{
  position:relative; 
  user-select:none; 
  cursor:pointer; 
  display:flex; 
  align-items:center; 
  justify-content:center; 
  font-weight:700; 
  font-size:18px; 
  border-radius:8px; 
  overflow:hidden; 
  transform:translateZ(0);
  transition: transform 260ms cubic-bezier(.2,.9,.3,1), box-shadow 220ms ease, opacity 200ms ease;
  box-shadow:0 6px 16px rgba(2,6,23,0.6);
  background:#0c1626;
  
  /* Prevent context menu and long-press behaviors */
  -webkit-touch-callout: none; /* iOS Safari */
  -webkit-user-select: none; /* Safari */
  -khtml-user-select: none; /* Konqueror HTML */
  -moz-user-select: none; /* Firefox */
  -ms-user-select: none; /* Internet Explorer/Edge */
  touch-action: manipulation; /* Prevent zoom and other touch behaviors */
  -webkit-tap-highlight-color: transparent; /* Remove tap highlight */
}

.tile img{ 
  position:absolute; 
  inset:0; 
  width:400%; 
  height:400%; 
  object-fit:none; 
  transform-origin:top left;
  
  /* Prevent context menu on images */
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  pointer-events: none; /* Images don't need to be interactive */
}

/* Prevent context menu on the entire board */
.board {
  width:var(--size); 
  height:var(--size); 
  display:grid; 
  grid-template-columns:repeat(4,1fr); 
  grid-template-rows:repeat(4,1fr); 
  gap:var(--gap); 
  background:#0b1220; 
  padding:var(--gap); 
  border-radius:10px; 
  box-shadow:0 6px 30px rgba(0,0,0,0.6);
  
  /* Prevent context menu */
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
        .tile.blank{ background:linear-gradient(180deg,#071021,#071425); cursor:default; box-shadow:none; }
    .notice{ margin-top:10px; font-size:13px; opacity:0.9 }

    /* Modal */
    .modal-backdrop{ position:fixed; inset:0; background:rgba(3,6,12,0.6); display:flex; align-items:center; justify-content:center; z-index:100; }
    .modal{ background:#082031; padding:18px; border-radius:12px; width:min(420px,90%); color:#e6f0ff; box-shadow:0 8px 40px rgba(0,0,0,0.6); }
    .modal h2{ margin-top:0 }

    /* small responsive */
   /* Also update the small responsive section to match */
@media (max-width:420px){ 
  :root{ --size: 85vw; } /* Changed from 92vw to 85vw */
  h1{ font-size:14px } 
}

    /* Add these styles for the modal */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100dvh; /* Use dynamic viewport height */
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  box-sizing: border-box;
}

.modal {
  background: white;
  border-radius: 12px;
  padding: 20px;
  max-width: 90vw;
  max-height: 90dvh; /* Use dynamic viewport height */
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}
  
  .modal h2 {
    margin: 0 0 15px 0;
    font-size: 18px;
    text-align: center;
    color: #333;
  }
  
  .modal #modalBody {
    margin-bottom: 15px;
    text-align: center;
  }
  


  .modal button {
    background: #0b84ff;
    color: white;
    border: 0;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
  }

  .modal p {
  color: #333; /* Change this for paragraph text in modal */
}
  
  .modal button:hover {
    background: #0066cc;
  }
  
  /* Responsive adjustments */
  @media (max-width: 480px) {
    .modal {
      padding: 15px;
      margin: 10px;
    }
    
    .modal #modalBody img {
      max-width: 100%;
    }
  }

     /* Add these styles to your styles.css */
    .board.completed .tile {
      cursor: default !important;
      pointer-events: none !important;
    }
    
    .board.completed .tile:hover {
      transform: none !important;
      box-shadow: 0 6px 16px rgba(2,6,23,0.6) !important;
    }

/* Hamburger styles */
.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  cursor: pointer;
  margin-left: auto;
  margin-right: 0;
}
.hamburger span {
  display: block;
  height: 2px;
  width: 18px;
  background: #222;
  border-radius: 2px;
  transition: all 0.3s;
}

/* Side menu styles */
.side-menu {
  position: fixed;
  top: 0;
  right: -320px;
  width: 280px;
  height: 100%;
  background: #fff;
  box-shadow: -2px 0 16px rgba(0,0,0,0.08);
  transition: right 0.3s;
  z-index: 1000;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.side-menu.open {
  right: 0;
}
.side-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0px 24px 0px 24px;
  font-family: 'Anton', Arial, sans-serif;
  font-size: 1.2em;
  border-bottom: 1px solid #eee;
  height: 60px;
}

.side-menu ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.side-menu li {
  margin: 0;
  padding: 12px 24px;
  width: 100%;
  box-sizing: border-box;
  border-radius: 0;
  transition: background 0.2s;
}

.side-menu li:hover {
  background-color: #8d99ae;
}

.side-menu a {
  text-decoration: none;
  color: #222;
  font-size: 1.1em;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}
.side-menu a:hover {
  color: #222; /* Keep link text black on hover */
}

#closeMenu {
  background: none;
  border: none;
  font-size: 2em;
  cursor: pointer;
  color: #222;
  line-height: 1;
  padding: 0;
}

/* Responsive: hide hamburger on wide screens if desired */
@media (max-width: 900px) {
  .hamburger {
    display: flex;
  }
}
@media (min-width: 901px) {
  .hamburger {
    display: flex;
  }
}