:root {
  --ink: #0b0b0b;
  --gray: #535353;
  --paper: #f4f4f4;
  --orange: #ff8539;
  --gold: #ffb536;
  --red: #ff6548;
  --pink: #f03c98;
  --green: #37ff52;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: #efefef;
  color: var(--ink);
  font-family: "Pixel Emulator", "Press Start 2P", monospace;
  text-rendering: geometricPrecision;
}

body {
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

#app {
  width: min(100vw, 430px);
  min-height: 100svh;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 12px max(18px, env(safe-area-inset-bottom));
  background: var(--paper);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 56px;
  padding: 8px 0 10px;
  background: var(--paper);
}

.brand {
  display: inline-flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: "Overspray", "Pixel Emulator", monospace;
  font-size: 24px;
  line-height: 1;
  white-space: nowrap;
}

.brand img {
  flex: 0 0 37px;
  width: 37px;
  height: 37px;
  image-rendering: pixelated;
}

.footer-brand img {
  width: 37px;
  height: 37px;
  image-rendering: pixelated;
}

.signin-btn,
.orange-btn,
.white-btn,
.text-btn,
.green-btn,
.learn-more-btn,
.main-action,
.preview-play,
.mini-btn,
.choice-btn,
.reward-card button {
  border-radius: 6px;
  border: 2px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  min-height: 38px;
  padding: 0 16px;
  color: #fff;
  background: var(--orange);
  letter-spacing: 0;
}

.signin-btn {
  min-height: 36px;
  padding: 0 14px;
  font-size: 13px;
}

.green-btn {
  background: #25a488;
  font-size: 12px;
}

.learn-more-btn {
  background: var(--paper);
  color: var(--gray);
  font-size: 11px;
}

.auth-head {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.balance-head {
  text-align: right;
  font-size: 9px;
  line-height: 1.1;
  color: var(--orange);
}

.balance-head b {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1px;
  color: var(--ink);
  font-size: 11px;
}

.balance-head img {
  width: 7px;
  height: 7px;
  vertical-align: 0;
  image-rendering: pixelated;
}

.coin-icon {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  image-rendering: pixelated;
}

.icon-btn {
  display: grid;
  flex: 0 0 46px;
  width: 46px;
  height: 43px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  place-items: center;
}

.icon-btn img {
  display: block;
  width: 46px;
  height: 43px;
  image-rendering: pixelated;
}

.profile-pop {
  position: absolute;
  top: 58px;
  right: 0;
  z-index: 30;
  width: 176px;
  padding: 14px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 4px 4px 0 var(--ink);
}

.profile-pop::before {
  position: absolute;
  top: -12px;
  right: 22px;
  width: 0;
  height: 0;
  border-right: 9px solid transparent;
  border-bottom: 12px solid var(--ink);
  border-left: 9px solid transparent;
  content: "";
}

.profile-pop button {
  display: block;
  width: 100%;
  padding: 12px 4px;
  border: 0;
  background: transparent;
  text-align: left;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  margin: 16px 0 14px;
  text-align: center;
  font-size: clamp(22px, 7vw, 28px);
}

.section-title {
  margin: 26px 0 12px;
  text-align: center;
  font-size: clamp(20px, 6vw, 25px);
}

.provider-screen > h1 {
  margin-top: 16px;
}

.provider-banner {
  display: block;
  margin: 8px 0 14px;
  border-radius: 9px;
  line-height: 0;
}

.provider-banner img {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
}

.game-card {
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 9px;
  background: #f2f2f2;
  box-shadow: 4px 4px 0 var(--ink);
}

.game-card h2 {
  height: 42px;
  padding-top: 12px;
  text-align: center;
  font-size: 19px;
  color: var(--gray);
}

.home-game-card {
  padding-bottom: 14px;
}

.home-game-card h2,
.provider-game-card h2 {
  height: 38px;
  padding-top: 10px;
  color: var(--ink);
  font-size: 22px;
  font-weight: 700;
  text-shadow: 1px 0 0 var(--ink);
}

.provider-game-card {
  padding-bottom: 10px;
}

.provider-preview-scene {
  height: clamp(118px, 35vw, 145px);
}

.preview-scene {
  position: relative;
  width: 100%;
  height: clamp(128px, 38vw, 150px);
  overflow: hidden;
  background: #f2f2f2;
}

.preview-world {
  position: absolute;
  left: 50%;
  top: 0;
  width: 390px;
  height: 150px;
  transform-origin: top center;
}

.preview-cloud {
  width: 70px;
  opacity: 0.45;
}

.preview-cloud-a {
  transform: translate(64px, 18px);
}

.preview-cloud-b {
  transform: translate(262px, 50px);
}

.preview-ground-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 92px;
  height: 1px;
  background: var(--gray);
}

