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

:root {
  --color-accent: #060606;
  --color-text: #1a1a1a;
  --color-muted: #6b6b6b;
  --color-border: #e8e8e8;
  --color-bg: #ffffff;
  --color-surface: #fafafa;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --transition: 0.2s ease;
  --max: 1080px;
  --pad: 24px;
}

html {
  scroll-behavior: smooth;
  background: var(--color-bg);
}

body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: transparent;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

.bones_right {
  left: 0;
  background-position: center top;
  background-repeat: no-repeat;
  max-width: 600px;
  position: absolute;
  bottom: 0;
  width: auto;
}

.bones_left {
  right: 0;
  background-position: center 240px;
  background-repeat: no-repeat;
  position: absolute;
  max-width: 600px;
  bottom: 0;
  width: auto;
}


.main_bg {
  width: 300px;
  margin: 0 auto;
  padding-top: 30px;
  }
  
img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 200;
  padding: 8px 14px;
  background: var(--color-accent);
  color: #fff;
  font-size: 13px;
}

.skip-link:focus {
  top: 12px;
}

/* ── Header ── */

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: transparent;
  transition: background-color 0.25s ease, backdrop-filter 0.25s ease;
}

.header--scrolled {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max);
  margin: 0 auto;
  padding: 20px var(--pad);
}

.header__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ── Promo banner ── */

.promo {
  position: relative;
  z-index: 1;
  margin-bottom: 16px;
}

.promo__inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--pad);
}

.promo__banner {
  display: block;
  width: 100%;
  height: 100px;
  max-height: 100px;
  border-radius: 12px;
  object-fit: cover;
  object-position: center;
  background: #111;
}

/* ── Buttons ── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 28px;
  background: var(--color-accent);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 10px;
  transition: opacity var(--transition);
  cursor: pointer;
  border: 1px solid var(--color-accent);
}

.btn:hover {
  opacity: 0.82;
}

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

.btn--small {
  padding: 8px 20px;
  font-size: 12px;
}

.btn--ghost {
  background: transparent;
  color: var(--color-accent);
  border: 1px solid var(--color-accent);
}

.btn--ghost:hover {
  opacity: 1;
  background: var(--color-accent);
  color: #fff;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

/* ── Breadcrumbs ── */

.crumbs {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  max-width: var(--max);
  width: 100%;
  margin: 0 auto;
  padding: 12px var(--pad) 0;
  font-size: 13px;
  color: var(--color-muted);
}

.crumbs .game__bet {
  margin: 0 0 0 auto;
}

.crumbs__home {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--color-accent);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.crumbs__home img {
  width: 20px;
  height: auto;
}

.crumbs__sep {
  color: #c8c8c8;
}

.crumbs__current {
  color: var(--color-muted);
}

/* ── Game screen ── */

.page-game {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.page-game .game {
  flex: 1;
  min-height: 0;
  padding: 8px 0 16px;
  display: flex;
  flex-direction: column;
  background: none;
}

.page-game main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.page-game .game__inner {
  flex: 1;
  min-height: 0;
  width: 100%;
}

.page-game .game__bet {
  font-size: 13px;
}

.page-game .game__bet img {
  width: 28px;
  height: 28px;
}

.page-game .game__hud {
  margin-bottom: 6px;
  gap: 8px 16px;
}

.page-game .game__avatar {
  width: 40px;
  height: 40px;
}

.page-game .game__name {
  font-size: 13px;
}

.page-game .game__score {
  font-size: 20px;
}

.page-game .game__timer {
  font-size: 28px;
}

.page-game .game__turn {
  margin-top: 2px;
  font-size: 12px;
}

.page-game .game__table {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.page-game .game__stage {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: grid;
  place-items: center;
}

.page-game .board {
  width: min(100%, 360px, 42dvh);
  margin: 0;
}

.page-game .game__actions {
  flex-shrink: 0;
  padding-top: 12px;
}

@supports (container-type: size) {
  .page-game .game__stage {
    container-type: size;
  }

  .page-game .board {
    width: min(100cqw, 400px, calc(100cqh * 3 / 5));
  }
}

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

.btn:disabled:hover {
  opacity: 0.4;
}

/* ── Hero ── */

.hero {
  position: relative;
  padding: 84px 0 32px;
}

.hero__inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--pad);
}

