@font-face {
  font-family: 'Quintessential';
  src: url('assets/quintessential-regular.woff2') format('woff2');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --black: #000;
  --paper: #f7f3e9;
  --muted: #b3afa6;
  --line: #45443f;
  --site-header-height: 74px;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  isolation: isolate;
  background-color: var(--black);
  color: var(--paper);
  font: 1rem/1.5 var(--sans);
}

body::before {
  --art-inset: clamp(.8rem, 3.5vw, 4.5rem);
  --art-bottom: clamp(.8rem, 3.5svh, 2.5rem);
  --art-gutter: calc(50vw - 19.5rem - var(--art-inset));
  position: fixed;
  z-index: -1;
  inset: 0;
  content: '';
  pointer-events: none;
  background-image: url('assets/background-hydrangea.webp?v=oni-masks'),
    url('assets/background-blue-ribbon.webp?v=oni-blue-mask');
  background-repeat: no-repeat;
  background-position: left var(--art-inset) bottom var(--art-bottom),
    right var(--art-inset) bottom var(--art-bottom);
  background-size: min(var(--art-gutter), 27rem, 55svh) auto,
    min(var(--art-gutter), 22rem, 32svh) auto;
  opacity: .92;
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--paper); outline-offset: 5px; }

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: min(100%, 1440px);
  min-height: var(--site-header-height);
  padding: 1rem clamp(1.25rem, 4.25vw, 4rem);
}

.wordmark {
  position: relative;
  flex: 0 0 auto;
  width: clamp(7rem, 28vw, 13.5rem);
}

.wordmark img {
  position: relative;
  display: block;
  width: 100%;
  height: auto;
}

.wordmark::before {
  position: absolute;
  inset: 0;
  background: url('assets/onibet-wordmark.webp') center / 100% 100% no-repeat;
  color: #699aeb;
  filter: drop-shadow(1px 0 0 currentColor) drop-shadow(-1px 0 0 currentColor)
    drop-shadow(0 1px 0 currentColor) drop-shadow(0 -1px 0 currentColor);
  pointer-events: none;
  content: '';
}

.back-link {
  color: var(--muted);
  font-size: .9rem;
  text-underline-offset: .22em;
}

.back-link:hover { color: var(--paper); text-decoration: underline; }

.menu {
  width: min(100% - 2.5rem, 580px);
  padding-block: clamp(2rem, 9svh, 5.5rem) 3.5rem;
  text-align: center;
}

.menu h1 {
  font-family: 'Quintessential', var(--serif);
  line-height: 1.12;
  letter-spacing: -.025em;
  text-shadow: 0 2px 12px rgb(0 0 0 / 70%);
}

.menu-mask {
  position: relative;
  isolation: isolate;
  display: block;
  width: min(46vw, clamp(8rem, 30svh, 17rem));
  height: auto;
  margin: 0 auto clamp(1.1rem, 3svh, 1.65rem);
}

.menu-mask:has(.oni-hair) { margin-top: clamp(1rem, 3svh, 1.75rem); }
.menu-mask > img { display: block; width: 100%; height: auto; }

.menu-mask > .oni-hair {
  --hair-margin: 27%;
  position: absolute;
  z-index: -1;
  left: 50%;
  bottom: 46%;
  width: 112%;
  opacity: .88;
  pointer-events: none;
  transform: translateX(-50%);
}

.oni-hair > img { display: block; width: 100%; height: auto; }
.oni-hair.is-animated > img { visibility: hidden; }
.oni-hair > canvas {
  position: absolute;
  top: calc(-1 * var(--hair-margin));
  left: calc(-1 * var(--hair-margin));
  width: calc(100% + 2 * var(--hair-margin));
  height: calc(100% + 2 * var(--hair-margin));
}

