:root {
  color-scheme: light;
  --ink: #211d19;
  --muted: #6d665e;
  --paper: #e9e4da;
  --panel: #f7f3ea;
  --line: #cec4b4;
  --line-strong: #9a7a4c;
  --ember: #8f3528;
  --ember-dark: #68251d;
  --gold: #c79b49;
  --green: #356858;
  --night: #171b1a;
  --night-soft: #222827;
  --shadow: 0 14px 34px rgba(19, 20, 18, 0.14);
  --font-display: "Cinzel", Georgia, "Times New Roman", serif;
  --font-ui: "Source Sans 3", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  min-height: 100vh;
}

.topbar {
  background: rgba(23, 27, 26, 0.97);
  border-bottom: 1px solid rgba(199, 155, 73, 0.34);
  box-shadow: 0 8px 24px rgba(10, 12, 11, 0.22);
  position: sticky;
  top: 0;
  z-index: 3;
}

.topbar-inner {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin: 0 auto;
  max-width: 1200px;
  min-height: 62px;
  padding: 0 1.25rem;
}

.brand {
  align-items: center;
  color: #f7f0df;
  display: inline-flex;
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 700;
  gap: .65rem;
  text-decoration: none;
}

.brand b {
  color: var(--gold);
  font-weight: 700;
}

.brand-mark {
  border: 1px solid rgba(199, 155, 73, 0.7);
  border-radius: 50%;
  height: 2.2rem;
  object-fit: cover;
  width: 2.2rem;
}

.nav-links,
.actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
}

.nav-links a {
  color: #c9c8c1;
  font-size: .95rem;
  text-decoration: none;
}

.nav-links a.active,
.nav-menu summary.active {
  color: #f0c66e;
  font-weight: 700;
}

main {
  margin: 0 auto 4rem;
  max-width: 1200px;
  padding: 0 1.25rem;
}

.panel,
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  margin-top: 1.25rem;
  padding: 1.5rem;
}

.hero-panel {
  background-color: var(--night);
  color: #f7f0df;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  overflow: hidden;
  padding: 3rem max(1.25rem, calc((100vw - 1175px) / 2));
  position: relative;
}

.hero-panel::after {
  background: rgba(16, 20, 19, 0.22);
  content: "";
  inset: 0;
  pointer-events: none;
  position: absolute;
}

.lobby-hero {
  background-image:
  linear-gradient(90deg, rgba(14, 17, 16, 0.94) 0%, rgba(14, 17, 16, 0.72) 38%, rgba(14, 17, 16, 0.08) 76%),
  url("../img/tavern-lobby.webp");
  background-position: center;
  background-size: cover;
  min-height: min(520px, 58vh);
  padding-bottom: 4rem;
  padding-top: 4rem;
}

.page-hero {
  border-bottom: 1px solid rgba(199, 155, 73, 0.38);
  padding-bottom: 2.4rem;
  padding-top: 2.4rem;
}

.page-hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.7rem);
}

.hero-panel::before {
  background: var(--gold);
  bottom: 0;
  content: "";
  height: 3px;
  left: 0;
  position: absolute;
  right: 0;
  z-index: 2;
}

.hero,
.split-panel {
  align-items: flex-start;
  display: flex;
  gap: 1.5rem;
  justify-content: space-between;
}

.hero {
  align-items: center;
  min-height: inherit;
  position: relative;
  z-index: 1;
}

.hero > div:first-child {
  max-width: 42rem;
}

h1,
h2 {
  font-family: var(--font-display);
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2.6rem, 6vw, 5.25rem);
  line-height: .98;
  margin: .3rem 0 1rem;
}

h2 {
  font-size: 1.65rem;
  margin: .1rem 0 .6rem;
}

h3 {
  font-family: var(--font-display);
}

p {
  color: var(--muted);
}

.eyebrow {
  color: var(--muted);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 .35rem;
  text-transform: uppercase;
}

.hero-panel .eyebrow {
  color: #e5be6a;
}

.hero-copy {
  color: #d4d1c9;
  font-size: 1.16rem;
  line-height: 1.55;
  margin: 0;
  max-width: 37rem;
}

.hero-button {
  white-space: nowrap;
}

.hero-balance {
  align-self: flex-end;
  border-left: 1px solid rgba(240, 198, 110, 0.7);
  display: grid;
  min-width: 10rem;
  padding: .5rem 0 .5rem 1.25rem;
}

