/* ------- Duckxy Run · Main Menu ------- */
:root {
  --bg-deep: #07111a;
  --bg-mid: #102634;
  --bg-soft: #1a4357;
  --panel: rgba(11, 28, 39, 0.62);
  --panel-strong: rgba(8, 22, 32, 0.82);
  --panel-border: rgba(139, 232, 255, 0.16);
  --panel-border-strong: rgba(139, 232, 255, 0.32);
  --cyan: #8be8ff;
  --cyan-soft: #b6f0ff;
  --warm: #ffb56b;
  --warm-soft: #ffd58b;
  --duck: #ffd24a;
  --duck-shadow: #d9982b;
  --bill: #ff8a4a;
  --text: #eaf6fb;
  --text-muted: #8fb0c2;
  --text-dim: #5d7f93;
  --gold: #ffd166;
  --silver: #cfd8df;
  --bronze: #c98a5a;
  --danger: #ff7a8a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #04080c;
  color: var(--text);
  font-family: "Outfit", system-ui, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#root { height: 100vh; width: 100vw; }

/* ------- App layout ------- */
.app {
  position: relative;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  isolation: isolate;
}

.app::after {
  /* subtle vignette on top */
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 35%, rgba(0,0,0,0.55) 100%);
  z-index: 1;
}

.scene-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.scene-layer svg {
  width: 100%;
  height: 100%;
  display: block;
}

.ui-layer {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(360px, 480px) minmax(20px, 1fr) minmax(340px, 460px);
  grid-template-rows: auto 1fr auto;
  align-items: center;
  gap: 20px;
  padding: 24px 48px;
  pointer-events: none;
  width: 100%;
  max-width: 1800px;
  height: 100%;
}

.ui-layer > * { pointer-events: auto; }

#main-menu .hidden {
  display: none !important;
}

.in-game-settings-btn {
  position: fixed;
  top: calc(18px + env(safe-area-inset-top));
  right: calc(18px + env(safe-area-inset-right));
  z-index: 45;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  appearance: none;
  border: 1px solid var(--panel-border-strong);
  border-radius: 50%;
  background: rgba(8, 22, 32, 0.76);
  color: var(--cyan-soft);
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow:
    0 16px 34px -18px rgba(0, 0, 0, 0.85),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: transform .18s ease, border-color .18s ease, background .18s ease, color .18s ease;
}

.in-game-settings-btn:hover {
  background: rgba(20, 56, 76, 0.84);
  border-color: var(--cyan-soft);
  color: #fff;
  transform: translateY(-1px);
}

.in-game-settings-btn:active {
  transform: translateY(0) scale(0.96);
}

/* row 1 — top-left clock, top-right profile/auth */
.clock-block {
  grid-row: 1;
  grid-column: 1;
  justify-self: start;
  align-self: start;
}
.top-bar {
  grid-row: 1;
  grid-column: 3;
  justify-self: end;
  align-self: start;
  width: 100%;
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
}

/* ------- Clock ------- */
.clock {
  display: inline-flex;
  flex-direction: column;
  padding: 14px 22px;
  border-radius: 16px;
  min-width: 280px;
  position: relative;
}
.clock::before {
  content: "";
  position: absolute;
  top: 14px; left: -1px;
  width: 3px; height: 32px;
  background: linear-gradient(180deg, var(--warm), var(--cyan));
  border-radius: 3px;
  box-shadow: 0 0 12px rgba(139, 232, 255, 0.5);
}
.clock-time {
  font-family: "Bagel Fat One", "Outfit";
  font-size: 34px;
  line-height: 1;
  color: var(--cyan-soft);
  display: flex;
  align-items: baseline;
  gap: 1px;
  letter-spacing: -0.01em;
  text-shadow: 0 0 14px rgba(139, 232, 255, 0.35);
}
.clock-time .colon { animation: blink 1s steps(2) infinite; opacity: 0.95; }
.clock-time .ss { font-size: 18px; color: var(--text-muted); margin-left: 6px; font-family: "Outfit"; font-weight: 700; letter-spacing: 0.04em; }
.clock-time .ampm { font-size: 11px; color: var(--text-muted); margin-left: 8px; letter-spacing: 0.24em; font-family: "Outfit"; font-weight: 700; }
@keyframes blink { 50% { opacity: 0.35; } }
.clock-meta {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.clock-meta .sep { opacity: 0.4; }
.clock-meta .mode { color: var(--warm-soft); }
.clock-meta .mode .ico { margin-right: 4px; font-size: 13px; }

/* foreground chick mascot — sits in the foreground pond, animated bob */
.chick-mascot {
  position: absolute;
  left: 40%;
  bottom: 5%;
  width: 160px;
  height: auto;
  pointer-events: none;
  transform-origin: center bottom;
  animation: duck-bob 5s ease-in-out infinite;
  filter: drop-shadow(0 0 24px rgba(255, 209, 102, 0.45)) drop-shadow(0 12px 8px rgba(0, 0, 0, 0.4));
  z-index: 2;
}
.chick-far {
  position: absolute;
  left: 6%;
  bottom: 11%;
  width: 52px;
  height: auto;
  pointer-events: none;
  opacity: 0.42;
  filter: brightness(0.5) saturate(0.5) drop-shadow(0 4px 4px rgba(0,0,0,0.5));
  transform-origin: center bottom;
  transform: scaleX(-1);
  animation: duck-bob 7s ease-in-out infinite;
  animation-delay: -2s;
  z-index: 1;
}

/* smooth scene brightness transitions */
.scene-layer { transition: filter 1.2s ease; }
.scene-layer svg { transition: opacity 1s ease; }

/* row 2 — left: title+menu, right: leaderboard */
.menu-block { grid-row: 2; grid-column: 1; align-self: center; }
.leaderboard { grid-row: 2 / span 2; grid-column: 3; align-self: stretch; max-height: calc(100vh - 48px); margin-top: 8px; }

/* row 3 — bottom-left: donate, bottom-center: version */
.donate-block { grid-row: 3; grid-column: 1; justify-self: start; align-self: end; }
.version-stamp {
  grid-row: 3;
  grid-column: 3;
  justify-self: end;
  align-self: end;
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--text-dim);
  text-transform: uppercase;
}

