/* baseline reset (auto-injected) */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { line-height: 1.5; -webkit-font-smoothing: antialiased; min-height: 100vh; }
img, picture, video, canvas, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; }
ul, ol { list-style: none; }
button { background: none; border: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* ── Custom Properties ── */
  :root {
    --color-primary: #B8860B;
    --color-accent: #F5C842;
    --color-background: #1A0A2E;
    --color-surface: #2D1B4E;
    --color-text: #F9F3E3;
    --color-text-muted: #C9B99A;
    --color-gold-glow: rgba(245, 200, 66, 0.35);
    --radius-md: 1rem;
    --radius-lg: 1.6rem;
    --radius-xl: 2.4rem;
    --shadow-gold: 0 4px 32px rgba(184, 134, 11, 0.45);
    --shadow-panel: 0 8px 48px rgba(0, 0, 0, 0.6);
    --font-display: clamp(1.5rem, 5vw, 2.8rem);
    --font-sub: clamp(1rem, 3vw, 1.5rem);
  }

  /* ── Base ── */
  html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    background: var(--color-background);
    color: var(--color-text);
    font-family: 'Georgia', 'Times New Roman', serif;
  }

  /* ── Background Section ── */
  .background {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    background-image: url('../images/luxury-bg.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
  }

  .background::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
      to bottom,
      rgba(26, 10, 46, 0.45) 0%,
      rgba(26, 10, 46, 0.25) 50%,
      rgba(26, 10, 46, 0.55) 100%
    );
    pointer-events: none;
  }

  .background__left,
  .background__right {
    position: absolute;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    pointer-events: none;
  }

  .background__left  { left: 0; }
  .background__right { right: 0; }

  .background__left__top,
  .background__right__top {
    display: flex;
    align-items: flex-start;
  }

  .background__left__bottom,
  .background__right__bottom {
    display: flex;
    align-items: flex-end;
  }

  .background__cloud {
    opacity: 0.18;
    filter: hue-rotate(220deg) saturate(0.4) brightness(1.4);
    pointer-events: none;
    user-select: none;
  }

  .background__cloud-left-1  { width: clamp(80px, 16vw, 160px); }
  .background__cloud-left-2  { width: clamp(60px, 12vw, 120px); }
  .background__cloud-left-3  { width: clamp(70px, 14vw, 140px); margin-left: -1rem; }
  .background__cloud-left-4  { width: clamp(50px, 10vw, 100px); }
  .background__cloud-right-1 { width: clamp(80px, 16vw, 160px); }
  .background__cloud-right-2 { width: clamp(60px, 12vw, 120px); }
  .background__cloud-right-3 { width: clamp(70px, 14vw, 140px); }

  .background__stars {
    position: absolute;
    inset: 0;
    pointer-events: none;
  }

  .background__star {
    position: absolute;
    filter: hue-rotate(30deg) saturate(2) brightness(1.2);
    opacity: 0.7;
    pointer-events: none;
    user-select: none;
    animation: starPulse 3s ease-in-out infinite alternate;
  }

  .background__star-1 { top: 8%;  left: 12%; width: clamp(16px, 3vw, 28px); animation-delay: 0s; }
  .background__star-2 { top: 15%; right: 18%; width: clamp(12px, 2.5vw, 22px); animation-delay: 0.6s; }
  .background__star-3 { top: 30%; left: 6%;  width: clamp(10px, 2vw, 18px); animation-delay: 1.1s; }
  .background__star-4 { top: 20%; right: 8%; width: clamp(14px, 2.5vw, 24px); animation-delay: 1.7s; }
  .background__star-5 { top: 5%;  left: 45%; width: clamp(10px, 2vw, 18px); animation-delay: 0.4s; }
  .background__star-6 { top: 40%; right: 5%; width: clamp(20px, 3.5vw, 32px); animation-delay: 2s; }

  @keyframes starPulse {
    from { opacity: 0.4; transform: scale(0.9); }
    to   { opacity: 1;   transform: scale(1.15); }
  }

  /* ── Game Section ── */
  .game {
    position: relative;
    z-index: 1;
    align-items: center;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: center;
    padding: clamp(1.2rem, 4vw, 2.8rem);
    width: 100%;
  }

  @media screen and (orientation: landscape) and (max-height: 550px) {
    .game {
      flex-direction: row;
      gap: 2rem;
    }
  }

  .game__header {
    text-align: center;
    margin-bottom: clamp(0.8rem, 2vw, 1.6rem);
    z-index: 1;
  }

  .game__header__h1 {
    font-size: var(--font-display);
    font-weight: 700;
    color: var(--color-accent);
    text-shadow: 0 2px 16px rgba(245, 200, 66, 0.5);
    letter-spacing: 0.03em;
    text-wrap: balance;
    margin-bottom: 0.4rem;
  }

  .game__header__h3 {
    font-size: var(--font-sub);
    color: var(--color-text);
    font-weight: 400;
    letter-spacing: 0.02em;
    text-wrap: balance;
  }

  .game__header__text {
    color: var(--color-text);
    font-size: clamp(0.95rem, 2.5vw, 1.3rem);
    text-transform: initial;
    margin-bottom: 0.5rem;
    text-wrap: balance;
  }

  /* ── Game Main ── */
  .game__main {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    max-width: min(420px, 80vw);
    margin: 0 auto;
  }

  .game__main__image {
    transform: rotate(0);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-height: clamp(180px, 42vh, 360px);
    max-width: 100%;
    object-fit: contain;
    filter: drop-shadow(0 8px 32px rgba(184, 134, 11, 0.5));
    pointer-events: none;
    user-select: none;
  }

  .game__main__image-rotate-1 {
    transform: rotate(8deg);
  }

  .game__main__image-rotate-2 {
    transform: rotate(-8deg);
  }

  .game__main__image-hand {
    bottom: clamp(2rem, 6vw, 5.5rem);
    right: clamp(1rem, 5vw, 7rem);
    height: clamp(48px, 10vw, 80px);
    width:  clamp(48px, 10vw, 80px);
    position: absolute;
    pointer-events: none;
    user-select: none;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.4));
    object-fit: contain;
  }

  @keyframes handPulse {
    0%, 100% { transform: translateY(0) scale(1); }
    50%       { transform: translateY(6px) scale(0.95); }
  }

  .game__main__image-hand-animation-pulse {
    animation: handPulse 1.2s ease-in-out infinite;
  }

  .game__main__bonus-container {
    height: 100%;
    left: 0;
    position: absolute;
    top: 0;
    width: 100%;
    z-index: 1;
    pointer-events: none;
  }

  .game__main__bonus-value {
    animation: fadeOut 3s forwards;
    color: var(--color-accent);
    font-size: clamp(1.2rem, 3vw, 2.4rem);
    font-weight: 700;
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
    opacity: 1;
    position: absolute;
    pointer-events: none;
    user-select: none;
  }

  @keyframes fadeOut {
    0%   { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-32px); }
  }

  /* ── Progress Bar ── */
  .game__footer {
    width: 100%;
    max-width: min(420px, 90vw);
    margin: 0 auto;
    padding-top: clamp(0.6rem, 2vw, 1.2rem);
  }

  .game__progress {
    align-items: center;
    background-color: rgba(45, 27, 78, 0.85);
    border: 1px solid rgba(245, 200, 66, 0.25);
    border-radius: var(--radius-lg);
    color: var(--color-text);
    display: flex;
    height: clamp(44px, 7vh, 56px);
    justify-content: center;
    overflow: hidden;
    position: relative;
    box-shadow: 0 2px 12px rgba(0,0,0,0.35);
  }

  .game__progress__bar {
    bottom: 0;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
    left: 0;
    position: absolute;
    top: 0;
    transition: width 1s linear;
    width: 0;
    z-index: 0;
    opacity: 0.7;
  }

  .game__progress__text {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    font-size: clamp(0.9rem, 2.5vw, 1.2rem);
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--color-text);
    gap: 0.3rem;
  }

  .game__progress__value {
    color: var(--color-accent);
    font-weight: 700;
  }

  .game__progress__value-header {
    /* styled via game__header__h3 */
  }

  /* ── Final Screen ── */
  .game-final-screen {
    align-items: center;
    background-image: url('../images/final-screen-bg.webp');
    background-size: cover;
    background-position: center;
    bottom: 0;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: center;
    left: 0;
    padding: clamp(1.2rem, 4vw, 2.8rem);
    position: absolute;
    right: 0;
    top: 0;
    width: 100%;
    z-index: 2;
    overflow: hidden;
  }

  .game-final-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
      to bottom,
      rgba(26, 10, 46, 0.35) 0%,
      rgba(26, 10, 46, 0.15) 50%,
      rgba(26, 10, 46, 0.45) 100%
    );
    pointer-events: none;
  }

  .game-final-screen > * {
    position: relative;
    z-index: 1;
  }

  @media screen and (orientation: landscape) and (max-height: 550px) {
    .game-final-screen {
      flex-direction: row;
      gap: 2rem;
    }
  }

  .game-final-screen .game__header {
    max-width: min(400px, 90vw);
  }

  .game-final-screen .game__header__h1 {
    color: var(--color-primary);
    text-shadow: 0 2px 16px rgba(184, 134, 11, 0.45);
  }

  .game-final-screen .game__header__text {
    color: rgba(45, 27, 78, 0.85);
    font-weight: 600;
    font-size: clamp(0.95rem, 2.5vw, 1.3rem);
  }

  .game-final-screen .game__header__h3 {
    color: rgba(45, 27, 78, 0.7);
    font-size: clamp(0.85rem, 2vw, 1.1rem);
  }

  .game-final-screen .game__main__image {
    transform: scale(1.35);
    filter: drop-shadow(0 12px 40px rgba(184, 134, 11, 0.55));
  }

  /* ── CTA Button (final screen) ── */
  .game__button {
    display: block;
    width: 100%;
    max-width: min(380px, 90vw);
    margin: 0 auto;
    padding: clamp(0.9rem, 2.5vh, 1.4rem) 2rem;
    font-size: clamp(1.1rem, 3vw, 1.6rem);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-background);
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-primary) 100%);
    border: none;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-gold), 0 2px 0 rgba(0,0,0,0.18);
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
    min-height: 56px;
    position: relative;
    overflow: hidden;
    user-select: none;
  }

  .game__button::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0) 60%);
    pointer-events: none;
  }

  .game__button:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 40px rgba(184, 134, 11, 0.6), 0 2px 0 rgba(0,0,0,0.18);
    filter: brightness(1.08);
  }

  .game__button:active {
    transform: translateY(1px) scale(0.98);
    box-shadow: 0 2px 12px rgba(184, 134, 11, 0.35);
    filter: brightness(0.97);
  }

  .game__button:focus-visible {
    outline: 3px solid var(--color-accent);
    outline-offset: 3px;
  }

  @media (prefers-reduced-motion: reduce) {
    .game__button {
      transition: none;
    }
  }

  /* ── Modal ── */
  .modal {
    align-items: center;
    display: flex;
    height: 100%;
    justify-content: center;
    padding: 1.4rem;
    position: absolute;
    inset: 0;
    width: 100%;
    z-index: 3;
    background: rgba(26, 10, 46, 0.72);
    backdrop-filter: blur(4px);
  }

  .modal__window {
    background: linear-gradient(160deg, var(--color-surface) 0%, #1f1038 100%);
    border: 1px solid rgba(245, 200, 66, 0.3);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-panel), 0 0 48px rgba(184, 134, 11, 0.2);
    padding: clamp(1.6rem, 5vw, 3rem) clamp(1.4rem, 4vw, 2.6rem);
    max-width: min(420px, 92vw);
    width: 100%;
    text-align: center;
    position: relative;
    overflow: hidden;
    animation: modalEntry 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  .modal__window::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(245, 200, 66, 0.06) 0%, transparent 60%);
    pointer-events: none;
  }

  @keyframes modalEntry {
    from { opacity: 0; transform: translateY(24px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
  }

  .modal__window__crown {
    font-size: clamp(2rem, 6vw, 3rem);
    margin-bottom: 0.6rem;
    animation: crownBob 2.4s ease-in-out infinite;
    display: block;
  }

  @keyframes crownBob {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-5px); }
  }

  .modal__window__title {
    font-size: clamp(1.3rem, 4vw, 2rem);
    font-weight: 700;
    color: var(--color-accent);
    text-shadow: 0 2px 12px rgba(245, 200, 66, 0.35);
    margin-bottom: 0.75rem;
    letter-spacing: 0.02em;
    text-wrap: balance;
  }

  .modal__window__text {
    font-size: clamp(0.9rem, 2.5vw, 1.15rem);
    color: var(--color-text-muted);
    margin-bottom: 1.5rem;
    line-height: 1.6;
    text-wrap: pretty;
  }

  .modal__window__button {
    display: block;
    padding: clamp(0.85rem, 2.5vh, 1.2rem) 2.4rem;
    font-size: clamp(1.1rem, 3.5vw, 1.5rem);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-background);
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-primary) 100%);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-gold);
    text-decoration: none;
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
    position: relative;
    user-select: none;
  }

  .modal__window__button:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 8px 36px rgba(184, 134, 11, 0.55);
    filter: brightness(1.08);
  }

  .modal__window__button:active {
    transform: translateY(1px) scale(0.98);
    filter: brightness(0.96);
  }

  .modal__window__button:focus-visible {
    outline: 3px solid var(--color-accent);
    outline-offset: 3px;
  }

  @media (prefers-reduced-motion: reduce) {
    .modal__window__button,
    .modal__window__crown,
    .background__star,
    .game__main__image-hand-animation-pulse {
      animation: none;
      transition: none;
    }
  }

  /* ── Utility: JS-toggled classes ── */
  .blur {
    filter: blur(8px);
  }

  .hidden {
    display: none !important;
  }

  .visible {
    animation: makeVisible 0.7s ease forwards;
    display: flex;
    opacity: 0;
  }

  @keyframes makeVisible {
    0%   { opacity: 0; }
    100% { opacity: 1; }
  }

  /* ── RTL ── */
  html[dir=rtl] .background__cloud {
    transform: scaleX(-1);
  }

  html[dir=rtl] .game__main__image-hand {
    right: auto;
    left: clamp(1rem, 5vw, 7rem);
  }

html,
body {
  scrollbar-width: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  width: 0;
  height: 0;
}
