@font-face {
  font-family: 'Mattone';
  src: url('./fonts/Mattone-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'uRegular';
  src: url(https://wavecdn.b-cdn.net/fonts/UnitPro-Regular.woff2) format('woff2'),
    url(https://wavecdn.b-cdn.net/fonts/UnitPro-Regular.woff) format('woff'),
    url(https://wavecdn.b-cdn.net/fonts/UnitPro-Regular.ttf) format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'uMedi';
  src: url(https://wavecdn.b-cdn.net/fonts/UnitPro-Medium.woff2) format('woff2'),
    url(https://wavecdn.b-cdn.net/fonts/UnitPro-Medium.woff) format('woff'),
    url(https://wavecdn.b-cdn.net/fonts/UnitPro-Medium.ttf) format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --reborn-green: #34bc7d;
  --reborn-green-light: #71d1a4;
  --reborn-green-pale: #9adebe;
  --reborn-green-bg: #d6f2e5;
  --reborn-teal: #003f46;
  --reborn-teal-muted: #4d797e;
  --reborn-heading: #373c4b;
  --reborn-text: #373c4b;
  --reborn-neutral: #ccd9da;
  --reborn-page: #e8e8e8;
  --reborn-white: #ffffff;
  --reborn-gray--light: #f9f9fa;
  --reborn-header-teal: #014045;
  --reborn-violet: #7c3aed;
  --reborn-dark: #0f0f1a;
  --reborn-dark-mid: #1a1a2e;
  --font: 'uRegular', Helvetica, Arial, sans-serif;
  --radius-btn: 4px;
  --reborn-cta: #34bc7d;
  --reborn-cta-hover: #71d1a4;
  --gizzmo-cta: rgb(110, 201, 62);
  --gizzmo-cta-hover: #5ba533;
  --shadow-soft: 0 12px 40px rgba(0, 63, 70, 0.18);
  --wheel-size-min: 19.25rem; /* 308px */
  --wheel-size-max: 22.5rem; /* 360px */
  --reborn-header-height: 64px;
}

@media (min-width: 768px) {
  :root {
    --reborn-header-height: 62px;
  }
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--reborn-text);
  background: var(--reborn-gray--light);
}

body.has-reborn-header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: 0;
}

body.has-reborn-header .page {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  width: 100%;
  min-height: 0;
  padding: 20px 16px 28px;
  overflow-x: hidden;
  overflow-y: auto;
  isolation: isolate;
  background-color: #5dc4c9;
  -webkit-overflow-scrolling: touch;
}

.page__atmosphere {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background-color: #5dc4c9;
  background-image: url('./images/bingo-bg.png');
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
}

.page__atmosphere::before,
.page__atmosphere::after {
  content: none;
  display: none;
}

.page__title {
  position: relative;
  z-index: 1;
  margin: 0;
  margin-top: 20px;
  font-family: 'uMedi', var(--font);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.25;
  color: #222b47;
  text-align: center;
}

.page__subtitle {
  position: relative;
  z-index: 1;
  margin: 0;
  max-width: 520px;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1.35;
  color: #222b47;
  text-align: center;
}

@media (min-width: 768px) {
  .page__title {
    font-size: 24px;
    line-height: 1.25;
  }

  .page__subtitle {
    font-size: 1.05rem;
  }
}

@media (min-width: 1024px) {
  .page__title {
    font-size: 32px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reveal-grid--active .reveal-card:not(:disabled):not(.is-flipped) {
    animation: none;
  }

  .reveal-card__inner {
    transition-duration: 0.01ms;
  }
}

.site-topbar {
  flex-shrink: 0;
  width: 100%;
  background: #0b1123;
}

.site-topbar__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 20px;
  height: 62px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 5px 24px 0;
}

.site-topbar__link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: #ffffff;
  opacity: 0.7;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1;
  text-decoration: none;
  transition: opacity 0.15s ease-in-out;
}

.site-topbar__link:hover,
.site-topbar__link:focus-visible {
  opacity: 1;
  color: #ffffff;
}

.site-topbar__link--back {
  justify-self: start;
}

.site-topbar__link--phone {
  justify-self: end;
}

.site-topbar__icon {
  width: 20px;
  height: 20px;
  display: block;
  flex-shrink: 0;
}

.site-topbar__link-text {
  white-space: nowrap;
}

.site-topbar__logo {
  justify-self: center;
  display: block;
  line-height: 0;
  flex-shrink: 0;
}

.site-topbar__logo img {
  display: block;
  width: 168px;
  height: auto;
}

@media (min-width: 768px) and (max-width: 1024px) {
  .site-topbar__inner {
    padding: 5px 16px 0;
    gap: 14px;
  }

  .site-topbar__link {
    font-size: 13px;
  }
}

@media (max-width: 767px) {
  .site-topbar__inner {
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    height: 64px;
    padding: 0 14px;
  }

  .site-topbar__link-text {
    display: none;
  }

  .site-topbar__logo img {
    width: 154px;
  }
}

.prize-board {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 26.25rem;
  margin: 0 auto;
  padding: 8px 4px 12px;
}

.reveal-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}

.reveal-grid__center,
.reveal-card {
  border: none;
  border-radius: 3px;
  background: linear-gradient(
    145deg,
    #fff8dc 0%,
    #e8c547 16%,
    #fff4cc 30%,
    #c9a227 48%,
    #fff9e6 62%,
    #d4af37 78%,
    #f7e7a8 100%
  );
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

.reveal-grid__center {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  aspect-ratio: 1;
  min-height: 0;
  padding: 6px;
  overflow: hidden;
  text-align: center;
}

.reveal-grid__center::before {
  content: '';
  position: absolute;
  inset: 6px;
  z-index: 0;
  background: radial-gradient(
    ellipse at 50% 42%,
    #fffef8 0%,
    #fdf2c4 52%,
    #f5e096 100%
  );
}

.reveal-grid__center-title {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 0 6px;
  font-family: 'uMedi', var(--font);
  font-size: clamp(0.68rem, 2.5vw, 0.84rem);
  font-weight: 400;
  line-height: 1.35;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #1a1a1b;
}

.reveal-card {
  position: relative;
  width: 100%;
  margin: 0;
  padding: 6px;
  cursor: not-allowed;
  perspective: 760px;
  -webkit-tap-highlight-color: transparent;
}

.reveal-grid--active .reveal-card:not(:disabled) {
  cursor: pointer;
}

.reveal-grid--active .reveal-card:not(:disabled):not(.is-flipped) {
  animation: reveal-card-pulse 1.8s ease-in-out infinite;
}

.reveal-grid--won .reveal-card,
.reveal-grid--active .reveal-card.is-flipped {
  animation: none;
}

@keyframes reveal-card-pulse {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.02);
  }
}

.reveal-card__inner {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  transform-style: preserve-3d;
  transition: transform 0.58s cubic-bezier(0.34, 1.12, 0.48, 1);
  will-change: transform;
}

.reveal-card.is-flipped .reveal-card__inner {
  transform: rotateY(180deg);
}

.reveal-card.is-selected {
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.2));
}

