:root {
  --s: #f8cef1;
  --r: #d9532f;
  --n: #3f29c6;
  --v: #7135be;
  --t: #4fee6e;
  --a: #ffb703;
  --warn: #ff4136;
  --void: #06070c;
  --panel: #101427;
  --panel2: #0b0e1a;
  --line: #222944;
  --ink: #e9ecf6;
  --dim: #7c86a6;
  --cy: #22e0ff;
  --mg: #ff2d95;
  --li: #c9f31d;
  --display: "Arial Black", "Arial Bold", Impact, Haettenschweiler, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --gap: 5px;
  /* phone first: the board takes the screen's width (less the page and panel padding), unless
     the height runs out first — that term leaves room for the HUD, the target row and the field. */
  --board: clamp(220px, min(100vw - 52px, 100vh - 280px), 460px);
  --cell: calc((var(--board) - 4 * var(--gap)) / 5);
  --pad-t: max(10px, env(safe-area-inset-top));
  --pad-r: max(12px, env(safe-area-inset-right));
  --pad-b: max(10px, env(safe-area-inset-bottom));
  --pad-l: max(12px, env(safe-area-inset-left))
}

/* 100vh on a phone includes the URL bar; dvh is the part you can actually see */
@supports (height: 100dvh) {
  :root {
    --board: clamp(220px, min(100vw - 52px, 100dvh - 280px), 460px)
  }
}

* {
  box-sizing: border-box
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%
}

html,
body {
  margin: 0;
  min-height: 100%
}

body {
  background: radial-gradient(95% 60% at 50% 0%, #161c33 0%, var(--void) 62%), var(--void);
  color: var(--ink);
  font-family: var(--mono);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overscroll-behavior: none
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  background: repeating-linear-gradient(180deg, rgba(255, 255, 255, .026) 0 1px, transparent 1px 3px)
}

/* phone: one screen, no page scroll — the field of rivals scrolls inside its own box */
.arena {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: var(--pad-t) var(--pad-r) var(--pad-b) var(--pad-l)
}

/* HUD */
.hud {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  flex: none
}

h1 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 11px;
  flex: none
}

h1 .mark {
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 7px;
  filter: drop-shadow(0 0 14px rgba(34, 224, 255, .18))
}

/* the wordmark only once there is room for it beside the numbers */
h1 .word {
  display: none;
  font-family: var(--display);
  font-style: italic;
  text-transform: uppercase;
  font-size: 22px;
  line-height: .9;
  letter-spacing: -.02em;
  background: linear-gradient(96deg, var(--cy), var(--mg) 62%, var(--li));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent
}

h1 small {
  display: block;
  font-size: .28em;
  font-style: normal;
  letter-spacing: .34em;
  color: var(--dim);
  -webkit-text-fill-color: var(--dim)
}

.hud-right {
  flex: 1;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-end;
  min-width: 0
}

.m {
  text-align: right;
  min-width: 0
}

.m b {
  display: block;
  font-variant-numeric: tabular-nums;
  font-size: 16px;
  white-space: nowrap
}

.m b.huge {
  font-family: var(--display);
  font-style: italic;
  font-size: 28px;
  color: var(--li);
  line-height: 1
}

.m span {
  display: block;
  font-size: 9px;
  letter-spacing: .16em;
  color: var(--dim);
  text-transform: uppercase;
  white-space: nowrap
}

.hud-right .m:first-child {
  text-align: left
}

.cullbar {
  flex: none;
  width: 100%;
  height: 3px;
  background: #1b2138;
  overflow: hidden;
  border-radius: 99px;
  margin-bottom: 10px
}

.cullbar i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--cy), var(--mg));
  will-change: width
}

/* stage */
.stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px
}

.core {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center
}

/* rivals: one grid, every card from both flanks */
.field {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 6px;
  align-content: start;
  padding-bottom: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent
}

.field .flank {
  display: contents
}

