:root {
  color-scheme: dark;
  font-family: "DM Sans", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-optical-sizing: auto;
  background: #1c0933;
  color: #fff6e4;
  --muted: #b79bd0;
  --mint: #ffcf3f;
  --pink: #ff5fa2;
  --line: rgba(255, 220, 160, .2);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow: hidden;
  background: #1c0933;
}

button, input { font: inherit; }
button { color: inherit; }

.game-shell { position: relative; width: 100vw; height: 100vh; min-height: 540px; overflow: hidden; background: #1c0933; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; }

.topbar {
  position: absolute;
  z-index: 2;
  inset: 0 0 auto;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5.2%;
  border-bottom: 1px solid rgba(234, 237, 255, .08);
  background: linear-gradient(180deg, rgba(28, 9, 51, .82), rgba(28, 9, 51, .3));
}

.brand { display: inline-flex; align-items: center; gap: 10px; color: #f6f7fc; text-decoration: none; font-family: "Fredoka", sans-serif; font-size: 22px; font-weight: 600; letter-spacing: -.3px; }
.brand-mark { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 9px; background: var(--mint); color: #101923; font-size: 23px; line-height: 1; font-weight: 700; transform: rotate(-8deg); }
.brand-light { color: #85899c; font-weight: 500; }
.topbar-center { display: flex; align-items: center; gap: 9px; color: #c3c6d3; font-size: 9px; font-weight: 700; letter-spacing: 1.15px; }
.live-dot, .minimap-live i { width: 6px; height: 6px; border-radius: 50%; background: #ff5fa2; box-shadow: 0 0 12px rgba(255, 95, 162, .9); }
.topbar-divider { color: #555b70; }
.sound-button { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: rgba(255,255,255,.035); color: #c4c9d6; font-size: 17px; cursor: pointer; transition: background .2s, color .2s; }
.sound-button:hover { background: rgba(255,207,63,.18); color: var(--mint); }

.hud { position: absolute; z-index: 1; top: 105px; left: 5.2%; display: flex; align-items: flex-start; gap: 12px; }
.score-card, .rank-card, .boost-card, .minimap-card { border: 1px solid rgba(255, 220, 160, .22); background: rgba(48, 14, 74, .78); backdrop-filter: blur(14px); box-shadow: 0 10px 35px rgba(0,0,0,.12); }
.score-card { width: 143px; height: 102px; padding: 15px 17px; border-radius: 13px; }
.hud-label { display: block; color: #8d93a7; font-size: 8px; font-weight: 700; letter-spacing: 1.25px; }
.score-card strong { display: block; margin-top: 1px; font-family: "Fredoka", sans-serif; font-size: 31px; letter-spacing: 0; }
.score-caption { display: block; margin-top: -3px; color: #868ba0; font-size: 9px; }
.rank-card { display: flex; align-items: center; gap: 9px; height: 48px; padding: 8px 13px; border-radius: 11px; }
.rank-icon { color: #ffcf3f; font-size: 17px; }
.rank-card .hud-label { font-size: 7px; }
.rank-card strong { display: block; margin-top: 1px; font-family: "Fredoka", sans-serif; font-size: 15px; }
.boost-card { position: absolute; top: 119px; left: 0; width: 143px; padding: 11px 12px; border-radius: 10px; }
.boost-copy { display: flex; justify-content: space-between; color: #dce1ed; font-size: 8px; font-weight: 700; letter-spacing: .8px; }
.boost-copy span:last-child { color: var(--mint); }
.boost-track { height: 4px; margin: 8px 0 7px; overflow: hidden; border-radius: 8px; background: rgba(255,255,255,.1); }
.boost-track span { display: block; width: 100%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #ff5fa2, #ffcf3f); transition: width .12s linear; }
.boost-hint { color: #7e8498; font-size: 6px; letter-spacing: .7px; white-space: nowrap; }

.side-note { position: absolute; top: 48%; left: 5.3%; color: rgba(176, 184, 209, .55); font-size: 8px; font-weight: 700; line-height: 1.9; letter-spacing: 1.6px; }
.note-line { display: block; width: 24px; height: 1px; margin-bottom: 12px; background: rgba(255,207,63,.85); }
.minimap-card { position: absolute; right: 5.2%; bottom: 36px; width: 190px; padding: 11px 12px 9px; border-radius: 12px; }
.minimap-heading, .minimap-coords { display: flex; align-items: center; justify-content: space-between; color: #a4a9ba; font-size: 7px; font-weight: 700; letter-spacing: 1px; }
.minimap-live { display: flex; align-items: center; gap: 5px; color: #ffb3d3; font-size: 6px; }
.minimap-live i { display: inline-block; width: 4px; height: 4px; }
#minimap { display: block; width: 100%; height: 91px; margin: 7px 0 6px; border-radius: 6px; background: rgba(255,255,255,.025); }
.minimap-coords { color: #777e93; font-size: 6px; letter-spacing: .7px; }
.minimap-coords span:last-child { color: #d0d5e0; }
.mobile-boost { display: none; }

.overlay { position: absolute; z-index: 3; inset: 0; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at 50% 43%, rgba(60, 18, 90, .4) 0%, rgba(28, 9, 51, .74) 58%, rgba(20, 6, 38, .92) 100%); transition: opacity .35s ease, visibility .35s ease; }
.overlay.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.start-card { width: min(390px, calc(100vw - 36px)); padding: 26px 34px 25px; border: 2px solid rgba(255, 207, 63, .55); border-radius: 21px; background: linear-gradient(150deg, rgba(86, 28, 122, .95), rgba(40, 12, 66, .96)); box-shadow: 0 28px 90px rgba(0,0,0,.55), 0 0 0 6px rgba(255,95,162,.12), inset 0 1px 0 rgba(255,255,255,.1); text-align: center; }
.card-eyebrow { display: flex; justify-content: center; align-items: center; gap: 8px; color: #a1a7b9; font-size: 8px; font-weight: 700; letter-spacing: 1.5px; }
.eyebrow-line { width: 15px; height: 1px; background: var(--mint); }
.portrait-frame { position: relative; width: 98px; height: 98px; margin: 17px auto 13px; display: grid; place-items: center; }
.portrait-frame img { position: relative; z-index: 1; width: 76px; height: 76px; border: 3px solid #ffcf3f; border-radius: 50%; object-fit: cover; object-position: center; box-shadow: 0 0 25px rgba(255,207,63,.35); }
.portrait-orbit { position: absolute; inset: 3px; border: 1px dashed rgba(255,207,63,.5); border-radius: 50%; }
.orbit-two { inset: -4px; border-color: rgba(255,95,162,.4); }
.portrait-sparkle { position: absolute; z-index: 2; color: #ff8cc0; }
.sparkle-one { top: 3px; right: 6px; font-size: 17px; }
.sparkle-two { bottom: 4px; left: 3px; color: #ffcf3f; font-size: 14px; }
.start-card h1 { margin: 0; color: #fff6e4; font-family: "Fredoka", sans-serif; font-size: 34px; font-weight: 600; line-height: 1.05; letter-spacing: 0; }
.start-card h1 span { color: var(--mint); }
.card-description { max-width: 284px; margin: 10px auto 17px; color: #9da2b4; font-size: 11px; line-height: 1.65; }
.name-label { display: block; margin-bottom: 7px; color: #9a9fb0; text-align: left; font-size: 7px; font-weight: 700; letter-spacing: 1.1px; }
.name-input-wrap { height: 39px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid rgba(221,227,255,.14); border-radius: 8px; background: rgba(28,9,51,.55); color: #c9aee0; }
.name-input-wrap:focus-within { border-color: rgba(255,207,63,.8); }
.name-input-wrap input { width: 100%; border: 0; outline: 0; background: transparent; color: #f1f3f8; font-size: 11px; }
.play-button { width: 100%; height: 42px; display: flex; align-items: center; justify-content: space-between; margin-top: 10px; padding: 0 15px; border: 0; border-radius: 8px; background: linear-gradient(90deg, #ffcf3f, #ffb42e); color: #3a1450; font-size: 9px; font-weight: 800; letter-spacing: 1px; cursor: pointer; transition: transform .18s, filter .18s; }
.play-button:hover { transform: translateY(-2px); filter: brightness(1.07); }
.play-button span:last-child { font-size: 14px; }
.control-hint { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 17px; color: #82889b; font-size: 7px; font-weight: 700; letter-spacing: .55px; }
.control-hint i { width: 2px; height: 2px; margin: 0 2px; border-radius: 50%; background: #626a7f; }
kbd { padding: 3px 4px; border: 1px solid rgba(255,255,255,.13); border-radius: 3px; color: #aeb4c3; font-family: inherit; font-size: 6px; }
.mouse-icon { position: relative; width: 10px; height: 14px; border: 1px solid #9ba1b1; border-radius: 7px; }
.mouse-icon::after { position: absolute; top: 2px; left: 4px; width: 1px; height: 3px; background: var(--mint); content: ""; }
.overlay-footer { position: absolute; right: 5.2%; bottom: 23px; left: 5.2%; display: flex; justify-content: space-between; color: #747a8d; font-size: 7px; font-weight: 700; letter-spacing: 1px; }
.overlay-footer i { font-style: normal; }
.overlay-footer b { margin-left: 4px; color: var(--mint); font-size: 11px; }

.topbar-actions { display: flex; align-items: center; gap: 10px; }
.shop-button { height: 34px; display: inline-flex; align-items: center; gap: 9px; padding: 0 6px 0 14px; border: 1px solid rgba(255, 207, 63, .55); border-radius: 17px; background: rgba(255, 207, 63, .12); color: #ffe08a; font-size: 8px; font-weight: 800; letter-spacing: 1px; cursor: pointer; transition: background .2s, transform .2s; }
.shop-button[hidden] { display: none; }
.shop-button:hover { background: rgba(255, 207, 63, .24); transform: translateY(-1px); }
.wallet { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 12px; background: #ffcf3f; color: #3a1450; font-size: 10px; letter-spacing: 0; }
.shop-link { display: block; width: 100%; margin-top: 8px; padding: 9px; border: 1px dashed rgba(255, 207, 63, .5); border-radius: 8px; background: transparent; color: #ffe08a; font-size: 10px; font-weight: 700; cursor: pointer; transition: background .2s; }
.shop-link:hover { background: rgba(255, 207, 63, .12); }

.shop { position: absolute; z-index: 5; inset: 0; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(20, 6, 38, .86); backdrop-filter: blur(6px); transition: opacity .25s ease, visibility .25s ease; }
.shop.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.shop-panel { width: min(900px, 100%); max-height: 100%; display: flex; flex-direction: column; padding: 24px 28px; border: 2px solid rgba(255, 207, 63, .55); border-radius: 22px; background: linear-gradient(150deg, rgba(86, 28, 122, .97), rgba(40, 12, 66, .98)); box-shadow: 0 28px 90px rgba(0,0,0,.6), 0 0 0 6px rgba(255,95,162,.12); }
.shop-header { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.shop-header > div:first-child { flex: 1; }
.shop-eyebrow { justify-content: flex-start; }
.shop-header h2 { margin: 6px 0 0; font-family: "Fredoka", sans-serif; font-size: 32px; font-weight: 600; line-height: 1; }
.shop-wallet { display: flex; align-items: baseline; gap: 6px; padding: 9px 15px; border-radius: 22px; background: #ffcf3f; color: #3a1450; font-size: 15px; }
.shop-wallet b { font-family: "Fredoka", sans-serif; font-size: 22px; }
.shop-wallet span { font-size: 9px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; }
.shop-close { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; background: rgba(255,255,255,.06); font-size: 15px; cursor: pointer; }
.shop-close:hover { background: rgba(255, 95, 162, .3); }
.skin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; overflow-y: auto; padding: 4px 4px 8px; }
.skin-card { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 12px 12px; border: 2px solid rgba(255, 220, 160, .16); border-radius: 16px; background: rgba(28, 9, 51, .5); text-align: center; transition: transform .2s, border-color .2s; }
.skin-card:hover { transform: translateY(-3px); border-color: rgba(255, 207, 63, .5); }
.skin-card.selected { border-color: #ffcf3f; background: rgba(255, 207, 63, .12); }
.skin-preview { position: relative; width: 84px; height: 84px; border: 3px solid #ffcf3f; border-radius: 50%; overflow: hidden; background: #2a0d45; }
.skin-preview img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.skin-card.locked .skin-preview img { filter: grayscale(.6) brightness(.55); }
.skin-lock { position: absolute; inset: 0; display: grid; place-items: center; font-size: 24px; }
.skin-name { font-family: "Fredoka", sans-serif; font-size: 15px; font-weight: 500; }
.skin-action { width: 100%; height: 34px; border: 0; border-radius: 8px; background: linear-gradient(90deg, #ffcf3f, #ffb42e); color: #3a1450; font-size: 10px; font-weight: 800; letter-spacing: .6px; cursor: pointer; }
.skin-action:hover:not(:disabled) { filter: brightness(1.08); }
.skin-action:disabled { background: rgba(255,255,255,.1); color: #b79bd0; cursor: not-allowed; }
.skin-action.owned { background: rgba(255, 95, 162, .85); color: #fff; }
.skin-action.active { background: rgba(255,255,255,.14); color: #ffe08a; cursor: default; }
.shop-footnote { margin: 12px 0 0; color: #b79bd0; font-size: 10px; text-align: center; }

@media (max-width: 700px) {
  .shop-button { padding-left: 10px; font-size: 0; }
  .shop-button .wallet { font-size: 10px; }
  .shop-panel { padding: 18px 16px; }
  .shop-header h2 { font-size: 26px; }
  .skin-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  .game-shell { min-height: 480px; }
  .topbar { height: 62px; padding: 0 20px; }
  .brand { font-size: 17px; }
  .topbar-center { gap: 6px; font-size: 7px; letter-spacing: .75px; }
  .sound-button { width: 31px; height: 31px; }
  .hud { top: 79px; left: 16px; gap: 7px; }
  .score-card { width: 112px; height: 83px; padding: 11px 12px; }
  .score-card strong { font-size: 26px; }
  .rank-card { height: 41px; padding: 7px 10px; }
  .boost-card { top: 92px; width: 112px; padding: 9px 10px; }
  .side-note { display: none; }
  .minimap-card { right: 14px; bottom: 17px; width: 145px; padding: 9px; }
  #minimap { height: 69px; }
  .mobile-boost { position: absolute; z-index: 2; right: 18px; bottom: 160px; width: 72px; height: 72px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 1px solid rgba(255,207,63,.6); border-radius: 50%; background: rgba(255,95,162,.25); color: #ffe08a; font-size: 8px; font-weight: 800; letter-spacing: .8px; backdrop-filter: blur(8px); touch-action: none; }
  .mobile-boost span { font-size: 17px; line-height: 1; }
  .start-card { padding: 21px 25px 20px; }
  .portrait-frame { width: 84px; height: 84px; margin: 13px auto 11px; }
  .portrait-frame img { width: 66px; height: 66px; }
  .start-card h1 { font-size: 29px; }
  .overlay-footer { right: 18px; bottom: 12px; left: 18px; font-size: 6px; }
}

@media (max-height: 680px) and (min-width: 701px) {
  .start-card { padding-top: 18px; padding-bottom: 17px; }
  .portrait-frame { width: 78px; height: 78px; margin: 10px auto 8px; }
  .portrait-frame img { width: 62px; height: 62px; }
  .start-card h1 { font-size: 28px; }
  .card-description { margin: 7px auto 12px; }
  .control-hint { margin-top: 12px; }
}
