:root {
  color-scheme: only light;
  --bg-a: #101827;
  --bg-b: #142b38;
  --panel: rgba(255, 255, 255, 0.09);
  --panel-strong: rgba(255, 255, 255, 0.15);
  --text: #f7fbff;
  --muted: rgba(247, 251, 255, 0.72);
  --cyan: #40e3ff;
  --pink: #ff4fd8;
  --lime: #b8ff5c;
  --orange: #ffb444;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 16% 12%, rgba(64, 227, 255, 0.26), transparent 30%),
    radial-gradient(circle at 88% 18%, rgba(255, 79, 216, 0.22), transparent 30%),
    linear-gradient(155deg, var(--bg-a), var(--bg-b));
}

button {
  font: inherit;
}

.app {
  min-height: 100vh;
  width: 100vw;
  position: relative;
  display: grid;
  place-items: center;
  padding: clamp(14px, 3vw, 34px);
}

.screen {
  position: absolute;
  inset: 0;
  padding: clamp(16px, 3vw, 34px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  opacity: 0;
  transform: translateY(18px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.24s ease, transform 0.28s ease;
}

.screen--active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.hero,
.result-card,
.modal-card {
  width: min(680px, 100%);
  padding: clamp(22px, 5vw, 44px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.06));
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.28);
  text-align: center;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--cyan);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.hero-top .eyebrow {
  margin: 0;
}

.language-switch {
  display: inline-flex;
  align-items: center;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 1px rgba(64, 227, 255, 0.05);
}

.language-switch__btn {
  min-width: 40px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
  letter-spacing: 0;
}

.language-switch__btn--active {
  color: #06111b;
  background: var(--cyan);
}

h1,
h2 {
  margin: 0;
  line-height: 0.95;
}

h1 {
  font-size: clamp(44px, 11vw, 86px);
}

h2 {
  font-size: clamp(38px, 9vw, 74px);
}

.subtitle {
  max-width: 540px;
  margin: 18px auto 0;
  color: var(--muted);
  font-size: clamp(16px, 2.4vw, 21px);
  line-height: 1.45;
}

.actions {
  margin-top: 24px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

.btn,
.icon-btn {
  border: 0;
  cursor: pointer;
  color: var(--text);
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.btn {
  min-width: 138px;
  padding: 13px 22px;
  border-radius: 999px;
  font-weight: 700;
}

.btn:active,
.icon-btn:active {
  transform: translateY(2px) scale(0.98);
}

.btn--primary {
  background: linear-gradient(135deg, var(--cyan), #3d7dff);
  box-shadow: 0 14px 28px rgba(64, 227, 255, 0.26);
}

.btn--ghost {
  background: rgba(255, 255, 255, 0.14);
}

.rules {
  width: min(680px, 100%);
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  display: grid;
  gap: 8px;
  padding: 0 18px;
  color: var(--muted);
  text-align: center;
  transition: max-height 0.24s ease, opacity 0.24s ease, padding 0.24s ease;
}

.rules--open {
  max-height: 220px;
  opacity: 1;
  padding: 14px 18px;
}

.hud {
  width: min(960px, 100%);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.hud > div,
.icon-btn {
  min-height: 58px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: var(--panel);
  display: grid;
  place-items: center;
}

.hud span {
  color: var(--muted);
  font-size: 12px;
}

.hud strong {
  font-size: 22px;
}

.icon-btn {
  width: 58px;
  font-weight: 800;
}

.stage-wrap {
  width: min(960px, calc(100vw - 28px));
  height: min(1440px, calc(100vh - 118px));
  display: grid;
  place-items: center;
}

canvas {
  width: 100%;
  height: 100%;
  max-height: calc(100vh - 118px);
  aspect-ratio: 2 / 3;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: #07121f;
  box-shadow:
    0 0 0 1px rgba(64, 227, 255, 0.12),
    0 26px 70px rgba(0, 0, 0, 0.34);
  touch-action: none;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(5, 10, 18, 0.62);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal--visible {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  max-width: 440px;
  transform: translateY(14px) scale(0.96);
  transition: transform 0.22s ease;
}

.modal--visible .modal-card {
  transform: translateY(0) scale(1);
}

@media (max-width: 620px) {
  .hero-top {
    align-items: flex-start;
  }

  .language-switch__btn {
    min-width: 38px;
  }

  .hud {
    grid-template-columns: repeat(3, minmax(0, 1fr)) 48px;
  }

  .icon-btn {
    width: 48px;
    min-height: 48px;
  }

  .hud > div {
    min-height: 52px;
  }

  .hud strong {
    font-size: 19px;
  }
}