.fieldhead {
  grid-column: 1 / -1;
  margin: 0;
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 2px 0 4px;
  background: var(--void);
  font-size: 9px;
  letter-spacing: .2em;
  color: var(--dim);
  text-transform: uppercase
}

/* nothing to show before the first snapshot */
.field:not(:has(.rv)) .fieldhead {
  visibility: hidden
}

/* own board */
.panel {
  background: linear-gradient(170deg, var(--panel), var(--panel2));
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px 12px;
  position: relative;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .6), 0 18px 44px rgba(0, 0, 0, .55)
}

.panel::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--cy);
  box-shadow: 0 0 14px var(--cy)
}

.mine {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center
}

/* phone: the target, your numbers and your tag in one row above the board */
.side {
  width: 100%;
  max-width: var(--board);
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: end;
  gap: 14px
}

.side h3 {
  margin: 0 0 5px;
  font-size: 9px;
  letter-spacing: .2em;
  color: var(--dim);
  text-transform: uppercase;
  white-space: nowrap
}

.pat {
  width: 66px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px
}

.pat i {
  aspect-ratio: 1;
  border-radius: 3px;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .3)
}

.mystats {
  display: flex;
  flex-direction: column;
  gap: 6px
}

.mystats .m {
  text-align: left
}

.mystats .m b {
  font-size: 18px;
  line-height: 1.1
}

.you {
  margin: 0;
  font-size: 10px;
  line-height: 1.5;
  color: var(--dim);
  letter-spacing: .04em;
  text-align: right;
  min-width: 0;
  overflow-wrap: anywhere
}

.you b {
  color: var(--ink)
}

.hint {
  display: block;
  margin-top: 4px
}

/* the hint matches the input you have */
.hint.keys {
  display: none
}

@media (hover: hover) and (pointer: fine) {
  .hint.keys {
    display: block
  }

  .hint.touch {
    display: none
  }
}

.boardwrap {
  width: var(--board)
}

.board {
  position: relative;
  width: var(--board);
  height: var(--board);
  /* swipes belong to the board, not to page scroll or pinch-zoom */
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none
}

.well {
  position: absolute;
  inset: calc(var(--cell) + var(--gap) - 3px);
  z-index: 3;
  pointer-events: none;
  border: 2px solid rgba(233, 236, 246, .9);
  border-radius: 6px;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, .35)
}

.tile {
  position: absolute;
  width: var(--cell);
  height: var(--cell);
  border-radius: 6px;
  border: 0;
  padding: 0;
  cursor: pointer;
  transition: transform .11s cubic-bezier(.3, .7, .3, 1);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .32), 0 2px 3px rgba(0, 0, 0, .4)
}

.tile:active {
  filter: brightness(1.2)
}

@media (hover: hover) {
  .tile:not(:disabled):hover {
    filter: brightness(1.16)
  }
}

/* matched: this tile sits on its target cell. A lime ring with a light sweep across it, and a dark
   band just inside so the ring reads against any tile colour (the board gap does that outside). */
.tile.ok::before {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 4px;
  pointer-events: none;
  border: 2px solid rgba(4, 5, 10, .6)
}

.tile.ok::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  border: 3px solid transparent;
  background:
    linear-gradient(115deg, var(--li) 0%, var(--li) 38%, #fff 50%, var(--li) 62%, var(--li) 100%) border-box;
  background-size: 300% 100%;
  -webkit-mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) padding-box exclude, linear-gradient(#000 0 0);
  filter: drop-shadow(0 0 4px rgba(201, 243, 29, .75));
  /* one delay for both, set per tile by markMatched() so every ring breathes in step */
  animation: okshine 2.4s linear infinite, okbreathe 1.6s ease-in-out infinite alternate;
  animation-delay: inherit
}

@keyframes okshine {
  from { background-position: 100% 0 }
  to { background-position: -50% 0 }
}