/* ------- Title ------- */
.title-wrap {
  margin-bottom: 38px;
  position: relative;
}
.title {
  font-family: "Bagel Fat One", "Outfit", system-ui;
  font-size: 120px;
  line-height: 0.88;
  letter-spacing: 0;
  margin: 0;
  color: var(--cyan-soft);
  text-shadow:
    0 0 12px rgba(139, 232, 255, 0.55),
    0 0 38px rgba(139, 232, 255, 0.35),
    0 0 80px rgba(96, 184, 220, 0.25);
  position: relative;
}
.title .duck-x {
  color: var(--warm-soft);
  text-shadow:
    0 0 14px rgba(255, 181, 107, 0.6),
    0 0 38px rgba(255, 181, 107, 0.35);
}
.title-sub {
  margin-top: 14px;
  font-family: "Outfit", sans-serif;
  font-weight: 500;
  letter-spacing: 0.4em;
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  padding-left: 6px;
}
.title-sub::before {
  content: "";
  display: inline-block;
  width: 28px;
  height: 1px;
  background: var(--text-muted);
  vertical-align: middle;
  margin-right: 14px;
  opacity: 0.6;
}

/* ------- Menu buttons ------- */
.menu-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(400px, 100%);
}

.menu-btn {
  position: relative;
  appearance: none;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--text);
  font-family: "Outfit", sans-serif;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  text-align: left;
  padding: 18px 20px 18px 52px;
  white-space: nowrap;
  cursor: pointer;
  border-radius: 14px;
  transition:
    transform .22s cubic-bezier(.2,.7,.2,1),
    background .22s ease,
    border-color .22s ease,
    color .22s ease,
    box-shadow .22s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
}

.menu-btn::before {
  /* leading marker */
  content: "";
  position: absolute;
  left: 22px;
  top: 50%;
  width: 14px;
  height: 2px;
  background: var(--cyan);
  transform: translateY(-50%);
  border-radius: 2px;
  transition: width .22s ease, background .22s ease;
}

.menu-btn .actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.menu-btn .chev {
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity .22s ease, transform .22s ease;
  color: var(--cyan);
  display: inline-flex;
}

.menu-btn:hover {
  background: rgba(20, 56, 76, 0.72);
  border-color: var(--panel-border-strong);
  color: #fff;
  transform: translateX(4px);
  box-shadow: 0 12px 40px -16px rgba(139, 232, 255, 0.45);
}
.menu-btn:hover::before { width: 22px; background: var(--cyan-soft); }
.menu-btn:hover .chev { opacity: 1; transform: translateX(0); }

.menu-btn.primary {
  background: linear-gradient(135deg, rgba(255, 181, 107, 0.22), rgba(139, 232, 255, 0.12));
  border-color: rgba(255, 181, 107, 0.35);
}
.menu-btn.primary::before { background: var(--warm); }
.menu-btn.primary .chev { color: var(--warm-soft); opacity: 0.8; transform: translateX(0); }
.menu-btn.primary:hover {
  background: linear-gradient(135deg, rgba(255, 181, 107, 0.36), rgba(139, 232, 255, 0.22));
  border-color: rgba(255, 181, 107, 0.6);
  box-shadow: 0 18px 50px -16px rgba(255, 181, 107, 0.6);
}
.menu-btn.primary:hover::before { background: var(--warm-soft); }

.menu-btn .kbd {
  font-family: "Outfit";
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--text-dim);
  border: 1px solid var(--panel-border);
  padding: 3px 8px;
  border-radius: 6px;
  margin-left: 12px;
}

/* ------- Generic glass panel ------- */
.panel {
  background: var(--panel-strong);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow:
    0 24px 60px -28px rgba(0,0,0,0.7),
    inset 0 1px 0 rgba(255,255,255,0.04);
}