.preview-ground-noise {
  position: absolute;
  left: 0;
  top: 68px;
  width: 780px;
  height: 72px;
  background: url("assets/game/ground-clean.svg") repeat-x left top / 390px 72px;
  opacity: 0.9;
}

.preview-dino {
  width: 96px;
}

.preview-cactus {
  width: 34px;
}

.preview-play {
  display: block;
  width: 150px;
  min-height: 38px;
  margin: 8px auto 0;
  border-color: var(--ink);
  background: var(--gray);
  box-shadow: 4px 4px 0 var(--ink);
  font-size: 12px;
}

.provider-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 0 9px;
  margin-top: 8px;
}

.provider-card-actions .preview-play,
.provider-card-actions .learn-more-btn {
  width: 100%;
  min-height: 40px;
  margin: 0;
}

.integration-block {
  margin: 26px auto 0;
  text-align: center;
}

.integration-block h2 {
  color: var(--ink);
  font-size: clamp(18px, 5.8vw, 24px);
  line-height: 1;
}

.integration-block p {
  max-width: 300px;
  margin: 12px auto 14px;
  color: var(--ink);
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  line-height: 1.45;
}

.integration-block .green-btn {
  min-width: 150px;
}

.contacts-card {
  margin-top: 28px;
  padding: 19px 17px 17px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #9ed49d;
  box-shadow: 4px 4px 0 var(--ink);
  text-align: center;
}

.contacts-card h2 {
  font-size: clamp(18px, 6vw, 24px);
  line-height: 1;
}

.contacts-card > p {
  max-width: 300px;
  margin: 14px auto 15px;
  color: var(--ink);
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  line-height: 1.45;
}

.contact-link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  margin-top: 10px;
  padding: 8px 14px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--paper);
  box-shadow: 4px 4px 0 var(--ink);
  color: var(--ink);
  text-decoration: none;
  font-size: 10px;
}

.contact-link img {
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  image-rendering: pixelated;
}

.contact-link span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.game-stage-card {
  margin-top: 10px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.scene-box {
  position: relative;
  width: 100%;
  height: clamp(285px, 78vw, 345px);
  overflow: hidden;
  background: #f2f2f2;
}

.game-world {
  position: absolute;
  left: 50%;
  top: 0;
  width: 390px;
  height: 330px;
  transform-origin: top center;
}

.sprite {
  position: absolute;
  display: block;
  user-select: none;
  pointer-events: none;
}

.cloud {
  width: 66px;
  opacity: 0.45;
}

#groundLine {
  position: absolute;
  left: 0;
  right: 0;
  top: 252px;
  height: 1px;
  background: var(--gray);
}

#groundNoise {
  position: absolute;
  left: 0;
  top: 228px;
  width: 780px;
  height: 72px;
  background: url("assets/game/ground-clean.svg") repeat-x left top / 390px 72px;
  opacity: 0.9;
}

#dino {
  width: 62px;
}

.cactus {
  width: 36px;
}

#eventSprite.bird {
  width: 67px;
}

#eventSprite.meteor {
  width: 78px;
}

#eventSprite.event-hidden {
  display: none !important;
}

#mult {
  position: absolute;
  top: 104px;
  left: 0;
  z-index: 3;
  width: 100%;
  text-align: center;
  color: var(--gray);
  font-size: 33px;
  line-height: 1;
}

#mult.choice-mult {
  top: 70px;
}

#choice {
  position: absolute;
  top: 30px;
  left: 0;
  z-index: 4;
  display: none;
  width: 100%;
  text-align: center;
  color: var(--gray);
}

#choiceTitle {
  margin-bottom: 50px;
  font-size: 24px;
  line-height: 1;
}

.choice-btn,
.mini-btn {
  display: block;
  width: 200px;
  min-height: 38px;
  margin: 8px auto 0;
  border: 0;
  border-radius: 18px;
  box-shadow: none;
  background: var(--gray);
  color: #fff;
}

.choice-btn {
  min-height: 34px;
  margin-top: 7px;
}

#loseText {
  position: absolute;
  top: 120px;
  width: 100%;
  text-align: center;
  color: var(--gray);
  font-size: 34px;
}

#retryBtn {
  position: absolute;
  top: 160px;
  left: 50%;
  width: 180px;
  transform: translateX(-50%);
}

.cash-box {
  margin-top: 12px;
}

.cash-main,
.cash-tile,
.main-action {
  width: 100%;
  border-radius: 7px;
  background: var(--gray);
  color: #fff;
}

.cash-main {
  display: grid;
  min-height: 48px;
  place-items: center;
  color: var(--green);
  font-size: 16px;
}

.cash-row {
  display: grid;
  grid-template-columns: 1fr 0.8fr;
  gap: 8px;
  margin-top: 8px;
}

.cash-tile {
  position: relative;
  min-height: 56px;
  padding: 10px 12px;
}