/* 1.6 s in, 1.6 s out: a slow resting breath, not a heartbeat */
@keyframes okbreathe {
  from { opacity: .55; filter: drop-shadow(0 0 1px rgba(201, 243, 29, .3)) }
  to { opacity: 1; filter: drop-shadow(0 0 9px rgba(201, 243, 29, .95)) }
}

.tile:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
  z-index: 4
}

.gapcell {
  position: absolute;
  width: var(--cell);
  height: var(--cell);
  border-radius: 6px;
  background: #04050a;
  box-shadow: inset 0 3px 9px rgba(0, 0, 0, .95);
  transition: transform .11s
}

.mygauge {
  height: 5px;
  background: #1b2138;
  border-radius: 99px;
  overflow: hidden;
  transform: skewX(-24deg);
  margin-top: 10px
}

.mygauge i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--cy);
  box-shadow: 0 0 10px var(--cy);
  transition: width .15s
}

/* rivals */
.rv {
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 3px;
  background: #0a0d18;
  min-width: 0
}

.rv.dead {
  opacity: .22;
  filter: grayscale(1)
}

.rv.hot {
  border-color: var(--li);
  box-shadow: 0 0 10px rgba(201, 243, 29, .25)
}

.rv .mini {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1px
}

.rv .mini i {
  aspect-ratio: 1;
  border-radius: 1px;
  background: #04050a
}

.rv .mini i.c {
  outline: 1px solid rgba(233, 236, 246, .45);
  outline-offset: -1px
}

.rv .lb {
  display: flex;
  justify-content: space-between;
  gap: 2px;
  font-size: 8px;
  letter-spacing: .02em;
  color: var(--dim);
  margin-top: 2px;
  white-space: nowrap
}

.rv .lb b {
  color: var(--ink);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0
}

/* overlays — a scrolling column, centred while it fits and top-aligned once it doesn't */
.veil {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  overflow-y: auto;
  /* without this, overflow-y makes x auto too, and the countdown's zoom-in (scale 1.6) flashes a
     sideways scrollbar */
  overflow-x: hidden;
  overscroll-behavior: contain;
  text-align: center;
  background: rgba(3, 4, 8, .92);
  backdrop-filter: blur(4px);
  padding: max(24px, env(safe-area-inset-top)) var(--pad-r) max(24px, env(safe-area-inset-bottom)) var(--pad-l)
}

.veil::before,
.veil::after {
  content: "";
  flex: 1 0 0
}

.veil>* {
  flex: none;
  width: 100%;
  max-width: 400px
}

.veil.off {
  display: none
}

.veil .big {
  font-family: var(--display);
  font-style: italic;
  text-transform: uppercase;
  line-height: .9;
  font-size: clamp(44px, 15vw, 120px);
  letter-spacing: -.03em;
  overflow-wrap: anywhere;
  background: linear-gradient(96deg, var(--cy), var(--mg));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  max-width: none
}

.veil .sub {
  font-size: 11px;
  letter-spacing: .22em;
  line-height: 1.6;
  color: var(--dim);
  text-transform: uppercase
}

.vlogo {
  display: none;
  width: min(300px, 72vw);
  height: auto;
  margin: 0 auto;
  filter: drop-shadow(0 0 26px rgba(34, 224, 255, .2))
}

.vlogo.on {
  display: block
}

.veil .big:empty {
  display: none
}

/* 16px: anything smaller and iOS zooms the page when the field takes focus */
.veil input {
  font-family: var(--mono);
  font-size: 16px;
  letter-spacing: .16em;
  text-transform: uppercase;
  text-align: center;
  background: #0d1120;
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 14px 12px;
  border-radius: 6px;
  margin: 0 auto
}

.veil input:focus {
  outline: none;
  border-color: var(--cy);
  box-shadow: 0 0 0 1px rgba(34, 224, 255, .35)
}