.hero__media {
  margin: 0 0 4px;
  max-width: 360px;
  width: 100%;
}

.hero__title {
  font-size: clamp(24px, 3.4vw, 32px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 12px;
}

.hero__text {
  color: #515151;
  font-size: 13px;
  max-width: 420px;
  margin: 20px 0 20px;
}

.chips {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 20px;
  margin: 20px 0 12px;
}

.chip {
  width: 70px;
  height: auto;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--transition), box-shadow var(--transition), filter var(--transition);
}

.chip img {
  width: 70px;
  height: auto;
  object-fit: contain;
  pointer-events: none;
}

.chip:hover {
  transform: translateY(-4px);
}

.chip:focus,
.chip:focus-visible {
  outline: none;
}

.chip--selected {
  transform: translateY(-4px);
}

.chip[data-bet="50"].chip--selected {
  box-shadow: 0 0 18px 4px rgba(246, 215, 43, 0.55), 0 0 36px 10px rgba(246, 215, 43, 0.35);
}

.chip[data-bet="100"].chip--selected {
  box-shadow: 0 0 18px 4px rgba(228, 25, 60, 0.5), 0 0 36px 10px rgba(228, 25, 60, 0.32);
}

.chip[data-bet="300"].chip--selected {
  box-shadow: 0 0 18px 4px rgba(0, 186, 237, 0.5), 0 0 36px 10px rgba(0, 186, 237, 0.32);
}

.chip[data-bet="500"].chip--selected {
  box-shadow: 0 0 18px 4px rgba(6, 6, 6, 0.35), 0 0 36px 10px rgba(6, 6, 6, 0.2);
}

/* ── Rules ── */

.rules {
  padding: 56px 0 88px;
}

.rules__inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--pad);
}

.rules__frame {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  width: 100%;
  padding: 28px 32px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
}

.rules__icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
}

.rules__body {
  min-width: 0;
}

.rules__title {
  font-size: clamp(20px, 3.2vw, 26px);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.rules__text {
  color: var(--color-muted);
  font-size: 16px;
  line-height: 1.7;
}

/* ── Footer ── */

.footer {
  border-top: 1px solid var(--color-border);
  padding: 28px 24px;
  text-align: center;
}

.footer__copy {
  font-size: 13px;
  color: var(--color-muted);
}

/* ── Game ── */

.game {
  position: relative;
  padding: 132px 0 88px;
}

.game__inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--pad);
}

.game__title {
  font-size: clamp(26px, 4vw, 36px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.12;
  margin-bottom: 16px;
}

.game__hud {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 16px 24px;
  width: 100%;
  max-width: 720px;
  margin-bottom: 8px;
}

.game__side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.game__avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
}

.game__name {
  font-size: 16px;
  font-weight: 600;
}

.game__score {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.game__center {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 120px;
}

.game__timer {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
}

.game__turn {
  margin-top: 6px;
  font-size: 13px;
  color: var(--color-muted);
  min-height: 1.2em;
}

#table {
  width: 100%;
  max-width: 880px;
}

.board {
  --board-image: url("../images/board.png?v=2");
  --die: 64px;
  position: relative;
  width: min(100%, 440px);
  aspect-ratio: 3 / 5;
  margin: 0 auto 28px;
  background-color: #ffffff;
  background-image: var(--board-image);
  background-size: 100% 100%;
  background-repeat: no-repeat;
  border-radius: 12px;
  overflow: hidden;
}

.dice-stage {
  position: absolute;
  inset: 0;
}

.dice-stage canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  background: transparent;
}

.die__face {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: 16%;
  gap: 10%;
  border: 1.5px solid #060606;
  border-radius: 10px;
  backface-visibility: hidden;
}

