html,
body,
#app {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #17191f;
  color: #f5f7fb;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html,
body {
  min-height: 100dvh;
}

[hidden] {
  display: none !important;
}

#app {
  position: fixed;
  inset: 0;
}

.boot-panel {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: grid;
  place-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
  background: #17191f;
}

.boot-panel h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
}

.boot-panel p {
  max-width: 460px;
  margin: 0;
  color: #cbd3e3;
  font-size: 16px;
  line-height: 1.45;
}

.boot-panel button,
.auth-form button,
.account-button,
.account-screen button {
  justify-self: center;
  border: 1px solid #6a86ff;
  border-radius: 8px;
  padding: 10px 16px;
  background: #2f4fe8;
  color: white;
  font-size: 15px;
  cursor: pointer;
}

.auth-panel {
  display: grid;
  gap: 12px;
  justify-items: center;
  width: min(100%, 420px);
}

.auth-choice-buttons {
  display: grid;
  width: 100%;
  gap: 10px;
  justify-items: center;
}

.auth-choice-buttons--stacked {
  justify-items: stretch;
}

.telegram-login-widget {
  display: grid;
  place-items: center;
  min-height: 40px;
  min-width: 220px;
}

.auth-form {
  display: grid;
  width: 100%;
  gap: 10px;
  text-align: left;
}

.auth-form label,
.account-panel h3,
.account-screen h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #f5f7fb;
}

.auth-form input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #35405c;
  border-radius: 8px;
  padding: 11px 12px;
  background: #10141f;
  color: #f5f7fb;
  font-size: 15px;
}

.auth-flash,
.account-panel__meta {
  color: #aebbd5;
  font-size: 14px;
}

.account-button {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 3;
}

.account-screen {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 20%, rgba(112, 130, 255, 0.28), transparent 32%),
    radial-gradient(circle at 80% 10%, rgba(255, 186, 73, 0.18), transparent 30%),
    rgba(7, 10, 18, 0.86);
  backdrop-filter: blur(12px);
}

.account-screen:focus {
  outline: none;
}

body.account-modal-open #game-frame {
  pointer-events: none;
}

.account-screen__shell {
  display: grid;
  gap: 16px;
  width: min(880px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  overflow: auto;
  padding: 22px;
  border: 1px solid #2a3144;
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(14, 19, 31, 0.98), rgba(26, 31, 44, 0.98));
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.42);
}

.account-screen__eyebrow {
  margin: 0 0 4px;
  color: #9fb1d7;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.account-panel__header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.account-panel__header h2 {
  margin: 0;
  font-size: clamp(26px, 4vw, 42px);
  line-height: 1;
}

.account-panel__section {
  display: grid;
  gap: 10px;
}

.account-panel__section ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.account-panel__section li {
  border: 1px solid #2a3144;
  border-radius: 10px;
  padding: 10px 12px;
  background: #131927;
  color: #f5f7fb;
}

.account-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 6px;
  border: 1px solid #29334a;
  border-radius: 16px;
  background: #0d1320;
}

.account-tabs__button {
  width: 100%;
  border-color: transparent !important;
  background: transparent !important;
  color: #b8c5df !important;
}

.account-tabs__button--active {
  background: #f0b84c !important;
  color: #17191f !important;
}

.account-tab {
  display: grid;
  gap: 16px;
}

.account-balance-card,
.account-stat-grid > div,
.account-achievement,
.account-topup-pack {
  border: 1px solid #2a3144;
  border-radius: 18px;
  padding: 16px;
  background: rgba(12, 17, 29, 0.76);
}

.account-balance-card {
  display: grid;
  gap: 8px;
}

.account-balance-card strong {
  color: #ffd166;
  font-size: clamp(34px, 7vw, 64px);
  line-height: 1;
}

.account-balance-card span,
.account-balance-card small,
.account-stat-grid span,
.account-achievement p,
.account-topup-pack p {
  color: #aebbd5;
}

.account-topup-packs,
.account-achievements-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.account-topup-pack {
  display: grid;
  gap: 8px;
}

.account-topup-pack strong,
.account-achievement strong,
.account-stat-grid strong {
  font-size: 22px;
}

.account-achievement {
  position: relative;
  display: grid;
  gap: 8px;
}

.account-achievement--locked {
  opacity: 0.58;
}

.account-achievement__progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #1c2638;
}

.account-achievement__progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f0b84c, #7dd3fc);
}

.account-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.account-stat-grid > div {
  display: grid;
  gap: 8px;
}

.account-screen__refresh {
  justify-self: end !important;
  border-color: #394866 !important;
  background: #151e2e !important;
}

.account-screen[aria-busy="true"] .account-screen__shell {
  cursor: progress;
}

.account-screen[aria-busy="true"] .account-screen__refresh {
  opacity: 0.62;
}

.account-ledger-list li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
}

.account-ledger-list strong {
  color: #ffd166;
}

.account-ledger-list span {
  color: #aebbd5;
  font-size: 13px;
}

.auth-form--compact label {
  font-size: 13px;
}

@media (max-width: 640px) {
  .account-screen {
    padding: 12px;
  }

  .account-screen__shell {
    width: 100%;
    max-height: calc(100dvh - 24px);
    padding: 16px;
  }

  .account-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

body.auth-required #retry-button,
body.auth-required #game-frame {
  display: none;
}

#game-frame {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

body.ready .boot-panel {
  display: none;
}