/* rejected tag: the field goes red and shakes once, and a bubble says why */
.veil input.bad {
  border-color: var(--warn);
  color: var(--warn);
  box-shadow: 0 0 0 1px var(--warn), 0 0 18px rgba(255, 65, 54, .3);
  animation: shake .38s cubic-bezier(.36, .07, .19, .97)
}

@keyframes shake {
  10%, 90% { transform: translateX(-2px) }
  20%, 80% { transform: translateX(3px) }
  30%, 50%, 70% { transform: translateX(-6px) }
  40%, 60% { transform: translateX(6px) }
  100% { transform: translateX(0) }
}

/* display:none while idle so it reserves no room in the veil's column */
.tagerr {
  display: none;
  position: relative;
  margin: -4px auto 0;
  padding: 9px 12px;
  border: 1px solid var(--warn);
  border-radius: 4px;
  background: #170c11;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: .03em;
  text-transform: none;
  text-align: center
}

.tagerr.on {
  display: block;
  animation: pop .18s ease-out
}

/* a small notch pointing back up at the field it is complaining about */
.tagerr::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 50%;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  transform: rotate(45deg);
  background: #170c11;
  border-left: 1px solid var(--warn);
  border-top: 1px solid var(--warn)
}

@keyframes pop {
  from { opacity: 0; transform: translateY(-5px) scale(.96) }
  to { opacity: 1; transform: translateY(0) scale(1) }
}

@media (prefers-reduced-motion: reduce) {
  .veil input.bad { animation: none }
  .tagerr.on { animation: none }
  .tile.ok::after { animation: none }
}

.btns {
  display: flex;
  gap: 10px;
  justify-content: center
}

.btns:empty {
  display: none
}

/* thumb-sized: buttons in a row share it */
.btns button.act {
  flex: 1 1 0
}

button.act {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: .2em;
  text-transform: uppercase;
  background: linear-gradient(96deg, var(--cy), #7de3ff);
  color: #04121a;
  border: 0;
  min-height: 50px;
  padding: 14px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 800
}

button.act:active {
  transform: translateY(1px);
  filter: brightness(.95)
}

button.act.ghost {
  background: none;
  border: 1px solid var(--line);
  color: var(--dim);
  font-weight: 600
}

.modes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px
}

.modes button {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  background: #0d1120;
  border: 1px solid var(--line);
  color: var(--dim);
  min-height: 64px;
  padding: 10px 6px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700
}

.modes button.on {
  border-color: var(--cy);
  color: var(--cy);
  box-shadow: 0 0 0 1px rgba(34, 224, 255, .35), 0 0 16px rgba(34, 224, 255, .16)
}

.modes button small {
  display: block;
  font-size: 10px;
  line-height: 1.35;
  letter-spacing: .02em;
  font-weight: 400;
  text-transform: none;
  color: var(--dim);
  margin-top: 4px
}

.modes button.on small {
  color: var(--ink)
}

@media (hover: hover) {

  button.act.ghost:hover,
  .modes button:hover {
    border-color: #3b466e;
    color: var(--ink)
  }

  .modes button.on:hover {
    border-color: var(--cy);
    color: var(--cy)
  }
}

body.nocull .cullbar {
  visibility: hidden
}

.veil .big.count {
  animation: zoom .5s ease-out
}

@keyframes zoom {
  from {
    transform: scale(1.6);
    opacity: 0
  }

  to {
    transform: none;
    opacity: 1
  }
}

ol.rank {
  list-style: none;
  padding: 0;
  margin: 4px auto 0;
  font-size: 13px;
  text-align: left
}

ol.rank:empty {
  display: none
}

ol.rank li {
  display: flex;
  gap: 10px;
  padding: 4px 0;
  color: var(--dim);
  border-bottom: 1px solid rgba(34, 41, 68, .5)
}

ol.rank li b {
  font-family: var(--display);
  font-style: italic;
  color: var(--cy);
  min-width: 34px
}

ol.rank li span {
  margin-left: auto;
  white-space: nowrap
}

