/*
  Shared look for the small games on playflappydash.com.

  The same palette and the same chunky buttons as the website (website/static/
  site.css), so a player moving from a guide page into a game never feels they
  have left the site. Every game page links this one file; anything a single
  game needs on top lives in that game's own folder.
*/

:root { color-scheme: only light; }
@media (prefers-color-scheme: dark) { :root { color-scheme: only light; } }

:root {
  --ink: #14101A;
  --shadow: #2C2230;
  --paper: #FFF4DC;
  --paper-2: #FFE9BF;
  --white: #FFFFFF;
  --sky: #4EC0CA;
  --sky-2: #8FE3E8;
  --sky-3: #EFFCFB;
  --water: #1B8FA8;
  --gold: #FFD54A;
  --orange: #FF8A3C;
  --rust: #C76D28;
  --pink: #FF5EA8;
  --berry: #C2405F;
  --leaf: #74BF2E;
  --leaf-dark: #3D7A18;
  --earth: #B07229;
  --sand: #D8B183;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font: 400 1rem/1.5 system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, var(--sky) 0, var(--sky-2) 60%, var(--sky-3) 100%)
    var(--sky-3);
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow-x: hidden;
}

/* Soft pixel clouds drifting behind everything. */
body::before, body::after {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  width: 120px; height: 36px; border-radius: 18px;
  background: rgba(255, 255, 255, .55);
  box-shadow: 30px -16px 0 -2px rgba(255, 255, 255, .55), 64px -6px 0 2px rgba(255, 255, 255, .5);
  animation: drift 70s linear infinite;
}
body::before { top: 120px; left: -160px; }
body::after { top: 340px; left: -160px; transform: scale(.7); animation-duration: 95s; animation-delay: -40s; opacity: .8; }
@keyframes drift { to { left: calc(100% + 60px); } }

[hidden] { display: none !important; }

/* ------------------------------------------------------------------ bar */

.game-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  background: var(--ink); color: var(--white);
}
.game-bar a { color: var(--white); text-decoration: none; font-weight: 800; }
.game-bar a:hover { color: var(--gold); }
.game-bar .home { display: inline-flex; align-items: center; gap: 8px; }
.game-bar .home img { width: 28px; height: 28px; image-rendering: pixelated; border-radius: 6px; }
.game-bar .home { white-space: nowrap; flex: none; }
.game-bar .title {
  margin-left: auto; font-weight: 900; letter-spacing: .06em; text-transform: uppercase;
  font-size: clamp(.8rem, 3.7vw, 1rem);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.game-bar .sound {
  width: 38px; height: 38px; margin: -4px 0; padding: 0;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .1); color: var(--white);
  border: 2px solid rgba(255, 255, 255, .25); border-radius: 50%;
  font-size: 1.05rem; cursor: pointer;
}
.game-bar .sound:hover { background: rgba(255, 255, 255, .2); }
.game-bar .full { margin-left: -4px; font-size: 1.15rem; }
@media (max-width: 380px) { .game-bar .home { font-size: 0; gap: 0; } }

/* ------------------------------------------------------------------ page */

.game-main {
  flex: 1;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 18px 14px 28px;
  display: flex; flex-direction: column; gap: 14px;
}

.card {
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 8px;
  box-shadow: 0 5px 0 var(--shadow);
  padding: 14px 16px;
}

h1.game-title {
  margin: 4px 0 0;
  font-size: clamp(1.7rem, 7vw, 2.4rem);
  font-weight: 900; letter-spacing: .06em; text-transform: uppercase;
  text-align: center; color: var(--white);
  text-shadow: 3px 3px 0 var(--ink), -1px -1px 0 var(--ink), 1px -1px 0 var(--ink), -1px 1px 0 var(--ink);
}

.status {
  text-align: center; font-weight: 800; font-size: 1.15rem;
  min-height: 1.6em;
}

/* --------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 18px;
  font: 900 .95rem/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  letter-spacing: .06em; text-transform: uppercase; text-decoration: none;
  color: var(--ink); background: var(--gold);
  border: 3px solid var(--ink); border-radius: 6px;
  box-shadow: 0 4px 0 var(--rust);
  cursor: pointer;
  transition: transform .06s ease, box-shadow .06s ease;
}
.btn:hover { background: #FFE07A; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--rust); }
.btn-quiet { background: var(--paper); box-shadow: 0 4px 0 var(--earth); }
.btn-quiet:hover { background: var(--white); }
.btn[aria-pressed="true"] { background: var(--sky-2); box-shadow: 0 4px 0 var(--water); }

.row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; }

/* ----------------------------------------------------------------- notes */