.hero-balance span {
  color: #c9c8c1;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.hero-balance strong {
  color: #fff4d6;
  font-family: var(--font-display);
  font-size: 2.2rem;
}

.hero-balance a {
  color: #efc76f;
  font-size: .88rem;
}

dl {
  display: grid;
  gap: .5rem 1rem;
  grid-template-columns: max-content 1fr;
}

dt {
  color: var(--muted);
  font-weight: 700;
}

dd {
  margin: 0;
}

code {
  background: #f0e4d1;
  border-radius: 4px;
  padding: .12rem .3rem;
}

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

.grid.two-column {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card {
  padding: 1rem;
}

.game-list {
  display: grid;
  gap: .75rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 1.25rem;
}

.game-card {
  align-items: center;
  background: #f7f3ea;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 7px 20px rgba(27, 25, 21, 0.08);
  color: var(--ink);
  display: grid;
  gap: .85rem;
  grid-template-columns: 2.6rem minmax(0, 1fr) auto;
  min-height: 7.2rem;
  padding: 1rem;
  text-decoration: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.game-card:hover {
  border-color: var(--line-strong);
  box-shadow: 0 14px 28px rgba(27, 25, 21, 0.13);
  transform: translateY(-2px);
}

.game-card-featured {
  background: var(--night-soft);
  border-color: #765f39;
  color: #f6eedc;
  grid-column: span 2;
}

.game-list > .game-card:last-child {
  grid-column: span 2;
}

.game-sigil {
  align-items: center;
  aspect-ratio: 1;
  background: #e5dccd;
  border: 1px solid #c4b59f;
  border-radius: 50%;
  color: var(--ember-dark);
  display: flex;
  font-family: var(--font-display);
  font-size: .78rem;
  font-weight: 700;
  justify-content: center;
}

.game-card-featured .game-sigil {
  background: rgba(199, 155, 73, 0.12);
  border-color: rgba(229, 190, 106, 0.5);
  color: #efc76f;
}

.game-copy {
  display: grid;
  min-width: 0;
}

.game-copy small {
  color: var(--muted);
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.game-copy strong {
  font-family: var(--font-display);
  font-size: 1rem;
  margin: .1rem 0 .2rem;
}

.game-copy > span {
  color: var(--muted);
  font-size: .86rem;
  line-height: 1.25;
}

.game-card-featured .game-copy small,
.game-card-featured .game-copy > span {
  color: #aaa9a2;
}

.game-cta {
  color: var(--ember);
  font-size: .82rem;
  font-weight: 700;
  white-space: nowrap;
}

.game-card-featured .game-cta {
  color: #efc76f;
}

.lobby-section {
  padding: 2.5rem 0 .75rem;
}

.section-heading {
  align-items: end;
  display: flex;
  gap: 2rem;
  justify-content: space-between;
}

.section-heading h2 {
  margin-bottom: 0;
}

.section-heading > p {
  margin: 0;
}

.section-heading.compact {
  align-items: center;
}

.compact-list {
  display: grid;
  gap: .6rem;
  margin-top: 1rem;
}

.compact-row {
  align-items: center;
  border-top: 1px solid var(--line);
  color: var(--ink);
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  padding: .72rem .2rem;
  text-decoration: none;
}

.compact-row:first-child {
  border-top: 0;
}

.compact-row small {
  color: var(--muted);
  display: block;
  margin-top: .15rem;
}

.compact-row .amount {
  color: var(--ember);
  font-weight: 700;
  white-space: nowrap;
}

.stat-card {
  min-height: 8rem;
}

.player-strip {
  align-items: center;
  background: var(--night-soft);
  border-bottom: 3px solid var(--gold);
  color: #f5eddb;
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(10rem, 1.4fr) repeat(5, minmax(4.7rem, .65fr)) auto;
  margin: 2.5rem calc(50% - 50vw) 0;
  padding: 1.25rem max(1.25rem, calc((100vw - 1175px) / 2));
}

.player-identity h2 {
  font-size: 1.22rem;
  margin: 0;
}

.player-identity a,
.player-wallet summary {
  color: #d9b967;
  font-size: .82rem;
}

.player-stat {
  border-left: 1px solid rgba(255, 255, 255, .13);
  display: grid;
  gap: .15rem;
  padding-left: 1rem;
}

.player-stat span {
  color: #9faaa6;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.player-stat strong {
  font-family: var(--font-display);
  font-size: 1.16rem;
}

.player-stat.positive strong {
  color: #87b99f;
}

.player-stat.negative strong {
  color: #e28f7c;
}

.player-wallet {
  align-items: center;
  display: flex;
  gap: .75rem;
  position: relative;
}

.player-wallet details {
  position: relative;
}

.wallet-action-menu {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
  display: grid;
  min-width: 11rem;
  padding: .65rem;
  position: absolute;
  right: 0;
  top: calc(100% + .7rem);
  z-index: 3;
}

.wallet-action-menu a {
  color: var(--ink);
  padding: .35rem;
  text-decoration: none;
}

.activity-grid {
  display: grid;
  gap: 3rem;
  grid-template-columns: minmax(0, 1.2fr) minmax(18rem, .8fr);
  padding-top: 2.8rem;
}

.activity-section {
  min-width: 0;
}

.empty-state {
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.signin-band {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--ember);
  display: flex;
  gap: 2rem;
  justify-content: space-between;
  margin-top: 2.5rem;
  padding: 1.5rem;
}

.signin-band h2,
.signin-band p {
  margin-bottom: .25rem;
  margin-top: 0;
}

.stat {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 2.35rem;
  margin: .2rem 0 0;
}

.wallet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: 1rem;
}

.button,
button {
  background: var(--ember);
  border: 1px solid var(--ember-dark);
  border-radius: 6px;
  color: #fff8e8;
  cursor: pointer;
  display: inline-block;
  font: inherit;
  font-weight: 700;
  padding: .65rem 1rem;
  text-decoration: none;
}

.button:visited {
  color: #fff8e8;
}

.button.secondary {
  background: transparent;
  color: var(--ember);
}

.button.secondary:visited {
  color: var(--ember);
}

.button:hover,
button:hover {
  background: var(--ember-dark);
  color: #fff8e8;
}

.button.secondary:hover {
  background: rgba(139, 47, 31, 0.08);
  color: var(--ember-dark);
}

.warning {
  color: var(--ember);
  font-weight: 700;
}

.muted-panel {
  background: rgba(255, 250, 241, 0.72);
  box-shadow: none;
}

.account-menu,
.nav-menu {
  position: relative;
}

summary {
  color: #c9c8c1;
  cursor: pointer;
  font-size: .95rem;
  list-style: none;
}

summary::-webkit-details-marker {
  display: none;
}

.dropdown {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(40, 22, 12, 0.14);
  min-width: 220px;
  padding: .75rem;
  position: absolute;
  right: 0;
  top: calc(100% + .6rem);
  z-index: 4;
}

.account-menu > summary.button {
  color: #fff8e8;
}

.dropdown span,
.dropdown a {
  display: block;
}

.dropdown span {
  color: var(--muted);
  margin-top: .2rem;
}

.dropdown a {
  color: var(--ink);
  margin-top: .55rem;
  padding: .2rem .25rem;
}

.dropdown a:visited {
  color: var(--ink);
}

.dropdown a:hover,
.dropdown a:focus-visible {
  background: #e9dfcf;
  color: var(--ember-dark);
  outline: none;
}

.nav-menu .dropdown {
  min-width: 210px;
  text-align: left;
}

pre {
  background: #241712;
  border-radius: 6px;
  color: #fffdf8;
  overflow: auto;
  padding: .75rem;
}

input {
  background: #fffaf1;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: block;
  font: inherit;
  margin-top: .4rem;
  max-width: 180px;
  padding: .55rem .65rem;
  width: 100%;
}

.tool-card form {
  display: grid;
  gap: .8rem;
  max-width: 22rem;
}

.play-panel form {
  max-width: 24rem;
}

.result-panel {
  border-color: var(--line-strong);
}

.result-panel.win {
  border-color: rgba(47, 109, 76, 0.65);
}

.result-panel.loss {
  border-color: rgba(139, 47, 31, 0.6);
}

.playing-card-row,
.versus-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 1rem 0;
}

.versus-cards > div {
  min-width: 8rem;
}

.playing-card {
  align-items: flex-start;
  aspect-ratio: 5 / 7;
  background: #fffdf8;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 12px 26px rgba(40, 22, 12, 0.14);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: .75rem;
  width: 7rem;
}

.playing-card.red {
  color: var(--ember);
}

.playing-card span,
.playing-card strong {
  font-family: var(--font-display);
}

.playing-card span {
  font-size: 1.2rem;
}

.playing-card strong {
  align-self: center;
  font-size: 2.4rem;
}

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

.roll-list {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin: 1rem 0;
}

.roll-list span {
  background: #f0e4d1;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .35rem .65rem;
}

.dice-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 1rem 0;
}

