@font-face {
  font-family: Cinzel;
  src: url("assets/fonts/cinzel.ttf") format("truetype");
  font-display: swap;
}
:root {
  color-scheme: dark;
  --gold: #c49b5d;
  --ivory: #f0dfba;
  --red: #ad3f37;
  --stone: #201b17;
  font-family: Georgia, serif;
  color: var(--ivory);
  background: #17120f;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  height: 100svh;
  min-height: 560px;
  overflow: hidden;
  background: #17120f url("assets/art/table.webp") center/cover no-repeat;
}
body:after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 120px #0008;
  z-index: -1;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: 1px solid #967340;
  background: #17120fdb;
  transition:
    filter 0.18s,
    background 0.18s,
    box-shadow 0.18s;
}
button:hover {
  filter: brightness(1.25);
  background-color: #3b2b1d;
}
button:focus-visible,
input:focus-visible {
  outline: 2px solid #ffe3a1;
  outline-offset: 4px;
}
button:disabled {
  cursor: default;
}
button:disabled:hover {
  filter: none;
}
button:active:not(:disabled) {
  filter: brightness(1.5);
}
.masthead {
  pointer-events: none;
  position: absolute;
  inset: 24px 28px auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  z-index: 2;
}
.brand {
  font-family: Cinzel, Georgia, serif;
  font-size: clamp(26px, 3.5vw, 62px);
  letter-spacing: 0.05em;
  color: #e2bd7e;
  text-shadow: 0 3px 2px #000;
}
.brand span {
  display: block;
  text-align: center;
  font: italic 0.37em Georgia;
  letter-spacing: 0.06em;
  margin-top: 3px;
}
nav {
  pointer-events: auto;
  display: flex;
  gap: 12px;
}
nav button {
  padding: 10px 18px;
  border-radius: 3px;
  font-size: 20px;
  box-shadow: inset 0 0 0 2px #352719;
}
.table {
  position: relative;
  width: min(650px, 58vh);
  height: calc(100svh - 24px);
  margin: 12px auto;
  padding: 38px 38px 30px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 3px solid #ae8951;
  border-radius: 44px 44px 38px 38px;
  background:
    linear-gradient(90deg, #0807069c, #33291d38, #0807069c),
    url("assets/art/stone.webp") center/cover;
  box-shadow:
    0 0 0 5px #30261f,
    0 0 0 9px #705a3c,
    0 0 0 13px #221d18,
    0 15px 50px #000c,
    inset 0 0 30px #000;
  isolation: isolate;
}
.table:before,
.table:after {
  content: "◆";
  position: absolute;
  left: calc(50% - 12px);
  color: #bd9454;
  background: #54221c;
  border: 1px solid #b78c48;
  line-height: 16px;
  padding: 0 4px;
  transform: rotate(45deg);
  font-size: 14px;
  z-index: 2;
}
.table:before {
  top: -10px;
}
.table:after {
  bottom: -10px;
}
.camp {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.nameplate {
  margin-inline: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 45px;
  border: 1px solid #a78450;
  background: linear-gradient(90deg, #181411, #392c1e, #181411);
  box-shadow:
    inset 0 0 0 3px #211710,
    0 3px 5px #0008;
  font-family: Cinzel, Georgia, serif;
  letter-spacing: 0.08em;
  font-size: clamp(15px, 2.5vh, 29px);
}
.nameplate span {
  flex: 1;
  text-align: center;
}
.nameplate strong {
  font-size: 1.5em;
  font-weight: 400;
  min-width: 83px;
  text-align: center;
  border-left: 1px solid #a78450;
  line-height: 1.15;
}
.opponent .nameplate {
  background: linear-gradient(90deg, #321310, #631e1c, #321310);
}
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  flex: 1;
  min-height: 0;
}
.column {
  padding: 4px;
  display: grid;
  grid-template-rows: repeat(3, minmax(0, 1fr)) 27px;
  gap: 5px;
  border: 1px solid #695137;
  border-radius: 10px;
  background: #100e0c70;
  min-height: 0;
  position: relative;
  box-shadow: inset 0 0 10px #0008;
}
.column:hover {
  background-color: #201b14;
}
.slot {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 0;
  border: 1px solid #554736;
  border-radius: 8px;
  background: linear-gradient(140deg, #0009, #30282042);
  box-shadow:
    inset 0 3px 7px #000d,
    inset 0 -1px 1px #9b815933;
}
.column-score {
  font-size: 22px;
  line-height: 25px;
  text-align: center;
  color: #e7c78e;
  border: 1px solid #85643d;
  background: #24190e;
  margin: 0 10px;
  clip-path: polygon(9% 0, 91% 0, 100% 50%, 91% 100%, 9% 100%, 0 50%);
}
.column.available {
  border-color: #d4a347;
  box-shadow:
    0 0 8px #b984262e,
    inset 0 0 12px #b984261a;
}
.column.target {
  background: #9c6c2638;
  box-shadow:
    0 0 15px #ffb42a9c,
    inset 0 0 20px #e9a63640;
  border-color: #ffdf82;
}
.column.full {
  cursor: not-allowed;
}
.column.invalid {
  animation: shake 0.25s;
}
.die {
  display: inline-block;
  position: relative;
  height: 94%;
  aspect-ratio: 1;
  max-width: 94%;
  background: url("assets/art/die.webp") center/100% 100% no-repeat;
  filter: drop-shadow(0 4px 2px #000a);
  flex-shrink: 0;
}
.pips {
  position: absolute;
  inset: 22%;
  display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  gap: 5%;
}
.pip {
  border-radius: 50%;
  background: radial-gradient(circle at 60% 70%, #55301a, #190c07 65%);
  box-shadow:
    inset 0 2px 2px #000a,
    0 1px 0 #ffe2a577;
  width: 78%;
  height: 78%;
  place-self: center;
}
.pip.off {
  visibility: hidden;
}
.opponent .die {
  filter: drop-shadow(0 2px 1px #8c1818) drop-shadow(0 4px 2px #0009);
}
.die.combo {
  filter: drop-shadow(0 0 5px #f5b73a) drop-shadow(0 3px 2px #0009);
}
.die.combo:after {
  content: attr(data-combo);
  position: absolute;
  right: 0;
  bottom: 5%;
  background: #39260d;
  color: #ffe3a1;
  border: 1px solid #d4a347;
  border-radius: 3px;
  font: 12px Georgia;
  padding: 1px 3px;
}
.die.spawn {
  animation: land 0.34s cubic-bezier(0.2, 0.8, 0.4, 1.3);
}
.die.shatter {
  animation: shatter 0.45s ease-out forwards;
}
.die.resonate {
  animation: resonate 0.6s;
}
.arena {
  height: 116px;
  flex-shrink: 0;
  border: 1px solid #b99354;
  box-shadow:
    inset 0 0 0 3px #302013,
    0 2px 6px #0008;
  display: flex;
  align-items: center;
  padding: 10px 15px;
  gap: 12px;
  position: relative;
  background: linear-gradient(100deg, #20180fdc, #35291ca1, #1b140fdc);
}
#roll {
  width: 90px;
  height: 90px;
  border: 0;
  background: none;
  padding: 0;
  touch-action: none;
  flex-shrink: 0;
  perspective: 400px;
}
#roll .die {
  height: 100%;
  max-width: 100%;
}
#roll:disabled {
  opacity: 0.8;
}
#roll.ready {
  animation: breathe 3s ease-in-out infinite;
}
#roll.rolling .die {
  animation: tumble 0.17s linear infinite;
}
.turn-copy {
  flex: 1;
  text-align: center;
}
h1 {
  font-family: Cinzel, Georgia, serif;
  font-size: clamp(16px, 2vh, 25px);
  font-weight: 500;
  margin: 0 0 8px;
  line-height: 1.15;
}
p {
  line-height: 1.6;
}
.turn-copy p {
  margin: 0;
  font-size: clamp(12px, 1.7vh, 17px);
  color: #d6c5a8;
}
#event {
  position: absolute;
  bottom: -16px;
  left: 50%;
  transform: translateX(-50%);
  background: #25180fee;
  color: #ffdc8a;
  font-size: 13px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 4;
  margin: 0;
  line-height: 22px;
  padding: 0 8px;
}
#event:empty {
  display: none;
}
.drag-ghost {
  position: fixed;
  width: 82px;
  height: 82px;
  pointer-events: none;
  z-index: 100;
  transform: translate(-50%, -50%) rotate(8deg);
  filter: drop-shadow(0 12px 8px #0009);
}
.drag-ghost .die {
  height: 100%;
}
.flying-shard {
  position: fixed;
  pointer-events: none;
  width: 7px;
  height: 12px;
  background: #d8ba83;
  z-index: 20;
  animation: shard 0.6s forwards;
}
.delta {
  position: absolute;
  top: 35%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  pointer-events: none;
  font-size: 24px;
  color: #ffe0a0;
  text-shadow: 0 2px 3px #000;
  animation: delta 1s forwards;
}
.versus .opponent {
  transform: rotate(180deg);
}
.versus .opponent .grid {
  direction: rtl;
}
.versus .opponent .column {
  direction: ltr;
}
.versus.p2-turn .arena {
  transform: rotate(180deg);
}
dialog {
  border: 1px solid #ad8951;
  border-radius: 12px;
  padding: 0;
  width: min(440px, calc(100% - 28px));
  max-height: calc(100svh - 32px);
  color: var(--ivory);
  background: #1c1712 url("assets/art/stone.webp") center/cover;
  box-shadow:
    0 0 0 4px #30261b,
    0 30px 100px #000;
  overflow: auto;
}
dialog::backdrop {
  background: #080605b8;
  backdrop-filter: blur(7px);
}
.dialog-inner {
  padding: 38px 32px 26px;
  text-align: center;
  position: relative;
}
h2 {
  font-family: Cinzel, Georgia, serif;
  font-size: 36px;
  font-weight: 500;
  margin: 0;
  color: #e9c891;
  letter-spacing: 0.04em;
}
.subtitle {
  font-style: italic;
  color: #bfa47d;
  margin: 8px 0 28px;
}
.close {
  position: absolute;
  right: 12px;
  top: 8px;
  border: 0;
  background: none;
  font: 26px Georgia;
  padding: 2px 8px;
}
fieldset {
  border: 0;
  padding: 0;
  margin: 20px 0 26px;
}
legend {
  text-align: center;
  width: 100%;
  font-size: 13px;
  color: #c6b294;
  margin-bottom: 12px;
}
.difficulty {
  display: flex;
  gap: 6px;
}
.difficulty button {
  flex: 1;
  padding: 12px 5px;
  font-size: 13px;
  border-color: #695238;
  border-radius: 3px;
}
.difficulty button[aria-pressed="true"] {
  border-color: #e5bd70;
  background: #694b28;
  box-shadow: inset 0 0 0 1px #b38d50;
}
.primary,
.secondary {
  width: 100%;
  padding: 15px 18px;
  margin: 6px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 3px;
}
.primary {
  background: linear-gradient(#8c6431, #60421f);
  border-color: #caa465;
  box-shadow: inset 0 1px #eccd8e55;
  font-size: 18px;
}
.secondary {
  background: #16110c88;
  border-color: #776041;
}
.menu-links {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 22px 0;
}
.menu-links button {
  border: 0;
  background: none;
  color: #c5ac83;
  font-size: 14px;
}
.portal-return {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin: 0 0 16px;
  padding: 10px 14px;
  border: 1px solid #776041;
  border-radius: 3px;
  background: #16110c88;
  color: #e4c48d;
  font-size: 14px;
  text-decoration: none;
}
.portal-return:hover,
.portal-return:focus-visible {
  border-color: #e5bd70;
  background: #694b2855;
}
.portal-return:focus-visible {
  outline: 2px solid #e5bd70;
  outline-offset: 3px;
}
small {
  font-size: 11px;
  color: #a18c70;
}
h3 {
  text-align: left;
  font-size: 19px;
  margin: 24px 0 4px;
  color: #e4c48d;
}
#rules p {
  text-align: left;
  font-family: Arial, sans-serif;
  font-size: 14px;
  color: #d2c3ac;
}
.example {
  border-left: 2px solid var(--gold);
  padding-left: 16px;
}
.keyboard {
  font-size: 12px !important;
  color: #b49d7c !important;
}
.range {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin: 26px 0;
  font-size: 17px;
}
.range input {
  width: 60%;
  accent-color: #c7a260;
}
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0;
  text-align: left;
}
.check input {
  accent-color: #b48b4a;
}
.result-scores {
  display: flex;
  justify-content: space-around;
  font-size: 48px;
  margin: 32px 0;
}
.versus-stats {
  font-size: 14px;
  color: #c3ac89;
  margin: 16px 0;
}
.reduced * {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  scroll-behavior: auto !important;
}
@keyframes tumble {
  0% {
    transform: rotateX(0) rotateZ(-12deg) translateY(0);
  }
  50% {
    transform: rotateX(110deg) rotateZ(15deg) translateY(-10px);
  }
  100% {
    transform: rotateX(180deg) rotateZ(-12deg) translateY(0);
  }
}
@keyframes land {
  0% {
    transform: translateY(-18px) scale(1.18);
    opacity: 0.3;
  }
  65% {
    transform: translateY(3px) scale(0.96);
  }
  100% {
    transform: none;
    opacity: 1;
  }
}
@keyframes resonate {
  50% {
    transform: scale(1.12);
    filter: drop-shadow(0 0 10px #ffcb47);
  }
}
@keyframes shatter {
  30% {
    filter: brightness(2);
    transform: scale(1.12);
  }
  100% {
    transform: scale(0.3) rotate(30deg);
    opacity: 0;
  }
}
@keyframes shard {
  to {
    transform: translate(var(--dx), var(--dy)) rotate(200deg);
    opacity: 0;
  }
}
@keyframes delta {
  to {
    transform: translate(-50%, -45px);
    opacity: 0;
  }
}
@keyframes shake {
  25%,
  75% {
    transform: translateX(3px);
  }
  50% {
    transform: translateX(-3px);
  }
}
@keyframes breathe {
  50% {
    filter: drop-shadow(0 0 9px #e8b04e55);
  }
}
.table {
  border-color: transparent;
  box-shadow:
    0 15px 50px #000c,
    inset 0 0 30px #000;
}
.table:before {
  content: "";
  position: absolute;
  inset: -13px;
  left: -13px;
  top: -13px;
  background: url("assets/art/frame.webp") center/100% 100% no-repeat;
  transform: none;
  border: 0;
  padding: 0;
  pointer-events: none;
  z-index: 6;
}
.table:after {
  display: none;
}
@media (min-width: 1100px) {
  .table {
    width: min(650px, 62vh);
  }
}
@media (max-width: 900px) {
  .masthead {
    inset: 12px 16px auto;
  }
  .brand {
    font-size: 25px;
  }
  .brand span {
    font-size: 11px;
  }
  nav {
    gap: 7px;
  }
  nav button {
    padding: 8px 10px;
    font-size: 16px;
  }
  .table {
    margin: 78px auto 12px;
    height: calc(100svh - 96px);
    width: min(500px, calc(100vw - 34px));
    padding: 16px 22px;
    border-radius: 25px;
    gap: 8px;
  }
  .nameplate {
    min-height: 33px;
    font-size: 17px;
  }
  .nameplate strong {
    min-width: 65px;
  }
  .arena {
    height: 88px;
    padding: 5px 10px;
    gap: 5px;
  }
  #roll {
    width: 70px;
    height: 70px;
  }
  .column {
    gap: 4px;
    padding: 3px;
    grid-template-rows: repeat(3, minmax(0, 1fr)) 23px;
  }
  .column-score {
    font-size: 18px;
    line-height: 21px;
    margin: 0 5px;
  }
  .grid {
    gap: 7px;
  }
  .camp {
    gap: 7px;
  }
  h1 {
    font-size: 17px;
  }
  .turn-copy p {
    font-size: 12px;
  }
}
@media (max-width: 450px) {
  .table {
    padding: 12px 15px;
  }
  .brand {
    font-size: 23px;
  }
  nav button {
    font-size: 15px;
  }
  .nameplate {
    font-size: 15px;
    min-height: 30px;
  }
  .nameplate strong {
    min-width: 52px;
  }
  .arena {
    height: 84px;
  }
  .grid {
    gap: 5px;
  }
  .column {
    padding: 3px;
    gap: 3px;
  }
  h1 {
    font-size: 15px;
  }
  .dialog-inner {
    padding: 34px 24px 22px;
  }
  h2 {
    font-size: 30px;
  }
}
@media (max-height: 600px) and (min-width: 650px) {
  body {
    min-height: 350px;
  }
  .masthead {
    inset: 12px 12px auto;
  }
  .brand {
    font-size: 24px;
  }
  .table {
    height: calc(100svh - 26px);
    margin: 13px auto;
    width: 350px;
    padding: 10px 20px;
    gap: 5px;
  }
  .nameplate {
    min-height: 24px;
    font-size: 13px;
  }
  .camp {
    gap: 4px;
  }
  .arena {
    height: 64px;
    padding: 4px;
  }
  #roll {
    height: 55px;
    width: 55px;
  }
  h1 {
    font-size: 14px;
  }
  .turn-copy p {
    font-size: 11px;
  }
  .column {
    grid-template-rows: repeat(3, minmax(0, 1fr)) 18px;
    gap: 2px;
    padding: 2px;
  }
  .column-score {
    font-size: 14px;
    line-height: 16px;
  }
  .grid {
    gap: 5px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