/* ------- Profile / auth card ------- */
.profile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px 12px 12px;
  border-radius: 999px;
  min-width: 260px;
}
.profile .avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--duck), var(--bill));
  display: grid; place-items: center;
  color: #2a1606;
  font-weight: 700;
  font-size: 16px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
  position: relative;
}
.profile .avatar.guest {
  background: linear-gradient(135deg, #4a6878, #2a4858);
  color: var(--text);
}
.profile .avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.profile .avatar .dot {
  position: absolute;
  bottom: 0; right: 0;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #6df59b;
  border: 2px solid var(--bg-deep);
}
.profile .meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.profile .meta .name { font-weight: 600; font-size: 14px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile .meta .status { font-size: 11px; color: var(--text-muted); letter-spacing: 0.18em; text-transform: uppercase; }
.profile .logout {
  appearance: none;
  border: 1px solid transparent;
  background: rgba(255, 122, 138, 0.08);
  color: var(--danger);
  width: 36px; height: 36px;
  border-radius: 50%;
  display: grid; place-items: center;
  cursor: pointer;
  transition: all .2s ease;
}
.profile .logout:hover { background: rgba(255, 122, 138, 0.16); border-color: rgba(255, 122, 138, 0.32); }
.profile .stat-divider {
  width: 1px; height: 28px;
  background: var(--panel-border);
  margin: 0 4px;
}
.profile .quick-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.1;
  padding-right: 4px;
}
.profile .quick-stat .v { font-family: "Bagel Fat One", "Outfit"; font-size: 20px; color: var(--warm-soft); }
.profile .quick-stat .l { font-size: 9px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--text-muted); }

.account-profile {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  width: min(360px, 100%);
  min-width: min(300px, 100%);
  padding: 8px;
  border-radius: 999px;
  transition: border-radius .2s ease, border-color .2s ease, background .2s ease;
}

.account-profile.editing {
  border-radius: 24px;
  border-color: var(--panel-border-strong);
  background: rgba(8, 22, 32, 0.9);
}

.profile-display {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 1px auto 36px;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
  padding: 4px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .18s ease, box-shadow .18s ease;
}

.profile-display:hover {
  background: rgba(139, 232, 255, 0.06);
  box-shadow: inset 0 0 0 1px rgba(139, 232, 255, 0.1);
}

.profile-display .meta {
  min-width: 0;
}

.profile-display .meta .status {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-display .stat-divider {
  margin: 0;
}

.profile-display .quick-stat {
  min-width: 52px;
  padding-right: 0;
}

.username-editor {
  width: 100%;
  display: grid;
  gap: 10px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(139, 232, 255, 0.07), rgba(255, 181, 107, 0.04)),
    rgba(0, 0, 0, 0.2);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.username-editor-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.username-editor input {
  width: 100%;
  min-width: 0;
  appearance: none;
  border: 1px solid rgba(139, 232, 255, 0.18);
  background: rgba(2, 10, 15, 0.58);
  color: var(--text);
  padding: 11px 12px;
  border-radius: 10px;
  font: 600 14px "Outfit", system-ui, sans-serif;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.username-editor input::placeholder {
  color: var(--text-dim);
}

.username-editor input:focus {
  border-color: var(--cyan);
  background: rgba(2, 10, 15, 0.76);
  box-shadow: 0 0 0 3px rgba(139, 232, 255, 0.12);
}

.username-editor-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.editor-action {
  appearance: none;
  border: 1px solid var(--panel-border);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  min-height: 38px;
  border-radius: 10px;
  font-family: "Outfit", sans-serif;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.editor-action:hover {
  transform: translateY(-1px);
  border-color: var(--panel-border-strong);
  background: rgba(139, 232, 255, 0.1);
}

.editor-action.primary {
  border-color: rgba(255, 181, 107, 0.42);
  background: linear-gradient(135deg, rgba(255, 181, 107, 0.28), rgba(139, 232, 255, 0.12));
  color: #fff;
}

.editor-action.primary:hover {
  box-shadow: 0 10px 28px -16px rgba(255, 181, 107, 0.7);
}

.editor-action:disabled {
  cursor: wait;
  opacity: 0.62;
  transform: none;
}

/* signed-out card */
.auth-card {
  padding: 18px;
  width: min(320px, 100%);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.auth-card .title-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 11px; letter-spacing: 0.28em; text-transform: uppercase; color: var(--text-muted);
  margin-bottom: 4px;
}
.auth-card .title-row::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--warm); box-shadow: 0 0 10px var(--warm);
}

.btn-google, .btn-guest {
  appearance: none;
  border: 1px solid var(--panel-border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 12px;
  font-family: "Outfit";
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all .2s ease;
}
.btn-google {
  background: #fff;
  color: #1f1f1f;
  border-color: rgba(255,255,255,0.85);
}
.btn-google:hover { transform: translateY(-1px); box-shadow: 0 10px 30px -10px rgba(255,255,255,0.4); }
.btn-guest:hover { background: rgba(139, 232, 255, 0.08); border-color: var(--panel-border-strong); transform: translateY(-1px); }
.btn-google svg, .btn-guest svg { flex-shrink: 0; }
.btn-guest .small { margin-left: auto; font-weight: 400; font-size: 11px; color: var(--text-muted); letter-spacing: 0.16em; text-transform: uppercase; }

/* ------- Leaderboard ------- */
.leaderboard {
  display: flex;
  flex-direction: column;
  padding: 24px 24px 16px 24px;
  width: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.lb-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.lb-head h2 {
  margin: 0;
  font-family: "Bagel Fat One", "Outfit";
  font-size: 22px;
  letter-spacing: 0.02em;
  color: var(--text);
  display: flex;
  align-items: center;
}
.lb-head h2 .ico { color: var(--warm); margin-right: 6px; }
.lb-trophy-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  object-fit: contain;
  margin-right: 8px;
  filter: drop-shadow(0 0 8px rgba(139, 232, 255, 0.28));
}

.lb-tabs {
  display: flex;
  gap: 4px;
  background: rgba(0,0,0,0.25);
  border-radius: 10px;
  padding: 4px;
  border: 1px solid var(--panel-border);
}
.lb-tab {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: "Outfit";
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 7px 12px;
  border-radius: 7px;
  cursor: pointer;
  transition: all .2s ease;
}
.lb-tab:hover { color: var(--text); }
.lb-tab.active {
  background: linear-gradient(135deg, rgba(139, 232, 255, 0.18), rgba(255, 181, 107, 0.12));
  color: var(--text);
  box-shadow: 0 4px 14px -6px rgba(139, 232, 255, 0.5);
}

.lb-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 4px;
  margin-right: -6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(139, 232, 255, 0.18) transparent;
}
.lb-list::-webkit-scrollbar { width: 6px; }
.lb-list::-webkit-scrollbar-thumb { background: rgba(139, 232, 255, 0.18); border-radius: 4px; }

.lb-row {
  display: grid;
  grid-template-columns: 36px 32px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: all .18s ease;
  position: relative;
}
.lb-row:hover { background: rgba(139, 232, 255, 0.04); border-color: var(--panel-border); }
.lb-row.me {
  background: linear-gradient(90deg, rgba(255, 181, 107, 0.12), rgba(255, 181, 107, 0.02));
  border-color: rgba(255, 181, 107, 0.32);
}
.lb-row.me::before {
  content: "";
  position: absolute;
  left: -22px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; background: var(--warm); border-radius: 2px;
  box-shadow: 0 0 10px var(--warm);
}

.rank {
  font-family: "Bagel Fat One", "Outfit";
  font-size: 18px;
  color: var(--text-muted);
  text-align: center;
}
.rank.r1 { color: var(--gold); text-shadow: 0 0 12px rgba(255, 209, 102, 0.55); }
.rank.r2 { color: var(--silver); }
.rank.r3 { color: var(--bronze); }

.lb-row .avatar-sm {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5a8092, #2c4a5a);
  display: grid; place-items: center;
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  border: 1px solid rgba(255,255,255,0.08);
}

.lb-row .name { font-weight: 600; font-size: 14px; color: var(--text); display: flex; align-items: center; gap: 8px; min-width: 0; }
.lb-row .name .badge {
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  background: rgba(255, 181, 107, 0.16);
  color: var(--warm-soft);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
}
.lb-row .score {
  font-family: "Bagel Fat One", "Outfit";
  font-size: 18px;
  color: var(--cyan-soft);
  letter-spacing: 0.02em;
}
.lb-row .score-meta { font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-dim); margin-top: -2px; text-align: right; }

