:root {
  --bg: #fdf8e1;
  --panel: rgba(255, 255, 255, 0.7);
  --text: #332a1b;
  --muted: #6e5e44;
  --accent: #e11d48; /* Authentic Doodle Red */
  --accent2: #65a30d; /* Authentic Platform Green */
  --border: #4a3a2a;
  --radius: 12px;
  --shadow: 4px 4px 0px rgba(0, 0, 0, 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Patrick Hand', cursive;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  /* Graph paper grid */
  background-image: 
    linear-gradient(rgba(225, 29, 72, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(225, 29, 72, 0.08) 1px, transparent 1px);
  background-size: 35px 35px;
}

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 70px 20px 50px;
  position: relative;
}

/* ── Header ── */
header.top {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  background: rgba(253, 248, 225, 0.95);
  border-bottom: 3px solid var(--border);
  z-index: 1000;
  box-shadow: 0 4px 0 rgba(0,0,0,0.05);
}

.logo {
  font-family: 'Indie Flower', cursive;
  font-size: 32px;
  color: var(--accent);
  font-weight: bold;
  letter-spacing: -1px;
  text-decoration: none;
  display: inline-block;
  transition: all 0.3s ease;
  animation: logoWiggle 3s infinite ease-in-out;
}

.logo:hover {
  transform: scale(1.1) rotate(-3deg);
  color: var(--accent2);
}

@keyframes logoWiggle {
  0%, 100% { transform: rotate(-1deg); }
  50% { transform: rotate(1deg) scale(1.05); }
}

.nav-links {
  display: flex;
  gap: 25px;
  margin-right: 40px;
}

.nav-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  text-decoration: none;
  transition: all 0.2s ease;
}

.nav-links a svg {
  width: 28px;
  height: 28px;
  filter: drop-shadow(2px 2px 0px rgba(0,0,0,0.1));
}

.nav-links a:hover {
  color: var(--accent);
  transform: scale(1.2);
}

.header-games {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: 20px;
  margin-right: auto;
}

.h-game {
  padding: 5px 10px;
  border: 2px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  transition: all 0.2s ease;
  box-shadow: 2px 2px 0 var(--border);
  background: #fff;
  font-family: 'Patrick Hand', cursive;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.h-game:hover {
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 var(--border);
  background: var(--bg);
  color: var(--accent);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border: 3px solid var(--border);
  border-radius: 2px;
  background: #fff;
  box-shadow: 3px 3px 0 var(--border);
  position: relative; /* Container for dropdown */
}

.search-input {
  border: none;
  outline: none;
  background: transparent;
  font-family: 'Patrick Hand', cursive;
  font-size: 18px;
  width: 180px;
  color: var(--text);
}

.search-input::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

/* ── Player ── */
.player-section {
  margin-top: 10px;
  background: #fff;
  padding: 10px;
  border: 4px solid var(--border);
  border-radius: 4px;
  box-shadow: 10px 10px 0 var(--border);
}

.player-container {
  position: relative;
  width: 100%;
  height: 550px;
  background: #eee;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.play-placeholder {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  cursor: pointer;
}

.play-placeholder::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.3);
  transition: background 0.3s;
}

.play-placeholder:hover::after {
  background: rgba(0,0,0,0.1);
}

.play-button {
  position: relative;
  z-index: 20;
  background: var(--accent2);
  color: #fff;
  border: 4px solid var(--border);
  padding: 15px 40px;
  font-family: 'Indie Flower', cursive;
  font-size: 32px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 8px 8px 0 var(--border);
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  align-items: center;
  gap: 15px;
}

.play-button:hover {
  transform: scale(1.1) rotate(-1deg);
  box-shadow: 12px 12px 0 var(--border);
  background: var(--accent);
}

.play-svg {
  width: 48px;
  height: 48px;
  fill: currentColor;
  transition: transform 0.2s;
}