.die--white .die__face {
  color: #060606;
  background: linear-gradient(145deg, #ffffff 0%, #efefef 100%);
}

.die--black .die__face {
  color: #f4f4f4;
  background: linear-gradient(145deg, #2a2a2a 0%, #111111 100%);
}

.die__face--1 { transform: rotateY(0deg) translateZ(calc(var(--die) / 2)); }
.die__face--6 { transform: rotateY(180deg) translateZ(calc(var(--die) / 2)); }
.die__face--3 { transform: rotateY(90deg) translateZ(calc(var(--die) / 2)); }
.die__face--4 { transform: rotateY(-90deg) translateZ(calc(var(--die) / 2)); }
.die__face--2 { transform: rotateX(90deg) translateZ(calc(var(--die) / 2)); }
.die__face--5 { transform: rotateX(-90deg) translateZ(calc(var(--die) / 2)); }

.pip {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: currentColor;
  align-self: center;
  justify-self: center;
}

.pip--tl { grid-area: 1 / 1; }
.pip--ml { grid-area: 2 / 1; }
.pip--bl { grid-area: 3 / 1; }
.pip--c  { grid-area: 2 / 2; }
.pip--tr { grid-area: 1 / 3; }
.pip--mr { grid-area: 2 / 3; }
.pip--br { grid-area: 3 / 3; }

.game__bet {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  color: var(--color-muted);
  font-size: 15px;
}

.game__bet img {
  width: 48px;
  height: 48px;
}

.game__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

/* ── Match modal ── */

.modal {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(6, 6, 6, 0.42);
}

.modal__card {
  width: min(520px, 100%);
  padding: 36px 32px 40px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  text-align: center;
}

.modal__title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.modal__text {
  margin: 0 0 28px;
  color: var(--color-muted);
  font-size: 16px;
  line-height: 1.6;
}

.modal__card .btn {
  min-width: 160px;
}

.matchup {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
}

.matchup__player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: block;
}

.avatar-ring {
  position: relative;
  width: 88px;
  height: 88px;
    color: #808080c2;
}

.avatar-ring .avatar {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 80px;
  height: 80px;
    color: #808080c2;
}

.avatar-ring__svg {
  position: absolute;
  inset: 0;
  width: 88px;
  height: 88px;
  transform: rotate(-90deg);
}

.avatar-ring__track,
.avatar-ring__bar {
  fill: none;
  stroke-width: 5;
}

.avatar-ring__track {
  stroke: #808080c2;
}

.avatar-ring__bar {
  stroke: var(--color-accent);
  stroke-linecap: round;
  stroke-dasharray: 251.2;
  stroke-dashoffset: 251.2;
}

.matchup__name {
  font-size: 16px;
  font-weight: 600;
}

.matchup__vs {
  display: block;
  width: 80px;
  height: auto;
}

/* ── Responsive ── */

@media (max-width: 1240px) {
  body::before,
  body::after {
    content: none;
  }
}

@media (max-width: 768px) {
  .hero {
    padding: 76px 0 28px;
  }

  .game {
    padding: 108px 0 64px;
  }

  .page-game .game {
    padding: 4px 0 12px;
  }

  .page-game .game__inner {
    margin-top: 60px;
  }

  .page-game .game__stage {
    place-items: start;
  }

  .crumbs {
    padding-top: 10px;
  }

  .game__hud {
    gap: 10px 12px;
  }

  .game__timer {
    font-size: 32px;
  }

  .game__score {
    font-size: 22px;
  }

  .modal__card {
    padding: 28px 20px 32px;
  }

  .avatar-ring {
    width: 72px;
    height: 72px;
  }

  .avatar-ring__svg {
    width: 72px;
    height: 72px;
  }

  .avatar,
  .avatar-ring .avatar {
    width: 64px;
    height: 64px;
  }

  .rules {
    padding: 40px 0 64px;
  }

  .chips {
    gap: 14px;
    margin: 20px 0 12px;
  }

  .chip {
    width: 80px;
    height: 80px;
  }

  .rules__frame {
    padding: 20px;
    gap: 14px;
  }

  .rules__icon {
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 480px) {
  :root {
    --pad: 20px;
  }

  .header__inner {
    padding-top: 16px;
    padding-bottom: 16px;
  }

  .hero {
    padding: 72px 0 24px;
  }

  .game {
    padding: 96px 0 48px;
  }

  .page-game .game {
    padding: 4px 0 10px;
  }

  .page-game .game__avatar {
    width: 36px;
    height: 36px;
  }

  .page-game .game__timer {
    font-size: 24px;
  }

  .board {
    width: 100%;
  }

  .chip {
    width: 72px;
    height: 72px;
  }

  .hero__text {
    font-size: 15px;
    margin-bottom: 16px;
  }

  .hero__media {
    max-width: 280px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .header,
  .chip {
    transition: none;
  }
}
