/* ============================================================
 * Simple Flappy Bird — styles (local demo)
 * ------------------------------------------------------------
 * Colour palette and layout only; every string lives in js/i18n.js
 * and every tunable in js/config.js.
 * ============================================================ */
* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: radial-gradient(circle at 30% 0%, #1d4a30, #060f0a 70%);
  color: #eef7e7;
  font-family: system-ui, 'Microsoft YaHei', sans-serif;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

.stage {
  position: fixed;
  inset: 0;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* ---------------- HUD ---------------- */
.hud {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  padding: 14px 16px 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  max-width: 560px;
  margin: 0 auto;
}

.hud.live {
  opacity: 1;
}

.hud-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.hud-score {
  display: flex;
  align-items: baseline;
  gap: 4px;
  text-shadow: 0 3px 10px rgba(0, 0, 0, 0.55);
}

.hud-score b {
  font-size: 44px;
  line-height: 1;
  color: #fff6d8;
}

.hud-score span {
  font-size: 13px;
  color: #d8eac9;
}

.hud-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.hud-meta {
  display: flex;
  gap: 14px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
}

.hud-meta span {
  font-size: 12px;
  color: #c3dcb6;
}

.hud-meta .tagmode {
  font-size: 11px;
  font-weight: 700;
  color: #cdeba0;
  padding: 1px 7px;
  border-radius: 99px;
  background: #ffffff1f;
}

.hud-meta b {
  font-size: 13px;
  color: #ffe9a8;
  font-variant-numeric: tabular-nums;
}

.hud-side {
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 2px 14px;
  text-align: right;
}

.hud-side div {
  display: flex;
  align-items: baseline;
  gap: 5px;
  justify-content: flex-end;
}

.hud-side label {
  font-size: 11px;
  color: #b9cfb3;
}

.hud-side b {
  font-size: 13px;
  color: #eaf6df;
}

.hud-biome {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 8px;
}

.hud-biome b {
  font-size: 17px;
  color: #ffeaa0;
  text-shadow: 0 3px 10px rgba(0, 0, 0, 0.6);
}

.hud-biome span {
  font-size: 11.5px;
  color: rgba(230, 245, 220, 0.72);
}

.hud-hint {
  margin: 8px 0 0;
  font-size: 11px;
  color: rgba(230, 245, 220, 0.6);
}

/* Local testing only: the god switch hides inside the HUD, so it is only
 * reachable while a run is actually going */
.god-btn {
  margin-left: 8px;
  padding: 3px 10px;
  border-radius: 99px;
  cursor: pointer;
  border: 1px solid #bde3a544;
  background: #0b1f14cc;
  color: #9db7a1;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
}

.hud.live .god-btn {
  pointer-events: auto;
}

.god-btn:hover {
  color: #dff0d6;
}

.god-btn.on {
  background: linear-gradient(180deg, #ffe9a8, #f2c94c);
  color: #4a3607;
  border-color: #ffe9a8;
}

/* ---------------- overlays & panels ---------------- */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(3, 10, 7, 0.68);
  backdrop-filter: blur(7px);
  overflow-y: auto;
}

.overlay.hidden {
  display: none;
}

.panel {
  width: min(430px, 100%);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 20px;
  border: 1px solid #bde3a544;
  border-radius: 16px;
  background: #0e261a;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.5);
}

.panel.narrow {
  text-align: center;
}

.panel h1 {
  margin: 0;
  font-size: 24px;
  color: #f3e3a8;
  line-height: 1.25;
}

.panel h1 em {
  display: block;
  font-size: 13px;
  font-style: normal;
  letter-spacing: 2px;
  color: #a9d875;
}

.panel h2 {
  margin: 0 0 4px;
  font-size: 19px;
  color: #f3e3a8;
}

.panel .sub {
  margin: 6px 0 14px;
  font-size: 12.5px;
  color: #9db7a1;
}

/* ---------------- mode switch (coin / distance) ---------------- */
.modes {
  display: flex;
  gap: 8px;
  margin: 0 0 8px;
}

.mode-btn {
  flex: 1;
  padding: 9px 10px;
  border: 1px solid #bde3a544;
  border-radius: 10px;
  background: #0b1f14;
  color: #cfe3c8;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s;
}

.mode-btn:hover {
  background: #143223;
}

.mode-btn.active {
  background: #2c6b3f;
  border-color: #a9d875;
  color: #f4ffe9;
  font-weight: 700;
}

.mode-hint {
  margin: 0 0 12px;
  font-size: 11.5px;
  color: #9db7a1;
  line-height: 1.55;
}

/* ---------------- data rows ---------------- */
.rows {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.rows > div {
  padding: 9px 11px;
  border: 1px solid #bde3a52e;
  border-radius: 10px;
  background: #0b1f14;
}

.rows label {
  display: block;
  font-size: 11px;
  color: #8fae8b;
  margin-bottom: 3px;
}

.rows b {
  font-size: 15px;
  color: #eaf6df;
}

/* ---------------- track code ---------------- */
.seedbox {
  padding: 11px 12px;
  border: 1px solid #bde3a52e;
  border-radius: 12px;
  background: #0b1f14;
  margin-bottom: 12px;
}

.seedline {
  display: flex;
  align-items: center;
  gap: 7px;
}

.seedline + .seedline {
  margin-top: 8px;
}

.seedline > span {
  font-size: 11px;
  color: #8fae8b;
}

.seedline code {
  font-size: 13px;
  color: #ffeaa0;
  letter-spacing: 0.5px;
}

.seedline input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid #bde3a544;
  border-radius: 9px;
  background: #071910;
  color: #fff;
  font: inherit;
  font-size: 13px;
}

.seedline input:focus {
  outline: none;
  border-color: #a9d875;
}

.mini {
  padding: 7px 11px;
  border: 1px solid #bde3a544;
  border-radius: 9px;
  background: #173b27;
  color: #dff0d6;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
}

.mini:hover {
  background: #1e4b32;
}

/* ---------------- leaderboard preview ---------------- */
.top3,
.history {
  margin-bottom: 12px;
}

.top3 label,
.history label {
  display: block;
  font-size: 11px;
  color: #8fae8b;
  margin-bottom: 6px;
}

.top3 ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.top3 li {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 9px;
  border-radius: 9px;
  background: #0b1f14;
  margin-bottom: 5px;
  font-size: 13px;
}

.top3 li b {
  width: 18px;
  color: #a9d875;
}

.top3 li span {
  flex: 1;
  color: #dff0d6;
}

.top3 li em {
  font-style: normal;
  color: #ffeaa0;
  font-weight: 700;
}

.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  padding: 3px 9px;
  border-radius: 99px;
  background: #173b27;
  color: #cfe3c8;
  font-size: 12px;
}

.dim {
  color: #7d9782;
  font-size: 12px;
}

/* ---------------- buttons ---------------- */
.primary {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(180deg, #b6e284, #8fc45c);
  color: #16301b;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 8px 20px rgba(169, 216, 117, 0.22);
}

.primary:active {
  transform: translateY(1px);
}

.ghost {
  width: 100%;
  padding: 10px;
  margin-top: 8px;
  border: 1px solid #bde3a544;
  border-radius: 11px;
  background: #143222;
  color: #dff0d6;
  font-size: 13.5px;
  cursor: pointer;
  font-family: inherit;
}

.ghost:hover {
  background: #1b4129;
}

.btnrow {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-top: 8px;
}

.btnrow .ghost {
  margin-top: 0;
  padding: 10px 6px;
  font-size: 12.5px;
}

/* ---------------- help / about ---------------- */
details {
  margin-top: 12px;
  border-top: 1px solid #bde3a52e;
  padding-top: 10px;
}

summary {
  cursor: pointer;
  font-size: 12.5px;
  color: #a9d875;
}

details ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: #cfe3c8;
  font-size: 12.5px;
  line-height: 1.75;
}

details li {
  margin: 4px 0;
}

details b {
  color: #ffeaa0;
}

/* ---------------- result ---------------- */
.bigscore {
  text-align: center;
  margin-bottom: 6px;
}

.bigscore b {
  font-size: 62px;
  line-height: 1;
  color: #fff6d8;
}

.bigscore span {
  font-size: 13px;
  color: #a9d875;
  margin-left: 5px;
}

.badge {
  text-align: center;
  padding: 7px 12px;
  border-radius: 99px;
  background: #173b27;
  color: #dff0d6;
  font-size: 13px;
  font-weight: 700;
  margin: 0 auto 10px;
  width: fit-content;
}

.badge.gold {
  background: linear-gradient(180deg, #ffe9a8, #f2c94c);
  color: #4a3607;
}

.badge.hot {
  background: #7c2f2f;
  color: #ffd9d9;
}

.rankline {
  text-align: center;
  font-size: 14px;
  color: #eaf6df;
  margin-bottom: 4px;
}

.diff {
  text-align: center;
  font-size: 12.5px;
  color: #ffeaa0;
  margin-bottom: 14px;
  min-height: 18px;
}

.diff.ok {
  color: #a9d875;
}

.diff.bad {
  color: #ff9c9c;
}

.verify {
  margin-top: 12px;
  padding: 8px 10px;
  border-radius: 9px;
  background: #0b1f14;
  font-size: 11.5px;
  color: #9db7a1;
  word-break: break-all;
}

.verify.ok {
  color: #a9d875;
}

.verify.bad {
  color: #ff9c9c;
}

.warn {
  margin: 6px 0 0;
  font-size: 11.5px;
  color: #e8c07d;
}

.overlay .panel .primary {
  margin-top: 14px;
}

/* ---------------- leaderboard ---------------- */
.board {
  list-style: none;
  margin: 10px 0 12px;
  padding: 0;
}

.board li {
  display: grid;
  grid-template-columns: 26px 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 9px;
  background: #0b1f14;
  margin-bottom: 5px;
  font-size: 13px;
}

.board li.mine {
  background: #1b3a26;
  border: 1px solid #a9d87555;
}

.board .rk {
  color: #a9d875;
  font-weight: 700;
}

.board .nm {
  color: #dff0d6;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board .sc {
  color: #ffeaa0;
  font-weight: 700;
}

.board .tm {
  color: #7d9782;
  font-size: 11.5px;
  min-width: 46px;
  text-align: right;
}

.tag {
  font-style: normal;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  background: #2c4a33;
  color: #9db7a1;
}

.tag.warn {
  background: #5c2a2a;
  color: #ffb4a8;
}

.namerow {
  display: flex;
  gap: 7px;
  margin-bottom: 10px;
}

.namerow input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid #bde3a544;
  border-radius: 9px;
  background: #071910;
  color: #fff;
  font: inherit;
  font-size: 13px;
}

.note {
  margin: 0 0 6px;
  font-size: 11px;
  color: #7d9782;
  line-height: 1.6;
}

/* ---------------- toast ---------------- */
.toast {
  position: absolute;
  left: 50%;
  bottom: 40px;
  transform: translate(-50%, 12px);
  z-index: 40;
  padding: 10px 16px;
  border-radius: 10px;
  background: rgba(14, 38, 26, 0.96);
  border: 1px solid #bde3a544;
  color: #eaf6df;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: 0.22s;
  max-width: calc(100vw - 40px);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------------- language switch ----------------
 * Small and tucked into the bottom-right corner so it never covers the
 * panels or the HUD; it stays clickable above every overlay. */
.lang-btn {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 30;
  padding: 7px 14px;
  border-radius: 99px;
  cursor: pointer;
  border: 1px solid #bde3a544;
  background: #0b1f14cc;
  color: #cfe3c8;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.lang-btn:hover {
  color: #fff;
  border-color: #a9d875;
}

@media (max-width: 420px) {
  .panel {
    padding: 16px;
  }

  .bigscore b {
    font-size: 52px;
  }

  .hud-score b {
    font-size: 36px;
  }

  .rows {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ---------------- landscape phones: compact layout ---------------- */
@media (orientation: landscape) and (max-height: 520px) {
  .hud {
    padding: 8px 14px 0;
  }

  .hud-score b {
    font-size: 30px;
  }

  .hud-score span {
    font-size: 11px;
  }

  .hud-meta span {
    font-size: 10px;
  }

  .hud-meta b {
    font-size: 11px;
  }

  .hud-side {
    gap: 1px 10px;
  }

  .hud-side label {
    font-size: 10px;
  }

  .hud-side b {
    font-size: 12px;
  }

  .hud-biome {
    margin-top: 5px;
  }

  .hud-hint {
    margin: 4px 0 0;
    font-size: 10px;
  }

  .overlay {
    padding: 10px;
  }

  .panel {
    width: min(520px, 94vw);
    max-height: calc(100vh - 20px);
    padding: 14px 18px;
  }

  .panel h1 {
    font-size: 20px;
  }

  .panel .sub {
    margin: 4px 0 10px;
  }

  .rows {
    margin-bottom: 10px;
  }

  .bigscore b {
    font-size: 44px;
  }

  .btnrow {
    margin-top: 6px;
  }

  .lang-btn {
    right: 10px;
    bottom: 10px;
    padding: 6px 12px;
    font-size: 11px;
  }
}