.lb-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 4px 4px;
  border-top: 1px solid var(--panel-border);
  margin-top: 10px;
}
.lb-foot .you-pill {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; color: var(--text-muted);
}
.lb-foot .you-pill .pos {
  font-family: "Bagel Fat One"; font-size: 18px; color: var(--warm-soft);
}
.lb-foot .refresh {
  appearance: none; background: transparent; border: none;
  color: var(--text-muted); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  transition: color .2s ease;
}
.lb-foot .refresh:hover { color: var(--cyan); }
.lb-foot .refresh.spinning svg { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------- Donate ------- */
.donate {
  appearance: none;
  background: rgba(11, 28, 39, 0.55);
  border: 1px solid var(--panel-border);
  color: var(--text);
  padding: 10px 18px 10px 14px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: "Outfit";
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  white-space: nowrap;
  backdrop-filter: blur(12px);
  transition: all .2s ease;
}
.donate:hover {
  background: rgba(255, 122, 138, 0.14);
  border-color: rgba(255, 122, 138, 0.36);
  color: #ffd0d6;
  transform: translateY(-1px);
}
.donate .heart { color: var(--danger); font-size: 14px; transition: transform .25s ease; }
.donate:hover .heart { transform: scale(1.18); }

/* ------- Modal (How to play / Settings) ------- */
.modal-scrim {
  position: fixed; inset: 0;
  background: rgba(2, 8, 14, 0.55);
  backdrop-filter: blur(8px);
  z-index: 50;
  display: grid; place-items: center;
  padding: 40px;
  animation: fadeIn .25s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: min(640px, 100%);
  padding: 32px 36px 28px;
  position: relative;
  animation: popIn .35s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes popIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.modal h3 {
  font-family: "Bagel Fat One", "Outfit"; font-size: 28px; margin: 0 0 8px 0; color: var(--cyan-soft);
}
.modal .modal-sub { font-size: 12px; letter-spacing: 0.28em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 22px; }
.modal .close {
  position: absolute; top: 20px; right: 22px;
  appearance: none; background: transparent; border: 1px solid var(--panel-border);
  width: 36px; height: 36px; border-radius: 50%; color: var(--text-muted);
  display: grid; place-items: center; cursor: pointer;
  transition: all .2s ease;
}
.modal .close:hover { color: var(--text); border-color: var(--panel-border-strong); }

.how-rows { display: flex; flex-direction: column; gap: 14px; }
.how-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(139, 232, 255, 0.04);
  border: 1px solid var(--panel-border);
}
.how-row .key {
  display: flex; gap: 4px;
}
.how-row .key span {
  font-family: "Outfit"; font-weight: 700; font-size: 13px;
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--panel-border-strong);
  color: var(--cyan-soft);
  padding: 6px 10px;
  border-radius: 8px;
  min-width: 34px;
  text-align: center;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.3);
}
.how-row .desc { font-size: 14px; color: var(--text); }
.how-row .desc small { display: block; color: var(--text-muted); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; margin-top: 2px; }