.cash-tile span {
  display: block;
  margin-bottom: 4px;
  font-size: 9px;
}

.cash-tile b {
  display: block;
  font-size: 14px;
  word-break: break-word;
}

.bet-arrows {
  position: absolute;
  right: 10px;
  top: 5px;
  display: flex;
  flex-direction: column;
}

.bet-arrows button {
  width: 24px;
  height: 22px;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 15px;
  line-height: 1;
}

.main-action {
  margin-top: 10px;
  min-height: 64px;
  border-color: var(--gray);
  background: var(--gray);
  box-shadow: none;
  font-size: 22px;
}

.main-action.take-ready {
  border: 2px solid var(--gray);
  background: transparent;
  color: var(--gray);
}

.reward-card {
  display: grid;
  grid-template-columns: 62px 1fr;
  gap: 10px;
  align-items: center;
  padding: 13px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--gold);
  box-shadow: 4px 4px 0 var(--ink);
}

.reward-crown-img {
  width: 52px;
  height: 52px;
}

.reward-crown-img {
  display: block;
  align-self: center;
  image-rendering: pixelated;
}

.reward-copy {
  min-width: 0;
}

.reward-copy h3 {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #fff;
  font-size: 18px;
  line-height: 1;
}

.reward-copy > span,
.progress-text {
  margin-top: 6px;
  color: var(--pink);
  font-size: 10px;
}

.progress-text {
  float: right;
}

.progress-bar {
  clear: both;
  height: 8px;
  margin-top: 6px;
  background: rgba(145, 74, 74, 0.35);
}

.progress-bar i {
  display: block;
  width: 0%;
  height: 100%;
  background: var(--pink);
}

.reward-card button {
  grid-column: 1 / -1;
  background: var(--red);
  box-shadow: none;
}

.reward-card button:disabled {
  opacity: 0.55;
}

.footer {
  margin-top: 38px;
  text-align: center;
  color: var(--gray);
}

.footer h3 {
  color: var(--ink);
  font-size: 17px;
}

.footer p {
  margin-top: 9px;
  font-size: 12px;
}

.footer small {
  display: block;
  max-width: 320px;
  margin: 22px auto 10px;
  color: var(--ink);
  font-family: "Press Start 2P", monospace;
  font-size: 7px;
  line-height: 1.5;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  font-family: "Overspray", "Pixel Emulator", monospace;
  font-size: 29px;
}

.footer b {
  display: block;
  margin-top: 10px;
  color: var(--ink);
  font-size: 10px;
}

.game-footer {
  margin-top: 18px;
}

.game-footer small {
  margin-top: 0;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 124px;
  margin-top: 18px;
  padding: 18px;
  border: 2px solid var(--ink);
  border-radius: 9px;
  background: var(--paper);
  box-shadow: 4px 4px 0 var(--ink);
}

.avatar {
  display: block;
  flex: 0 0 82px;
  width: 82px;
  height: 82px;
  object-fit: contain;
  image-rendering: pixelated;
}

.user-card p {
  margin: 6px 0;
  font-size: 12px;
  word-break: break-word;
}

.account-reward {
  margin-top: 12px;
}

.compact {
  margin-top: 180px;
}

.modal {
  width: min(calc(100vw - 24px), 390px);
  padding: 0;
  border: 0;
  background: transparent;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.modal-card {
  position: relative;
  padding: 18px 14px 16px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--paper);
  box-shadow: 4px 4px 0 var(--ink);
}

.modal-card h2 {
  margin-bottom: 18px;
  font-size: 18px;
}

.modal-card p {
  margin-bottom: 10px;
  font-size: 10px;
}

.close {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: transparent;
  box-shadow: none;
  line-height: 0;
}

.close img {
  display: block;
  width: 24px;
  height: 24px;
}

.modal-card label {
  display: block;
  margin-top: 10px;
}

.modal-card label span {
  display: block;
  margin-bottom: 5px;
  font-size: 9px;
}

.modal-card input {
  width: 100%;
  min-height: 42px;
  padding: 0 10px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  font-size: 12px;
}

.orange-btn,
.white-btn,
.text-btn {
  width: 100%;
  margin-top: 12px;
  box-shadow: none;
}

.white-btn,
.text-btn {
  background: var(--paper);
  color: var(--ink);
}

.text-btn {
  min-height: 32px;
  border: 0;
  text-decoration: underline;
}

.form-error {
  min-height: 14px;
  margin-top: 10px;
  color: #d31d1d;
  font-size: 10px;
  line-height: 1.35;
}

.hidden {
  display: none !important;
}

@media (max-width: 340px) {
  #app {
    padding-right: 8px;
    padding-left: 8px;
  }

  .brand {
    font-size: 24px;
  }

  .signin-btn {
    padding: 0 9px;
    font-size: 11px;
  }

  .choice-btn,
  .mini-btn {
    width: 180px;
  }
}