/* phone: the three boards stacked, one under the other */
.hs {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  text-align: left
}

.hs:empty {
  display: none
}

.hs section {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: #0a0d18
}

.hs h4 {
  margin: 0 0 7px;
  font-size: 10px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--dim)
}

.hs ol {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 12px
}

.hs li {
  display: flex;
  gap: 8px;
  padding: 3px 0;
  color: var(--dim)
}

.hs li b {
  color: var(--ink);
  font-weight: 600;
  min-width: 18px
}

.hs li em {
  font-style: normal;
  color: var(--ink);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap
}

.hs li span {
  font-variant-numeric: tabular-nums;
  white-space: nowrap
}

.hs li.self em,
.hs li.self span {
  color: var(--li)
}

.hs .empty {
  font-size: 11px;
  color: var(--dim);
  letter-spacing: .08em
}

.mycard {
  font-size: 12px;
  line-height: 1.6;
  letter-spacing: .08em;
  color: var(--dim)
}

.mycard:empty {
  display: none
}

/* no tag, no card: say why rather than show nothing */
.nohs {
  color: var(--a);
  letter-spacing: .06em
}

.mycard b {
  color: var(--li);
  font-variant-numeric: tabular-nums
}

.toast {
  position: fixed;
  left: 50%;
  top: max(14px, env(safe-area-inset-top));
  transform: translateX(-50%);
  z-index: 65;
  font-family: var(--display);
  font-style: italic;
  text-transform: uppercase;
  font-size: clamp(18px, 5vw, 26px);
  white-space: nowrap;
  color: var(--mg);
  text-shadow: 0 0 20px rgba(255, 45, 149, .5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s
}

.toast.on {
  opacity: 1
}

.ko {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-content: center;
  padding: 16px;
  border-radius: 6px;
  background: rgba(4, 5, 10, .82);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s
}

.ko.on {
  opacity: 1;
  pointer-events: auto
}

.ko b {
  font-family: var(--display);
  font-style: italic;
  font-size: clamp(40px, 12vw, 64px);
  text-align: center;
  color: var(--mg);
  transform: rotate(-7deg)
}

.ko small {
  display: block;
  text-align: center;
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: .18em;
  color: var(--dim);
  margin-top: 8px
}

.ko .kocard {
  min-height: 15px;
  margin-top: 12px;
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
  letter-spacing: .08em;
  color: var(--dim)
}

.ko .kocard b {
  font-family: var(--mono);
  font-style: normal;
  font-size: 12px;
  color: var(--ink);
  transform: none
}

.ko .kocard .wait {
  opacity: .5
}

.ko .act {
  margin: 18px auto 0;
  justify-self: center;
  padding: 14px 28px;
  letter-spacing: .22em;
  font-weight: 800;
  font-size: 13px;
  border: 0;
  color: #1b0311;
  background: linear-gradient(96deg, var(--mg), #ff8ccb);
  box-shadow: 0 0 0 1px rgba(255, 45, 149, .55), 0 6px 26px rgba(255, 45, 149, .4);
  animation: koglow 1.7s ease-in-out infinite
}

.ko .act:hover {
  filter: brightness(1.12) saturate(1.05)
}

@keyframes koglow {

  0%,
  100% {
    box-shadow: 0 0 0 1px rgba(255, 45, 149, .55), 0 6px 24px rgba(255, 45, 149, .32)
  }

  50% {
    box-shadow: 0 0 0 2px rgba(255, 45, 149, .85), 0 10px 44px rgba(255, 45, 149, .7)
  }
}

/* ---------------- wider phones and tablets in portrait ---------------- */
@media (min-width: 560px) {
  h1 .word {
    display: block
  }

  .hud-right {
    justify-content: flex-end;
    gap: 18px
  }

  .field {
    grid-template-columns: repeat(auto-fill, minmax(52px, 1fr))
  }

  .hs {
    max-width: 680px;
    grid-template-columns: repeat(3, 1fr)
  }
}

/* ---------------- phones on their side: board on the left, field on the right ---------------- */
@media (orientation: landscape) and (max-height: 560px) {
  :root {
    --board: clamp(180px, 100vh - 112px, 400px)
  }

  @supports (height: 100dvh) {
    :root {
      --board: clamp(180px, 100dvh - 112px, 400px)
    }
  }

  .hud {
    margin-bottom: 6px
  }

  h1 .word {
    display: none
  }

  .stage {
    flex-direction: row;
    gap: 12px
  }

  .core {
    justify-content: flex-start
  }

  .mine {
    flex-direction: row;
    align-items: flex-start;
    gap: 12px
  }

  .side {
    width: 92px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px
  }

  .pat {
    width: 100%
  }

  .you {
    text-align: left
  }

  /* no height to spare for it here */
  .hint.touch,
  .hint.keys {
    display: none
  }

  .mygauge {
    margin-top: 8px
  }
}

/* ---------------- desktop: rivals flank the board, the page scrolls ---------------- */
@media (min-width: 900px) and (min-height: 561px) {
  :root {
    --board: 310px
  }

  body {
    padding: 14px 12px 40px
  }

  .arena {
    height: auto;
    display: block;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0
  }

  .hud {
    gap: 16px;
    margin-bottom: 14px
  }

  h1 .mark {
    width: 52px;
    height: 52px;
    border-radius: 9px
  }

  h1 .word {
    font-size: 38px
  }

  .hud-right {
    gap: 16px
  }

  .m b {
    font-size: 21px
  }

  .m b.huge {
    font-size: 38px
  }

  .hud-right .m:first-child {
    text-align: right
  }

  .cullbar {
    margin-bottom: 14px
  }

  .stage {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    grid-template-areas: "left core right";
    gap: 14px;
    align-items: start
  }

  .core {
    grid-area: core;
    align-items: center
  }

  .field {
    display: contents
  }

  .fieldhead {
    display: none
  }

  .field .flank {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
    gap: 6px;
    align-content: start
  }

  #left {
    grid-area: left
  }

  #right {
    grid-area: right
  }

  .rv .lb {
    font-size: 7px
  }

  .panel {
    padding: 12px
  }

  .mine {
    flex-direction: row;
    align-items: flex-start;
    gap: 14px
  }

  .side {
    width: 98px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px
  }

  .pat {
    width: 100%
  }

  .you {
    text-align: left;
    font-size: 9px;
    line-height: 1.6;
    letter-spacing: .06em
  }

  .veil>* {
    max-width: 440px
  }

  .hs {
    max-width: 680px
  }
}

