:root {
  --ink: #12203a;
  --ink-dark: #0a1420;
  --panel: #16233d;
  --panel-2: #1d2e4f;
  --text: #ffffff;
  --gold: #ffd23c;
  --good: #3ee07a;
  --red: #ff4d62;
  --cyan: #2ee6ff;
  --shadow: 5px 5px 0 rgba(6, 12, 24, 0.55);
  --font: "Consolas", "Cascadia Mono", "Courier New", monospace;
  --cursor-hover: url("../assets/ui/cursor-hover.png") 8 9, auto;
  --cursor-select: url("../assets/ui/cursor-select.png") 8 9, pointer;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  color: var(--text);
  background: var(--ink-dark);
  cursor: var(--cursor-hover);
  user-select: none;
}

button { cursor: var(--cursor-hover); font-family: var(--font); }
img { image-rendering: pixelated; }
canvas { image-rendering: pixelated; }

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
}
.screen.visible {
  display: flex;
  animation: screenIn 0.28s ease-out;
}
@keyframes screenIn {
  from { opacity: 0; transform: translate3d(0, 8px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

.px-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 22px;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--text);
  background: var(--panel-2);
  border: 3px solid var(--ink-dark);
  box-shadow: inset -3px -3px 0 rgba(0, 0, 0, 0.35), inset 3px 3px 0 rgba(255, 255, 255, 0.18), var(--shadow);
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.45);
}
.px-btn img { width: 22px; height: 22px; }
.px-btn:hover { transform: translate(-2px, -2px); box-shadow: inset -3px -3px 0 rgba(0, 0, 0, 0.35), inset 3px 3px 0 rgba(255, 255, 255, 0.18), 7px 7px 0 rgba(6, 12, 24, 0.55); filter: brightness(1.08); }
.px-btn:active { transform: translate(2px, 2px); box-shadow: inset 3px 3px 0 rgba(0, 0, 0, 0.35), var(--shadow); cursor: var(--cursor-select); }