.die-card {
  align-items: center;
  aspect-ratio: 1;
  background:
  linear-gradient(145deg, rgba(255, 253, 248, 0.96), rgba(240, 228, 209, 0.86));
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 12px 26px rgba(40, 22, 12, 0.14);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 7rem;
  padding: .75rem;
}

.die-card.total {
  border-color: var(--ember);
}

.die-card strong {
  font-family: var(--font-display);
  font-size: 2.6rem;
}

.dice-operator {
  color: var(--ember);
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1;
}

.proof-list {
  border-top: 1px solid var(--line);
  margin-top: 1rem;
  padding-top: 1rem;
}

.proof-list dd {
  min-width: 0;
  overflow-wrap: anywhere;
}

.proof-note {
  color: var(--muted);
  font-weight: 700;
  margin: -.35rem 0 1rem;
}

.proof-action {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: .8rem;
  justify-content: space-between;
  margin-top: 1rem;
  padding-top: 1rem;
}

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

.proof-check {
  box-shadow: none;
}

.proof-check.passed {
  border-color: rgba(47, 109, 76, 0.65);
}

.proof-check.failed {
  border-color: rgba(139, 47, 31, 0.6);
}

.footer {
  background: var(--night);
  border-top: 1px solid rgba(199, 155, 73, 0.34);
  color: #aaa9a2;
  margin-top: 2rem;
}