.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 4px;
  border-bottom: 1px solid var(--panel-border);
}
.settings-row:last-child { border-bottom: none; }
.settings-row .label { font-size: 14px; color: var(--text); }
.settings-row .label small { display: block; color: var(--text-muted); font-size: 11px; margin-top: 2px; }
.switch {
  width: 44px; height: 24px; border-radius: 999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--panel-border);
  position: relative;
  cursor: pointer;
  transition: background .2s ease;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--text-muted);
  transition: all .22s cubic-bezier(.2,.7,.2,1);
}
.switch.on { background: rgba(139, 232, 255, 0.22); border-color: var(--panel-border-strong); }
.switch.on::after { left: 22px; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }

.bgm-select {
  appearance: none;
  background: rgba(11, 28, 39, 0.8);
  border: 1px solid var(--panel-border);
  color: var(--text);
  font-family: "Outfit", sans-serif;
  font-size: 13px;
  padding: 6px 30px 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  outline: none;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%238be8ff%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 10px top 50%;
  background-size: 10px auto;
  transition: border-color .2s ease;
}
.bgm-select:hover { border-color: var(--cyan-soft); }
.bgm-select option { background: var(--bg-deep); color: var(--text); }

.slider-row { display: flex; align-items: center; gap: 12px; }
.slider-row input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 140px; height: 4px; border-radius: 4px;
  background: rgba(255,255,255,0.08);
}
.slider-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--cyan); cursor: pointer; box-shadow: 0 0 10px var(--cyan);
}

/* ------- Donate Modal (YouTube banner + QR) ------- */
.donate-modal {
  width: min(720px, 100%);
  padding: 0 0 26px 0;
  overflow: hidden;
}
.donate-modal .close {
  background: rgba(0, 0, 0, 0.45);
  border-color: rgba(255, 255, 255, 0.18);
  color: #fff;
  z-index: 3;
}
.donate-modal .donate-title {
  font-family: "Bagel Fat One", "Outfit";
  font-size: 26px;
  margin: 22px 32px 6px;
  color: var(--cyan-soft);
}
.donate-modal .modal-sub {
  margin: 0 32px 22px;
  font-size: 11px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* YouTube banner */
.yt-banner {
  display: block;
  position: relative;
  height: 168px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.yt-banner-bg {
  position: absolute; inset: 0;
  background: url('assets/channels4_banner.jpg') center/cover no-repeat;
}
.yt-banner-bg::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 60%);
}
.yt-banner-content {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 16px;
  padding: 0 32px 22px;
  height: 100%;
  z-index: 2;
}
.yt-avatar {
  width: 78px; height: 78px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid #fff;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  display: grid; place-items: center;
  flex-shrink: 0;
  position: relative;
  transform: translateY(8px);
}
.yt-avatar img {
  width: 110%;
  height: 110%;
  object-fit: cover;
  object-position: center 30%;
}
.yt-meta {
  flex: 1;
  min-width: 0;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  padding-bottom: 4px;
}
.yt-handle-row {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.95);
  font-weight: 600;
}
.yt-handle-row .yt-logo { display: inline-flex; align-items: center; }
.yt-handle { background: rgba(0,0,0,0.25); padding: 3px 10px; border-radius: 999px; }
.yt-verified { display: inline-flex; }
.yt-channel-name {
  font-family: "Bagel Fat One", "Outfit";
  font-size: 28px;
  line-height: 1.1;
  margin-top: 4px;
}
.yt-stats {
  margin-top: 4px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.92;
}
.yt-stats b { font-weight: 700; }
/* Donate grid */
.donate-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 22px;
  padding: 0 32px;
  align-items: start;
}
.qr-card {
  display: flex; flex-direction: column; gap: 10px;
  align-items: center;
}
.qr-frame {
  position: relative;
  width: 200px;
  height: 200px;
  padding: 12px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 16px 40px -16px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255,255,255,0.08);
}
.qr-frame img { width: 100%; height: 100%; display: block; }
.qr-corner {
  position: absolute;
  width: 14px; height: 14px;
  border: 2px solid var(--cyan);
  filter: drop-shadow(0 0 6px rgba(139, 232, 255, 0.6));
}
.qr-corner.tl { top: -4px; left: -4px; border-right: none; border-bottom: none; border-top-left-radius: 4px; }
.qr-corner.tr { top: -4px; right: -4px; border-left: none; border-bottom: none; border-top-right-radius: 4px; }
.qr-corner.bl { bottom: -4px; left: -4px; border-right: none; border-top: none; border-bottom-left-radius: 4px; }
.qr-corner.br { bottom: -4px; right: -4px; border-left: none; border-top: none; border-bottom-right-radius: 4px; }
.qr-caption { text-align: center; line-height: 1.3; }
.qr-label { font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--cyan-soft); font-weight: 600; }
.qr-hint { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* Action rows */
.donate-actions { display: flex; flex-direction: column; gap: 10px; }
.donate-row {
  display: flex; align-items: center; gap: 12px;
  background: rgba(139, 232, 255, 0.04);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 12px 14px;
  transition: border-color .2s ease, background .2s ease;
}
.donate-row:hover { border-color: var(--panel-border-strong); background: rgba(139, 232, 255, 0.07); }
.donate-row-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.donate-row-icon.yt   { background: rgba(255, 0, 51, 0.12); }
.donate-row-icon.link { background: rgba(139, 232, 255, 0.12); color: var(--cyan-soft); }
.donate-row-icon.heart{ background: rgba(255, 122, 138, 0.12); color: var(--danger); }
.donate-row-text { flex: 1; min-width: 0; }
.donate-row-text .t { font-size: 14px; color: var(--text); font-weight: 600; }
.donate-row-text .s { font-size: 11px; color: var(--text-muted); margin-top: 2px; letter-spacing: 0.06em; }
.donate-row-btn {
  appearance: none;
  border: 1px solid var(--panel-border-strong);
  background: transparent;
  color: var(--cyan-soft);
  padding: 8px 14px;
  border-radius: 999px;
  font-family: "Outfit";
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: all .2s ease;
}
.donate-row-btn:hover { background: rgba(139, 232, 255, 0.12); transform: translateY(-1px); }
.donate-row-btn.primary {
  background: linear-gradient(135deg, #ff2a3e, #ff5a3a);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 20px -8px rgba(255, 42, 62, 0.7);
}
.donate-row-btn.primary:hover { box-shadow: 0 10px 28px -8px rgba(255, 42, 62, 0.9); }
.donate-row-emoji { font-size: 20px; padding: 0 8px; }

.donate-foot {
  margin: 22px 32px 0;
  padding: 14px 16px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px dashed var(--panel-border);
  border-radius: 10px;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-align: center;
}

@media (max-width: 640px) {
  .donate-grid { grid-template-columns: 1fr; }
  .qr-card { align-self: center; }
}

/* ------- Toast ------- */
.toast {
  position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%);
  background: var(--panel-strong);
  border: 1px solid var(--panel-border-strong);
  border-radius: 999px;
  padding: 10px 18px 10px 14px;
  font-size: 13px;
  color: var(--text);
  display: flex; align-items: center; gap: 10px;
  z-index: 60;
  backdrop-filter: blur(12px);
  animation: toastIn .35s cubic-bezier(.2,.9,.3,1.2);
}
.toast .check {
  width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan), #6da6c8);
  color: #04161e; display: grid; place-items: center; font-weight: 800; font-size: 13px;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ------- Scene animation ------- */
@keyframes float-y { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes shimmer { 0%,100% { opacity: 0.4; } 50% { opacity: 0.9; } }
@keyframes drift-x { 0% { transform: translateX(0); } 100% { transform: translateX(40px); } }
@keyframes firefly {
  0%, 100% { opacity: 0; }
  20%, 80% { opacity: 1; }
}
@keyframes duck-bob {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-6px) rotate(1deg); }
}
@keyframes ripple {
  0% { transform: scale(0.6); opacity: 0.6; }
  100% { transform: scale(1.6); opacity: 0; }
}
@keyframes star-twinkle { 0%,100% { opacity: 0.4; } 50% { opacity: 1; } }