.px-btn.good { background: var(--good); color: #062a14; text-shadow: none; }
.px-btn.gold { background: var(--gold); color: #3a2a04; text-shadow: none; }
.px-btn.danger { background: var(--red); color: #33060c; text-shadow: none; }
.px-btn.small { padding: 8px 14px; font-size: 13px; }
.px-btn.tiny { padding: 5px 9px; font-size: 11px; letter-spacing: 1px; }
.px-btn:disabled { opacity: 0.45; pointer-events: none; filter: grayscale(0.2); }

/* ---------- HOME ---------- */
#screen-home {
  background: linear-gradient(180deg, #4db2f7 0%, #7cc9ff 55%, #a8ddff 100%);
  overflow: hidden;
}

.home-fx {
  display: none;
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.home-glow {
  position: absolute;
  inset: auto 10% -40px;
  height: 180px;
  background: radial-gradient(ellipse at center, rgba(46, 230, 255, 0.16), transparent 70%);
}
.home-stars {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(2px 2px at 8% 18%, #fff, transparent),
    radial-gradient(2px 2px at 22% 42%, #9be7ff, transparent),
    radial-gradient(1px 1px at 36% 12%, #fff, transparent),
    radial-gradient(2px 2px at 48% 28%, #ffd0d6, transparent),
    radial-gradient(1px 1px at 62% 16%, #fff, transparent),
    radial-gradient(2px 2px at 74% 38%, #9be7ff, transparent),
    radial-gradient(1px 1px at 88% 22%, #fff, transparent),
    radial-gradient(2px 2px at 14% 68%, #fff, transparent),
    radial-gradient(1px 1px at 31% 78%, #9be7ff, transparent),
    radial-gradient(2px 2px at 57% 72%, #fff, transparent),
    radial-gradient(1px 1px at 81% 64%, #ffd0d6, transparent),
    radial-gradient(2px 2px at 93% 80%, #fff, transparent);
  opacity: 0.85;
}

.fx-cube {
  position: absolute;
  width: 28px;
  height: 28px;
  image-rendering: pixelated;
  opacity: 0.55;
  background: none;
  border: 0;
  box-shadow: none;
  outline: none;
  will-change: transform;
  animation: cubeDrift 7.5s ease-in-out infinite;
}
.fx-cube.c1 { left: 8%; top: 22%; animation-duration: 8.2s; }
.fx-cube.c2 { right: 10%; top: 30%; width: 22px; height: 22px; animation-duration: 6.6s; animation-delay: -2s; }
.fx-cube.c3 { left: 16%; bottom: 16%; width: 18px; height: 18px; animation-duration: 9s; animation-delay: -4s; }
@keyframes cubeDrift {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(0deg); }
  50% { transform: translate3d(0, -18px, 0) rotate(12deg); }
}

.home-center {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 34px;
}

.home-logo {
  width: min(520px, 80vw);
  filter: drop-shadow(6px 8px 0 rgba(6, 12, 24, 0.45));
  animation: logoBob 3.4s ease-in-out infinite;
}
@keyframes logoBob { 0%, 100% { transform: translate3d(0, 0, 0) rotate(-1deg); } 50% { transform: translate3d(0, -10px, 0) rotate(1deg); } }

.home-buttons { display: flex; flex-direction: column; gap: 16px; width: min(320px, 84vw); }
.home-buttons .px-btn { width: 100%; justify-content: flex-start; font-size: 20px; padding: 14px 20px; }
.home-buttons .px-btn img { width: 26px; height: 26px; }
.home-buttons .px-btn span { line-height: 1; }
.lotd {
  width: min(320px, 84vw);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  background: rgba(10, 16, 24, 0.92);
  border: 3px solid var(--gold);
  box-shadow: 4px 4px 0 rgba(6, 12, 24, 0.35), 0 0 18px rgba(255, 210, 60, 0.25);
  padding: 10px 14px;
  cursor: pointer;
  color: var(--text);
  font-family: var(--font);
}
.lotd:hover { filter: brightness(1.12); }
.lotd-kicker { font-size: 10px; font-weight: 900; letter-spacing: 2px; color: var(--gold); }
.lotd-title { font-size: 17px; font-weight: 900; letter-spacing: 1px; color: #ffffff; text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.6); }
.lotd-by { font-size: 11px; color: #c8d8f0; letter-spacing: 1px; }
.lotd-play { font-size: 12px; font-weight: 900; letter-spacing: 2px; color: var(--good); margin-top: 2px; }

.home-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}
.home-skin { display: none; }
.home-stats {
  margin: 0;
  font-weight: 700;
  letter-spacing: 1px;
  color: #0d3557;
  background: rgba(255, 255, 255, 0.75);
  border: 3px solid var(--ink-dark);
  box-shadow: 4px 4px 0 rgba(6, 12, 24, 0.35);
  padding: 7px 16px;
}
.home-account {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  font-weight: 900;
  letter-spacing: 1px;
  color: #0d3557;
  background: rgba(255, 255, 255, 0.75);
  border: 3px solid var(--ink-dark);
  box-shadow: 4px 4px 0 rgba(6, 12, 24, 0.35);
  padding: 7px 14px;
}
.home-account.hidden { display: none; }
.home-account b { color: #12203a; }
.acct-tag-wrap { white-space: normal; }
.acct-tag {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border: 2px solid var(--gold);
  background: var(--ink-dark);
  color: var(--gold);
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 0.5px;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.35);
  vertical-align: 1px;
}
.rank-chip {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border: 2px solid var(--good);
  background: var(--ink-dark);
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 0.5px;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.35);
  vertical-align: 1px;
  white-space: nowrap;
}
.release {
  background: var(--panel-2);
  border: 2px solid var(--ink-dark);
  padding: 8px 10px;
  margin-bottom: 8px;
}
.release.latest { border-color: var(--gold); }
.release-head { display: flex; gap: 8px; align-items: baseline; font-size: 13px; }
.release-head b { color: var(--gold); }
.release-new {
  margin-left: auto;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #062a14;
  background: var(--gold);
  padding: 1px 6px;
}
.release-items { margin: 6px 0 2px; padding-left: 18px; font-size: 12px; }
.release-items li { margin-bottom: 2px; }
body.has-newver #btnSettingsHome::after {
  content: "";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid var(--ink-dark);
  box-shadow: 0 0 8px rgba(255, 210, 60, 0.8);
}
.n-title .acct-tag, .n-sub .acct-tag, .lb-name .acct-tag, h2 .acct-tag {
  font-size: 10px;
  letter-spacing: 0.4px;
}
.ui-space .home-account {
  color: #c8d8f0;
  background: rgba(10, 18, 32, 0.82);
}
.ui-space .home-account b { color: var(--cyan); }
.tag-preview {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.5px;
  padding: 8px 6px;
  text-align: center;
  line-height: 1.25;
  white-space: normal;
}
.avatar-frame {
  display: inline-flex;
  padding: 2px;
  border-radius: 6px;
  line-height: 0;
}
.avatar-frame img { display: block; }
.frame-bronze { border: 3px solid #b0783c; background: #3a2415; }
.frame-silver { border: 3px solid #cfd8e6; background: #2a3444; box-shadow: 0 0 8px rgba(207, 216, 230, 0.5); }
.frame-neon { border: 3px solid var(--cyan); box-shadow: 0 0 10px var(--cyan), inset 0 0 6px rgba(46, 230, 255, 0.4); }
.frame-royal { border: 3px solid #b45cff; background: #1c1030; box-shadow: 0 0 10px rgba(180, 92, 255, 0.6); }
.frame-inferno { border: 3px solid #ff5a1a; background: #2a0f06; box-shadow: 0 0 12px rgba(255, 90, 26, 0.7); }
.frame-prism {
  border: 3px solid transparent;
  background: linear-gradient(#16233d, #16233d) padding-box,
    linear-gradient(135deg, #ff5a5a, #ffd23c, #3ee07a, #2ee6ff, #b45cff) border-box;
  box-shadow: 0 0 12px rgba(255, 210, 60, 0.35);
}
.trail-preview {
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: center;
  padding: 12px 6px;
}
.trail-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* ---------- TOP BAR / LEVELS ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--panel);
  border-bottom: 4px solid var(--ink-dark);
}
.bar-title { margin: 0; font-size: 22px; letter-spacing: 4px; text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.4); }
.bar-spacer { flex: 1; }

#screen-levels,
#screen-network,
#screen-netsaved,
#screen-netsearch {
  background:
    radial-gradient(ellipse at 50% -10%, rgba(46, 230, 255, 0.08), transparent 50%),
    linear-gradient(180deg, #0d1830 0%, #101f3c 100%);
}

.level-list {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px;
  width: min(760px, 100%);
  margin: 0 auto;
}

.level-card {
  display: flex;
  align-items: center;
  gap: 16px;
  text-align: left;
  padding: 16px 18px;
  background: var(--panel-2);
  border: 3px solid var(--ink-dark);
  border-left-width: 8px;
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.09), var(--shadow);
  color: var(--text);
  cursor: pointer;
  animation: cardIn 0.32s ease-out both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translate3d(-12px, 0, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}
.level-card.diff-1 { border-left-color: var(--good); }
.level-card.diff-2 { border-left-color: var(--gold); }
.level-card.diff-3 { border-left-color: #ff9d2e; }
.level-card.diff-4 { border-left-color: #ff5a1a; }
.level-card.diff-5 { border-left-color: var(--red); }
.level-card.cleared { background: #1a3a2a; }
.level-card:hover { transform: translate(-2px, -2px); box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.09), 7px 7px 0 rgba(6, 12, 24, 0.55); filter: brightness(1.1); }
.level-card:active { transform: translate(2px, 2px); cursor: var(--cursor-select); }
.level-num {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 900;
  color: #062a14;
  background: var(--good);
  border: 3px solid var(--ink-dark);
  box-shadow: inset -3px -3px 0 rgba(0, 0, 0, 0.25);
}
.level-info { flex: 1; min-width: 0; }
.level-name { font-size: 19px; font-weight: 900; letter-spacing: 1px; text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.4); }
.level-meta { font-size: 12px; color: #9db4d8; margin-top: 4px; letter-spacing: 1px; }
.level-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 1px;
  color: var(--cyan);
  background: rgba(46, 230, 255, 0.12);
  border: 2px solid var(--ink-dark);
  padding: 1px 6px;
}
.level-done {
  font-weight: 900;
  font-size: 13px;
  letter-spacing: 1px;
  color: #062a14;
  background: var(--good);
  border: 3px solid var(--ink-dark);
  padding: 5px 9px;
  box-shadow: inset -2px -2px 0 rgba(0, 0, 0, 0.25);
}
.level-best { font-weight: 700; font-size: 13px; color: var(--gold); }
.level-lb {
  flex: none;
  margin-left: 4px;
  letter-spacing: 1px;
}

.loading-note { color: #9db4d8; letter-spacing: 1px; padding: 30px; text-align: center; }

/* ---------- GAME ---------- */
#screen-game { background: #05080d; }
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

#touchControls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  top: 0;
  display: none;
  pointer-events: none;
}
body.touch #touchControls { display: block; }
.touch-cluster {
  position: absolute;
  display: flex;
  gap: 12px;
  pointer-events: none;
}
.touch-cluster.left {
  left: var(--tc-lx, 14px);
  bottom: calc(var(--tc-ly, 14px) + env(safe-area-inset-bottom, 0px));
}
.touch-cluster.right {
  right: var(--tc-rx, 14px);
  bottom: calc(var(--tc-ry, 14px) + env(safe-area-inset-bottom, 0px));
}
.touch-btn {
  pointer-events: auto;
  width: var(--tc-size, 72px);
  height: var(--tc-size, 72px);
  border: none;
  background: transparent;
  padding: 0;
  display: grid;
  place-items: center;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow: none;
  filter: drop-shadow(3px 3px 0 rgba(0,0,0,0.4));
}
.touch-btn img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; pointer-events: none; display: block; }
.touch-btn.jump {
  width: calc(var(--tc-size, 72px) + 12px);
  height: calc(var(--tc-size, 72px) + 12px);
}
.touch-btn.on {
  filter: brightness(1.25) drop-shadow(3px 3px 0 rgba(0,0,0,0.4));
  transform: scale(0.94);
}
body.joystick #touchControls { display: none !important; }
#joystick {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: none;
}
body.joystick #joystick { display: block; }
#joyBase, #joyKnob {
  position: absolute;
  border-radius: 50%;
  display: none;
  transform: translate(-50%, -50%);
}
#joyBase {
  width: 110px;
  height: 110px;
  border: 3px solid rgba(255, 255, 255, 0.35);
  background: rgba(10, 16, 24, 0.35);
}
#joyKnob {
  width: 52px;
  height: 52px;
  background: rgba(255, 210, 60, 0.75);
  border: 3px solid var(--ink-dark);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.4);
}

.hud {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}
.hud-chip {
  pointer-events: auto;
  display: flex;
  gap: 12px;
  align-items: center;
  background: rgba(10, 16, 24, 0.85);
  border: 3px solid var(--ink-dark);
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.08), 4px 4px 0 rgba(0, 0, 0, 0.4);
  padding: 8px 12px;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 1px;
}
#hudTime { color: var(--gold); }
#hudDeaths { color: #ff8ba0; }
.hud-practice {
  font-weight: 900;
  letter-spacing: 2px;
  color: #062a14;
  background: var(--good);
  border: 2px solid var(--ink-dark);
  padding: 1px 7px;
  cursor: pointer;
}
.intro-card {
  position: absolute;
  left: 0;
  right: 0;
  top: 22%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
  z-index: 4;
  animation: introIn 0.35s ease-out;
}
.intro-card.hidden { display: none; }
@keyframes introIn {
  from { opacity: 0; transform: translateY(14px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
#introTitle {
  font-size: clamp(28px, 6vw, 52px);
  font-weight: 900;
  letter-spacing: 4px;
  color: #fff;
  text-shadow: 4px 4px 0 rgba(0, 0, 0, 0.65);
}
#introAuthor { font-size: 14px; letter-spacing: 2px; color: var(--gold); text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.6); }
#introDiff img { width: 44px; height: auto; image-rendering: pixelated; filter: drop-shadow(3px 3px 0 rgba(0,0,0,.5)); }

.fps-debug {
  position: fixed;
  top: 10px;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  z-index: 80;
  font-family: var(--font);
  font-size: 28px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: 1px;
  color: var(--gold);
  text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.75);
  pointer-events: none;
}
.fps-debug.hidden { display: none; }

.overlay-card {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  background: rgba(4, 8, 12, 0.6);
  z-index: 8;
}
.overlay-card.visible { display: grid; }
.card {
  min-width: 340px;
  background: var(--panel);
  border: 4px solid var(--ink-dark);
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.1), 8px 8px 0 rgba(0, 0, 0, 0.5), 0 0 28px rgba(255, 210, 60, 0.18);
  padding: 22px 26px;
  text-align: center;
  animation: modalPop 0.28s ease-out;
}
.card h2 { margin: 0 0 8px; font-size: 30px; letter-spacing: 3px; color: var(--gold); text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.5); }
.card p { margin: 0 0 16px; color: #b9cbe8; letter-spacing: 1px; }
.card-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.leaderboard { margin: 12px 0; max-height: 160px; overflow: auto; text-align: left; border: 2px solid var(--ink-dark); background: var(--panel-2); padding: 6px; }
.leaderboard-full { max-height: min(50vh, 360px); }
.leaderboard .lb-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: var(--panel); border: 2px solid var(--ink-dark); margin-bottom: 4px; font-size: 12px; }
.leaderboard .lb-rank { width: 28px; text-align: center; font-weight: 900; color: var(--gold); }
.leaderboard .lb-name { flex: 1; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leaderboard .lb-time { color: var(--good); font-weight: 900; }
.leaderboard .lb-skin { width: 20px; height: 20px; image-rendering: pixelated; border: 1px solid var(--ink-dark); }
.leaderboard .lb-me { border-color: var(--cyan); background: rgba(46,230,255,0.12); box-shadow: 0 0 0 1px var(--cyan); }
.leaderboard .lb-race { cursor: pointer; }
.leaderboard .lb-race:hover { border-color: var(--gold); background: rgba(255,210,60,0.10); }
.leaderboard .lb-race-hint { font-size: 10px; font-weight: 900; color: var(--gold); letter-spacing: 1px; white-space: nowrap; }
.leaderboard .lb-title { font-size: 10px; letter-spacing: 1px; color: var(--muted); text-align: center; margin-bottom: 6px; }
.ghost-countdown { position: absolute; inset: 0; display: grid; place-items: center; font-size: 88px; font-weight: 900; color: var(--gold); text-shadow: 5px 5px 0 rgba(0,0,0,0.7); background: rgba(5,8,13,0.55); z-index: 6; }
.ghost-countdown.hidden { display: none !important; }

/* ---------- MODALS ---------- */
.modal-root {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  background: rgba(4, 8, 14, 0.75);
  z-index: 30;
}
.modal-root.visible { display: grid; animation: screenIn 0.2s ease-out; }
.modal {
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: var(--panel);
  border: 4px solid var(--ink-dark);
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.1), 10px 10px 0 rgba(0, 0, 0, 0.5);
  padding: 18px 20px;
  animation: modalPop 0.22s ease-out;
}
@keyframes modalPop {
  from { transform: translate3d(0, 14px, 0) scale(0.96); opacity: 0; }
  to { transform: translate3d(0, 0, 0) scale(1); opacity: 1; }
}
.modal h2 { margin: 0 0 14px; font-size: 22px; letter-spacing: 3px; text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.4); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.modal-head h2 { margin: 0; }
.coin-chip { display: inline-flex; align-items: center; gap: 6px; font-weight: 900; letter-spacing: 1px; color: var(--gold); }
.coin-chip img, .coin-icon { width: 22px; height: 22px; }
.coin-chip b { color: var(--gold); }
.chest-balances { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.key-icon { width: auto; height: 22px; }
.shop-cost { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 900; color: var(--gold); }
.shop-cost img, .shop-cost .coin-icon { width: 14px; height: 14px; }
.skin-tile.cant { opacity: 0.72; }
.row-end { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.row-end.skin-actions { justify-content: space-between; align-items: center; }
#codeMsg { min-height: 18px; margin: 4px 0 0; }
.sep { border: 0; border-top: 3px solid var(--ink-dark); margin: 14px 0; }

.skin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; }
.skin-tile {
  position: relative;
  padding: 12px 8px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--panel-2);
  border: 3px solid var(--ink-dark);
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.08), 4px 4px 0 rgba(0, 0, 0, 0.4);
  color: var(--text);
}
.skin-tile img { width: 48px; height: 48px; }
.skin-gif-hold {
  position: fixed;
  left: -64px;
  top: -64px;
  width: 32px;
  height: 32px;
  opacity: 0;
  pointer-events: none;
}
.skin-tile .skin-name { font-size: 11px; font-weight: 900; letter-spacing: 1px; text-align: center; }
.skin-tile:hover { filter: brightness(1.08); transform: translate(-1px, -1px); }
.skin-tile.selected {
  border-color: var(--cyan);
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.08), 0 0 0 2px var(--cyan), 0 0 14px rgba(46,230,255,.35), 4px 4px 0 rgba(0, 0, 0, 0.4);
}
.skin-tile.locked { filter: grayscale(1) brightness(0.55); }
.skin-tile.locked::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 12px;
  height: 10px;
  background: #ffd23c;
  border: 2px solid var(--ink-dark);
  box-shadow: 0 -5px 0 -2px #ffd23c, 0 -6px 0 -1px var(--ink-dark);
}
.skin-hint { font-size: 10px; color: var(--gold); text-align: center; min-height: 24px; letter-spacing: 0.5px; }
.px-btn img[src*="chest-"] { width: 26px; height: 26px; background: #fff3c2; border: 2px solid var(--ink-dark); }
.px-btn img[src*="wheel"] { width: 22px; height: 22px; image-rendering: pixelated; }

.wheel-stage {
  position: relative;
  width: 220px;
  height: 236px;
  margin: 4px auto 10px;
}
.wheel-pointer {
  position: absolute;
  left: 50%;
  top: 0;
  z-index: 2;
  width: 0;
  height: 0;
  border-left: 11px solid transparent;
  border-right: 11px solid transparent;
  border-top: 20px solid var(--gold);
  transform: translateX(-50%);
  filter: drop-shadow(2px 3px 0 rgba(6, 12, 24, 0.7));
}
.wheel-clip {
  position: absolute;
  left: 50%;
  top: 16px;
  width: 200px;
  height: 200px;
  margin-left: -100px;
  overflow: hidden;
  border-radius: 50%;
  border: 4px solid var(--ink-dark);
  background: #05080d;
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.08), 6px 6px 0 rgba(0, 0, 0, 0.45);
}
.wheel-clip img {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  transform: rotate(0deg);
}
.wheel-wager-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 0 0 8px;
}
#wheelMsg { min-height: 18px; margin: 4px 0 0; }
#modalChest .modal { width: min(920px, calc(100vw - 24px)); }
.chest-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 8px 0 4px;
}
.chest-col { min-width: 0; }
.chest-open {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin: 0 0 10px;
  padding: 16px 10px 12px;
  background: var(--panel-2);
  border: 4px solid var(--ink-dark);
  box-shadow: inset 2px 2px 0 rgba(255,255,255,0.1), 6px 6px 0 rgba(0,0,0,0.45);
  color: var(--gold);
  font-weight: 900;
  letter-spacing: 3px;
  font-size: 15px;
}
.chest-open.gold {
  color: #ffe27a;
  background: #2a220e;
  box-shadow: inset 2px 2px 0 rgba(255, 226, 122, 0.18), 6px 6px 0 rgba(0,0,0,0.45);
}
.chest-open.diamond {
  color: var(--cyan);
  background: #0e2430;
  box-shadow: inset 2px 2px 0 rgba(46, 230, 255, 0.18), 6px 6px 0 rgba(0,0,0,0.45);
}
.chest-open.king {
  color: #e8c4ff;
  background: #24102e;
  box-shadow: inset 2px 2px 0 rgba(232, 196, 255, 0.18), 6px 6px 0 rgba(0,0,0,0.45);
}
.chest-open.king > span:not(.chest-price) { letter-spacing: 1px; font-size: 13px; }
.chest-open.champion {
  color: #ffe27a;
  background: #2a1c08;
  box-shadow: inset 2px 2px 0 rgba(255, 226, 122, 0.22), 6px 6px 0 rgba(0,0,0,0.45);
}
.chest-open.champion > span:not(.chest-price) { letter-spacing: 1px; font-size: 13px; }
.chest-open.champion img { background: #05080d; }
.chest-col.champion { grid-column: 1 / -1; }
.chest-col.champion .chest-odds { grid-template-columns: 1fr 1fr; }
.chest-key-icon {
  width: 12px;
  height: 24px;
  image-rendering: pixelated;
  vertical-align: middle;
  margin-right: 4px;
}
.chest-price {
  font-size: 10px;
  letter-spacing: 0.6px;
  color: var(--good);
  font-weight: 800;
  text-align: center;
  line-height: 1.3;
}
.chest-price.paid { color: var(--gold); }
.chest-open img {
  width: 96px;
  height: 96px;
  image-rendering: pixelated;
  background: #fff3c2;
  border: 3px solid var(--ink-dark);
  box-shadow: 4px 4px 0 rgba(0,0,0,0.35);
}
.chest-open:hover { filter: brightness(1.08); transform: translate(-1px, -1px); }
.chest-open:active { transform: translate(2px, 2px); }
.chest-open.opening img { animation: chestShake 0.55s ease-in-out; }
.chest-open.prize img { animation: chestPop 0.35s ease-out; }
@keyframes chestShake {
  0%, 100% { transform: translate(0, 0) rotate(0); }
  20% { transform: translate(-4px, 2px) rotate(-6deg); }
  40% { transform: translate(5px, -2px) rotate(5deg); }
  60% { transform: translate(-3px, 1px) rotate(-3deg); }
  80% { transform: translate(3px, -1px) rotate(3deg); }
}
@keyframes chestPop {
  0% { transform: scale(0.86); filter: brightness(1); }
  55% { transform: scale(1.12); filter: brightness(1.25); }
  100% { transform: scale(1); filter: brightness(1); }
}
.chest-odds {
  display: grid;
  gap: 3px;
  padding: 8px;
  background: var(--ink);
  border: 3px solid var(--ink-dark);
}
.chest-odd {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.4px;
  color: #c8d8f0;
}
.chest-odd b { color: var(--gold); }
.chest-odd.jackpot { color: var(--cyan); }
.chest-odd.jackpot b { color: var(--cyan); }
#chestMsg { min-height: 20px; margin: 8px 0 6px; font-weight: 800; }
@media (max-width: 700px) {
  .chest-row { grid-template-columns: 1fr; }
  .chest-col.champion { grid-column: auto; }
  .chest-col.champion .chest-odds { grid-template-columns: 1fr; }
}

/* Skin tree — grouped + progress */
.skin-tree { display: flex; flex-direction: column; gap: 16px; }
.skin-section { background: var(--panel); border: 3px solid var(--ink-dark); box-shadow: inset 2px 2px 0 rgba(255,255,255,0.06), 4px 4px 0 rgba(0,0,0,0.35); padding: 12px; }
.skin-section-title { font-size: 11px; font-weight: 900; letter-spacing: 2px; color: var(--cyan); margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.skin-section-title .line { flex: 1; height: 2px; background: var(--ink-dark); }
.skin-section .skin-grid { margin-top: 8px; }
.skin-progress { height: 8px; background: var(--ink-dark); border: 2px solid var(--ink-dark); margin: 6px 0 4px; position: relative; overflow: hidden; }
.skin-progress-fill { height: 100%; background: var(--good); transition: width 0.3s ease; }
.skin-progress-text { font-size: 10px; color: var(--muted); text-align: right; letter-spacing: 0.5px; }

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 8px 0;
}
.check-row input { width: 20px; height: 20px; accent-color: var(--good); }
.slider-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 8px 0 2px;
  color: var(--text);
}
.slider-row b { color: var(--cyan); }
.gfx-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 2px 0 4px; }
.gfx-opt.on { background: var(--good); color: #062a14; text-shadow: none; }
.ctl-opt.on { background: var(--good); color: #062a14; text-shadow: none; }
body.gfx-simple img, body.gfx-simple canvas { image-rendering: pixelated; }
body.gfx-ultra canvas { image-rendering: auto; }
.hint { color: #9db4d8; font-size: 12px; letter-spacing: 0.5px; line-height: 1.5; }
.modal label {
  display: block;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1px;
  color: #9db4d8;
  margin: 0 0 4px;
}

.px-input {
  width: 100%;
  padding: 9px 10px;
  margin-bottom: 8px;
  background: var(--ink-dark);
  color: var(--text);
  border: 3px solid var(--ink);
  font-family: var(--font);
  font-size: 14px;
  letter-spacing: 1px;
}
.px-input:focus { outline: none; border-color: var(--cyan); }
.px-input.code { width: 110px; text-transform: uppercase; text-align: center; margin-bottom: 0; }

.row-gap { display: flex; gap: 8px; align-items: center; margin-top: 4px; flex-wrap: wrap; }
.stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 6px 0;
  color: #9db4d8;
}
.stat-row b { color: var(--text); }

.section-title {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 3px;
  color: var(--cyan);
  margin: 4px 0 8px;
}

.achv.notice, .achv.notice-bad { background: var(--panel-2); color: var(--text); }
.achv.notice-bad { border-color: var(--red); }
.achv.notice .achv-name { font-weight: 700; font-size: 13px; max-width: 340px; }

/* ---------- ACHIEVEMENT POPUPS ---------- */
#achievements {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 50;
  pointer-events: none;
}
.achv {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--gold);
  color: #3a2a04;
  border: 4px solid var(--ink-dark);
  box-shadow: inset -3px -3px 0 rgba(0, 0, 0, 0.2), inset 3px 3px 0 rgba(255, 255, 255, 0.45), 6px 6px 0 rgba(0, 0, 0, 0.45);
  padding: 12px 18px;
  opacity: 0;
  transform: translateY(-16px);
  transition: opacity 0.28s ease, transform 0.28s ease;
}
.achv.show { opacity: 1; transform: translateY(0); }
.achv img { width: 44px; height: 44px; image-rendering: pixelated; border: 3px solid var(--ink-dark); background: #fff3c2; }
.achv .achv-title { font-size: 11px; font-weight: 900; letter-spacing: 2px; }
.achv .achv-name { font-size: 17px; font-weight: 900; letter-spacing: 1px; }

/* ---------- DASHPOINT NETWORK ---------- */
.px-btn.net { border-color: #6e1c2c; color: #ff8ba0; background: #241017; }
.home-fab-row {
  display: flex;
  flex-direction: row;
  gap: 16px;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
}
.home-settings-btn {
  position: relative;
  margin-top: 4px;
  width: 78px; height: 78px;
  border-radius: 16px;
  background: rgba(17,27,46,.85);
  border: 3px solid #22334f;
  display: flex; align-items: center; justify-content: center;
  padding: 14px;
}
.home-settings-btn img { width: 100%; height: auto; opacity: .75; image-rendering: pixelated; }
.home-settings-btn:hover { border-color: #2c4269; }
.home-settings-btn:hover img { opacity: 1; }
.check-row.locked-opt { opacity: 0.45; }

/* ---------- SPACE MODE (unlock: beat The Climb) ---------- */
.ui-space #screen-home {
  background:
    radial-gradient(ellipse at 18% 0%, rgba(255, 42, 60, 0.32), transparent 52%),
    radial-gradient(ellipse at 86% 8%, rgba(46, 230, 255, 0.26), transparent 48%),
    linear-gradient(180deg, #050910 0%, #0b1730 46%, #122a4a 100%);
}
.ui-space .home-fx { display: block; }
.ui-space .home-skin {
  display: block;
  width: 42px;
  height: 42px;
  image-rendering: pixelated;
  border: 3px solid var(--ink-dark);
  background: #0a1420;
  box-shadow: inset 2px 2px 0 rgba(255,255,255,.12), 4px 4px 0 rgba(6,12,24,.45);
}
.ui-space .home-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  background: none;
  border: 0;
  box-shadow: none;
  padding: 0;
  color: #cfe3ff;
}
.ui-space .hs-chip {
  font-weight: 700;
  letter-spacing: 1px;
  font-size: 12px;
  color: #cfe3ff;
  background: rgba(10, 18, 34, 0.82);
  border: 3px solid var(--ink-dark);
  box-shadow: 4px 4px 0 rgba(6, 12, 24, 0.45);
  padding: 7px 12px;
}
.ui-space .hs-chip b { color: var(--gold); }

.net-acct { font-family: var(--mono); font-size: 11px; color: #9db4d8; letter-spacing: 1px; }
#btnBell { position: relative; }
.bell-count {
  position: absolute;
  top: -8px;
  right: -8px;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  display: grid;
  place-items: center;
  padding: 0 5px;
  border: 2px solid var(--ink-dark);
}
.bell-row {
  background: var(--panel-2);
  border: 2px solid var(--ink-dark);
  padding: 8px 10px;
  font-size: 13px;
}
.net-body { flex: 1; overflow: auto; display: flex; flex-direction: column; align-items: center; padding: 20px; }
.net-grid { display: flex; gap: clamp(12px, 3vw, 30px); justify-content: center; width: 100%; max-width: 900px; }
.net-tile {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: clamp(14px, 3vh, 28px) 12px;
  background: var(--panel-2);
  border: 3px solid var(--ink-dark);
  box-shadow: inset 2px 2px 0 rgba(255,255,255,.09), 5px 5px 0 rgba(0,0,0,.4);
  color: var(--text);
}
.net-tile img { width: clamp(44px, 9vh, 72px); height: auto; image-rendering: pixelated; }
.net-tile b { font-size: clamp(13px, 1.6vh + .4vw, 18px); letter-spacing: 2px; text-shadow: 2px 2px 0 rgba(0,0,0,.4); }
.net-tile span { font-size: 11px; color: #9db4d8; text-align: center; }
.net-tile:hover:not(:disabled) { transform: translateY(-3px); filter: brightness(1.12); border-color: var(--cyan); box-shadow: inset 2px 2px 0 rgba(255,255,255,.09), 5px 5px 0 rgba(0,0,0,.4), 0 0 16px rgba(46,230,255,.2); }
.net-tile:disabled { opacity: .45; filter: grayscale(.8); }

.net-panel { width: min(720px, 100%); margin-top: 18px; }
.net-panel.hidden, .hidden { display: none !important; }
.net-panel-head { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.net-panel-head b { letter-spacing: 2px; font-size: 15px; color: var(--cyan); }

.net-results { display: flex; flex-direction: column; gap: 8px; max-height: 46vh; overflow: auto; }
.comment-row {
  background: var(--panel-2);
  border: 2px solid var(--ink-dark);
  padding: 7px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.comment-head { font-size: 12px; font-weight: 900; display: flex; gap: 8px; align-items: baseline; }
.comment-time { font-size: 10px; color: #9db4d8; font-weight: 400; }
.comment-body { font-size: 13px; overflow-wrap: anywhere; }
.comment-acts { display: flex; gap: 6px; justify-content: flex-end; }
#screen-netsearch .net-results,
#screen-netsaved .level-list {
  max-height: none;
  flex: 1;
  overflow: auto;
  width: min(720px, calc(100vw - 32px));
  margin: 0 auto;
}
.net-search-head {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(720px, calc(100vw - 32px));
  margin: 16px auto 12px;
}
.net-search-head .chips { display: flex; gap: 6px; }
.chip {
  padding: 6px 12px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1px;
  color: #9db4d8;
  background: var(--panel-2);
  border: 3px solid var(--ink-dark);
  box-shadow: inset 2px 2px 0 rgba(255,255,255,.08);
}
.chip.active {
  color: #062a14;
  background: var(--cyan);
  border-color: var(--ink-dark);
}
.chip:hover { filter: brightness(1.08); }
.net-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; text-align: left; width: 100%;
  background: var(--panel-2); border: 3px solid var(--ink-dark);
  box-shadow: inset 2px 2px 0 rgba(255,255,255,.07), 3px 3px 0 rgba(0,0,0,.35);
  color: var(--text);
}
.net-row:hover { border-color: var(--cyan); }
.net-row .n-title { font-weight: 900; font-size: 15px; letter-spacing: 1px; }
.net-row .n-sub { font-size: 11px; color: #9db4d8; margin-top: 2px; }
.net-row .n-main { flex: 1; min-width: 0; }
.net-row .n-diff { color: var(--gold); font-size: 15px; letter-spacing: 2px; white-space: nowrap; }
.net-row .n-play {
  pointer-events: auto;
  padding: 6px 12px; font-size: 12px; font-weight: 900; letter-spacing: 1px;
  background: var(--good); color: #062a14; border: 3px solid var(--ink-dark);
  box-shadow: inset -2px -2px 0 rgba(0,0,0,.25);
}
.net-row .n-play.n-dl {
  background: var(--cyan);
  color: #062a14;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.net-row .n-play.n-dl svg { display: block; }
.n-like {
  pointer-events: auto;
  align-self: center;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; font-size: 13px; font-weight: 900;
  background: var(--panel-2); color: var(--text);
  border: 3px solid var(--ink-dark);
  box-shadow: inset -2px -2px 0 rgba(0,0,0,.25);
}
.n-like img { width: 18px; height: 18px; image-rendering: pixelated; filter: grayscale(1) brightness(.55); opacity: .75; }
.n-like.liked img { filter: none; opacity: 1; }
.n-like.liked { background: var(--pink, #ff5a6e); border-color: var(--ink-dark); color: #2b0510; }
.li-like img { width: 18px; height: 18px; image-rendering: pixelated; vertical-align: -3px; filter: grayscale(1) brightness(.55); opacity: .75; }
.li-like.liked img { filter: none; opacity: 1; }
.li-like.liked { border-color: var(--pink, #ff5a6e); color: var(--pink, #ff5a6e); }
.n-opts { position: relative; flex: none; }
.n-opts-btn {
  background: var(--panel) !important;
  color: var(--text) !important;
}
.n-opts-menu {
  display: none;
  position: fixed;
  z-index: 80;
  min-width: 128px;
  flex-direction: column;
  background: var(--panel-2);
  border: 3px solid var(--ink-dark);
  box-shadow: 4px 4px 0 rgba(0,0,0,.45);
}
.n-opts.open .n-opts-menu { display: flex; }
.n-opts-menu button {
  pointer-events: auto;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1px;
  text-align: left;
  background: transparent;
  color: var(--text);
  border: 0;
  border-bottom: 2px solid var(--ink-dark);
}
.n-opts-menu button:last-child { border-bottom: 0; }
.n-opts-menu button:hover { background: rgba(46,230,255,.12); }
.n-opts-menu button.gold { color: var(--gold); }
.n-opts-menu button.danger { color: var(--red); }
.net-row.user .n-avatar { width: 40px; height: 40px; border: 2px solid var(--ink-dark); image-rendering: pixelated; background: var(--ink); }

.hud-author-chip {
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer;
  color: var(--cyan);
  border-bottom: 2px dotted rgba(46,230,255,.5);
}

/* ---------- COMPACT LAYOUT FOR PHONES ---------- */
@media (max-height: 560px), (max-width: 900px) {
  .home-logo { width: clamp(170px, 52vw, 300px); }
  .home-center {
    gap: 12px;
    justify-content: flex-start;
    overflow-y: auto;
    min-height: 0;
    padding: 10px 0 14px;
  }
  .home-foot { max-width: 96vw; min-width: 0; }
  .home-account { max-width: 94vw; font-size: 12px; padding: 5px 10px; overflow-wrap: anywhere; }
  .home-stats { max-width: 94vw; overflow-wrap: anywhere; }
  .acct-tag { white-space: nowrap; }
  .ui-space .home-stats { gap: 6px; }
  .home-buttons { gap: 10px; width: min(250px, 70vw); }
  .home-buttons .px-btn { font-size: 14px; padding: 9px 14px; }
  .home-buttons .px-btn img { width: 19px; height: 19px; }
  .home-stats { font-size: 10px; padding: 5px 10px; border-width: 2px; }
  .ui-space .hs-chip { font-size: 10px; padding: 5px 8px; border-width: 2px; }
  .ui-space .home-skin { width: 32px; height: 32px; }
  .home-settings-btn { width: 64px; height: 64px; padding: 11px; }

  .topbar { padding: 8px 10px; gap: 10px; }
  .bar-title { font-size: 16px; letter-spacing: 2px; }

  .level-list { padding: 10px; gap: 8px; }
  .level-card { padding: 9px 12px; gap: 10px; }
  .level-num { width: 36px; height: 36px; font-size: 17px; border-width: 2px; }
  .level-name { font-size: 14px; }
  .level-meta { font-size: 10px; margin-top: 2px; }
  .level-done, .level-best { font-size: 10px; padding: 3px 6px; }
  .level-lb { font-size: 10px; padding: 4px 7px; }

  .hud-chip { padding: 5px 8px; font-size: 11px; gap: 8px; }
  .px-btn.tiny { padding: 4px 7px; font-size: 10px; }

  .card { min-width: 260px; padding: 14px 16px; }
  .card h2 { font-size: 22px; }

  .modal { padding: 12px 14px; width: min(560px, calc(100vw - 20px)); }
  .modal h2 { font-size: 16px; margin-bottom: 8px; }
  .section-title { font-size: 10px; margin-bottom: 6px; }
  .px-input { padding: 7px 8px; font-size: 12px; margin-bottom: 6px; }
  .check-row { font-size: 13px; padding: 5px 0; }
  .slider-row { font-size: 13px; padding: 5px 0 0; }
  .stat-row { font-size: 11px; padding: 4px 0; }
  .skin-grid { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
  .skin-tile { padding: 8px 6px 7px; gap: 5px; }
  .skin-tile img { width: 34px; height: 34px; }
  .skin-hint { font-size: 9px; min-height: 20px; }
  .row-gap { gap: 6px; }
  .wheel-stage { width: 176px; height: 190px; }
  .wheel-clip { width: 160px; height: 160px; margin-left: -80px; }
}

.n-diff-face { width: 36px; height: auto; image-rendering: pixelated; flex: none; }
.lc-face img { width: 30px; height: auto; image-rendering: pixelated; }
.face-row { display: flex; gap: 10px; margin-top: 2px; }
.face-row button {
  background: none; border: 3px solid transparent; padding: 4px;
  cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.face-row button img { width: 44px; height: auto; image-rendering: pixelated; opacity: 0.35; }
.face-row button span { font-family: var(--mono); font-size: 9px; letter-spacing: 1px; color: var(--muted); }
.face-row button.on { border-color: var(--cyan); background: rgba(46,230,255,.08); }
.face-row button.on img { opacity: 1; filter: drop-shadow(0 0 8px rgba(46,230,255,.7)); }

/* Level info / preview modal (Geometry Dash style) */
.level-info-modal { text-align: center; }
.level-info-modal .stat-row { max-width: 320px; margin: 0 auto; }
.li-diff { margin: 8px auto 4px; width: 64px; }
.li-diff img { width: 64px; height: auto; image-rendering: pixelated; }

/* Splash screen */
.splash-root {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #050910;
  z-index: 9999;
  pointer-events: none;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.splash-root.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.splash-logo {
  width: 180px;
  height: 180px;
  image-rendering: pixelated;
  transform: translateY(100vh);
  animation: splashRise 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
             splashPulse 0.4s ease-in-out 0.8s forwards,
             splashFade 0.4s ease-out 1.2s forwards;
}

@keyframes splashRise {
  from { transform: translateY(100vh); }
  to { transform: translateY(0); }
}

@keyframes splashPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

@keyframes splashFade {
  from { opacity: 1; }
  to { opacity: 0; }
}

.splash-root.hidden .splash-logo {
  animation: none;
  transform: translateY(0);
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
  .screen.visible, .modal, .card, .level-card, .home-logo, .fx-cube {
    animation: none !important;
  }
}

/* ---------- ROOM CHAT ---------- */
.room-chat {
  position: fixed;
  left: 12px;
  bottom: 12px;
  z-index: 28;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  pointer-events: none;
}
.room-chat.hidden { display: none; }
.room-chat-toggle {
  pointer-events: auto;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--text);
  background: var(--panel);
  border: 3px solid var(--ink-dark);
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.1), 4px 4px 0 rgba(0, 0, 0, 0.4);
  padding: 7px 12px;
}
.room-chat-toggle.has-new { color: #3a2a04; background: var(--gold); }
.room-chat.open .room-chat-toggle { display: none; }
.room-chat-box {
  display: none;
  pointer-events: auto;
  width: min(320px, calc(100vw - 24px));
  background: rgba(16, 26, 44, 0.94);
  border: 3px solid var(--ink-dark);
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.08), 6px 6px 0 rgba(0, 0, 0, 0.45);
}
.room-chat.open .room-chat-box { display: flex; flex-direction: column; }
.room-chat-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 10px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--cyan);
  border-bottom: 2px solid var(--ink-dark);
}
.room-chat-min {
  font-family: var(--font);
  font-weight: 900;
  color: var(--text);
  background: var(--panel-2);
  border: 2px solid var(--ink-dark);
  padding: 0 8px;
  line-height: 18px;
}
.room-chat-log {
  height: 148px;
  overflow: auto;
  padding: 8px 10px;
  user-select: text;
}
.room-chat-line {
  margin: 0 0 6px;
  font-size: 12px;
  line-height: 1.35;
  letter-spacing: 0.3px;
  word-break: break-word;
}
.room-chat-line b { color: var(--gold); }
.room-chat-line.me b { color: var(--good); }
.room-chat-line.sys { color: #9db4d8; font-style: italic; }
.room-chat-form {
  display: flex;
  gap: 6px;
  padding: 8px;
  border-top: 2px solid var(--ink-dark);
}
.room-chat-form .px-input { margin: 0; flex: 1; padding: 6px 8px; font-size: 13px; }
.room-chat-form .px-btn { flex: none; }

@media (max-width: 700px) {
  .room-chat { left: 8px; bottom: 8px; }
  .room-chat-box { width: min(260px, calc(100vw - 16px)); }
  .room-chat-log { height: 110px; }
}

/* ---------- PHONE TOUCH CONTROLS (removed — desktop keyboard only) ---------- */
html, body { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

/* ---------- QUICK CHAT ---------- */
#widgetLayer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.dp-widget {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: top left;
  overflow: hidden;
  pointer-events: auto;
}
#chatBubbles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  overflow: hidden;
}
.chat-bubble {
  position: absolute;
  transform: translateX(-50%);
  top: 0;
  left: 0;
  background: rgba(10, 18, 30, 0.92);
  border: 2px solid var(--ink-dark);
  border-bottom: 3px solid var(--gold);
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.1), 3px 3px 0 rgba(0, 0, 0, 0.45);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5px;
  padding: 6px 10px;
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: bubblePop 0.22s ease-out;
}
.chat-bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--gold);
}
@keyframes bubblePop {
  from { transform: translateX(-50%) translateY(8px) scale(0.85); opacity: 0; }
  to { transform: translateX(-50%) translateY(0) scale(1); opacity: 1; }
}

.qc-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 40;
  display: none;
  width: min(560px, calc(100vw - 30px));
  background: var(--panel);
  border: 4px solid var(--ink-dark);
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.1), 10px 10px 0 rgba(0, 0, 0, 0.5), 0 0 40px rgba(255, 210, 60, 0.25);
  padding: 16px;
  text-align: center;
  animation: modalPop 0.18s ease-out;
}
.qc-popup.open { display: block; }
.qc-caption {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 3px;
  color: var(--gold);
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5);
  margin-bottom: 12px;
}
.qc-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.qc-msg {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5px;
  padding: 10px 8px;
  background: var(--panel-2);
  border: 3px solid var(--ink-dark);
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.08), 3px 3px 0 rgba(0, 0, 0, 0.35);
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.qc-msg:hover { border-color: var(--cyan); }
.qc-msg.sel {
  border-color: var(--gold);
  background: rgba(255, 210, 60, 0.16);
  box-shadow: 0 0 0 2px var(--gold), inset 2px 2px 0 rgba(255, 255, 255, 0.08);
}
.qc-hint {
  margin-top: 10px;
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--muted, #9db4d8);
}

.chat-feed {
  position: fixed;
  left: 14px;
  bottom: 14px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
  max-width: min(360px, 60vw);
}
.feed-item {
  display: flex;
  gap: 8px;
  align-items: baseline;
  align-self: flex-start;
  background: rgba(10, 18, 30, 0.92);
  border: 2px solid var(--ink-dark);
  border-left: 4px solid var(--cyan);
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.08), 3px 3px 0 rgba(0, 0, 0, 0.4);
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 400;
  max-width: 100%;
  animation: bubblePop 0.2s ease-out;
  opacity: 1;
  transition: opacity 0.5s ease;
}
.feed-item.feed-self { border-left-color: var(--gold); }
.feed-item b { color: var(--cyan); font-weight: 900; white-space: nowrap; }
.feed-item.feed-self b { color: var(--gold); }
.feed-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-item.fade { opacity: 0; }
@media (max-width: 720px) {
  .qc-grid { grid-template-columns: 1fr; }
  .qc-msg { font-size: 12px; padding: 8px; }
  .chat-feed { left: 8px; bottom: 8px; max-width: 80vw; }
}
input[type="range"] {
  width: 100%;
  height: 28px;
  margin: 0 0 10px;
  accent-color: var(--cyan);
}

body.gfx-good img,
body.gfx-good canvas {
  image-rendering: pixelated;
}
body.gfx-good .chest-open img {
  width: 128px;
  height: 128px;
  image-rendering: pixelated;
  object-fit: contain;
  background: #fff3c2;
}
body.gfx-good .px-btn img[src*="chest-"] {
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
  object-fit: contain;
}
body.gfx-good .skin-tile img {
  width: 64px;
  height: 64px;
  image-rendering: pixelated;
}
body.gfx-good .wheel-clip img {
  image-rendering: pixelated;
}