.reveal-card__face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.reveal-card__face--front {
  transform: rotateY(0deg);
  color: #7388c5;
  background: #1a2842 url('./images/bingo-card.png') center center / cover no-repeat;
  opacity: 1;
  transition: opacity 0.18s ease;
}

.reveal-card__front-label {
  position: relative;
  z-index: 1;
  font-family: 'uMedi', var(--font);
  font-size: clamp(4rem, 24vw, 6.5rem);
  font-weight: 400;
  line-height: 1;
  color: #7388c5;
  text-shadow: 0 2px 12px rgba(115, 136, 197, 0.35);
}

.reveal-card__face--back {
  transform: rotateY(180deg);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.reveal-card.is-flipped .reveal-card__face--front {
  opacity: 0;
}

.reveal-card.is-flipped .reveal-card__face--back {
  opacity: 1;
}

.reveal-card__face--win {
  color: #1a1a1b;
  background: radial-gradient(
    ellipse at 50% 42%,
    #fffef8 0%,
    #fdf2c4 52%,
    #f5e096 100%
  );
}

.reveal-card__face--lose {
  color: #7388c5;
  background: #1a2842 url('./images/bingo-card.png') center center / cover no-repeat;
}

.reveal-card__prize-value {
  font-family: 'uMedi', var(--font);
  font-size: clamp(1.35rem, 6.5vw, 1.65rem);
  line-height: 1.05;
  letter-spacing: 0.02em;
  color: #1a1a1b;
}

.reveal-card__prize-detail {
  font-family: 'uMedi', var(--font);
  font-size: clamp(0.72rem, 3.4vw, 0.9rem);
  line-height: 1.15;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #1a1a1b;
}

.reveal-card__emoji {
  font-size: clamp(1.85rem, 9vw, 2.35rem);
  line-height: 1;
}

.reveal-card__lose-label {
  font-family: 'uMedi', var(--font);
  font-size: clamp(0.62rem, 3vw, 0.78rem);
  line-height: 1.2;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #7388c5;
}

@media (max-width: 399px) {
  .reveal-card__front-label {
    font-size: clamp(2.5rem, 16vw, 3.25rem);
  }

  .reveal-card__prize-value {
    font-size: clamp(1rem, 5vw, 1.2rem);
  }

  .reveal-card__prize-detail {
    font-size: clamp(0.58rem, 2.6vw, 0.72rem);
  }

  .reveal-card__emoji {
    font-size: clamp(1.35rem, 6.5vw, 1.65rem);
  }

  .reveal-card__lose-label {
    font-size: clamp(0.5rem, 2.4vw, 0.62rem);
  }
}

.game__title {
  margin: 0 0 20px;
  font-family: 'uMedi', var(--font);
  font-size: 24px;
  font-weight: 400;
  line-height: 1.3;
  color: var(--reborn-heading);
  text-align: center;
}

.game__subtitle {
  margin-bottom: 22px;
  font-family: var(--font);
  font-size: 1.125rem;
  font-weight: 400;
  line-height: 1.25;
  color: var(--reborn-text);
}

.btn {
  display: block;
  width: 100%;
  max-width: 328px;
  margin: 0 auto;
  padding: 18px 32px;
  border: none;
  border-radius: var(--radius-btn);
  font-family: 'uMedi', var(--font);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.2;
  text-align: center;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.btn--primary {
  color: var(--reborn-white);
  background: var(--reborn-cta);
}

.btn--primary:hover:not(:disabled) {
  background: var(--reborn-cta-hover);
}

.btn--primary:active:not(:disabled) {
  opacity: 0.92;
}

.btn--primary__gizzmo {
  color: var(--reborn-white);
  background: var(--gizzmo-cta);
}

.btn--primary__gizzmo:hover:not(:disabled) {
  background: var(--gizzmo-cta-hover);
}

.btn--primary__gizzmo:active:not(:disabled) {
  opacity: 0.92;
}

.win-popup__cta {
  color: var(--reborn-white);
  background: var(--gizzmo-cta);
}

.win-popup__cta:hover {
  background: var(--gizzmo-cta-hover);
}

.win-popup__cta:active {
  opacity: 0.92;
}

.btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

body.has-win-popup {
  overflow: hidden;
}

.win-popup {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.win-popup[hidden] {
  display: none;
}

.win-popup__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(55, 60, 75, 0.55);
  backdrop-filter: blur(4px);
}

.win-popup__dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 750px;
  padding: 36px 24px;
  border-radius: 16px;
  background: var(--reborn-white);
  text-align: center;
  box-shadow: 0 24px 48px rgba(0, 63, 70, 0.2);
}

.win-popup__header {
  margin: 0 0 24px;
}

.win-popup__header .game__title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.win-popup__header .game__title .game__subtitle {
  margin: 0;
  font-family: var(--font);
}

.win-popup__prize-box {
  width: 100%;
  max-width: 23.75rem;
  margin: 0 auto 1.5rem;
  padding: 1.5rem 1.25rem 2rem;
  border: 1px solid #e0e3e8;
  border-radius: 0.625rem;
  background: #f0f1f3;
  box-shadow: inset 0 1px 2px rgba(55, 60, 75, 0.06);
}

.win-popup__prize-value {
  margin: 0 0 6px;
  font-family: 'uMedi', var(--font);
  font-size: clamp(2.5rem, 12vw, 3.5rem);
  font-weight: 400;
  line-height: 1.05;
  color: var(--reborn-heading);
}

.win-popup__prize-detail {
  margin-top: 1.25rem;
  margin-bottom: 0;
  font-family: 'uMedi', var(--font);
  font-size: clamp(1rem, 4.5vw, 1.25rem);
  font-weight: 400;
  line-height: 1.3;
  color: var(--reborn-heading);
}

.win-popup__disclaimer {
  margin: 1.5rem auto 0;
  padding: 0 2px;
  max-width: 36rem;
  font-family: var(--font);
  font-size: 0.75rem;
  line-height: 1.4;
  color: #8a8f9a;
  text-align: center;
}

.win-popup__disclaimer a {
  color: inherit;
  text-decoration: none;
}

.win-popup__disclaimer a:hover,
.win-popup__disclaimer a:focus {
  text-decoration: underline;
}

.win-popup__disclaimer[hidden] {
  display: none;
}

@media (min-width: 768px) {
  .prize-board {
    max-width: 33.125rem; /* 530px */
  }

  .reveal-grid__center-title {
    font-size: 1.25rem;
  }

  .win-popup__disclaimer {
    margin-top: 2.5rem;
    padding: 0;
  }

  .game__title {
    font-size: 32px;
    line-height: 1.3;
  }
}

@media (max-width: 767px) {
  body.has-reborn-header .page {
    align-items: center;
    justify-content: flex-start;
    min-height: calc(100svh - var(--reborn-header-height));
    min-height: calc(100dvh - var(--reborn-header-height));
    padding: 12px;
  }
}