.play-button:hover .play-svg {
  transform: scale(1.15);
}

.player-container iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  z-index: 5;
}

.game-info-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 5px 0;
}

.game-title {
  font-family: 'Indie Flower', cursive;
  font-size: 28px;
  color: var(--accent);
}

.actions {
  display: flex;
  gap: 12px;
}

.btn {
  padding: 8px 16px;
  font-family: 'Patrick Hand', cursive;
  font-size: 18px;
  background: #fff;
  border: 3px solid var(--border);
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--border);
  transition: transform 0.1s;
}

.btn:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--border);
}

.btn-green {
  background: var(--accent2);
  color: #fff;
}

/* ── Content ── */
.content-area {
  margin-top: 60px;
  background: rgba(255, 255, 255, 0.4);
  padding: 40px;
  border: 3px solid var(--border);
  border-radius: 2px;
  position: relative;
}

.content-area::before {
  content: "";
  position: absolute;
  top: -10px; left: -10px; right: -10px; bottom: -10px;
  border: 1px solid rgba(0,0,0,0.05);
  pointer-events: none;
}

h2 {
  font-family: 'Indie Flower', cursive;
  font-size: 34px;
  color: var(--accent);
  margin-bottom: 20px;
  margin-top: 40px;
  border-bottom: 2px dashed var(--border);
  display: inline-block;
}

h3 {
  font-family: 'Patrick Hand', cursive;
  font-size: 26px;
  color: var(--text);
  margin: 25px 0 15px;
  padding-left: 10px;
  border-left: 5px solid var(--accent2);
}

h4 {
  font-family: 'Patrick Hand', cursive;
  font-size: 22px;
  color: var(--muted);
  margin: 20px 0 10px;
  text-decoration: underline wavy var(--accent);
}

h2:first-child { margin-top: 0; }

p {
  font-size: 21px;
  margin-bottom: 20px;
}

ul {
  margin-left: 20px;
  margin-bottom: 24px;
}

li {
  font-size: 20px;
  margin-bottom: 10px;
  list-style-type: square;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 30px 0;
  font-size: 19px;
  border: 3px solid var(--border);
  background: #fff;
  box-shadow: 6px 6px 0 var(--border);
}

th, td {
  border: 2px solid var(--border);
  padding: 12px 15px;
  text-align: left;
}

th {
  background: var(--bg);
  font-family: 'Indie Flower', cursive;
  font-size: 22px;
  color: var(--accent);
}

/* ── Games Grid ── */
.games-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 20px;
  margin-top: 25px;
}

@media (max-width: 1024px) {
  .games-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 768px) {
  .games-grid { grid-template-columns: repeat(2, 1fr); }
  .header-games { display: none; }
}

.game-card {
  background: #fff;
  border: 3px solid var(--border);
  border-radius: 4px;
  padding: 10px;
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s ease;
  box-shadow: 5px 5px 0 var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.game-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 8px 8px 0 var(--border);
}

.game-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 2px solid var(--border);
  margin-bottom: 10px;
  border-radius: 2px;
}

.game-card span {
  font-size: 18px;
  font-weight: bold;
  font-family: 'Patrick Hand', cursive;
}

/* ── Footer ── */
footer {
  margin-top: 60px;
  text-align: center;
  padding-bottom: 40px;
  font-size: 18px;
  color: var(--muted);
  border-top: 2px dashed var(--border);
  padding-top: 20px;
}

