:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background: #080d1c;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  display: grid;
  place-items: center;
}

button,
a {
  touch-action: manipulation;
  font: inherit;
}

button {
  cursor: pointer;
}

.mobile-page {
  display: grid;
  place-items: center;
  position: relative;
  isolation: isolate;
  width: 100%;
  max-width: 480px;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: #31100c url("assets/bg.webp") center center / cover no-repeat;
}

.telegram-button,
.start-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 1px solid #b7eaff;
  border-radius: 999px;
  background: linear-gradient(180deg, #36b9f2 0%, #159bda 52%, #0a84c5 100%);
  box-shadow: 0 2px 0 #ffffff2e inset, 0 -3px 0 #0069a549 inset, 0 8px 24px #04101b60, 0 0 26px #ffd3725c;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  text-shadow: 0 1px 2px #00649442;
}

.telegram-button {
  width: calc(100% - 48px);
  max-width: 360px;
  min-height: 64px;
  padding: 17px 20px;
  font-size: clamp(15px, 4.1vw, 18px);
  white-space: nowrap;
  animation: heartbeat 1.8s ease-in-out infinite;
  transform-origin: center;
  will-change: transform;
}

.telegram-icon,
.dice-icon {
  display: block;
  flex-shrink: 0;
}

.dice-icon {
  opacity: 0.96;
  transform: rotate(-12deg);
}

.telegram-button:active {
  filter: brightness(0.94);
}

.telegram-button:focus-visible,
.start-button:focus-visible,
.close-button:focus-visible {
  outline: 3px solid #ffe4a2;
  outline-offset: 5px;
}

.game-dialog {
  position: fixed;
  inset: 0;
  width: calc(100% - 48px);
  max-width: 360px;
  max-height: calc(100dvh - 48px);
  margin: auto;
  overflow: auto;
  padding: 24px;
  border: 1px solid #f5cf8a69;
  border-radius: 28px;
  background: radial-gradient(ellipse at 50% 0, #253244 0%, #111c2c 52%, #0b1422 100%);
  box-shadow: 0 1px 0 #fff1d51a inset, 0 24px 80px #0009, 0 0 40px #ffcc651a;
  color: #fff;
}

.game-dialog[open] {
  animation: dialog-enter 220ms ease-out both;
}

.game-dialog::backdrop {
  background: #030713ad;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.game-dialog[open]::backdrop {
  animation: backdrop-enter 220ms ease-out both;
}

.close-button {
  display: grid;
  place-items: center;
  position: absolute;
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid #ffffff1a;
  border-radius: 50%;
  background: #ffffff09;
}

.close-button:active {
  background: #ffffff20;
}

.dialog-content {
  padding: 40px 0 28px;
}

#game-title {
  margin: 0 0 16px;
  font-size: 24px;
}

#game-title:empty {
  display: none;
}

.trust-list {
  display: grid;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: clamp(14px, 3.85vw, 16px);
  font-weight: 500;
  line-height: 1.4;
}

.trust-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.trust-icon {
  display: grid;
  place-items: center;
  flex: 0 0 36px;
  height: 36px;
  border: 1px solid #f5cf8a29;
  border-radius: 11px;
  background: #f5cf8a0a;
}

.trust-icon img {
  display: block;
}

.start-button {
  width: 100%;
  min-height: 56px;
  padding: 14px 20px;
  font-size: 17px;
  border-color: #ffe4af;
  background: linear-gradient(180deg, #ffe7b6 0%, #f5cf8a 52%, #dca855 100%);
  box-shadow: 0 2px 0 #fff7e35c inset, 0 -3px 0 #9c652b38 inset, 0 8px 24px #0003, 0 0 22px #f5cf8a12;
  color: #33220f;
  text-shadow: 0 1px 0 #fff4d959;
}

.start-button:active {
  transform: scale(0.98);
}

@keyframes heartbeat {
  0%, 100% { transform: scale(0.97); }
  50% { transform: scale(1.035); }
}

@keyframes dialog-enter {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes backdrop-enter {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::backdrop {
    animation: none !important;
    will-change: auto !important;
  }
}
