/* Dot Siege: a war fought in the margins of graph paper. */
@font-face {
  font-family: "Nunito Sans";
  src: url("/site/brand/NunitoSans-Black.woff2") format("woff2");
  font-weight: 900;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("/site/brand/DMSans-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("/site/brand/DMSans-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
:root {
  color-scheme: light;
  --paper: #f6f0e1;
  --paper-2: #ebe2cc;
  --card: #fffdf6;
  --ink: #24222c;
  --soft: #6b6674;
  --margin: #e2615a;
  --grid: rgba(70, 120, 190, 0.14);
  --you: #1f6fd6;
  --you-dark: #134a93;
  --rook: #d97a00;
  --plum: #b13f8c;
  --hot: #ffb300;
  --head: "Nunito Sans", system-ui, sans-serif;
  --body: "DM Sans", system-ui, sans-serif;
  --shell-ink: var(--ink);
  --shell-paper: var(--card);
  --shell-accent: var(--you);
  --shell-on-accent: #fff;
  --shell-font: var(--body);
  --top: env(safe-area-inset-top, 0px);
  --bottom: env(safe-area-inset-bottom, 0px);
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
body {
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 22px 22px;
  color: var(--ink);
  font: 16px/1.4 var(--body);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}
[hidden] {
  display: none !important;
}
button {
  font: inherit;
  color: inherit;
}
:focus-visible {
  outline: 3px solid var(--hot);
  outline-offset: 3px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.screen {
  position: fixed;
  inset: 0;
  padding: calc(var(--top) + 12px) 16px calc(var(--bottom) + 12px);
}

/* ---------- buttons ---------- */
.btn {
  font-family: var(--head);
  font-weight: 900;
  font-size: 17px;
  min-height: 48px;
  padding: 10px 20px;
  border-radius: 14px;
  border: 3px solid var(--ink);
  background: var(--card);
  box-shadow: 0 4px 0 var(--ink);
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s;
}
.btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--ink);
}
.btn:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none;
  box-shadow: 0 4px 0 var(--ink);
}
.btn.primary {
  background: var(--you);
  color: #fff;
}
.btn.small {
  font-size: 14px;
  min-height: 40px;
  padding: 6px 12px;
  border-width: 2px;
  box-shadow: 0 3px 0 var(--ink);
}
.btn.big {
  font-size: 30px;
  padding: 14px 44px;
  border-radius: 20px;
  min-width: 240px;
}
.btn.big small {
  display: block;
  font-size: 14px;
  opacity: 0.85;
  letter-spacing: 0.04em;
}
.menu-btn {
  position: fixed;
  z-index: 50;
  top: calc(var(--top) + 10px);
  right: 12px;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  border: 3px solid var(--ink);
  background: var(--card);
  box-shadow: 0 3px 0 var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}
.menu-btn svg {
  width: 24px;
  height: 24px;
  stroke: var(--ink);
  stroke-width: 2.6;
  stroke-linecap: round;
  fill: none;
}
.badge {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  border-radius: 11px;
  background: var(--margin);
  color: #fff;
  font-size: 13px;
  margin-left: 4px;
  vertical-align: 2px;
}
.coin {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffe38a, #f0b429 60%, #b67a00);
  border: 2px solid #8a5b00;
  vertical-align: -2px;
  margin-right: 5px;
}

/* ---------- title ---------- */
.title {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  overflow-y: auto;
  /* the red margin line of a notebook */
  background: linear-gradient(90deg, transparent 38px, rgba(226, 97, 90, 0.55) 38px, rgba(226, 97, 90, 0.55) 40px, transparent 40px);
}
.title > * {
  flex-shrink: 0;
}
/* centred when it fits, scrollable from the top when it doesn't (landscape phones) */
.title > :first-child {
  margin-top: auto;
}
.title > :last-child {
  margin-bottom: auto;
}
.title-art svg {
  width: min(260px, 64vw);
  height: auto;
  display: block;
}
@media (prefers-reduced-motion: no-preference) {
  .title-art path[stroke="#ffb300"] {
    animation: blink 1.2s ease-in-out infinite;
  }
}
@keyframes blink {
  50% {
    opacity: 0.25;
  }
}
.title h1 {
  font: 900 clamp(48px, 13vw, 76px) / 1 var(--head);
  margin: 4px 0 0;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-shadow: 3px 3px 0 var(--hot);
}
.tagline {
  margin: 0 0 14px;
  font-size: 18px;
  color: var(--soft);
}
.rung-line {
  margin: 6px 0 4px;
  font-size: 15px;
  color: var(--soft);
  min-height: 42px;
}
.rung-line svg {
  vertical-align: -2px;
}
.btn.daily {
  background: #fff4cf;
  border-color: #8a5b00;
  box-shadow: 0 4px 0 #8a5b00;
  font-size: 16px;
  padding: 8px 18px;
}
.btn.daily small {
  display: block;
  font: 700 13px var(--body);
  color: var(--soft);
}
.daily-line {
  margin: 0;
  font-size: 14px;
  color: var(--soft);
}
.row {
  display: flex;
  gap: 12px;
}
.purse {
  margin: 8px 0 0;
  font-weight: 700;
}

/* ---------- pages: deck, ladder ---------- */
.page {
  overflow-y: auto;
  max-width: 720px;
  margin: 0 auto;
  padding-right: 16px;
  -webkit-user-select: none;
  /* keyboard focus and scrollIntoView stop below the sticky head */
  scroll-padding-top: calc(var(--top) + 76px);
}
.page-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-right: 58px;
  /* stays at the top while the list scrolls, so no card button slides under the menu button */
  position: sticky;
  z-index: 2;
  top: calc(-12px - var(--top));
  margin: calc(-12px - var(--top)) 0 0;
  padding-top: calc(12px + var(--top));
  padding-bottom: 8px;
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 22px 22px;
  /* line the grid up with the body's (the page sits 16px in, centred when wider than 720px) */
  background-position: calc(-16px - max(0px, (100vw - 720px) / 2)) 0;
}
.page-head h2 {
  font: 900 24px/1.1 var(--head);
  white-space: nowrap;
  margin: 0;
  flex: 1;
}
.page-head .purse {
  margin: 0;
}
.page h3 {
  font: 900 20px var(--head);
  margin: 18px 0 8px;
}
.note {
  margin: 4px 0 10px;
  color: var(--soft);
  font-size: 15px;
}
.deck-slots {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.slot {
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 12px;
}
.slot.on .mini {
  outline: 4px solid var(--you);
  outline-offset: 2px;
  transform: translateY(-3px);
}
.mini {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 10px 4px 6px;
  border-radius: 12px;
  border: 2px solid var(--ink);
  background: linear-gradient(var(--tint) 0 58%, var(--card) 58%);
  min-height: 96px;
  font-size: 12px;
  line-height: 1.1;
  text-align: center;
}
.mini b {
  font-size: 12px;
}
.mini small {
  color: var(--soft);
}
.mini .cost,
.card .cost,
.entry .cost {
  position: absolute;
  top: -8px;
  left: -8px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #5b3cc4;
  color: #fff;
  font: 900 15px/26px var(--head);
  font-style: normal;
  text-align: center;
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--ink);
}
.mini em {
  position: absolute;
  top: -8px;
  right: -6px;
  font-style: normal;
  font-weight: 900;
  font-size: 12px;
  background: var(--ink);
  color: #fff;
  border-radius: 8px;
  padding: 1px 6px;
}
.mini em.new {
  background: var(--margin);
}
.collection {
  display: grid;
  gap: 10px;
  padding-bottom: 20px;
}
.entry {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 12px;
  align-items: center;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 10px 12px;
}
.entry .art {
  position: relative;
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  border-radius: 12px;
  background: var(--tint);
  border: 2px solid var(--ink);
}
.entry b small {
  color: var(--soft);
  font-weight: 700;
}
.entry p {
  margin: 2px 0 0;
  font-size: 14px;
}
.entry .shards {
  color: var(--soft);
  font-size: 13px;
}
.entry .acts {
  display: grid;
  gap: 6px;
}
.entry.locked {
  opacity: 0.55;
  grid-template-columns: 64px 1fr;
}
.rungs {
  list-style: none;
  margin: 0;
  padding: 0 0 20px;
  display: grid;
  gap: 8px;
}
.rungs li {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 10px;
  align-items: center;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 10px 12px;
}
.rungs li.now {
  border-width: 3px;
  border-color: var(--you);
  box-shadow: 0 0 0 3px rgba(31, 111, 214, 0.2);
}
.rungs li.locked {
  opacity: 0.5;
}
.rungs .n {
  font: 900 24px var(--head);
  text-align: center;
}
.rungs small {
  display: block;
  color: var(--soft);
  font-size: 13px;
}
.rungs .lock {
  font-size: 20px;
  padding: 0 10px;
}

