/* 2048 Cupcakes — candy theme. Reference: a bakery display case, not a generic game portal. */
:root {
  --bg: #fff7fb;
  --card: #ffffff;
  --ink: #3b1d3a;
  --muted: #8a6a86;
  --primary: #ff5c8a;
  --primary-deep: #d6336c;
  --accent: #ffc542;
  --line: #f3d9e6;
  --radius: 14px;
  --shadow-1: 0 1px 2px rgba(59, 29, 58, .06);
  --shadow-2: 0 8px 24px rgba(59, 29, 58, .08);
  --font-head: "Baloo 2", "Nunito", sans-serif;
  --font-body: "Nunito", sans-serif;
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.6;
}
img { max-width: 100%; height: auto; }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.2; }
h1 { font-size: 36px; margin: 0 0 8px; }
h2 { font-size: 28px; margin: 32px 0 12px; }
h3 { font-size: 18px; margin: 20px 0 8px; }
a { color: var(--primary-deep); }
a:hover { color: var(--primary); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.skip {
  position: absolute; left: -999px; top: 0; background: var(--card); color: var(--ink);
  padding: 8px 14px; border-radius: 0 0 8px 0; z-index: 20;
}
.skip:focus { left: 0; }

/* top bar */
.topbar {
  background: var(--card);
  border-bottom: 2px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.bar-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-head); font-weight: 800; font-size: 20px; color: var(--ink); text-decoration: none;
}
.brand:hover { color: var(--primary); }
.brand-cup {
  width: 22px; height: 22px; border-radius: 5px 5px 9px 9px;
  background: linear-gradient(180deg, var(--accent) 0 40%, var(--primary) 40% 100%);
  box-shadow: var(--shadow-1);
}
.topnav { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.topnav a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; padding: 6px 2px; }
.topnav a:hover { color: var(--primary); }

/* footer */
.foot { border-top: 2px solid var(--line); background: var(--card); margin-top: 64px; }
.foot-row { display: flex; flex-wrap: wrap; gap: 16px 32px; justify-content: space-between; padding: 28px 20px; }
.foot-name { font-family: var(--font-head); font-weight: 800; margin: 0 0 4px; }
.foot-note { color: var(--muted); font-size: 13px; margin: 0; max-width: 60ch; }
.foot-nav { display: flex; flex-wrap: wrap; gap: 4px 16px; align-content: center; }
.foot-nav a { color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 600; }
.foot-nav a:hover { color: var(--primary); }


