:root {
  color-scheme: dark;
  --bg: #050505;
  --glass: rgba(8, 8, 9, 0.58);
  --glass-strong: rgba(12, 12, 13, 0.74);
  --ink: #fbfbfb;
  --muted: rgba(255, 255, 255, 0.66);
  --line: rgba(255, 220, 141, 0.22);
  --gold: #ffd981;
  --gold-strong: #f0b747;
  --white-soft: rgba(255, 255, 255, 0.82);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.62);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  z-index: -3;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.16), rgba(0, 0, 0, 0.82)),
    linear-gradient(90deg, rgba(0, 0, 0, 0.74), rgba(0, 0, 0, 0.18) 46%, rgba(0, 0, 0, 0.72)),
    url("/assets/neon-gold-table.jpg");
  background-size: cover;
  background-position: center;
}

body::after {
  z-index: -2;
  background:
    linear-gradient(115deg, transparent 0%, transparent 38%, rgba(255, 225, 156, 0.12) 48%, transparent 59%, transparent 100%),
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 8px);
  mix-blend-mode: screen;
  opacity: 0.78;
  animation: light-sweep 8s ease-in-out infinite alternate;
}

@keyframes light-sweep {
  from {
    transform: translateX(-5%);
  }

  to {
    transform: translateX(5%);
  }
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease, opacity 140ms ease;
}

button:active {
  transform: translateY(1px);
}

.ambient-icons {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.ambient-icon {
  position: absolute;
  display: block;
  opacity: 0.18;
  filter: drop-shadow(0 0 28px rgba(255, 217, 129, 0.46));
}

.icon-chip {
  right: 1.4rem;
  top: 8rem;
  width: 5.8rem;
  height: 5.8rem;
  border: 1px solid rgba(255, 217, 129, 0.72);
  border-radius: 999px;
}

.icon-chip::before {
  content: "";
  position: absolute;
  inset: 1.2rem;
  border: 1px dashed rgba(255, 255, 255, 0.7);
  border-radius: inherit;
}

.icon-dice {
  left: 1rem;
  bottom: 6rem;
  width: 5rem;
  height: 5rem;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 8px;
  transform: rotate(-12deg);
}

.icon-dice::before {
  content: "";
  position: absolute;
  left: 1rem;
  top: 1rem;
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 999px;
  background: rgba(255, 217, 129, 0.9);
  box-shadow: 2.35rem 0 rgba(255, 217, 129, 0.9), 1.16rem 1.16rem rgba(255, 255, 255, 0.8), 0 2.35rem rgba(255, 217, 129, 0.9), 2.35rem 2.35rem rgba(255, 217, 129, 0.9);
}

.icon-spark {
  right: 2.6rem;
  bottom: 2.4rem;
  width: 5.5rem;
  height: 5.5rem;
}

.icon-spark::before,
.icon-spark::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5.5rem;
  height: 1px;
  background: rgba(255, 217, 129, 0.8);
  transform: translate(-50%, -50%) rotate(45deg);
}

.icon-spark::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 0.85rem;
  width: min(42rem, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(0.9rem, env(safe-area-inset-top)) 0.85rem max(1rem, env(safe-area-inset-bottom));
}

.topbar,
.table,
.earn-card,
.profile-card,
.history-wrap,
.status,
.invite-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.025)), var(--glass);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(1.08);
  -webkit-backdrop-filter: blur(18px) saturate(1.08);
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: start;
  padding: 1rem;
}

.eyebrow,
.balance span,
.player-panel span,
.status,
.muted,
.stats span,
.earn-meta span,
.invite-head span {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 0.2rem;
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 3.35rem;
  line-height: 0.92;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.35rem;
}

.balance {
  min-width: 8.2rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid rgba(255, 217, 129, 0.66);
  border-radius: 8px;
  background: rgba(255, 247, 226, 0.9);
  color: #050505;
  text-align: right;
  box-shadow: 0 0 32px rgba(255, 190, 73, 0.18);
}

.balance span {
  color: rgba(0, 0, 0, 0.62);
}

.balance strong {
  display: block;
  margin-top: 0.15rem;
  font-size: 1.45rem;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
}