/* ---------- match ---------- */
.match {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 6px;
  padding: calc(var(--top) + 8px) 10px calc(var(--bottom) + 8px);
  touch-action: none;
}
.hud {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding-right: 58px;
  min-height: 52px;
}
.score .tug {
  display: flex;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid var(--ink);
  background: var(--paper-2);
}
.score .side {
  flex-basis: 0;
  transition: flex-grow 0.3s;
  min-width: 0;
}
.side.s0 {
  background: var(--you);
}
.side.s1 {
  background: repeating-linear-gradient(135deg, var(--rook) 0 4px, #f3b35a 4px 7px);
}
.side.s2 {
  background: radial-gradient(circle, #f1d2e7 1.4px, var(--plum) 1.6px) 0 0 / 6px 6px;
}
.side.neutral {
  background: transparent;
}
/* The HUD keeps one height all match (names and notes stay on one line, long names get "…"): a HUD that
   grew or shrank as scores reached two digits moved the board under the player's finger. */
.score {
  min-width: 0;
}
.names {
  display: flex;
  gap: 2px 12px;
  margin-top: 4px;
  font-size: 13px;
  font-weight: 700;
}
.nm {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  min-width: 0;
}
.nm svg,
.nm b {
  flex-shrink: 0;
}
.nmt {
  overflow: hidden;
  text-overflow: ellipsis;
}
.nm b {
  font: 900 17px var(--head);
}
.clock {
  text-align: center;
  line-height: 1;
}
.clock b {
  display: block;
  font: 900 30px var(--head);
  font-variant-numeric: tabular-nums;
}
.clock b.low {
  color: var(--margin);
}
.clock small {
  display: block;
  font-size: 11px;
  color: var(--soft);
  max-width: 110px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stage {
  position: relative;
  min-height: 0;
  border-radius: 16px;
  overflow: hidden;
  border: 3px solid var(--ink);
  box-shadow: 0 4px 0 var(--ink);
}
#board {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}
.coach {
  position: absolute;
  left: 50%;
  top: 10px;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 20px);
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  padding: 10px 14px;
  border-radius: 12px;
  text-align: center;
  pointer-events: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}
@media (prefers-reduced-motion: no-preference) {
  .coach.in {
    animation: drop 0.3s ease-out;
  }
}
@keyframes drop {
  from {
    opacity: 0;
    transform: translate(-50%, -8px);
  }
}
.dock {
  display: grid;
  gap: 8px;
}
.ticker {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 20px);
  background: rgba(36, 34, 44, 0.88);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  padding: 7px 12px;
  border-radius: 999px;
  text-align: center;
  pointer-events: none;
}
.tips {
  display: none;
}
.meters {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.meter {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pips {
  display: flex;
  gap: 4px;
}
.pips i {
  width: 16px;
  height: 22px;
  border-radius: 4px 4px 8px 8px;
  border: 2px solid var(--you-dark);
  background: linear-gradient(to top, var(--you) calc(var(--f) * 100%), #fff calc(var(--f) * 100%));
}
.pips i.bonus {
  border-color: var(--hot);
}
.pips.shake {
  animation: shake 0.3s;
}
@keyframes shake {
  25% {
    transform: translateX(-4px);
  }
  75% {
    transform: translateX(4px);
  }
}
.mana .bar {
  flex: 1;
  height: 14px;
  border-radius: 7px;
  border: 2px solid var(--ink);
  background: #fff;
  overflow: hidden;
}
.mana .bar i {
  display: block;
  height: 100%;
  background: repeating-linear-gradient(90deg, #6c4bd8 0 calc(10% - 2px), #4a2fb0 calc(10% - 2px) 10%);
  background-size: 100% 100%;
}
.mana b {
  font: 900 18px var(--head);
  min-width: 22px;
  text-align: right;
  color: #5b3cc4;
}
.hand {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  touch-action: none;
}
.card {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 2px;
  min-height: 104px;
  padding: 12px 4px 8px;
  border-radius: 14px;
  border: 3px solid var(--ink);
  background: linear-gradient(var(--tint) 0 60%, var(--card) 60%);
  box-shadow: 0 4px 0 var(--ink);
  cursor: grab;
  touch-action: none;
  line-height: 1.05;
  overflow: visible;
}
.card b {
  font: 900 13px/1.05 var(--head);
  text-align: center;
}
.card:not(.ready) {
  filter: grayscale(0.85);
  opacity: 0.7;
}
.card .charge {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 4px;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, #6c4bd8 calc(var(--charge, 0) * 100%), transparent calc(var(--charge, 0) * 100%));
}
.card.ready .charge {
  display: none;
}
.card.armed {
  outline: 4px solid var(--you);
  outline-offset: 2px;
  transform: translateY(-6px);
}
.card .key {
  position: absolute;
  top: 4px;
  right: 7px;
  font-size: 11px;
  font-weight: 700;
  color: var(--soft);
  display: none;
}
@media (hover: hover) and (pointer: fine) {
  .card .key {
    display: block;
  }
  .card.ready:hover {
    transform: translateY(-3px);
  }
}
.ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 60;
  width: 88px;
  min-height: 96px;
  pointer-events: none;
  opacity: 0.92;
  transition: width 0.1s, min-height 0.1s, opacity 0.1s;
}
.ghost.small {
  width: 58px;
  min-height: 60px;
  opacity: 0.6;
}
.ghost.small b {
  display: none;
}

/* ---------- results (inside the shell modal) ---------- */
.result h2 {
  font: 900 34px var(--head);
  margin-bottom: 2px;
}
.result.win h2 {
  color: var(--you);
}
.result.loss h2 {
  color: var(--margin);
}
.standings {
  list-style: none;
  padding: 0;
  margin: 8px 0 12px;
  display: grid;
  gap: 4px;
}
.standings li {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--paper);
  border-radius: 10px;
  padding: 6px 10px;
}
.standings li span {
  margin-left: auto;
  font-weight: 700;
}
.res-sub {
  margin: 8px 0 6px !important;
}
.pack {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 10px 0 6px;
}
@media (prefers-reduced-motion: no-preference) {
  .pack .mini {
    animation: flip-in 0.45s ease-out backwards;
  }
  .pack .mini:nth-child(2) {
    animation-delay: 0.15s;
  }
  .pack .mini:nth-child(3) {
    animation-delay: 0.3s;
  }
}
@keyframes flip-in {
  from {
    transform: rotateY(90deg) scale(0.8);
    opacity: 0;
  }
}
.rankup {
  background: #fff4cf;
  border: 2px dashed var(--hot);
  border-radius: 10px;
  padding: 8px 10px;
}

/* ---------- wide screens: board left, dock right ---------- */
@media (min-width: 820px) and (min-aspect-ratio: 5/4) {
  .match {
    grid-template-columns: 1fr 320px;
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas: "hud hud" "stage dock";
    column-gap: 16px;
    padding: calc(var(--top) + 12px) 20px 20px;
    max-width: 1280px;
    margin: 0 auto;
  }
  .hud {
    grid-area: hud;
  }
  .stage {
    grid-area: stage;
  }
  .dock {
    grid-area: dock;
    grid-template-rows: minmax(0, 1fr) auto auto;
    gap: 14px;
    min-height: 0;
  }
  .meters {
    grid-template-columns: 1fr;
  }
  .tips {
    display: block;
    align-self: start;
    background: var(--card);
    border: 2px solid var(--ink);
    border-radius: 14px;
    padding: 12px 14px;
    font-size: 14px;
    max-height: 100%;
    overflow-y: auto;
  }
  .tips h3 {
    font: 900 18px var(--head);
    margin: 0 0 6px;
  }
  .tips ul {
    list-style: none;
    margin: 0 0 8px;
    padding: 0;
    display: grid;
    gap: 4px;
  }
  .tips svg {
    vertical-align: -3px;
  }
  .tips i {
    color: var(--soft);
  }
  .tips p {
    margin: 6px 0 0;
    color: var(--soft);
  }
  kbd {
    font: 700 12px var(--body);
    border: 1.5px solid var(--ink);
    border-bottom-width: 3px;
    border-radius: 5px;
    padding: 0 5px;
    background: #fff;
    color: var(--ink);
  }
  .hand {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .card {
    min-height: 130px;
  }
  .card b {
    font-size: 15px;
  }
}
@media (max-height: 700px) and (max-width: 819px) {
  .card {
    min-height: 88px;
  }
  .card svg {
    width: 32px;
    height: 32px;
  }
}
/* ---------- landscape phones: board left, a compact dock right ---------- */
@media (max-height: 560px) and (min-aspect-ratio: 5/4) {
  .title {
    gap: 6px;
  }
  .title-art svg {
    width: 150px;
  }
  .title h1 {
    font-size: 48px;
  }
  .tagline {
    margin-bottom: 4px;
  }
  .rung-line {
    min-height: 0;
    margin: 2px 0;
  }
  .match {
    grid-template-columns: 1fr clamp(200px, 30vw, 280px);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas: "hud hud" "stage dock";
    column-gap: 12px;
    row-gap: 4px;
    padding: calc(var(--top) + 6px) calc(env(safe-area-inset-right, 0px) + 10px) calc(var(--bottom) + 8px) calc(env(safe-area-inset-left, 0px) + 10px);
  }
  .hud {
    grid-area: hud;
    min-height: 48px;
  }
  .stage {
    grid-area: stage;
  }
  .dock {
    grid-area: dock;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
  }
  .tips {
    display: none;
  }
  .meters {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .hand {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: minmax(0, 1fr);
    min-height: 0;
    padding-top: 8px;
  }
  .card {
    min-height: 0;
    padding: 8px 4px 6px;
  }
  .card svg {
    width: 30px;
    height: 30px;
  }
}
@media (max-height: 440px) and (min-aspect-ratio: 5/4) {
  .title-art {
    display: none;
  }
  .title h1 {
    margin-top: auto;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
