* {
  box-sizing: border-box;
}
:root {
  font-family: system-ui, sans-serif;
  color: #fff9e4;
  background: #041f19;
  font-weight: 700;
  --gold: #ffcf63;
  --mint: #6bffbc;
  --red: #ff827a;
}
body {
  margin: 0;
  min-height: 100svh;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at top, #11503c, transparent 72%),
    repeating-linear-gradient(120deg, #ffffff04 0 1px, transparent 1px 9px);
}
main {
  width: min(490px, 96vw);
  padding: 12px;
  text-align: center;
}
nav,
.ledger,
#actions,
#dice,
#locks {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
nav a,
nav button {
  color: #b7ead0;
  font-size: 14px;
  text-decoration: none;
  padding: 9px;
  background: none;
  border: 0;
  box-shadow: none;
}
h1 {
  font: 1000 clamp(32px, 9vw, 54px) / 1 system-ui;
  letter-spacing: -0.055em;
  margin: 6px 0;
  text-shadow: 0 4px #06241a;
}
i {
  color: var(--gold);
}
p {
  margin: 8px 0;
  font-size: 14px;
  line-height: 1.42;
}
header p,
#hint {
  color: #b7dfc8;
  font-weight: 550;
}
.ledger {
  margin: 18px 0;
}
.ledger div {
  flex: 1;
}
.ledger,
.label {
  color: #9fd5b9;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 11px;
}
.ledger b {
  display: block;
  color: #fffaea;
  font-size: clamp(15px, 4.5vw, 23px);
  letter-spacing: -0.04em;
}
.felt {
  padding: 22px 16px 14px;
  background: radial-gradient(circle at center, #108957, #075239 77%);
  border: 2px solid #ba9652;
  border-radius: 25px;
  box-shadow: inset 0 0 0 5px #073b2b, inset 0 0 0 6px #d5ae586b,
    0 7px 24px #00140d77;
}
#cash {
  display: block;
  color: var(--gold);
  font-size: 44px;
  line-height: 1.2;
  letter-spacing: -0.045em;
  text-shadow: 0 3px #03422a;
}
button {
  font: inherit;
  color: #062b1f;
  cursor: pointer;
  touch-action: manipulation;
  border: 0;
  background: var(--mint);
  border-radius: 13px;
  padding: 13px 7px;
  box-shadow: 0 4px #168a56;
}
button:disabled {
  cursor: default;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid white;
  outline-offset: 3px;
}
button:enabled:hover {
  filter: brightness(1.1);
}
#dice {
  justify-content: center;
  margin: 16px 0 0;
  gap: 12px;
}
#dice button {
  padding: 0;
  background: none;
  box-shadow: none;
  color: #ecfff2;
  flex: 1;
  min-width: 0;
  font-size: 19px;
}
#dice small {
  display: block;
  font-size: 11px;
  margin-top: 2px;
  min-height: 15px;
  letter-spacing: 0.03em;
}
.die {
  margin: 0 auto 13px;
  width: clamp(85px, 24vw, 121px);
  aspect-ratio: 1;
  display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  padding: 12px;
  border-radius: 20%;
  background: linear-gradient(135deg, #fff, #ffe8ad);
  box-shadow: 0 6px #d49d4f, 0 11px #002d20, inset 0 0 0 3px #fff6d9;
}
.die b {
  align-self: center;
  justify-self: center;
  width: 71%;
  aspect-ratio: 1;
  border-radius: 100%;
  background: #092e25;
  box-shadow: inset 0 3px #0005;
}
.red .die,
#locks .red {
  background: #a02d34;
  box-shadow: 0 6px #611b23, inset 0 0 0 2px #ff827a;
  color: #fff;
}
.red .die b {
  background: #ffe9ce;
}
.red {
  color: #ffaca0 !important;
}
#dice button:enabled:hover .die {
  transform: translateY(-3px);
}
#status {
  min-height: 22px;
  color: #fff6c9;
}
#locks {
  max-width: 315px;
  margin: 12px auto 14px;
  gap: 7px;
}
#locks span {
  flex: 1;
  padding: 6px 0;
  border: 1px solid #ffffff4a;
  border-radius: 8px;
  background: #003f30;
  font-size: 18px;
}
#locks .red {
  box-shadow: none;
}
#hint {
  font-size: 14px;
}
#actions {
  margin: 16px 0 12px;
}
#actions button {
  flex: 1;
  min-height: 61px;
}
#actions small {
  display: block;
  font-size: 12px;
  margin-top: 2px;
}
#actions button:disabled {
  opacity: 0.48;
}
#bank {
  background: var(--gold);
  box-shadow: 0 4px #b57b2f;
}
dialog {
  width: min(390px, 92vw);
  background: #093b2d;
  color: white;
  border: 2px solid var(--gold);
  border-radius: 18px;
  padding: 22px;
}
dialog p {
  font-weight: 500;
  margin: 12px 0;
}
dialog button {
  width: 100%;
}
dialog::backdrop {
  background: #00140dcc;
}
@media (prefers-reduced-motion: no-preference) {
  .toss .die {
    animation: toss 0.24s ease-out;
  }
  @keyframes toss {
    from {
      transform: translateY(-10px) rotate(-17deg) scale(0.87);
    }
    65% {
      transform: rotate(5deg) scale(1.06);
    }
  }
}
@media (max-height: 760px) {
  main {
    padding-block: 3px;
  }
  h1 {
    font-size: 34px;
  }
  .ledger {
    margin: 8px 0;
  }
  .felt {
    padding: 12px;
  }
  .die {
    width: 85px;
    padding: 10px;
  }
  #cash {
    font-size: 32px;
  }
  #dice {
    margin-top: 7px;
  }
  #actions button {
    min-height: 49px;
    padding: 6px;
  }
  #locks {
    margin: 7px auto;
  }
  #actions {
    margin: 9px 0;
  }
  p {
    margin: 4px 0;
  }
}
@media (max-height: 610px) {
  header p {
    display: none;
  }
  .die {
    width: 65px;
  }
  #dice small {
    min-height: 12px;
  }
  #status {
    font-size: 12px;
  }
  h1 {
    font-size: 27px;
  }
}
[hidden] {
  display: none !important;
}
.take {
  display: block;
  border-radius: 12px;
  background: var(--mint);
  color: #062b1f;
  padding: 12px 2px;
  box-shadow: 0 4px #168a56;
  font-size: clamp(14px, 4.4vw, 19px);
}
.red .take {
  background: #4a2023;
  box-shadow: 0 4px #341519;
  color: #ffcbc3;
}
#dice small {
  margin-top: 8px;
}
#status {
  font-size: 16px;
}
#status.loss {
  color: #ffd6cf;
  background: #711d26;
  border-radius: 9px;
  padding: 8px;
}
#danger {
  margin-top: 9px;
}
#odds {
  margin: 16px auto;
  padding: 18px 10px;
  max-width: 340px;
  border-radius: 14px;
  background: #002e25;
}
.meter {
  margin: 10px auto;
  height: 11px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--mint);
}
.meter div {
  height: 100%;
  background: #ff6861;
  border-right: 2px solid #002e25;
}
#upside {
  color: var(--mint);
  margin: 0;
}
@media (max-height: 700px) {
  #status,
  #hint {
    font-size: 13px;
  }
  #odds {
    margin: 9px auto;
    padding: 12px 8px;
  }
}
#job {
  display: inline-block;
  margin: 6px auto;
  padding: 6px 10px;
  border: 1px solid #ffcf6377;
  border-radius: 9px;
  color: var(--gold);
  background: #062e25;
  font-size: 13px;
}
#job.earned {
  background: var(--gold);
  color: #062b1f;
}
#receipt {
  margin: 12px auto;
  padding: 0;
  max-width: 300px;
}
#receipt li {
  display: flex;
  justify-content: space-between;
  padding: 5px;
  border-bottom: 1px solid #ffffff40;
}
#receipt b {
  color: var(--gold);
}
#mode {
  color: var(--gold);
  text-decoration: underline;
  text-underline-offset: 4px;
}
#share {
  margin: 8px auto;
  color: var(--mint);
  border: 1px solid var(--mint);
  background: transparent;
  box-shadow: none;
}
#copy {
  display: block;
  margin: 8px auto;
  width: 100%;
  min-height: 100px;
  font: inherit;
}
/* Keep the decision beside the dice on short landscape screens. */
@media (orientation: landscape) and (min-width: 620px) and (max-height: 510px) {
  main {
    width: min(96vw, 880px);
    display: grid;
    grid-template-columns: 1fr 1.35fr;
    grid-template-rows: 1fr auto auto auto auto 1fr;
    column-gap: 18px;
    align-items: center;
  }
  nav { grid-area: 2/1; }
  header { grid-area: 3/1; }
  .ledger { grid-area: 4/1; }
  #actions { grid-area: 5/1; }
  .felt { grid-area: 1/2/7/3; }
  #share { grid-area: 6/1; }
  #copy { grid-column: 1/-1; }
  #job { margin: 2px auto; padding: 3px 6px; }
  #dice small:empty { display: none; }
  .die { margin-bottom: 8px; }
}