.oni-eyes, .oni-smoke { position: absolute; pointer-events: none; }
.oni-eyes { inset: 0; animation: oni-eye-pulse 2.6s ease-in-out -.3s infinite; }
.oni-eyes::before, .oni-eyes::after {
  position: absolute;
  top: 52.3%;
  left: 35.7%;
  width: 15%;
  height: 8%;
  background: radial-gradient(ellipse, #ffe2be 0%, #ff7953 14%, #ff1b10 33%, #d60908a3 54%, transparent 74%);
  content: '';
  transform: translate(-50%, -50%) rotate(9deg);
}
.oni-eyes::after { left: 64.3%; transform: translate(-50%, -50%) rotate(-9deg); }

.oni-smoke {
  top: 76%;
  left: 50%;
  width: 66%;
  aspect-ratio: 1.8;
  transform: translate(-23%, -52%);
}
.oni-smoke::before, .oni-smoke::after {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 38% 32% at 43% 58%, #fff8, transparent 100%),
    url('assets/oni-smoke-hair.webp') center / 100% 135% no-repeat;
  mask-image: radial-gradient(ellipse, #000 24%, #000c 58%, transparent 76%);
  content: '';
  opacity: 0;
  transform-origin: 23% 52%;
  animation: oni-breath 4.4s ease-out infinite;
}
.oni-smoke::after { inset: 8% 24% 14% 2%; animation-delay: .24s; }

@keyframes oni-eye-pulse {
  0%, 100% { opacity: .24; }
  43%, 55% { opacity: 1; }
}

@keyframes oni-breath {
  0% { opacity: 0; transform: translate(-1%, 5%) scale(.12); }
  9% { opacity: .72; transform: translate(8%, -1%) scale(.38, .52); }
  26% { opacity: .92; transform: translate(35%, -10%) rotate(-9deg) scale(.86, .82); }
  43% { opacity: .42; transform: translate(51%, -23%) rotate(-15deg) scale(1.04, .92); }
  62%, 100% { opacity: 0; transform: translate(65%, -33%) rotate(-18deg) scale(1.25, 1.02); }
}

@keyframes oni-breath-soft {
  0%, 62%, 100% { opacity: 0; }
  16%, 34% { opacity: .68; }
}

h1 {
  margin: 0;
  font: 400 clamp(2.55rem, 6.4vw, 4.1rem)/1.04 var(--serif);
  letter-spacing: -.06em;
  text-wrap: balance;
}

.mode-label {
  margin: 0 0 .42rem;
  color: var(--muted);
  font-size: .875rem;
  font-weight: 650;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .9rem;
  margin-top: 1.4rem;
}

.tile {
  display: grid;
  place-items: center;
  min-height: 104px;
  padding: .7rem .3rem;
  border: 1px solid var(--line);
  border-radius: .5rem;
  background: #111110;
  font: 400 clamp(1.45rem, 4.4vw, 2.25rem)/1.1 var(--serif);
  letter-spacing: -.035em;
  transition: background-color .16s, color .16s, border-color .16s;
}

.tile:hover {
  border-color: var(--paper);
  background: var(--paper);
  color: var(--black);
}

.mode-tiles .tile {
  background: radial-gradient(ellipse at center, rgb(5 4 3 / 70%), rgb(5 4 3 / 30%)),
    #171514 var(--mode-art) center var(--mode-art-position) / cover no-repeat;
  color: var(--paper);
  font-family: 'Quintessential', var(--serif);
  letter-spacing: 0;
  text-shadow: 0 2px 8px rgb(0 0 0 / 90%);
}

.paid-tile {
  --mode-art: url('assets/paid-mode.webp');
  --mode-art-position: 31%;
}

.free-tile {
  --mode-art: url('assets/free-mode.webp');
  --mode-art-position: 30%;
}

.game-tiles {
  grid-template-columns: minmax(0, 1fr);
  width: min(100% - 1rem, 27rem);
  margin-inline: auto;
}

.tile.blackjack-tile {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(.4rem, 1.8vw, .9rem);
  min-height: clamp(6.25rem, 26vw, 8.5rem);
  padding: .4rem clamp(.55rem, 3.2vw, 1.6rem);
  background: linear-gradient(90deg, rgb(7 9 14 / 8%), rgb(7 9 14 / 25%) 40%, rgb(7 9 14 / 76%) 72%, rgb(7 9 14 / 61%)),
    #151b22 url('assets/blackjack-oni.webp') center 8% / cover no-repeat;
  color: var(--paper);
}

.blackjack-tile img {
  display: block;
  flex: none;
  height: auto;
}

.blackjack-lettering {
  width: clamp(5.75rem, 25vw, 8.25rem);
  filter: drop-shadow(0 2px 6px rgb(0 0 0 / 78%));
}

.blackjack-cards {
  width: clamp(3.4rem, 16vw, 5.8rem);
  /* Follow the outside edges of the two cards in the photograph. */
  clip-path: polygon(
    9.3% 17.8%, 10.1% 15.9%, 27.9% 11.9%, 29% 8.8%, 31.5% 7.7%,
    55% 8.7%, 68% 7%, 70% 8%, 70.5% 9.9%, 88.2% 11.2%, 90% 12.9%,
    90% 14.5%, 85% 86.9%, 83% 88.7%, 57% 87.5%, 24.5% 92%, 21% 91%, 20% 87.2%
  );
}

.description { margin: .65rem 0 0; color: var(--muted); }

.coinflip-page::before { opacity: .39; }

.coin-game {
  --coin-size: clamp(8.75rem, 34vw, 11rem);
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: min(100% - 2.5rem, 27rem);
  padding-block: 3rem clamp(4rem, 14vh, 9rem);
  text-align: center;
}

.coin-stage {
  display: grid;
  place-items: center;
  position: relative;
  min-height: calc(var(--coin-size) + 1.5rem);
  width: 100%;
  perspective: 620px;
}

.coin-shadow {
  position: absolute;
  bottom: .05rem;
  width: calc(var(--coin-size) * .86);
  height: .95rem;
  border-radius: 50%;
  background: radial-gradient(ellipse, #716957 12%, #494234 42%, transparent 73%);
  filter: blur(3px);
  opacity: .48;
}

.coin-flight { transform-style: preserve-3d; }

.coin {
  --rest-angle: 0deg;
  position: relative;
  width: var(--coin-size);
  aspect-ratio: 1;
  transform-style: preserve-3d;
  transform: rotateX(var(--rest-angle));
}

.coin::before, .coin::after {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #746e60;
  content: '';
}

.coin::before { transform: translateZ(1px); }
.coin::after { transform: translateZ(-1px); }

.coin[data-side="Tails"] { --rest-angle: 180deg; }

.coin-stage.is-tossing .coin-flight { animation: full-flight var(--toss-time) both; }
.coin-stage.is-tossing .coin { animation: full-turn var(--toss-time) both; }
.coin-stage.is-tossing .coin-shadow { animation: toss-shadow var(--toss-time) both; }

@keyframes full-flight {
  0% { transform: translate3d(0, 0, 0); animation-timing-function: ease-out; }
  41% { transform: translate3d(0, var(--toss-lift), 32px); animation-timing-function: ease-in; }
  78% { transform: translate3d(0, 0, 0); animation-timing-function: ease-out; }
  85% { transform: translate3d(0, -16px, 0); animation-timing-function: ease-in; }
  93% { transform: translate3d(0, 0, 0); animation-timing-function: ease-out; }
  96% { transform: translate3d(0, -3px, 0); animation-timing-function: ease-in; }
  100% { transform: translate3d(0, 0, 0); }
}

@keyframes full-turn {
  0% { transform: rotateX(var(--rest-angle)) rotateZ(0deg); }
  41% { transform: rotateX(var(--mid-turn)) rotateZ(12deg); }
  78% { transform: rotateX(var(--last-turn)) rotateZ(0deg); animation-timing-function: ease-out; }
  85% { transform: rotateX(calc(var(--last-turn) - 15deg)) rotateZ(-4deg); }
  94% { transform: rotateX(calc(var(--last-turn) + 4deg)) rotateZ(1deg); }
  100% { transform: rotateX(var(--last-turn)) rotateZ(0deg); }
}

@keyframes toss-shadow {
  0%, 100% { transform: scale(1); opacity: .48; }
  41% { transform: scale(.55); opacity: .12; }
  78% { transform: scale(1.04); opacity: .56; }
  85% { transform: scale(.88); opacity: .36; }
}

.coin-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: 3px solid #b0aca0;
  border-radius: 50%;
  background: radial-gradient(circle at 28% 18%, #655f54, #292723 64%, #171613 100%);
  box-shadow: inset 0 0 0 2px #282621, inset 0 0 0 4px #726d61, 0 0 0 2px #47433a;
  color: #e5dcc6;
  backface-visibility: hidden;
}

.coin-heads { transform: translateZ(2px); }
.coin-tails { transform: rotateX(180deg) translateZ(2px); }
.coin-heads img { width: 69%; height: auto; margin-top: -.7rem; }

.coin-face span {
  position: absolute;
  bottom: 12%;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .19em;
  text-transform: uppercase;
}

.tail-mark {
  position: relative;
  width: 56%;
  aspect-ratio: 1;
  margin-top: -.8rem;
  color: #e5dcc6;
  transform: rotate(-19deg);
}

.tail-mark::before {
  position: absolute;
  inset: 18% 19% 13% 16%;
  border: clamp(.27rem, .8vw, .4rem) solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  content: '';
}

.tail-mark::after {
  position: absolute;
  top: 11%;
  right: 15%;
  width: 30%;
  aspect-ratio: 1;
  background: currentColor;
  clip-path: polygon(0 43%, 92% 0, 88% 100%, 59% 64%, 42% 59%);
  content: '';
}

.coin-choices {
  display: flex;
  gap: .75rem;
  margin-top: 1.15rem;
}

.coin-choices button {
  min-width: 7.25rem;
  min-height: 48px;
  padding: .55rem 1rem;
  border: 1px solid var(--line);
  border-radius: .35rem;
  background: transparent;
  color: var(--paper);
  font-size: 1rem;
}

.coin-choices button:hover:not(:disabled, [aria-disabled="true"]) {
  border-color: var(--paper);
  background: #171714;
}

.coin-choices button[aria-disabled="true"], .coin-choices button:disabled {
  color: var(--muted);
  cursor: wait;
}

.flip-result {
  min-height: 1.5em;
  margin: .7rem 0 0;
  color: var(--muted);
  font-size: .95rem;
}

@media (max-width: 58rem) {
  body::before {
    --art-inset: clamp(.75rem, 3vw, 2.25rem);
    --art-bottom: 1rem;
    background-size: min(42vw, 19rem, 34svh) auto, auto min(46svh, 70vw, 27rem);
  }
}

@media (max-width: 540px) {
  :root { --site-header-height: 60px; }
  .menu-page::before {
    --right-character-height: min(29svh, 53vw);
    position: static;
    order: 1;
    flex: 1 0 auto;
    align-self: stretch;
    min-height: calc(var(--right-character-height) + 1rem);
    background-size: auto min(24svh, 46vw), auto var(--right-character-height);
  }
  .menu { padding-block: clamp(1.5rem, 4svh, 2.5rem) 1rem; }
  .menu-mask { width: min(42vw, 26svh, 12rem); }
  .menu-mask:has(.oni-hair) { margin-top: clamp(1.1rem, 4svh, 2.5rem); }
  .menu-mask > .oni-hair { bottom: 33%; width: 104%; }
  .tiles { gap: .65rem; margin-top: 1.05rem; }
  .tile { min-height: 80px; }
  .coin-game { padding-block: 2.5rem 6rem; }
}

@media (prefers-reduced-motion: reduce) {
  .tile { transition: none; }
  .oni-eyes { animation-duration: 4.6s; }
  .oni-smoke::before, .oni-smoke::after {
    transform: translate(24%, -8%) scale(.62, .72);
    animation-name: oni-breath-soft;
    animation-duration: 7s;
  }
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: .45rem clamp(.65rem, 2.3vw, 1.2rem);
  min-width: 0;
  padding-left: .8rem;
}

.account-link {
  display: block;
  min-width: 0;
  max-width: min(13rem, 45vw);
  overflow: hidden;
  padding: .43rem .73rem;
  border: 1px solid #555145;
  border-radius: .35rem;
  background: #13130f;
  color: var(--paper);
  font-size: .88rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-link:hover { border-color: #c8ae7e; }

.account-menu { position: relative; z-index: 5; }

.account-menu > summary {
  display: flex;
  align-items: center;
  gap: .58rem;
  cursor: pointer;
  list-style: none;
}

.account-menu > summary::-webkit-details-marker { display: none; }

.account-menu > summary::after {
  width: .4rem;
  height: .4rem;
  border: solid currentColor;
  border-width: 0 1px 1px 0;
  transform: translateY(-.12rem) rotate(45deg);
  content: '';
}

.account-menu[open] > summary::after { transform: translateY(.09rem) rotate(225deg); }

.account-menu-links {
  position: absolute;
  inset-block-start: 100%;
  inset-inline-end: 0;
  width: min(12.5rem, calc(100vw - 2.5rem));
  padding: .3rem;
  border: 1px solid #555145;
  border-radius: .4rem;
  background: #13130f;
  box-shadow: 0 .5rem 1.2rem rgb(0 0 0 / .45);
}

.account-menu-links a {
  display: block;
  padding: .5rem .65rem;
  border-radius: .25rem;
  font-size: .88rem;
  overflow-wrap: anywhere;
}

.account-menu-links [data-account-link] {
  margin-block-end: .2rem;
  border-block-end: 1px solid var(--line);
  font-weight: 700;
}

.account-menu-links a:hover, .account-menu-links a:focus-visible { background: #26251f; }

@media (max-width: 540px) {
  .header-actions { gap: .4rem; }
  .account-link { padding-inline: .58rem; }
}