/* ── Toast Notification ── */
.toast {
  position: fixed;
  bottom: 25px;
  left: 25px;
  background: var(--text);
  color: #fff;
  padding: 12px 24px;
  border: 3px solid var(--border);
  border-radius: 4px;
  box-shadow: 4px 4px 0 var(--border);
  font-family: 'Patrick Hand', cursive;
  font-size: 18px;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Bottom Nav - Hidden on Desktop, Visible on Mobile */
.bottom-nav {
  display: none;
}

@media (max-width: 768px) {
  .player-container { height: 400px; }
  header.top { padding: 0 15px; height: 60px; }
  .logo { font-size: 22px; }
  .nav-links { display: none; }
  .search-box { display: none; }
  .wrap { padding: 80px 10px 100px; }
  .content-area { padding: 20px; margin-top: 30px; }
  p { font-size: 18px; }
  h2 { font-size: 28px; }
  
  .games-grid { 
    grid-template-columns: repeat(2, 1fr); 
    gap: 15px; 
    margin-top: 15px;
  }
  
  .game-card {
    padding: 10px;
    box-shadow: 4px 4px 0 var(--border);
  }

  .game-card img {
    aspect-ratio: 1 / 1;
    width: 100%;
    object-fit: cover;
  }
  
  .game-card span {
    font-size: 16px;
    line-height: 1.2;
    margin-top: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 38px;
  }

  .game-info-bar {
    flex-direction: column;
    gap: 15px;
    align-items: flex-start;
  }
  
  .actions {
    width: 100%;
    justify-content: space-between;
  }
  
  .btn {
    padding: 10px;
    flex: 1;
    font-size: 16px;
    text-align: center;
  }

  /* Bottom Nav Styling */
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background: #fff;
    border-top: 3px solid var(--border);
    z-index: 1001;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text);
    font-size: 12px;
    font-weight: bold;
    gap: 4px;
    flex: 1;
  }

  .nav-item svg {
    width: 24px;
    height: 24px;
  }

  .nav-item:active {
    color: var(--accent);
    transform: scale(0.95);
  }

  /* Mobile Search Overlay */
  .search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg);
    z-index: 2000;
    padding: 20px;
    display: none;
    flex-direction: column;
    animation: slideUp 0.3s ease-out;
  }

  @keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  .search-overlay.active {
    display: flex;
  }

  .search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
  }

  .search-overlay .search-box {
    display: flex;
    width: 100%;
    margin-bottom: 20px;
  }

  .search-overlay .search-input {
    width: 100%;
  }

  .close-search {
    background: var(--accent);
    color: white;
    border: 3px solid var(--border);
    padding: 5px 15px;
    font-family: 'Patrick Hand', cursive;
    font-size: 18px;
    box-shadow: 3px 3px 0 var(--border);
  }

  .search-box.active {
    display: flex;
    position: fixed;
    top: 60px;
    left: 0;
    width: 100%;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-top: 3px solid var(--border);
    z-index: 1002;
  }

  .search-dropdown {
    width: 100%;
    border-radius: 0;
    max-height: 80vh;
    border-left: 0;
    border-right: 0;
    box-shadow: none;
  }
}

/* Search Dropdown - Hand-Drawn / Paper Style */
.search-dropdown {
  position: absolute;
  top: 110%;
  left: 0;
  width: 320px;
  max-height: 400px;
  background: #fff; /* Paper White */
  border: 3px solid var(--border);
  border-radius: 4px; /* More rigid like the site boxes */
  z-index: 2000;
  overflow-y: auto;
  box-shadow: 8px 8px 0 var(--border);
  padding: 5px 0;
}

.search-item {
  display: flex;
  align-items: center;
  padding: 10px 15px;
  text-decoration: none;
  color: var(--text);
  transition: background 0.2s;
  border-bottom: 2px dashed rgba(74, 58, 42, 0.1);
}

.search-item:last-child {
  border-bottom: none;
}

.search-item:hover {
  background: rgba(101, 163, 13, 0.1); /* Light Green Highlight */
  color: var(--accent);
}

.search-item img {
  width: 44px;
  height: 44px;
  border-radius: 4px;
  object-fit: cover;
  margin-right: 15px;
  border: 2px solid var(--border);
  background: #fff;
}

.search-item span {
  font-size: 19px;
  font-weight: 700;
  font-family: 'Patrick Hand', cursive;
}