/* stage: the one signature block — cupcake liner ruffle lives only here */
.stage-block { margin-top: 16px; }
.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  overflow: hidden;
}
.stage::before {
  /* paper-liner ruffle: the single site-wide motif */
  content: "";
  position: absolute; inset: auto 0 -1px 0; height: 14px;
  background: repeating-linear-gradient(90deg, var(--primary) 0 14px, var(--accent) 14px 28px);
  opacity: .85;
  z-index: 1;
}
.stage[data-gf-state="playing"]::before { display: none; }
.cover, .loader { position: absolute; inset: 0; }
.cover {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 197, 66, .18) 0 60px, transparent 61px),
    radial-gradient(circle at 80% 30%, rgba(255, 92, 138, .14) 0 70px, transparent 71px),
    var(--card);
  cursor: pointer;
}
.cover img { width: auto; height: auto; max-width: min(440px, 78%); max-height: 50%; object-fit: contain; border-radius: 16px; box-shadow: var(--shadow-2); }
.play-btn {
  font-family: var(--font-head); font-weight: 800; font-size: 20px;
  background: var(--primary-deep); color: #fff; border: 0; border-radius: 999px;
  padding: 14px 34px; min-height: 52px; cursor: pointer;
  box-shadow: var(--shadow-2);
}
.play-btn:hover { background: #b02a5b; }
.play-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.cover-hint { color: var(--muted); font-size: 13px; margin: 0; }
.loader {
  display: none; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: var(--card); color: var(--muted); font-weight: 600;
}
.loader p { margin: 0; }
.loader-cup {
  width: 34px; height: 34px; border-radius: 50%;
  border: 4px solid var(--line); border-top-color: var(--primary);
  animation: cupspin .8s linear infinite;
}
@keyframes cupspin { to { transform: rotate(360deg); } }
.stage[data-gf-state="loading"] .loader { display: flex; }
.stage iframe { display: block; width: 100%; height: 100%; border: 0; background: #fff; }
.stage-actions { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.act {
  background: var(--card); color: var(--ink); border: 2px solid var(--line);
  border-radius: 999px; padding: 8px 16px; min-height: 40px;
  font-family: var(--font-body); font-weight: 700; font-size: 14px; cursor: pointer;
}
.act:hover { border-color: var(--primary); color: var(--primary); }
.act[aria-pressed="true"], .act[data-gf-liked] { background: var(--primary-deep); border-color: var(--primary-deep); color: #fff; }
.share-msg { color: var(--muted); font-size: 13px; }

/* trust line: verifiable facts next to the game, per AI/visitor trust */
.trust-line { color: var(--muted); font-size: 13px; margin: 10px 0 0; }
.trust-line a { color: var(--muted); text-decoration: underline; }
.trust-line a:hover { color: var(--primary); }

/* daily leaderboard */
.leaderboard {
  margin-top: 32px; padding: 18px 20px;
  background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1);
}
.leaderboard h2 { margin: 0 0 10px; font-size: 22px; }
.lb-run { margin: 0 0 10px; font-weight: 800; color: var(--primary-deep); }
.lb-list { list-style: none; margin: 0; padding: 0; }
.lb-list li { display: flex; align-items: center; gap: 12px; padding: 7px 8px; border-top: 1px solid var(--line); font-size: 15px; }
.lb-list li:first-child { border-top: 0; }
.lb-list li.me { background: #fdeef5; border-radius: 8px; }
.lb-rank { font-family: var(--font-head); font-weight: 800; min-width: 34px; color: var(--muted); }
.lb-list li.top1 .lb-rank { color: #d6336c; }
.lb-list li.top2 .lb-rank { color: #c77d11; }
.lb-list li.top3 .lb-rank { color: #9a6b2f; }
.lb-name-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { font-weight: 800; font-variant-numeric: tabular-nums; }
.lb-empty { color: var(--muted); }
.lb-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-top: 12px; }
.lb-me { margin: 0; color: var(--muted); font-size: 14px; }
.lb-name { display: flex; gap: 8px; align-items: center; }
.lb-label { font-size: 13px; color: var(--muted); }
.lb-name input {
  border: 2px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--ink);
  padding: 8px 14px; min-height: 38px; width: 170px; font: inherit;
}
.lb-name input:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.lb-name button {
  background: var(--primary-deep); color: #fff; border: 0; border-radius: 999px;
  padding: 8px 18px; min-height: 38px; font-family: var(--font-head); font-weight: 800; cursor: pointer;
}
.lb-name button:hover { background: #b02a5b; }
.lb-note { color: var(--muted); font-size: 12px; margin: 12px 0 0; }

/* game cards */
.more-games { margin-top: 36px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.card {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--card); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 14px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow-1);
}
.card:hover { box-shadow: var(--shadow-2); border-color: var(--primary); color: var(--ink); }
.card img { border-radius: 10px; object-fit: cover; }
.card-name { font-family: var(--font-head); font-weight: 800; font-size: 18px; }
.card-note { color: var(--muted); font-size: 13px; }


/* content pages */
.page-head { margin: 18px 0 8px; }
.tagline { color: var(--muted); font-size: 17px; margin: 0; }
.contentpage > p, .postpage > p, .gamepage > p, .legalpage > p { max-width: 70ch; }
.crumbs { margin-top: 18px; }
.crumbs ol { list-style: none; display: flex; gap: 8px; margin: 0; padding: 0; font-size: 13px; }
.crumbs li { display: flex; gap: 8px; align-items: center; }
.crumbs a { text-decoration: none; color: var(--muted); }
.crumbs a:hover { color: var(--primary); }
.crumbs li + li::before { content: "/"; color: var(--line); }

/* faq */
.faq { margin-top: 32px; }
.faq-item {
  background: var(--card); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 10px;
}
.faq-item summary { cursor: pointer; font-weight: 700; font-family: var(--font-head); font-size: 16px; }
.faq-item p { margin: 10px 0 2px; color: var(--ink); }

/* play cta */
.play-cta {
  margin-top: 40px; padding: 20px 24px;
  background: var(--card); border: 2px dashed var(--primary); border-radius: var(--radius);
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px;
}
.play-cta p { margin: 0; font-weight: 700; }
.btn {
  display: inline-block; background: var(--primary-deep); color: #fff; text-decoration: none;
  font-family: var(--font-head); font-weight: 800; font-size: 16px;
  padding: 12px 26px; min-height: 44px; border-radius: 999px;
}
.btn:hover { background: #b02a5b; color: #fff; }
.btn-ghost { background: transparent; color: var(--primary-deep); border: 2px solid var(--primary-deep); }
.btn-ghost:hover { background: var(--primary-deep); color: #fff; }

/* blog list */
.postlist { margin-top: 28px; display: flex; flex-direction: column; gap: 12px; }
.post-row {
  display: flex; flex-direction: column; gap: 2px;
  background: var(--card); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; text-decoration: none; color: var(--ink);
}
.post-row:hover { border-color: var(--primary); }
.post-row-title { font-family: var(--font-head); font-weight: 800; font-size: 17px; }
.post-row-desc { color: var(--muted); font-size: 14px; }
.post-row-date { color: var(--muted); font-size: 12px; }

/* post meta + tables */
.post-date { color: var(--muted); font-size: 14px; margin: 0; }
table { border-collapse: collapse; width: 100%; margin: 16px 0; background: var(--card); border-radius: var(--radius); overflow: hidden; }
th, td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; font-size: 14px; }
th { background: #fdeef5; font-family: var(--font-head); }

/* 404 */
.notfound { text-align: center; padding: 64px 0; }
.notfound p { max-width: 60ch; margin: 12px auto 24px; color: var(--muted); }
.notfound-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* mobile */
@media (max-width: 640px) {
  h1 { font-size: 28px; }
  h2 { font-size: 22px; }
  .stage { aspect-ratio: 1 / 1; }
  .bar-row { padding-top: 10px; padding-bottom: 10px; }
  .topnav { gap: 4px 12px; }
  .foot-row { flex-direction: column; }
  .leaderboard { padding: 14px; }
  .lb-foot { flex-direction: column; align-items: stretch; }
  .lb-name input { flex: 1; width: auto; }
}
