html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  overflow-x: hidden;
}

*, *:after, *:before {
  box-sizing: inherit;
}

body {
  display: flex;
  flex-direction: column;
  font-family: "Arial Black", Impact, sans-serif;
  background: #f4fcf6;
  color: #1a2a3a;
  min-height: 100vh;
  user-select: none;
  -webkit-user-select: none;
}

header {
  background-color: #2e8b57;
  background-image: repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.04) 50px, transparent 50px, transparent 100px);
  padding: 20px 15px;
  text-align: center;
  border-bottom: 6px solid #ffffff;
  box-shadow: 0 6px 0 #1a2a3a;
  width: 100%;
}

header h1 {
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 3rem);
  letter-spacing: 1px;
}

.logo-main {
  color: #ffffff;
  text-shadow: 4px 4px 0 #134226;
}

.logo-flipped {
  display: inline-block;
  color: #fffb00;
  transform: scaleX(-1);
  margin-left: 8px;
  text-shadow: -4px 4px 0 #134226;
}

.back-btn {
  display: inline-block;
  margin-top: 12px;
  padding: 8px 20px;
  background: #ff9f43;
  color: #ffffff;
  text-decoration: none;
  border-radius: 12px;
  font-weight: 700;
  border: 3px solid #1a2a3a;
  box-shadow: 0 4px 0 #1a2a3a;
  font-family: Arial, sans-serif;
  transition: transform 0.1s;
}

.back-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #1a2a3a;
}

h2 {
  margin-top: 0;
  text-align: center;
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  color: #1a2a3a;
}

.page-layout {
  display: flex;
  flex: 1;
  max-width: 1500px;
  margin: 0 auto;
  padding: 30px 15px;
  width: 100%;
  gap: 25px;
}

main {
  display: flex;
  flex-direction: column;
  flex: 1;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
}

#arcade-cabinet {
  background: #ffffff;
  border: 4px solid #1a2a3a;
  border-radius: 24px;
  padding: clamp(15px, 4vw, 30px);
  box-shadow: 0 8px 0 #1a2a3a;
  width: 100%;
  max-width: 500px;
  margin-bottom: 25px;
  flex-shrink: 0;
  position: relative;
}

#gameWrapper {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

#canvas-container {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #121824;
  border: 4px solid #1a2a3a;
  border-radius: 16px;
  box-shadow: 0 6px 0 #1a2a3a;
  overflow: hidden;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

#hudContainer {
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: #1a2a3a;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 16px;
  width: 100%;
  font-size: 1.1rem;
}

#hudContainer b {
  color: #fffb00;
}

.screen-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(26, 42, 58, 0.95);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: #ffffff;
  z-index: 10;
  text-align: center;
  padding: 20px;
}

.screen-overlay h3 {
  font-size: 2rem;
  margin: 0 0 15px 0;
  color: #fffb00;
}

.screen-overlay p {
  font-family: Arial, sans-serif;
  font-size: 1rem;
  margin: 0 0 25px 0;
  color: #cbd5e1;
}

.arcade-btn {
  padding: 12px 28px;
  font-size: 1.1rem;
  font-weight: bold;
  background-color: #ff9f43;
  border: 3px solid #ffffff;
  color: #ffffff;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 0 #000000;
  text-transform: uppercase;
}

.arcade-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #000000;
}

/* Side Ads (Matched to Reference CSS) */
.side-ad {
  width: 160px;
  flex-shrink: 0;
  height: 600px;
}

.ad-placeholder {
  padding: 20px 0;
  width: 100%;
  background-color: #2e8b57;
  background-image: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.05) 20px, transparent 20px, transparent 40px);
  border: 4px solid #1a2a3a;
  box-shadow: 0 6px 0 #1a2a3a;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
  box-sizing: border-box;
}

.panel-icon {
  font-size: 2.2rem;
  margin-bottom: 15px;
}

.panel-text {
  color: #fffb00;
  font-size: 1.4rem;
  letter-spacing: 2px;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  text-shadow: 2px 2px 0 #1a2a3a;
}

/* Instruction Card (Matched to Reference CSS) */
#instruction-card {
  background: #ffffff;
  border: 4px solid #1a2a3a;
  box-shadow: 0 6px 0 #1a2a3a;
  border-radius: 24px;
  padding: 20px 25px;
  max-width: 500px;
  width: 100%;
  font-family: Arial, sans-serif;
  margin: 0 auto 25px;
  flex-shrink: 0;
}

#instruction-card h3 {
  font-size: 1.3rem;
  font-weight: 900;
  margin: 0 0 12px;
  text-transform: uppercase;
  border-bottom: 3px solid #e2e8f0;
  padding-bottom: 6px;
}

#instruction-card ul {
  margin: 0;
  padding-left: 20px;
}

#instruction-card li {
  font-size: 1rem;
  font-weight: 700;
  color: #334155;
  line-height: 1.5;
  margin-bottom: 8px;
}

footer {
  background: #1a2a3a;
  color: #ffffff;
  padding: 20px 10px;
  text-align: center;
  font-size: 0.95rem;
  font-family: Arial, sans-serif;
  font-weight: 700;
  border-top: 5px solid #fffb00;
  margin-top: auto;
  width: 100%;
}

footer p {
  margin: 0;
  line-height: 1.4;
}

.footer-nav {
  display: flex;
  margin-bottom: 15px;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}

.footer-nav a {
  color: #fffb00;
  text-decoration: none;
  font-size: 0.95rem;
  font-family: Arial, sans-serif;
  transition: color 0.1s;
}

.footer-nav a:hover {
  color: #ffffff;
  text-decoration: underline;
}

@media (max-width: 850px) {
  .side-ad {
    display: none !important;
  }
  .page-layout {
    padding: 15px 10px;
  }
}

@media (max-width: 480px) {
  #arcade-cabinet {
    border-radius: 16px;
    padding: 12px;
  }
}