/*
 * Lobby styles. Tile tilt, glow, sheen and caption are ported from
 * sites/aureaplay.com/html/styles/styles.css (Tile art: tilt, glow, sheen, caption).
 * Brand colors come from --brand-primary / --brand-accent; the builder currently injects
 * --primary / --accent, so both are accepted.
 */
:root {
  --bp: var(--brand-primary, var(--primary, #110e1b));
  --ba: var(--brand-accent, var(--accent, #ffd257));
  --surface: rgba(255, 255, 255, .06);
  --line: rgba(255, 255, 255, .12);
  --text-dim: rgba(255, 255, 255, .7);
  --radius: 16px;
}

* { box-sizing: border-box; }
body { background: var(--bp); color: #fff; }
body.has-overlay { overflow: hidden; }

.btn {
  font: inherit;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: #fff;
  cursor: pointer;
}
.btn-primary, .btn-signup { background: var(--ba); color: #111; border-color: var(--ba); font-weight: 700; }
.btn:focus-visible, .tile-art:focus-visible, .tile-actions button:focus-visible { outline: 2px solid var(--ba); outline-offset: 2px; }

/* ---------- header ---------- */
.hdr { position: sticky; top: 0; z-index: 20; background: var(--bp); border-bottom: 1px solid var(--line); }
.hdr-login { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; }
.hdr-name { color: var(--text-dim); max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hdr-coin-select { font: inherit; background: var(--surface); color: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; }
.hdr-balance { position: relative; }
.hdr-amount { font: inherit; font-weight: 700; font-variant-numeric: tabular-nums; background: none; border: 0; color: #fff; cursor: pointer; padding: 6px 8px; }
.hdr-split {
  position: absolute; right: 0; top: 100%; z-index: 30;
  min-width: 220px; margin: 4px 0 0; padding: 8px 12px; list-style: none;
  background: #1b1726; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .5);
  display: none;
}
.hdr-split:empty { display: none !important; }
.hdr-balance.is-open .hdr-split { display: block; }
@media (hover: hover) and (pointer: fine) {
  .hdr-balance:hover .hdr-split, .hdr-balance:focus-within .hdr-split { display: block; }
}
.split-line { display: flex; justify-content: space-between; gap: 16px; padding: 4px 0; font-variant-numeric: tabular-nums; }
.split-ccy { color: var(--text-dim); }
.spinner {
  display: inline-block; width: 18px; height: 18px; vertical-align: middle;
  border: 2px solid var(--line); border-top-color: var(--ba); border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- lobby sections (Featured, Popular, New, All Games), stacked; the page scrolls ---------- */
.lobby-section + .lobby-section { margin-top: 24px; }
.section-title {
  margin: 0; padding: 16px 16px 12px; text-align: left;
  font-size: 20px; font-weight: 700; letter-spacing: .01em;
}
.section-title::after {
  content: ""; display: block; width: 32px; height: 3px; margin-top: 6px;
  border-radius: 2px; background: var(--ba); opacity: .85;
}

/* ---------- tiles ---------- */
.tile { position: relative; text-align: center; }
.tile[hidden] { display: none; }

.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity .5s ease, transform .5s ease; }
.js .reveal.is-visible { opacity: 1; transform: none; }

.tile-art {
  --rx: 0deg;
  --ry: 0deg;
  --lift: 0px;
  --mx: 50%;
  --my: 50%;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .35);
  transform: perspective(700px) rotateX(var(--rx)) rotateY(var(--ry)) translateY(var(--lift));
  transition: transform .25s ease-out, box-shadow .25s ease-out, border-color .25s ease-out;
}
.tile-art.is-tilting { transition-duration: .08s; }
.tile-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  text-transform: uppercase;
  pointer-events: none;
}
.tile-badge + .tile-badge { top: 30px; }
.tile-badge-new { background: #19c37d; color: #04281a; }
.tile-badge-hot { background: #ff5a3c; color: #fff; }
.tile-art img { width: 100%; height: auto; aspect-ratio: 427 / 575; border-radius: inherit; }
.tile-art-blank { display: flex; align-items: center; justify-content: center; width: 100%; aspect-ratio: 427 / 575; padding: 12px; border-radius: inherit; background: var(--surface); color: var(--text-dim); font-weight: 600; overflow-wrap: anywhere; }

/* pointer-following glow */
.tile-art::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(220px circle at var(--mx) var(--my), rgba(255, 210, 87, .26), transparent 62%);
  opacity: 0;
  transition: opacity .25s ease-out;
  pointer-events: none;
}

/* sheen sweep (pseudo-element instead of the original extra .tile-sheen span) */
.tile-art::before {
  content: "";
  position: absolute;
  z-index: 1;
  top: -20%;
  bottom: -20%;
  left: -60%;
  width: 45%;
  background: linear-gradient(105deg, transparent 0%, rgba(255, 255, 255, .3) 50%, transparent 100%);
  transform: skewX(-18deg);
  opacity: 0;
  pointer-events: none;
}

.tile-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  margin: 0;
  padding: 36px 12px 12px;
  border-radius: 0 0 var(--radius) var(--radius);
  background: linear-gradient(to top, rgba(17, 14, 27, .94) 0%, rgba(17, 14, 27, .6) 60%, rgba(17, 14, 27, 0) 100%);
  text-align: left;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  opacity: 0;
  transform: translateY(100%);
  transition: transform .3s ease-out, opacity .3s ease-out;
  pointer-events: none;
}

.tile:hover .tile-art,
.tile:has(:focus-visible) .tile-art {
  --lift: -6px;
  border-color: var(--ba);
  box-shadow: 0 16px 34px rgba(0, 0, 0, .5), 0 0 26px rgba(255, 210, 87, .35);
}
.tile:hover .tile-art::after { opacity: 1; }
.tile:hover .tile-caption, .tile:has(:focus-visible) .tile-caption { opacity: 1; transform: none; }
.tile:hover .tile-art::before { animation: tileSheen .75s ease-out forwards; }

@keyframes tileSheen {
  0% { transform: translateX(0) skewX(-18deg); opacity: 0; }
  15% { opacity: 1; }
  100% { transform: translateX(380%) skewX(-18deg); opacity: 0; }
}

/* action buttons: revealed on hover/focus (desktop) or when armed (touch) */
.tile-actions {
  position: absolute;
  left: 8px;
  right: 8px;
  top: 50%;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity .2s ease-out;
  pointer-events: none;
}
.tile-actions[hidden] { display: none; }
/* :has(:focus-visible), not :focus-within: a mouse click (or focus returned after closing a game) must not leave
   the tile looking pressed; keyboard focus still reveals the actions. */
.tile:hover .tile-actions,
.tile:has(:focus-visible) .tile-actions,
.tile.is-armed .tile-actions { opacity: 1; pointer-events: auto; }
.tile-actions button { font: inherit; font-weight: 700; padding: 10px; border-radius: 10px; border: 0; cursor: pointer; }
.play-real { background: var(--ba); color: #111; }
.play-fun { background: rgba(17, 14, 27, .85); color: #fff; border: 1px solid var(--line) !important; }
.play-fun:disabled { opacity: .45; cursor: not-allowed; }
[data-real="off"] .play-real { opacity: .45; pointer-events: none; }
.tile.is-armed .tile-art { border-color: var(--ba); }

/* touch: no tilt, no hover-only effects (matches the original @media (hover: none) block) */
@media (hover: none) {
  .tile-art { transform: none !important; }
  .tile-art::after, .tile-art::before { display: none; }
  .tile-caption { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .tile-art { transform: none !important; transition: none; }
  .tile-art::before { animation: none !important; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .spinner { animation-duration: 2s; }
}

/* ---------- modals ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, .65); }
.modal { position: relative; width: min(420px, 100%); padding: 24px; border-radius: var(--radius); background: #1b1726; border: 1px solid var(--line); box-shadow: 0 24px 60px rgba(0, 0, 0, .6); }
.modal h2 { margin: 0 0 16px; font-size: 20px; }
.modal-form { display: flex; flex-direction: column; gap: 12px; }
.modal-field { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--text-dim); }
.modal-field input, .modal-field select { font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(0, 0, 0, .25); color: #fff; }
.modal-error { margin: 0; min-height: 1.2em; color: #ff8a8a; font-size: 14px; }
.modal-note { margin: 0; color: var(--text-dim); font-size: 14px; }
.modal-note:empty, .modal-error:empty { display: none; }
.gift-locked { margin: 0; color: var(--text-dim); font-size: 14px; }
.gift-locked:empty { display: none; }
.modal-links { display: flex; justify-content: space-between; gap: 8px; margin-top: 12px; }
.link { font: inherit; font-size: 14px; background: none; border: 0; padding: 0; color: var(--ba); cursor: pointer; text-decoration: underline; }
.modal-close { position: absolute; top: 8px; right: 8px; width: 36px; height: 36px; font-size: 22px; line-height: 1; background: none; border: 0; color: #fff; cursor: pointer; }

/* ---------- cashier ---------- */
.modal.cashier { width: min(480px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; }
.cashier-result { display: flex; flex-direction: column; gap: 10px; }
.cashier-line, .cashier-result > .cashier-label { margin: 0; font-size: 14px; }
.cashier-label { color: var(--text-dim); }
/* Addresses: every character visible, never truncated or ellipsized, broken anywhere instead of overflowing. */
.cashier-address, .wd-address {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  word-break: break-all; overflow-wrap: anywhere; white-space: normal;
}
.cashier-addr { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(0, 0, 0, .25); }
.cashier-address { font-size: 15px; user-select: all; }
.cashier-addr .btn { align-self: flex-start; }
.copy-status { font-size: 13px; color: var(--text-dim); }
.cashier-warning { margin: 0; padding: 10px 12px; border-radius: 10px; background: rgba(255, 179, 0, .12); border: 1px solid rgba(255, 179, 0, .4); color: #ffd27a; font-size: 14px; font-weight: 600; }
.wd-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.wd-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); font-size: 14px; }
.wd-date, .wd-network { color: var(--text-dim); font-size: 13px; }
.wd-amount { font-weight: 700; }
.wd-status { text-align: right; font-weight: 600; }
.wd-address { grid-column: 1 / -1; font-size: 12px; color: var(--text-dim); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 70;
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 12px;
  background: #2a2438; border: 1px solid var(--line); color: #fff;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.is-shown { opacity: 1; transform: translate(-50%, 0); }

/* ---------- game overlay (desktop) ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; background: #000; }
.overlay-frame { display: block; width: 100%; height: 100%; border: 0; }
.overlay-close {
  position: absolute; top: 10px; right: 10px; z-index: 1;
  width: 40px; height: 40px; border-radius: 50%;
  font-size: 24px; line-height: 1; color: #fff; cursor: pointer;
  background: rgba(0, 0, 0, .6); border: 1px solid rgba(255, 255, 255, .3);
}

/* ---------- chain cashier (lazy chunk) ---------- */
.cashier [hidden] { display: none !important; }
.cashier-chain { display: flex; flex-direction: column; gap: 10px; }
.chain-badge { align-self: flex-start; padding: 2px 10px; border-radius: 999px; background: rgba(255, 179, 0, .18); border: 1px solid rgba(255, 179, 0, .5); color: #ffd27a; font-size: 12px; font-weight: 700; letter-spacing: .06em; }
.chain-mins { margin: 0; padding-left: 18px; font-size: 14px; }