.tab {
  min-height: 2.7rem;
  border: 1px solid rgba(255, 217, 129, 0.18);
  border-radius: 8px;
  color: var(--white-soft);
  background: rgba(10, 10, 11, 0.58);
  font-weight: 850;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.tab.active {
  color: #100b02;
  background: linear-gradient(180deg, #fff4c9, var(--gold-strong));
  border-color: rgba(255, 244, 201, 0.9);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.table {
  padding: 1rem;
}

.dice-stage {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.65rem;
  min-height: 13.5rem;
}

.player-panel {
  display: grid;
  gap: 0.65rem;
  min-width: 0;
  text-align: center;
}

.player-panel span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.die {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  width: min(100%, 8.5rem);
  margin: 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  background: linear-gradient(145deg, #ffffff, #d8d8d8);
  color: #050505;
  font-size: 4.8rem;
  font-weight: 950;
  box-shadow: 0 0.45rem 0 rgba(176, 125, 30, 0.92), 0 0 36px rgba(255, 217, 129, 0.2);
}

.die.rolling {
  transform: rotate(4deg) scale(1.03);
}

.versus {
  display: grid;
  place-items: center;
  width: 2.55rem;
  height: 2.55rem;
  border: 1px solid rgba(255, 217, 129, 0.36);
  border-radius: 999px;
  background: rgba(5, 5, 5, 0.52);
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 900;
}

.controls {
  display: grid;
  gap: 0.65rem;
  margin-top: 1rem;
}

.controls label {
  color: var(--muted);
  font-weight: 800;
}

.bet-row {
  display: grid;
  grid-template-columns: 3rem 1fr 3rem;
  gap: 0.5rem;
}

.icon-button,
.quick-bets button,
.secondary-button,
.roll-button,
.glass-button {
  min-height: 3rem;
  border: 1px solid rgba(255, 217, 129, 0.18);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(12, 12, 13, 0.66);
  font-weight: 900;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.icon-button {
  font-size: 1.35rem;
}

input {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(255, 217, 129, 0.2);
  border-radius: 8px;
  padding: 0 1rem;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.48);
  /*text-align: center;*/
  font-weight: 950;
}

.quick-bets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.secondary-button,
.glass-button {
  color: var(--gold);
}

.roll-button {
  min-height: 3.25rem;
  border: 1px solid rgba(255, 244, 201, 0.92);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff5d0, #f0b747);
  color: #110b02;
  font-weight: 950;
  box-shadow: 0 0 32px rgba(255, 190, 73, 0.22);
}

.roll-button:disabled,
.earn-button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.invite-panel {
  display: grid;
  gap: 0.65rem;
  padding: 0.75rem;
}

.invite-panel[hidden] {
  display: none;
}

.invite-head,
.earn-meta {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.5rem;
}

.invite-head strong {
  color: var(--gold);
}

#invite-link {
  margin: 0;
  padding: 0.62rem 0.7rem;
  overflow-wrap: anywhere;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.84);
  background: rgba(0, 0, 0, 0.32);
  font-size: 0.84rem;
}

.invite-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.earn-card,
.profile-card,
.history-wrap {
  padding: 1rem;
}

.earn-card {
  display: grid;
  gap: 1rem;
}

.earn-button {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 10rem;
  border: 1px solid rgba(255, 244, 201, 0.84);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.16), transparent 36%),
    linear-gradient(180deg, rgba(255, 217, 129, 0.92), rgba(172, 112, 16, 0.96));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42), 0 22px 60px rgba(0, 0, 0, 0.46), 0 0 46px rgba(255, 190, 73, 0.24);
}

.earn-button::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 0%, rgba(255, 255, 255, 0.24) 46%, transparent 58%);
  transform: translateX(-38%);
  animation: coin-shine 3.6s ease-in-out infinite;
}

@keyframes coin-shine {
  50% {
    transform: translateX(38%);
  }

  100% {
    transform: translateX(38%);
  }
}

.earn-coin {
  position: relative;
  width: 5.6rem;
  height: 5.6rem;
  border: 0.42rem solid rgba(255, 255, 255, 0.78);
  border-radius: 999px;
  background: linear-gradient(145deg, #fff7d7, #d89424);
  box-shadow: 0 0 42px rgba(255, 245, 208, 0.42);
}

.earn-coin::before,
.earn-coin::after {
  content: "";
  position: absolute;
  inset: 1.05rem;
  border: 1px solid rgba(20, 12, 0, 0.32);
  border-radius: inherit;
}

.earn-coin::after {
  inset: auto;
  left: 50%;
  top: 50%;
  width: 1.2rem;
  height: 2.3rem;
  border: 0;
  border-left: 0.34rem solid rgba(20, 12, 0, 0.62);
  border-right: 0.34rem solid rgba(20, 12, 0, 0.62);
  border-radius: 2px;
  transform: translate(-50%, -50%);
}

.earn-meta {
  padding: 0.75rem;
  border: 1px solid rgba(255, 217, 129, 0.17);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.34);
}

.profile-head {
  display: grid;
  grid-template-columns: 3.4rem 1fr;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

.avatar {
  display: grid;
  place-items: center;
  width: 3.4rem;
  height: 3.4rem;
  border: 1px solid rgba(255, 244, 201, 0.72);
  border-radius: 999px;
  background: linear-gradient(180deg, #fff4c9, #d9982a);
  color: #050505;
  font-weight: 950;
  font-size: 1.4rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.stats div {
  min-height: 4.5rem;
  padding: 0.7rem;
  border: 1px solid rgba(255, 217, 129, 0.15);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.34);
}

.stats strong {
  display: block;
  margin-top: 0.25rem;
  font-size: 1.35rem;
}

.history-wrap {
  margin-top: 0.85rem;
}

.history {
  display: grid;
  gap: 0.5rem;
  max-height: 22rem;
  margin: 0.75rem 0 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.history li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  padding: 0.7rem;
  border: 1px solid rgba(255, 217, 129, 0.13);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.32);
}

.history small {
  color: var(--muted);
}

.status {
  min-height: 2.75rem;
  margin: 0;
  padding: 0.72rem 0.8rem;
  line-height: 1.3;
}

.status.win,
.delta-win {
  color: #fff4c9;
}

.status.loss,
.delta-loss {
  color: #c7c7c7;
}

.status.draw,
.delta-draw {
  color: var(--gold);
}

@media (max-width: 480px) {
  .app-shell {
    padding-inline: 0.7rem;
  }

  .topbar {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 2.35rem;
  }

  .balance {
    width: 100%;
    text-align: left;
  }

  .dice-stage {
    gap: 0.45rem;
  }

  .die {
    width: min(100%, 7.7rem);
    font-size: 4rem;
  }

  .earn-button {
    min-height: 8.6rem;
  }

  .invite-actions {
    grid-template-columns: 1fr;
  }
}