.duck-mascot { animation: duck-bob 5s ease-in-out infinite; transform-origin: center bottom; }
.firefly { animation: firefly 4s ease-in-out infinite; }
.water-shimmer { animation: shimmer 5s ease-in-out infinite; }
.star { animation: star-twinkle 4s ease-in-out infinite; }

/* ============================================================
   Responsive: mobile landscape, iPad, laptop, desktop, 21" PC
   ============================================================ */

/* Safety net: allow body to scroll if anything overflows the viewport.
   These rules MUST defeat src/styles.css (which applies `display: flex;
   overflow: hidden` to body) — index.html loads src/styles.css first so
   the cascade resolves here.
   Use svh (small viewport height) instead of vh so we don't reserve space
   for the Safari/Chrome mobile URL bar — otherwise content gets pushed
   off-screen and forces scrolling on iPhone landscape. */
html, body {
  overflow-x: hidden;
  overflow-y: auto;
  display: block;
  min-height: 100svh;
  height: auto;
}

/* Keep scene background pinned to viewport while content scrolls */
.app { min-height: 100svh; height: auto; overflow: visible; }
.scene-layer { position: fixed; }

/* ── Big monitors / 21"+ ── */
@media (min-width: 1700px) {
  .ui-layer {
    padding: 48px 80px;
    gap: 36px;
    grid-template-columns: minmax(480px, 600px) 1fr minmax(400px, 500px);
  }
  .title { font-size: 132px; }
  .menu-list { width: 430px; }
}

/* ── Standard desktop / laptop already covered by base grid (1280–1699 wide) ── */

/* ── Shorter viewports (windowed browser, laptop with chrome) ── */
@media (max-height: 820px) {
  .ui-layer { padding: 18px 32px; gap: 12px; }
  .title { font-size: 76px; }
  .title-wrap { margin-bottom: 18px; }
  .menu-block { align-self: start; padding-top: 20px; }
  .leaderboard { max-height: calc(100vh - 24px); }
  .clock-block .clock { min-width: 220px; padding: 10px 16px; }
  .clock-time { font-size: 26px; }
}