@media (prefers-reduced-motion:reduce) {
  * {
    animation: none !important;
    transition: none !important
  }
}

/* cull warning — boards on the chopping block, last 30% of timer */
@keyframes doomrv {

  0%,
  100% {
    border-color: rgba(226, 35, 26, .7);
    box-shadow: 0 0 0 1px rgba(226, 35, 26, .3), 0 0 9px rgba(226, 35, 26, .35)
  }

  50% {
    border-color: #ff4136;
    box-shadow: 0 0 0 1px rgba(226, 35, 26, .75), 0 0 20px rgba(226, 35, 26, .8)
  }
}

@keyframes doompanel {

  0%,
  100% {
    border-color: rgba(226, 35, 26, .75);
    box-shadow: 0 0 0 1px rgba(226, 35, 26, .35), 0 18px 44px rgba(0, 0, 0, .55), 0 0 24px rgba(226, 35, 26, .3)
  }

  50% {
    border-color: #ff4136;
    box-shadow: 0 0 0 2px rgba(226, 35, 26, .85), 0 18px 44px rgba(0, 0, 0, .55), 0 0 46px rgba(226, 35, 26, .75)
  }
}

body.cullnear .rv.doom {
  animation: doomrv .72s ease-in-out infinite
}

body.cullnear .panel.doom {
  animation: doompanel .72s ease-in-out infinite
}