.footer-inner {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin: 0 auto;
  max-width: 1200px;
  min-height: 72px;
  padding: 0 1rem;
}

.footer-inner > span {
  font-family: var(--font-display);
  font-weight: 700;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: .9rem;
}

.footer-links a {
  color: #aaa9a2;
  font-size: .92rem;
  text-decoration: none;
}

.footer-links a:hover {
  color: #efc76f;
}

@media (max-width: 1020px) {
  .game-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .player-strip {
    grid-template-columns: minmax(10rem, 1.5fr) repeat(3, minmax(5rem, 1fr)) auto;
  }

  .player-stat:nth-of-type(4),
  .player-stat:nth-of-type(5) {
    display: none;
  }
}

@media (max-width: 760px) {
  .hero,
  .split-panel,
  .topbar-inner {
    align-items: stretch;
    flex-direction: column;
  }

  .grid,
  .grid.two-column,
  .game-list,
  .proof-checks,
  .activity-grid,
  .player-strip {
    grid-template-columns: 1fr;
  }

  main {
    padding: 0 1rem;
  }

  .topbar-inner {
    gap: .6rem;
    padding-bottom: .7rem;
    padding-top: .7rem;
  }

  .nav-links {
    gap: .85rem;
    justify-content: space-between;
    width: 100%;
  }

  .desktop-link {
    display: none;
  }

  .lobby-hero {
    background-image:
    linear-gradient(90deg, rgba(14, 17, 16, 0.94), rgba(14, 17, 16, 0.58)),
    url("../img/tavern-lobby.webp");
    background-position: 58% center;
    min-height: 430px;
    padding-bottom: 2.5rem;
    padding-top: 2.5rem;
  }

  .hero {
    justify-content: center;
  }

  .hero-balance {
    align-self: flex-start;
    border-left: 0;
    border-top: 1px solid rgba(240, 198, 110, 0.7);
    padding: 1rem 0 0;
  }

  .section-heading,
  .signin-band {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-heading {
    display: flex;
    gap: .5rem;
  }

  .game-card-featured {
    grid-column: auto;
  }

  .game-list > .game-card:last-child {
    grid-column: auto;
  }

  .player-strip {
    justify-items: stretch;
  }

  .player-stat {
    border-left: 0;
    border-top: 1px solid rgba(255, 255, 255, .13);
    grid-template-columns: 1fr auto;
    padding: .65rem 0 0;
  }

  .player-stat:nth-of-type(4),
  .player-stat:nth-of-type(5) {
    display: grid;
  }

  .player-wallet {
    justify-content: space-between;
  }

  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
  }

  h1 {
    font-size: 2.7rem;
  }

  .dropdown {
    left: 0;
    right: auto;
  }
}