@media (max-height: 640px) {
  .ui-layer { padding: 14px 28px; gap: 10px; }
  .title { font-size: 52px; }
  .title-wrap { margin-bottom: 10px; }
  .menu-block { padding-top: 12px; }
  /* keep padding-left ≥ 50px so the ::before marker doesn't overlap text */
  .menu-btn { padding: 12px 18px 12px 50px; font-size: 14px; }
  .clock-block .clock { padding: 8px 12px; min-width: auto; }
  .clock-time { font-size: 20px; }
  .clock-meta { font-size: 9px; }
  .donate-block, .version-stamp { display: none; }
}

/* ── iPad landscape / small laptop (1024–1279) ── */
@media (max-width: 1279px) {
  .ui-layer {
    padding: 24px 32px;
    gap: 18px;
    grid-template-columns: minmax(340px, 440px) 1fr minmax(300px, 380px);
  }
  .title { font-size: 88px; }
}

/* ── iPad portrait / large mobile (≤ 1023 wide): stack the layout ── */
@media (max-width: 1023px) {
  .ui-layer {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto;
    gap: 14px;
    padding: 18px 22px;
    align-items: start;
  }
  .clock-block { grid-row: 1; grid-column: 1; }
  .top-bar     { grid-row: 1; grid-column: 2; }
  .menu-block  { grid-row: 2; grid-column: 1 / -1; align-self: start; padding-top: 0; }
  .leaderboard { grid-row: 3; grid-column: 1 / -1; max-height: 440px; margin-top: 0; align-self: stretch; }
  .donate-block{ grid-row: 4; grid-column: 1; align-self: start; }
  .version-stamp { display: none; }

  .title { font-size: 76px; }
  .title-wrap { margin-bottom: 16px; }
  .chick-mascot { width: 100px; left: auto; right: 6%; }
  .chick-far { display: none; }
}

