/* Layout and styling to match 2048cupcakes.com */

:root {
  --orange: #e67e22;
  --green: #27ae60;
  --green-dark: #219653;
  --purple: #8b5a9b;
  --purple-dot: #7b5a8b;
  --pink: #f67098;
  --pink-light: #f888a9;
  --text-dark: #2c2c2c;
  --text-body: #444;
  --white: #fff;
  --gray-bg: #f5f5f5;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--white);
  color: var(--text-body);
  font-family: "Open Sans", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

body {
  padding-top: 0;
  min-height: 100vh;
}

a {
  color: var(--text-dark);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* ========== Header like 2048cupcakes.com ========== */
.site-header {
  background: var(--white);
  border-bottom: 1px solid #eee;
  padding: 12px 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-family: "Nunito", sans-serif;
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
}
.logo:hover {
  text-decoration: none;
}
.logo-2048 {
  color: var(--orange);
}
.logo-cupcakes {
  color: var(--green);
}
.logo-com {
  color: var(--green-dark);
  font-size: 1rem;
}

.nav-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  height: 3px;
  background: var(--text-dark);
  border-radius: 2px;
}

.site-nav {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--white);
  border-bottom: 1px solid #eee;
  padding: 12px 20px;
  flex-direction: column;
  gap: 8px;
}
body.nav-open .site-nav {
  display: flex;
}
.site-nav a {
  padding: 8px 0;
  font-weight: 600;
}

@media (min-width: 768px) {
  .nav-toggle {
    display: none;
  }
  .site-nav {
    display: flex;
    position: static;
    flex-direction: row;
    gap: 24px;
    border: none;
    padding: 0;
  }
}

/* ========== Page wrapper ========== */
.page-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 16px 40px;
}

/* ========== Ad slots – space reserved; add AdSense code inside each #ad-slot-* div ========== */
.ad-slot {
  display: block;
  margin: 0 auto 24px;
  min-height: 90px;
  background: transparent;
  overflow: hidden;
}
.ad-slot-top {
  min-height: 50px;
  margin-bottom: 20px;
}
.ad-slot-below-game {
  min-height: 250px;
  max-width: 336px;
  margin-left: auto;
  margin-right: auto;
}
.ad-slot-above-footer {
  min-height: 50px;
  margin-top: 8px;
  margin-bottom: 24px;
}
@media (min-width: 768px) {
  .ad-slot-top {
    min-height: 90px;
    max-width: 728px;
    margin-left: auto;
    margin-right: auto;
  }
  .ad-slot-above-footer {
    min-height: 90px;
    max-width: 728px;
    margin-left: auto;
    margin-right: auto;
  }
}

/* ========== Hero – game first so user can start playing immediately ========== */
.hero {
  margin-bottom: 24px;
}
.hero .game-area-border {
  margin-bottom: 0;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0 0 16px;
}

/* ========== Guides And Instructions – below game box ========== */
.guides-section {
  margin-bottom: 28px;
}

.guides-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.guides-list li {
  margin-bottom: 8px;
}
.guides-list a {
  color: var(--purple);
  font-weight: 600;
}
.guides-list a:hover {
  text-decoration: underline;
}

/* ========== Game area ========== */
.game-area-border {
  border: none;
  border-radius: 12px;
  padding: 24px 20px;
  background: var(--white);
}

.main-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-dark);
  text-align: center;
  margin: 0 0 20px;
  font-family: "Open Sans", sans-serif;
}

/* Container for game (from original) - centered, no extra title */
.container {
  width: 500px;
  max-width: 100%;
  margin: 0 auto 24px;
}

.heading {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  margin-bottom: 12px;
  width: 100%;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}
.heading:after {
  content: none;
}
.title-container {
  display: none;
}

/* Score rows: each row = two equal boxes side by side */
.scores-container {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: stretch;
  width: 100%;
}

.score-container, .best-container,
.score-points, .best-points {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  height: auto !important;
  background: var(--pink) !important;
  color: var(--white) !important;
  border-radius: 6px;
  padding: 10px 12px;
  padding-top: 22px;
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 !important;
  float: none !important;
  position: relative;
  overflow: hidden;
  text-align: center;
  line-height: 1.3;
}
.score-container:after, .best-container:after,
.score-points:after, .best-points:after {
  position: absolute;
  left: 0;
  right: 0;
  top: 6px;
  color: rgba(255,255,255,0.95);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1;
}

/* Game intro + button – single row, full width */
.above-game {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  width: 100%;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}
.above-game:after {
  content: none;
}

.game-intro {
  margin: 0 !important;
  font-size: 1.05rem;
  color: var(--text-dark);
  font-weight: 600;
  flex: 1;
  min-width: 0;
}

.restart-button {
  display: inline-block;
  background: var(--pink-light) !important;
  color: var(--white) !important;
  padding: 10px 24px;
  border-radius: 6px;
  font-weight: 700;
  text-decoration: none !important;
  border: none;
  cursor: pointer;
}
.restart-button:hover {
  background: var(--pink) !important;
  color: var(--white) !important;
  text-decoration: none !important;
}