.small { font-size: .9rem; color: var(--shadow); text-align: center; }

/* ------------------------------------------------------------ more games */

.more-games { margin-top: 10px; }
.more-games h2 {
  margin: 0 0 8px; text-align: center;
  font: 900 1rem/1 system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase;
}
.more-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.more-list a {
  display: grid; grid-template-columns: 34px 1fr; grid-template-rows: auto auto;
  column-gap: 8px; align-items: center;
  padding: 8px 10px;
  background: var(--paper); color: var(--ink); text-decoration: none;
  border: 2px solid var(--ink); border-radius: 8px; box-shadow: 0 3px 0 var(--shadow);
  transition: transform .1s ease;
}
.more-list a:hover { transform: translateY(-2px); background: var(--white); }
.more-list .icon, .more-list img { grid-row: span 2; font-size: 1.5rem; text-align: center; }
.more-list img { width: 30px; height: 30px; image-rendering: pixelated; }
.more-list strong { font-size: .92rem; line-height: 1.1; }
.more-list small { font-size: .74rem; color: var(--shadow); line-height: 1.2; }
.more-list .flappy { background: var(--gold); }

/* --------------------------------------------------------------- effects */

.fx-confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; }

.fx-float {
  position: fixed; z-index: 40; pointer-events: none;
  transform: translate(-50%, -50%);
  font-weight: 900; line-height: 1; white-space: nowrap;
  -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill;
  text-shadow: 0 3px 0 var(--ink);
  animation: fx-rise 1.1s ease-out forwards;
}
@keyframes fx-rise {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(.6); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
  30% { transform: translate(-50%, -55%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -160%); }
}

.fx-shake { animation: fx-shake .35s ease; }
@keyframes fx-shake {
  20% { transform: translateX(-6px); } 40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); } 80% { transform: translateX(2px); }
}

/* A card that pops in, for results. */
.pop-in { animation: pop-in .35s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes pop-in { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  body::before, body::after { animation: none; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* --------------------------------------------- sharing a score (share.js) */

.share-box {
  width: min(92vw, 380px); padding: 0; border: 3px solid var(--ink); border-radius: 18px;
  background: var(--paper); color: var(--ink); box-shadow: 0 10px 0 rgba(20, 16, 26, .35);
}
.share-box::backdrop { background: rgba(20, 16, 26, .6); }
.share-card { position: relative; display: grid; gap: 10px; padding: 18px 18px 20px; margin: 0; }
.share-card h2 { margin: 0 36px 0 0; font: 900 1.35rem/1.1 system-ui, sans-serif; }
.share-msg {
  margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--white); border: 2px dashed rgba(20, 16, 26, .25);
  font: 700 .86rem/1.35 system-ui, sans-serif; word-break: break-word; user-select: text; -webkit-user-select: text;
}
.share-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 14px;
  border: 3px solid var(--ink); border-radius: 12px; cursor: pointer; text-decoration: none;
  font: 900 1.02rem/1 system-ui, sans-serif; color: var(--ink); background: var(--white); box-shadow: 0 4px 0 var(--ink);
}
.share-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.share-btn.wa { background: #25D366; color: #06341A; }
.share-btn.more { background: var(--gold); }
.share-btn[hidden] { display: none; }
.share-x {
  position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border: 2px solid var(--ink); border-radius: 50%;
  background: var(--white); color: var(--ink); font: 900 1rem/1 system-ui, sans-serif; cursor: pointer;
}

.challenge-banner {
  position: fixed; left: 0; right: 0; top: max(64px, env(safe-area-inset-top)); z-index: 50; margin: 0 auto;
  display: flex; align-items: center; gap: 8px; width: fit-content; max-width: min(92vw, 520px); padding: 10px 10px 10px 14px;
  border: 3px solid var(--ink); border-radius: 14px; background: var(--gold); color: var(--ink);
  font: 900 .95rem/1.25 system-ui, sans-serif; box-shadow: 0 6px 0 rgba(20, 16, 26, .35);
  animation: cb-in .35s ease both; transition: opacity .5s ease, transform .5s ease;
}
.challenge-banner.gone { opacity: 0; transform: translateY(-12px); }
.challenge-banner button { flex: none; width: 30px; height: 30px; border: 2px solid var(--ink); border-radius: 50%; background: var(--white); cursor: pointer; font: 900 .85rem/1 system-ui, sans-serif; }
@keyframes cb-in { from { opacity: 0; transform: translateY(-14px); } }