/* ── Mobile landscape (short + wide) ── */
@media (max-height: 500px) and (orientation: landscape) {
  /* Lock the menu to a single viewport — no page scroll.
     Internal panels (leaderboard) handle their own overflow. */
  html, body { min-height: 100svh; height: 100svh; overflow: hidden; }
  .app { min-height: 100svh; height: 100svh; overflow: hidden; }

  /* In-game gear: pinned to the very top-right corner, small (32px) so it
     sits in the ~80px gap to the right of the canvas-drawn TOTAL SCORE /
     DISTANCE HUD (which is right-aligned at VIEW_WIDTH-110). */
  .in-game-settings-btn {
    top: calc(6px + env(safe-area-inset-top));
    right: calc(6px + env(safe-area-inset-right));
    width: 32px;
    height: 32px;
  }

  .ui-layer {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    padding:
      calc(6px + env(safe-area-inset-top))
      calc(12px + env(safe-area-inset-right))
      calc(6px + env(safe-area-inset-bottom))
      calc(12px + env(safe-area-inset-left));
    gap: 8px;
    align-items: stretch;
    height: 100svh;
    max-width: 100%;
  }
  .clock-block { grid-row: 1; grid-column: 1; min-width: 0; }
  .top-bar     { grid-row: 1; grid-column: 2; justify-self: end; min-width: 0; }
  .menu-block  { grid-row: 2; grid-column: 1; align-self: center; padding-top: 0; min-width: 0; }
  .leaderboard { grid-row: 2; grid-column: 2; max-height: 100%; height: 100%; min-height: 0; margin-top: 0; }
  .version-stamp { display: none; }
  .donate-block {
    grid-row: 3;
    grid-column: 1 / -1;
    position: static;
    justify-self: center;
    width: auto;
    z-index: auto;
  }
  .donate {
    width: auto;
    justify-content: center;
    padding: 7px 14px;
    font-size: 10px;
    letter-spacing: 0.14em;
  }

  .title { font-size: 34px; }
  .title-wrap { margin-bottom: 6px; }
  .title-sub { display: none; }
  /* preserve padding-left so ::before marker doesn't overlap text */
  .menu-btn { padding: 7px 12px 7px 42px; font-size: 11px; letter-spacing: 0.16em; border-radius: 10px; }
  .menu-btn::before { left: 16px; width: 12px; }
  .menu-btn .kbd { display: none; }
  .menu-list { gap: 6px; width: 100%; }
  .clock { padding: 5px 10px; min-width: auto; border-radius: 12px; }
  .clock::before { top: 8px; height: 22px; }
  .clock-time { font-size: 16px; }
  .clock-meta { font-size: 8px; margin-top: 3px; gap: 6px; }
  .auth-card {
    width: 100%;
    padding: 8px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .auth-card .title-row { display: none; }
  .btn-google, .btn-guest {
    min-height: 42px;
    justify-content: center;
    padding: 8px 10px;
    font-size: 12px;
  }
  .btn-guest .small { display: none; }
  .account-profile {
    width: 100%;
    min-width: 0;
    padding: 7px;
  }
  .account-profile.editing { border-radius: 18px; }
  .profile-display {
    grid-template-columns: 40px minmax(0, 1fr) 1px minmax(44px, auto) 34px;
    gap: 8px;
    padding: 2px;
  }
  .profile .avatar { width: 40px; height: 40px; }
  .profile .meta .status { font-size: 10px; letter-spacing: 0.12em; }
  .username-editor {
    margin-top: 6px;
    padding: 8px;
    gap: 8px;
  }
  .username-editor input {
    padding: 9px 10px;
    font-size: 13px;
  }
  .editor-action {
    min-height: 34px;
    font-size: 11px;
    letter-spacing: 0.12em;
  }
  .lb-head { margin-bottom: 8px; }
  .lb-head h2 { font-size: 18px; }
  .lb-tabs { padding: 3px; }
  .lb-tab { padding: 6px 8px; font-size: 10px; letter-spacing: 0.1em; }
  .leaderboard { padding: 12px; }
  .lb-row { grid-template-columns: 30px 26px 1fr auto; gap: 8px; padding: 6px 8px; }
  .lb-row .avatar-sm { width: 24px; height: 24px; }
  .lb-row .name { font-size: 12px; }
  .lb-row .score { font-size: 14px; }
  .lb-foot { padding-top: 8px; margin-top: 6px; }
  .modal-scrim { padding: 10px 14px; }
  .modal {
    width: min(560px, 100%);
    max-height: calc(100svh - 20px);
    overflow: auto;
    padding: 18px 20px;
  }
  .modal h3 { font-size: 22px; }
  .modal .modal-sub { margin-bottom: 12px; }
  /* Donate / Credits modal — used by both #modal-donate and #modal-credits.
     Compact every section so the whole popup fits a ~430px iPhone landscape
     viewport without scrolling. Keep internal scroll as a safety net. */
  .donate-modal {
    max-height: calc(100svh - 20px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 14px;
  }
  .donate-modal .yt-banner { height: 86px; }
  .donate-modal .yt-banner-content { padding: 0 16px 10px; gap: 10px; }
  .donate-modal .yt-avatar { width: 46px; height: 46px; border-width: 2px; transform: translateY(4px); }
  .donate-modal .yt-channel-name { font-size: 18px; margin-top: 2px; }
  .donate-modal .yt-handle-row { font-size: 10px; }
  .donate-modal .yt-stats { font-size: 9px; margin-top: 2px; }
  .donate-modal .donate-title { font-size: 18px; margin: 10px 16px 2px; }
  .donate-modal .modal-sub { display: none; }
  .donate-modal .donate-grid {
    grid-template-columns: 120px 1fr;
    gap: 12px;
    padding: 0 16px;
  }
  .donate-modal .qr-frame { width: 120px; height: 120px; padding: 8px; }
  .donate-modal .qr-caption { display: none; }
  .donate-modal .donate-actions { gap: 6px; }
  .donate-modal .donate-row { padding: 6px 8px; gap: 8px; }
  .donate-modal .donate-row-icon { width: 28px; height: 28px; border-radius: 8px; }
  .donate-modal .donate-row-text .t { font-size: 12px; }
  .donate-modal .donate-row-text .s { font-size: 10px; margin-top: 1px; }
  .donate-modal .donate-row-btn { padding: 5px 10px; font-size: 10px; }
  .donate-modal .donate-foot {
    margin: 10px 16px 0;
    padding: 8px 10px;
    font-size: 10px;
  }
  .how-rows { gap: 8px; }
  .how-row { padding: 8px 10px; gap: 10px; }
  .settings-row { padding: 10px 4px; }
  .toast { bottom: 16px; }
  .chick-mascot, .chick-far { display: none; }
}

/* ── Mobile portrait (≤ 600 wide) ── */
@media (max-width: 600px) {
  .in-game-settings-btn {
    top: calc(12px + env(safe-area-inset-top));
    right: calc(12px + env(safe-area-inset-right));
    width: 44px;
    height: 44px;
  }

  .ui-layer {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto;
    padding: 12px 12px calc(72px + env(safe-area-inset-bottom));
    gap: 12px;
  }
  .clock-block { grid-row: 1; grid-column: 1; justify-self: stretch; }
  .top-bar     { grid-row: 2; grid-column: 1; justify-self: stretch; }
  .top-bar > .panel { width: 100%; }
  .menu-block  { grid-row: 3; grid-column: 1; padding-top: 0; }
  .leaderboard { grid-row: 4; grid-column: 1; max-height: min(340px, 38svh); }
  .version-stamp { display: none; }
  .donate-block {
    display: block;
    position: fixed;
    left: 12px;
    right: 12px;
    width: calc(100vw - 24px);
    bottom: calc(12px + env(safe-area-inset-bottom));
    z-index: 5;
  }
  .donate {
    width: 100%;
    justify-content: center;
    padding: 12px 14px;
  }

  .title { font-size: 54px; }
  .title-wrap { margin-bottom: 12px; }
  .clock { min-width: auto; padding: 8px 12px; }
  .clock-time { font-size: 22px; }
  .clock-meta .sep, .clock-meta .date { display: none; }
  .menu-btn { padding: 14px 16px 14px 48px; font-size: 14px; }
  .lb-row { padding: 6px 8px; font-size: 12px; }
  .profile { padding: 10px; }
  .account-profile {
    width: 100%;
    min-width: 0;
    border-radius: 22px;
  }
  .account-profile:not(.editing) { border-radius: 22px; }
  .profile-display {
    grid-template-columns: 40px minmax(0, 1fr) 1px auto 34px;
    gap: 8px;
    padding: 2px;
  }
  .profile .quick-stat .v { font-size: 16px; }
  .auth-card { padding: 12px; }
  .chick-mascot, .chick-far { display: none; }
}
