:root {
  font-family: "Arial Narrow", Arial, sans-serif;
  color: #fff4fc;
  color-scheme: dark;
  --pink: #ff85dc;
  --cyan: #9fffff;
  --panel: rgba(29, 10, 51, 0.95);
}
* {
  box-sizing: border-box;
}
html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #1d102e;
}
button,
input,
select {
  font: inherit;
}
button {
  cursor: pointer;
  color: inherit;
  border: 0;
}
button:disabled {
  cursor: default;
  opacity: 0.45;
}
button:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 4px;
}
#app {
  position: relative;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
#game {
  position: absolute;
  width: 100%;
  height: 100%;
  display: block;
}
#ui {
  position: absolute;
  inset: 0;
  pointer-events: none;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left);
}
#ui > * {
  pointer-events: auto;
}
.caps {
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-shadow: 0 2px 4px #341240;
}
.topbar {
  position: absolute;
  top: max(22px, env(safe-area-inset-top));
  left: max(28px, env(safe-area-inset-left));
  right: max(28px, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 4;
}
.profile {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 18px;
}
.profile img {
  height: 40px;
}
.profile small {
  display: block;
  font-size: 11px;
  letter-spacing: 2px;
  color: #ecd1ea;
}
.wallet {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: linear-gradient(90deg, transparent, #231234b8);
  font-size: 20px;
}
.wallet img {
  width: 25px;
  height: 28px;
  object-fit: contain;
}
.icon-button {
  background: #311745ad;
  border: 1px solid #dba9ef60;
  width: 44px;
  height: 44px;
  border-radius: 9px;
  display: grid;
  place-items: center;
}
.icon-button img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}
.home-logo {
  position: absolute;
  left: 9%;
  top: 12%;
  width: 36%;
  height: 46%;
  object-fit: contain;
  filter: drop-shadow(0 10px 22px #41124f88);
}
.home-play {
  position: absolute;
  left: 10%;
  top: 65%;
  width: 34%;
  text-align: center;
}
.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(180deg, #a453b9, #692b90 48%, #4c256d);
  border: 1px solid #f8bbff;
  border-radius: 4px;
  padding: 13px 35px;
  box-shadow:
    0 0 0 3px #4c1d61,
    0 5px 0 #321841,
    0 5px 20px #2c1337;
  font-size: 23px;
  min-height: 50px;
  text-transform: uppercase;
  font-style: italic;
  font-weight: 900;
  letter-spacing: 1.4px;
}
.primary:hover {
  filter: brightness(1.2);
}
.home-play .primary {
  width: 100%;
  font-size: clamp(23px, 3vw, 43px);
  padding: 16px 20px;
}
.home-play p {
  font-size: 12px;
  letter-spacing: 2px;
  color: #fff0f8;
  text-shadow: 0 1px 4px #321333;
}
.home-footer {
  position: absolute;
  bottom: max(24px, env(safe-area-inset-bottom));
  left: 4%;
  right: 4%;
  display: flex;
  justify-content: center;
  gap: 18px;
}
.nav-button {
  background: linear-gradient(#42264db0, #251039e6);
  border-top: 1px solid #f6c3f573;
  border-bottom: 2px solid #8b49ad88;
  min-width: 100px;
  padding: 10px 17px;
  text-transform: uppercase;
  font-weight: 800;
  font-style: italic;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 3px;
}
.nav-button img {
  width: 25px;
  height: 25px;
  object-fit: contain;
}
.best-home {
  position: absolute;
  right: 10%;
  top: 16%;
  text-align: center;
  font-size: 15px;
  text-shadow: 0 2px 3px #222;
}
.best-home strong {
  font-size: 36px;
  display: block;
  letter-spacing: 3px;
  color: #fff0fb;
}
.small-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 16px;
  background: #6d3e87;
  border: 1px solid #d5a7e2;
  border-radius: 4px;
  font-weight: 700;
}
.glass {
  background: var(--panel);
  border: 1px solid #e7b2f1a8;
  box-shadow:
    0 0 70px #120824aa,
    inset 0 0 30px #6f358a30;
  border-radius: 9px;
}
.scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #1b0d31ac, #29163d70);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.panel {
  width: min(760px, 95vw);
  max-height: calc(100dvh - 40px);
  overflow: auto;
  padding: 25px 30px;
  touch-action: pan-y;
}
.panel.wide {
  width: min(1100px, 96vw);
}
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 20px;
}
.panel h1,
.panel h2 {
  font-size: 28px;
  font-style: italic;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin: 0;
}
.panel p {
  line-height: 1.5;
  color: #dfcce8;
  font-size: 14px;
}
.panel-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 24px;
}
.muted {
  color: #c9a8d5;
  font-size: 13px;
}
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.world-card {
  padding: 0;
  overflow: hidden;
  position: relative;
  border: 2px solid #805198;
  border-radius: 6px;
  background: #321f46;
  text-align: center;
}
.world-card.selected {
  border-color: #adffff;
  box-shadow: 0 0 17px #5fffff45;
}
.world-card img {
  width: 100%;
  height: 150px;
  object-fit: cover;
}
.world-card strong {
  display: block;
  padding: 16px;
  font-size: 21px;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-style: italic;
}
.world-card:nth-child(2) {
  background: #173150;
}
.world-card:nth-child(3) {
  background: #541d33;
}
.world-card span {
  display: block;
  font-size: 12px;
  color: #e4c9e8;
  padding-bottom: 15px;
}
.hud {
  position: absolute;
  inset: 0;
  pointer-events: none !important;
}
.hud .score {
  position: absolute;
  left: 32px;
  top: 23px;
  font-size: 40px;
  font-weight: 900;
  font-style: italic;
  line-height: 1;
  text-shadow:
    2px 3px 0 #813d9d,
    0 0 14px #4d144e;
}
.hud .score small {
  display: block;
  font-size: 12px;
  letter-spacing: 3px;
  margin-bottom: 7px;
}
.hud .wish {
  position: absolute;
  right: 95px;
  top: 27px;
  font-size: 18px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 2px;
  text-shadow: 0 2px 3px #512044;
}
.hud .pause {
  position: absolute;
  right: 25px;
  top: 22px;
  pointer-events: auto;
}
.hud .multiplier {
  position: absolute;
  left: 31px;
  top: 105px;
  color: #b5ffff;
  font-size: 24px;
  font-style: italic;
  text-shadow: 0 1px 5px #512044;
}
.hud .crystals {
  position: absolute;
  right: 31px;
  top: 85px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 17px;
  font-weight: 700;
  text-shadow: 0 1px 5px #512044;
}
.hud .crystals img {
  width: 22px;
  height: 26px;
  object-fit: contain;
}
.controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100px;
  pointer-events: none !important;
  display: flex;
  justify-content: space-between;
  padding: 0 max(25px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom)) max(25px, env(safe-area-inset-left));
}
.control {
  pointer-events: auto;
  align-self: flex-end;
  width: 156px;
  height: 64px;
  border: 1px solid #ffe4ff81;
  border-radius: 7px;
  background: linear-gradient(#52285d55, #30173e99);
  box-shadow: inset 0 0 18px #ffc6f822;
  font-size: 24px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 2px;
  color: #fff4fb;
  touch-action: none;
}
.control small {
  font-size: 10px;
  display: block;
  font-style: normal;
  letter-spacing: 1px;
  margin-top: 3px;
  opacity: 0.7;
}
.control:active,
.control.pressed {
  background: #8b4b9caa;
  border-color: #c5ffff;
  box-shadow: 0 0 25px #d8abff65;
}
.dash-meter {
  height: 3px;
  position: absolute;
  bottom: 9px;
  right: max(25px, env(safe-area-inset-right));
  width: 156px;
  background: #361843;
}
.dash-meter i {
  display: block;
  height: 100%;
  background: #c5ffff;
  transform-origin: left;
  box-shadow: 0 0 8px #fff;
}
.tutorial-hint {
  position: absolute;
  top: 23%;
  left: 25%;
  right: 25%;
  text-align: center;
  padding: 12px 20px;
  color: #fff;
  font-size: 22px;
  font-style: italic;
  font-weight: 800;
  text-shadow: 0 2px 6px #371b51;
  background: #38204790;
  border: 1px solid #eebaff77;
  border-radius: 6px;
}
.result {
  max-width: 580px;
  text-align: center;
}
.result h1 {
  font-size: 35px;
}
.result-score {
  font-size: 64px;
  letter-spacing: 4px;
  font-weight: 900;
  font-style: italic;
  text-shadow: 0 3px 0 #8f439e;
  margin: 20px 0 5px;
}
.wish-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 20px 0;
}
.wish-tile {
  background: #62377744;
  border: 1px solid #a77cc0;
  padding: 10px 18px;
  flex: 1;
  color: #dac5e5;
}
.wish-tile strong {
  display: block;
  font-size: 22px;
  margin-top: 5px;
  color: white;
}
.result .stats {
  display: flex;
  gap: 25px;
  justify-content: center;
  color: #ecd8ef;
}
.result .stats strong {
  display: block;
  font-size: 22px;
}
.tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 0 0 20px;
}
.tabs button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #432252;
  border: 1px solid #986ca5;
  padding: 10px 20px;
  border-radius: 4px;
}
.tabs button.selected {
  background: #a267b4;
  color: #fff;
}
.shop-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 22px;
}
.shop-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-height: 45dvh;
  overflow: auto;
  padding: 3px;
  touch-action: pan-y;
}
.item {
  position: relative;
  min-height: 135px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 13px 10px;
  background: #382045;
  border: 1px solid #8c619f;
  border-radius: 5px;
  text-align: center;
}
.item.selected {
  border-color: var(--cyan);
  background: #49345b;
}
.item img {
  height: 55px;
  width: 70px;
  object-fit: contain;
}
.item strong {
  font-size: 13px;
}
.item span {
  font-size: 12px;
  color: #dcb2e4;
}
.preview {
  position: relative;
  min-height: 230px;
  background: radial-gradient(ellipse, #78588766, transparent);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}
.preview .preview-name {
  font-size: 17px;
  letter-spacing: 2px;
}
.settings-list {
  display: grid;
  gap: 14px;
}
.setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  background: #4a2a5655;
  padding: 13px;
  border-radius: 4px;
}
.setting input[type="checkbox"] {
  accent-color: #e894f2;
  width: 23px;
  height: 23px;
}
.setting input[type="range"] {
  accent-color: #d58fe7;
  max-width: 200px;
}
.setting select {
  background: #45254f;
  border: 1px solid #b286bd;
  padding: 7px;
  border-radius: 4px;
  max-width: 60%;
}
.goal {
  padding: 15px;
  background: #40204f80;
  border: 1px solid #87599a;
  border-radius: 5px;
  margin-bottom: 12px;
}
.goal .line {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}
.goal h3 {
  margin: 0 0 10px;
  font-size: 16px;
}
.goal progress {
  width: 100%;
  accent-color: #e1a3e7;
  height: 10px;
}
.goal small {
  display: block;
  color: #cfb2dc;
  margin-top: 5px;
}
.records {
  width: 100%;
  border-collapse: collapse;
}
.records th,
.records td {
  text-align: left;
  border-bottom: 1px solid #88619a66;
  padding: 12px;
}
.empty {
  text-align: center;
  padding: 20px;
  color: #cfb2dc;
}
.error {
  color: #ffbecb;
}
.help-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.help-grid div {
  padding: 14px;
  border: 1px solid #805594;
  border-radius: 5px;
}
.help-grid strong {
  color: #b8ffff;
}
.help-grid p {
  margin-bottom: 0;
}
.restore-note {
  font-size: 11px;
  color: #c4a8cf;
  margin-top: 24px;
}
.rotation-tip {
  display: none;
}
#loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, #5f3c74, #21132f 75%);
  gap: 10px;
}
#loading img {
  width: 290px;
  height: 230px;
  object-fit: contain;
}
#loading p {
  font-size: 21px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 4px;
  margin: 10px;
}
#load-status {
  color: #d1b5dc;
  font-size: 13px;
}
#toast {
  pointer-events: none;
  position: absolute;
  top: 17%;
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  opacity: 0;
  transition: 0.2s;
  padding: 12px 25px;
  background: #311641e8;
  border: 1px solid #e7b3ef;
  border-radius: 5px;
  text-align: center;
  max-width: 90%;
  font-weight: 700;
  z-index: 20;
}
#toast.visible {
  opacity: 1;
  transform: translateX(-50%);
}
.boost-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.boost-list .item img {
  height: 58px;
}
.credits {
  text-align: center;
}
a {
  color: #c8fbff;
}
.hidden {
  display: none !important;
}
@media (max-height: 570px) {
  .topbar {
    top: 13px;
    left: 20px;
    right: 20px;
  }
  .home-logo {
    top: 8%;
    height: 49%;
  }
  .home-play {
    top: 61%;
  }
  .home-footer {
    bottom: 14px;
    gap: 10px;
  }
  .nav-button {
    padding: 8px 12px;
    min-width: 82px;
    font-size: 12px;
  }
  .profile {
    font-size: 15px;
  }
  .profile img {
    height: 30px;
  }
  .wallet {
    font-size: 17px;
    padding: 5px 10px;
  }
  .home-play .primary {
    padding: 10px;
    min-height: 44px;
  }
  .home-play p {
    font-size: 10px;
    margin: 9px 0;
  }
  .panel {
    padding: 17px 23px;
    max-height: calc(100dvh - 24px);
  }
  .panel-header {
    margin-bottom: 14px;
  }
  .panel h1,
  .panel h2 {
    font-size: 24px;
  }
  .world-card img {
    height: 95px;
  }
  .world-card strong {
    padding: 10px;
    font-size: 18px;
  }
  .world-card span {
    padding-bottom: 10px;
  }
  .panel-actions {
    margin-top: 15px;
  }
  .primary {
    padding: 10px 25px;
    font-size: 19px;
    min-height: 42px;
  }
  .result-score {
    font-size: 48px;
    margin-top: 10px;
  }
  .wish-row {
    margin: 12px 0;
  }
  .wish-tile {
    padding: 7px 15px;
  }
  .result h1 {
    font-size: 28px;
  }
  .result p {
    margin: 8px 0;
  }
  .control {
    height: 52px;
    width: 135px;
    font-size: 20px;
  }
  .controls {
    height: 75px;
    padding-bottom: 13px;
  }
  .dash-meter {
    width: 135px;
    bottom: 7px;
  }
  .hud .score {
    top: 17px;
    font-size: 31px;
  }
  .hud .wish {
    top: 23px;
  }
  .hud .pause {
    top: 14px;
  }
  .hud .multiplier {
    top: 84px;
    font-size: 20px;
  }
  .hud .crystals {
    top: 68px;
  }
  .shop-grid {
    max-height: 46dvh;
  }
  .item {
    min-height: 113px;
    padding: 9px;
  }
  .item img {
    height: 42px;
  }
  .shop-layout {
    grid-template-columns: 1fr 220px;
  }
  .preview {
    min-height: 150px;
  }
  .panel .muted {
    font-size: 12px;
  }
}
@media (max-width: 600px) and (orientation: portrait) {
  .home-logo {
    left: 13%;
    top: 12%;
    width: 74%;
    height: 34%;
  }
  .home-play {
    left: 15%;
    width: 70%;
    top: 66%;
  }
  .home-footer {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    left: 5%;
    right: 5%;
    bottom: 22px;
  }
  .nav-button {
    min-width: 0;
    padding: 10px 6px;
    gap: 6px;
    font-size: 10px;
  }
  .nav-button img {
    width: 20px;
    height: 20px;
  }
  .best-home {
    top: 51%;
    right: 12%;
    font-size: 11px;
  }
  .best-home strong {
    font-size: 25px;
  }
  .topbar {
    top: 18px;
    left: 16px;
    right: 16px;
  }
  .profile small {
    font-size: 9px;
  }
  .profile {
    font-size: 13px;
    gap: 7px;
  }
  .wallet {
    font-size: 16px;
    gap: 7px;
    padding: 6px;
  }
  .wallet img {
    width: 19px;
    height: 23px;
  }
  .cards {
    grid-template-columns: 1fr;
  }
  .world-card {
    display: grid;
    grid-template-columns: 105px 1fr;
    align-items: center;
  }
  .world-card img {
    height: 85px;
    grid-row: span 2;
  }
  .world-card strong {
    padding: 11px 5px 3px;
    font-size: 18px;
  }
  .world-card span {
    padding: 3px 8px 10px;
  }
  .panel {
    padding: 20px;
  }
  .panel h1 {
    font-size: 23px;
  }
  .panel-actions {
    gap: 10px;
  }
  .shop-layout {
    display: flex;
    flex-direction: column-reverse;
  }
  .preview {
    min-height: 130px;
  }
  .shop-grid {
    max-height: 34dvh;
  }
  .tabs {
    gap: 4px;
    margin-bottom: 12px;
  }
  .tabs button {
    padding: 8px 12px;
    font-size: 13px;
  }
  .item {
    min-height: 120px;
  }
  .item strong {
    font-size: 11px;
  }
  .boost-list {
    grid-template-columns: 1fr 1fr;
  }
  .help-grid {
    grid-template-columns: 1fr;
  }
  .control {
    width: 116px;
    height: 58px;
    font-size: 21px;
  }
  .dash-meter {
    width: 116px;
  }
  .hud .score {
    left: 20px;
    font-size: 31px;
  }
  .hud .wish {
    right: 78px;
    font-size: 15px;
  }
  .hud .pause {
    right: 20px;
  }
  .hud .crystals {
    right: 22px;
  }
  .hud .multiplier {
    left: 20px;
    font-size: 20px;
  }
  .tutorial-hint {
    left: 10%;
    right: 10%;
    font-size: 18px;
    top: 20%;
  }
  .rotation-tip {
    display: block;
    position: absolute;
    bottom: 110px;
    width: 100%;
    text-align: center;
    font-size: 11px;
    letter-spacing: 1px;
    color: #ffe9f5bb;
    text-shadow: 0 1px 4px #321337;
    pointer-events: none;
  }
  .records th,
  .records td {
    font-size: 12px;
    padding: 10px 5px;
  }
  .result .stats {
    gap: 16px;
  }
  .result-score {
    font-size: 49px;
  }
  .settings-list .setting {
    padding: 10px;
  }
  .setting select {
    max-width: 55%;
    font-size: 12px;
  }
  .profile .rank-stars {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

#part-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.preview-name {
  position: relative;
  z-index: 1;
  pointer-events: none;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.native-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  line-height: 1;
}
.native-label canvas {
  display: block;
  filter: drop-shadow(0 2px 2px #351441);
}
#score canvas {
  display: block;
  filter: drop-shadow(2px 3px 0 #813d9d);
}

.native-label {
  max-width: 100%;
}
.native-label canvas {
  max-width: 100%;
  height: auto !important;
}