body.cullnear .panel.doom::before {
  background: var(--warn);
  box-shadow: 0 0 14px var(--warn)
}

@media (prefers-reduced-motion:reduce) {
  body.cullnear .rv.doom {
    border-color: #ff4136;
    box-shadow: 0 0 12px rgba(226, 35, 26, .6)
  }

  body.cullnear .panel.doom {
    border-color: #ff4136;
    box-shadow: 0 0 28px rgba(226, 35, 26, .55)
  }
}

/* ---------------- tutorial: first visit, and "How to play" on the menu ---------------- */
.veil>.howto {
  width: auto;
  margin: -4px auto 0;
  padding: 6px 10px;
  background: none;
  border: 0;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .2em;
  text-transform: uppercase;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer
}

@media (hover: hover) {
  .veil>.howto:hover {
    color: var(--ink)
  }
}

/* menu footer; the same page is the privacy policy URL on the Play listing */
.veil>.legal {
  margin: 4px auto 0;
  padding: 6px 10px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .2em;
  text-transform: uppercase;
  text-underline-offset: 4px
}

/* above the menu it opens over, and opaque so the menu does not read through; its board sizes
   from the cell, not from --board */
.tut {
  z-index: 75;
  gap: 16px;
  background: radial-gradient(95% 60% at 50% 0%, #161c33 0%, var(--void) 62%), var(--void);
  --cell: clamp(44px, min((100vw - 60px) / 4, (100vh - 340px) / 3), 72px)
}

.tutstep {
  font-size: 11px;
  letter-spacing: .3em;
  color: var(--dim)
}

.tuttitle {
  margin: -6px 0 0;
  font-family: var(--display);
  font-style: italic;
  font-weight: 400;
  text-transform: uppercase;
  line-height: .95;
  font-size: clamp(34px, 11vw, 56px);
  letter-spacing: -.03em;
  background: linear-gradient(96deg, var(--cy), var(--mg));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent
}

.tuttext {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  letter-spacing: .02em
}

.tip {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: var(--dim)
}

.tip.keys {
  display: none
}

@media (hover: hover) and (pointer: fine) {
  .tip.keys {
    display: block
  }

  .tip.touch {
    display: none
  }
}

.tutplay {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px
}

.tutside {
  display: flex;
  align-items: flex-end;
  gap: 18px
}

.tutside h3 {
  margin: 0 0 5px;
  font-size: 9px;
  letter-spacing: .2em;
  color: var(--dim);
  text-transform: uppercase;
  white-space: nowrap
}

.tut .pat {
  width: auto;
  display: inline-grid
}

.tutside .m {
  text-align: left
}

.tutside .m b {
  font-size: 18px;
  line-height: 1.1
}

/* app.js writes width, height and the outline's box in cells, and moves tiles from the corner —
   pinned there, or the veil's centred text drags their static position to the middle */
.tutboard .well {
  inset: auto
}

.tutboard .tile,
.tutboard .gapcell {
  left: 0;
  top: 0
}

/* phones on their side: the words and buttons on the left, the board on the right */
@media (orientation: landscape) and (max-height: 560px) {
  .tut {
    display: grid;
    grid-template-columns: minmax(0, 380px) auto;
    grid-template-areas: "step play" "title play" "text play" "btns play";
    align-content: center;
    justify-content: center;
    column-gap: 32px;
    row-gap: 10px;
    --cell: clamp(36px, (100vh - 150px) / 3, 72px)
  }

  .tut::before,
  .tut::after {
    display: none
  }

  .tutstep { grid-area: step }
  .tuttitle { grid-area: title; margin: 0 }
  .tuttext { grid-area: text }
  .tut .btns { grid-area: btns }

  .tut .tutplay {
    grid-area: play;
    align-self: center;
    width: auto;
    max-width: none
  }
}