/* Game container - pink background */
.game-container {
  background: var(--pink) !important;
  border-radius: 8px;
  padding: 15px;
  width: 500px;
  height: 500px;
  max-width: 100%;
  margin: 0 auto;
}

.grid-cell {
  background: rgba(255,255,255,0.35) !important;
  border-radius: 4px;
}

/* Win/Game over overlay – Try Again, Keep going */
.game-container .game-message a,
.game-container .game-message .retry-button,
.game-container .game-message .keep-playing-button {
  display: inline-block;
  background: var(--pink-light) !important;
  color: var(--white) !important;
  text-decoration: none !important;
  padding: 12px 24px;
  border-radius: 6px;
  font-weight: 700;
  line-height: 1.3;
  border: none;
  cursor: pointer;
}
.game-container .game-message a:hover,
.game-container .game-message .retry-button:hover,
.game-container .game-message .keep-playing-button:hover {
  background: var(--pink) !important;
  color: var(--white) !important;
}

.tile .tile-inner {
  border-radius: 4px;
}

/* Content below game - Game Rules, Tips */
.content-below-game {
  max-width: 720px;
  margin: 28px auto 0;
}
.content-below-game p {
  margin: 0 0 1rem;
  color: var(--text-body);
  line-height: 1.65;
}
.content-below-game h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-dark);
  margin: 1.5rem 0 0.5rem;
}
.content-below-game h3:first-of-type {
  margin-top: 0;
}

.guide-article {
  margin-top: 2rem;
  scroll-margin-top: 4rem;
}
.guide-article h3 {
  margin-top: 0;
}

/* ========== Inner pages (About, Privacy Policy) ========== */
.page-content.inner-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 0 32px;
}
.page-content.inner-page .page-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0 0 1.25rem;
  line-height: 1.3;
}
.page-content.inner-page .page-updated {
  font-size: 0.9rem;
  color: #666;
  margin: 0 0 1.5rem;
}
.page-content.inner-page h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-dark);
  margin: 1.5rem 0 0.5rem;
  line-height: 1.3;
}
.page-content.inner-page h2:first-of-type {
  margin-top: 0;
}
.page-content.inner-page p {
  margin: 0 0 1rem;
  color: var(--text-body);
  line-height: 1.65;
}
.page-content.inner-page ul {
  margin: 0 0 1rem;
  padding-left: 1.5rem;
  color: var(--text-body);
  line-height: 1.65;
}
.page-content.inner-page li {
  margin-bottom: 0.35rem;
}
.page-content.inner-page a {
  color: var(--purple);
  font-weight: 600;
}
.page-content.inner-page a:hover {
  text-decoration: underline;
}

/* Footer */
.site-footer {
  text-align: center;
  padding-top: 24px;
  border-top: 1px solid #eee;
  font-size: 0.9rem;
  color: #666;
}
.site-footer p {
  margin: 0;
}
.site-footer a {
  color: var(--purple);
}

/* ========== Mobile ========== */
@media (max-width: 520px) {
  .page-wrapper {
    padding: 16px 12px 32px;
  }
  .game-area-border {
    padding: 16px 12px;
  }
  .main-title {
    font-size: 1.5rem;
  }
  .container {
    width: 100%;
  }
  .game-container {
    width: 280px !important;
    height: 280px !important;
    margin-left: auto;
    margin-right: auto;
    padding: 10px !important;
  }
  .score-container, .best-container,
  .score-points, .best-points {
    min-width: 0;
    padding: 8px 10px;
    padding-top: 20px;
    font-size: 0.85rem;
  }
  .heading {
    max-width: 100%;
  }
  .above-game {
    max-width: 100%;
  }
  .game-container .game-message a,
  .game-container .game-message .retry-button,
  .game-container .game-message .keep-playing-button {
    padding: 12px 20px !important;
  }
  .page-content.inner-page {
    padding: 20px 0 28px;
  }
  .page-content.inner-page .page-title {
    font-size: 1.4rem;
    margin-bottom: 1rem;
  }
  .page-content.inner-page h2 {
    font-size: 1.1rem;
    margin-top: 1.25rem;
  }
  .page-content.inner-page p,
  .page-content.inner-page ul {
    font-size: 0.95rem;
  }
}

/* Responsive: tablet and small desktop */
@media (min-width: 521px) and (max-width: 767px) {
  .page-wrapper {
    padding: 20px 20px 36px;
  }
  .header-inner {
    padding: 0 4px;
  }
  .site-nav {
    gap: 16px;
  }
  .page-content.inner-page {
    padding: 24px 0 32px;
  }
}

/* Responsive: ensure touch targets and readable text on small screens */
@media (max-width: 767px) {
  html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
  }
  .site-nav a {
    padding: 12px 0;
    display: block;
  }
  .site-header {
    padding: 10px 16px;
  }
}
