:root {
  --serif: "DM Serif Text","Iowan Old Style",Georgia,"Times New Roman",serif;
  --sans: "Inter",system-ui,-apple-system,"Segoe UI",sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-padding: 12px;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font: 400 16px/1.5 var(--sans);
  min-height: 100vh;
}

button,input,select {
  font: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

button:disabled {
  cursor: default;
  opacity: .48;
}

button,a,input,select,summary {
  outline-offset: 3px;
}

button:focus-visible,a:focus-visible,summary:focus-visible,:is(input,select):focus-visible {
  outline: 3px solid #ce8634;
}

a {
  color: var(--brand);
}

[hidden] {
  display: none!important;
}

.skip {
  position: absolute;
  left: -500px;
}

.skip:focus {
  left: 10px;
  top: 5px;
  z-index: 20;
  background: var(--surface);
  padding: 8px;
}

.wrap {
  width: min(1180px,100% - 56px);
  margin-inline: auto;
}

.mast {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.mast nav {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font: 700 28px/1 var(--serif);
  text-decoration: none;
  letter-spacing: -1.4px;
  color: var(--text);
}

.brandmark {
  display: grid;
  place-items: center;
  width: 35px;
  height: 36px;
  border: 2px solid #d0b077;
  outline: 2px solid #234a3e;
  outline-offset: 0;
  background: #234a3e;
  color: #eed294;
  font-size: 25px;
  border-radius: 7px;
  transform: rotate(-6deg);
  box-shadow: 2px 2px 0 #6c7b66;
}

.navtools,.actions,.boardtools,.racktop>div {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ico {
  width: 20px;
  height: 20px;
  flex: none;
  vertical-align: middle;
}

.plain,.iconbtn,.primary,.secondary,.brass,.tertiary,.hero-alt,.herolink,.tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 9px 15px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 650;
  font-size: .93rem;
  line-height: 1.3;
}

.plain,.iconbtn,.tertiary,.tab {
  background: transparent;
  color: var(--brand);
}

.plain>span:first-child {
  border: 1.6px solid currentColor;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-weight: 700;
  font-size: 12px;
}

.iconbtn {
  min-width: 44px;
  padding: 8px;
  font-size: 23px;
}

.tertiary {
  padding: 8px 10px;
}

.primary {
  background: var(--brand);
  color: var(--brandwhite);
  border-color: var(--brand);
  box-shadow: 0 2px 0 #0002;
}

.secondary {
  background: var(--surface);
  border-color: var(--line);
  color: var(--text);
}

.brass {
  background: #f1d59d;
  color: #233e32;
  border-color: #f1d59d;
  box-shadow: 0 3px 0 #bba16c;
}

.hero-alt {
  background: #ffffff0a;
  border-color: #a9bcb16b;
  color: #fff8df;
}

.herolink {
  background: transparent;
  color: #dfebde;
  padding-inline: 0;
  font-weight: 550;
  margin-top: 12px;
}

.herolink .ico {
  color: #dcc390;
}

.primary:hover:enabled,.brass:hover:enabled {
  filter: brightness(1.08);
}

.secondary:hover:enabled,.iconbtn:hover:enabled,.plain:hover:enabled,.tertiary:hover:enabled,.tab:hover:enabled {
  background: var(--pale);
}

.hero-alt:hover,.herolink:hover {
  color: white;
  background: #ffffff14;
}

.wide {
  width: 100%;
}

.muted,.optional {
  color: var(--sub);
}

.optional {
  font-weight: 400;
  font-size: .87rem;
}

h1,h2,h3,p {
  margin: 0;
}

h1,h2,h3 {
  font-family: var(--serif);
  line-height: 1.13;
}

h1 {
  font-size: clamp(2.1rem,4.2vw,3.9rem);
  letter-spacing: -.052em;
}

h2 {
  font-size: 1.64rem;
  letter-spacing: -.04em;
}

h3 {
  font-size: 1.26rem;
  margin: 16px 0 6px;
}

.eyebrow {
  font-size: .76rem;
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: .11em;
  font-weight: 750;
  color: var(--sub);
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.eyebrow b {
  font-size: 1em;
  opacity: .6;
}

.eyebrow .ico {
  width: 17px;
  height: 17px;
}

.gold {
  color: #e7ca8d;
}

main {
  padding: 30px 0 48px;
  outline: none;
}

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid #203e2d;
  background: radial-gradient(ellipse at 68% 0%,#365e4c 0,transparent 58%),linear-gradient(110deg,#1e4237,#173a31 60%,#345441);
  color: #f7f3da;
  box-shadow: 0 6px 22px #1a352015;
  min-height: 360px;
  display: flex;
  align-items: center;
}

.hero:after,.invite:after {
  content: "";
  position: absolute;
  inset: 9px;
  border: 1px solid #d3c18e41;
  border-radius: 13px;
  pointer-events: none;
  z-index: -1;
}

.hero:before,.invite:before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(38deg,#ffffff04 0 1px,transparent 1px 4px);
  pointer-events: none;
  z-index: -1;
}

.hero-copy {
  position: relative;
  z-index: 2;
  padding: clamp(28px,4.7vw,65px);
  width: 57%;
}

.hero h1 {
  font-size: clamp(4.1rem,7.3vw,6.9rem);
  line-height: 1;
  letter-spacing: -.075em;
  font-weight: 500;
  margin: 14px 0;
}

.hero h1 em {
  color: #f2d69a;
  font-weight: 500;
}

.hero-star {
  font: 400 .3em/1 var(--serif);
  vertical-align: top;
  color: #d8be80;
  margin-left: 10px;
  position: relative;
  top: 4px;
}

.hero p {
  color: #e1e8d9;
  font-size: 1.06rem;
  max-width: 35ch;
  line-height: 1.55;
  margin-bottom: 19px;
}

.hero .actions>button {
  padding: 12px 18px;
}

.hero-art {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 46%;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}

.artframe {
  position: absolute;
  left: 9%;
  top: -5%;
  width: min(41vw,460px);
  aspect-ratio: 1;
  transform: rotate(-10deg) skew(-1deg,-2deg);
  border: 7px solid #a78c61;
  border-radius: 7px;
  background: #b2a582;
  padding: 9px;
  box-shadow: 0 6px 0 #6f583f,0 22px 24px #071b1990;
}

.artgrid {
  height: 100%;
  display: grid;
  grid-template-columns: repeat(8,1fr);
  grid-template-rows: repeat(8,1fr);
  gap: 2px;
  background: #a1b09b;
  border: 2px solid #899d84;
}

.artgrid i {
  display: grid;
  place-items: center;
  position: relative;
  font-style: normal;
  border-radius: 1px;
}

.artcell {
  background: #d2d9c4;
  color: #3f534644;
  font: 700 clamp(7px,.85vw,12px) var(--sans);
}

.arttile,.loose,.racktile,.sq.tile {
  background: linear-gradient(135deg,#fff1d3,#ead7ac);
  color: var(--inktile);
  border: 1px solid #bcaa80;
  box-shadow: inset 0 1px 0 #fff8,0 2px 0 #9c895f;
}

.arttile {
  font: bold clamp(19px,2.95vw,43px)/1 var(--serif);
  z-index: 1;
}

.artgrid small,.loose small {
  font: 700 .28em/1 var(--sans);
  position: absolute;
  right: 9%;
  bottom: 10%;
}

.loose {
  position: absolute;
  display: grid;
  place-items: center;
  width: clamp(43px,5.5vw,76px);
  aspect-ratio: 1;
  border-radius: 8px;
  font: 700 clamp(28px,4vw,56px) var(--serif);
  box-shadow: 0 4px 0 #988660,0 10px 10px #08221a70;
}

.loose.one {
  left: 1%;
  bottom: 15%;
  transform: rotate(-18deg);
}

.loose.two {
  left: 12%;
  bottom: 4%;
  transform: rotate(13deg);
}

.publicbox,.return,.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
}

.publicbox {
  margin-top: 24px;
  padding: 25px 28px 22px;
}

.secttop,.pagetop,.gamehead,.racktop,.boardbar,.directoryrow,.return,.return>div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.secttop h2 {
  font-size: 1.95rem;
}

.tabbar {
  display: flex;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  margin-top: 12px;
}

.tab {
  color: var(--sub);
  border-radius: 0;
  position: relative;
  padding: 10px 6px;
}

.tab[aria-pressed=true] {
  color: var(--brand);
}

.tab[aria-pressed=true]:after {
  content: "";
  height: 3px;
  background: var(--brand);
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
}

.empty {
  padding: 28px 0 11px;
  display: flex;
  align-items: center;
  gap: 15px;
}

.empty>.ico {
  width: 42px;
  height: 42px;
  background: var(--pale);
  padding: 10px;
  border-radius: 10px;
  color: var(--brand);
}

.empty p,.return,.facts,.card>p {
  color: var(--sub);
}

.empty strong,.directoryrow strong {
  font-weight: 650;
}

.empty p,.directoryrow small {
  font-size: .91rem;
}

.return {
  margin-top: 16px;
  padding: 12px 20px;
}

.return>div {
  justify-content: flex-start;
}

.publicbox .directoryrow {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.directoryrow small,.scores small,.history small {
  display: block;
  color: var(--sub);
  font-size: .79rem;
}

.pagetop,.gamehead {
  margin: 1px 0 22px;
}

.pagetop .eyebrow,.gamehead .eyebrow {
  margin-bottom: 4px;
}

.lobbygrid {
  display: grid;
  grid-template-columns: minmax(0,1.15fr) minmax(0,1fr);
  gap: 16px;
}

.card {
  padding: 20px 22px;
  min-width: 0;
}

.card>h2 {
  margin-bottom: 13px;
}

.card>p {
  margin: 8px 0 14px;
}

.invite {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: linear-gradient(115deg,#163b32,#305543);
  color: #f9f2da;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 30px;
}

.roomcode {
  font: 700 clamp(36px,5vw,68px)/1.25 var(--serif);
  letter-spacing: .08em;
  color: #f2d69e;
}

.invite p {
  margin: 4px 0 14px;
  color: #dee6d9;
}

.qr {
  width: clamp(100px,13vw,165px);
  height: auto;
  border-radius: 8px;
  background: white;
}

.pill {
  padding: 4px 12px;
  background: var(--pale);
  color: var(--brand);
  border-radius: 20px;
  font-size: .9rem;
  font-weight: 700;
}

.facts {
  display: grid;
  gap: 8px;
  margin: 12px 0 16px;
}

.facts span {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  gap: 10px;
  padding-bottom: 6px;
}

.facts strong {
  color: var(--text);
  font-size: .94rem;
}

.scores,.history {
  padding: 0;
  margin: 0;
  list-style: none;
}

.scores li,.history li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.scores li:last-child,.history li:last-child {
  border: 0;
}

.avatar {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border-radius: 9px;
  font: 700 1.15rem var(--serif);
  flex: none;
}

.juniper {
  background: #d7e5d3;
  color: #28563e;
}

.marigold {
  background: #f4dda6;
  color: #714f16;
}

.indigo {
  background: #dedfed;
  color: #454778;
}

.rose {
  background: #efd2cc;
  color: #863c33;
}

.scores li>div,.history li>div {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.scores strong,.history strong {
  font-size: .97rem;
}

.scores strong small {
  display: inline;
  font-weight: 400;
}

.score {
  font: 700 1.6rem var(--serif);
  font-variant-numeric: tabular-nums;
}

.scores .now .avatar {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.lobbyplayers>button {
  margin-top: 10px;
}

.gamehead h1 {
  font-size: clamp(2rem,3.7vw,3.2rem);
}

.gamehead {
  margin: 0 0 13px;
}

.codebtn {
  font-family: ui-monospace,monospace;
  letter-spacing: .16em;
}

.playgrid {
  display: grid;
  grid-template-columns: minmax(0,1fr) clamp(210px,25%,312px);
  align-items: start;
  gap: 20px;
}

.playleft {
  min-width: 0;
}

.playgrid aside {
  display: grid;
  gap: 14px;
}

.boardbar {
  margin-bottom: 5px;
}

.bag {
  font-size: .91rem;
  color: var(--sub);
  display: flex;
  align-items: center;
  gap: 5px;
}

.bag .ico {
  width: 18px;
}

.boardtools {
  gap: 2px;
}

.board-shell {
  border: 1px solid #79917b;
  border-radius: 10px;
  background: var(--axis);
  padding: 4px;
  overflow: hidden;
}

.viewport {
  max-width: 100%;
  width: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  touch-action: pan-x pan-y pinch-zoom;
  position: relative;
}

#board {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(16px,.5fr) repeat(15,minmax(0,1fr));
  grid-template-rows: minmax(16px,.45fr) repeat(15,minmax(0,1fr));
  aspect-ratio: 1.015;
  background: var(--board);
  gap: 1px;
  user-select: none;
  -webkit-user-select: none;
}

.board-shell:not(.focused) {
  max-width: min(100%,max(370px,calc(100svh - 412px)));
  margin-inline: auto;
}

.board-shell.focused .viewport {
  height: min(62svh,620px);
}

.board-shell.focused #board {
  width: max(100%,745px);
  min-height: 745px;
}

.sq,.axis {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  border: 0;
  border-radius: 1px;
  padding: 0;
  position: relative;
}

.axis {
  background: var(--axis);
  color: var(--sub);
  font-size: clamp(9px,.8vw,12px);
  font-weight: 650;
}

.sq {
  background: var(--square);
  color: #26372c;
  font: bold clamp(8px,.78vw,12px)/1 var(--sans);
  touch-action: manipulation;
}

.sq.tile {
  font: 700 clamp(16px,2.1vw,33px)/1 var(--serif);
  border-radius: 3px;
  z-index: 1;
}

.sq.tile strong {
  font-weight: 700;
  transform: translate(-2%,-2%);
}

.sq small,.racktile small {
  position: absolute;
  bottom: 4%;
  right: 5%;
  font: 700 .34em/1 var(--sans);
}

.sq.recent {
  box-shadow: inset 0 -3px #60806a;
}

.sq.draft {
  background: linear-gradient(140deg,#fae2a5,#e8bc72);
  border: 1px dashed #79602d;
  box-shadow: inset 0 -3px #9a7739;
}

.sq.cursor {
  box-shadow: inset 0 0 0 3px #184b40;
  z-index: 2;
}

.sq.cursor:after {
  content: "";
  position: absolute;
  right: 2px;
  top: 2px;
  border: 4px solid transparent;
  border-right: 0;
  border-left: 6px solid #1e5743;
}

.sq.cursor.down:after {
  border: 4px solid transparent;
  border-bottom: 0;
  border-top: 6px solid #1e5743;
}

.sq.DW,.DW {
  background: var(--dw);
  color: #673d3a;
}

.sq.TW,.TW {
  background: var(--tw);
  color: #48251e;
}

.sq.TL,.TL {
  background: var(--tl);
  color: #183c42;
}

.sq.DL,.DL {
  background: var(--dl);
  color: #294956;
}

.sq span {
  font-size: 1.7em;
}

.focused .sq.tile {
  font-size: clamp(24px,2.2vw,36px);
}

.focused .sq:not(.tile) {
  font-size: 11px;
}

.rackbox {
  margin-top: 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  padding: 9px 14px 12px;
}

.racktop h2 {
  font-size: 1.3rem;
}

.racktop>div {
  gap: 2px;
}

.racktop .tertiary {
  min-height: 36px;
}

.rack {
  display: grid;
  grid-template-columns: repeat(7,minmax(0,1fr));
  gap: 6px;
  max-width: 430px;
  margin: 2px auto 5px;
}

.racktile {
  border-radius: 6px;
  position: relative;
  min-height: 44px;
  aspect-ratio: 1.08;
  max-height: 58px;
  font: 700 clamp(25px,3vw,35px) var(--serif);
  line-height: 1;
}

.racktile:disabled {
  opacity: 1;
}

.racktile.spent {
  background: var(--pale);
  border: 1px dashed var(--line);
  box-shadow: none;
  color: var(--sub);
  opacity: .55;
}

.racktile.selected {
  outline: 3px solid var(--brand);
  outline-offset: 1px;
  transform: translateY(-3px);
}

.racktile small {
  right: 9%;
  bottom: 10%;
}

.draftline {
  font-size: .86rem;
  color: var(--sub);
  text-align: center;
  min-height: 1.5em;
  margin: 4px 0;
}

.rackactions {
  display: flex;
  gap: 7px;
}

.rackactions .primary {
  margin-left: auto;
  min-width: 132px;
}

.legendgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
}

.legendgrid span {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .86rem;
}

.legendgrid b {
  display: grid;
  place-items: center;
  width: 28px;
  height: 26px;
  border-radius: 4px;
  font: 700 10px var(--sans);
}

summary {
  font-weight: 650;
  color: var(--brand);
  cursor: pointer;
  min-height: 36px;
  align-content: center;
}

.history b {
  font-variant-numeric: tabular-nums;
}

.result {
  background: #204237;
  color: #f4f0da;
  border: 1px solid #39614c;
  padding: 18px 22px;
  border-radius: 12px;
  margin: 10px 0 18px;
}

.result h2 {
  font-size: 2rem;
  margin: 4px 0 12px;
}

.result>div:not(.eyebrow):not(.actions) {
  display: flex;
  gap: 25px;
  justify-content: space-between;
  max-width: 390px;
}

.result button {
  margin-top: 12px;
}

dialog {
  padding: 0;
  width: min(470px,calc(100% - 24px));
  max-height: min(88dvh,880px);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 20px 85px #09241c66;
  overflow: auto;
  overscroll-behavior: contain;
}

dialog::backdrop {
  background: #10241ec2;
}

.dialoghead {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 10px 16px 10px 22px;
  background: var(--surface);
}

.dialoghead h2 {
  font-size: 1.65rem;
}

#dialogbody {
  padding: 18px 22px 22px;
}

form,.controlbody {
  display: grid;
  gap: 13px;
}

label,legend {
  display: block;
  font-size: .94rem;
  font-weight: 650;
}

label :is(input:not([type=checkbox],[type=radio]),select) {
  margin-top: 5px;
}

input:not([type=checkbox],[type=radio]),select {
  display: block;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  min-height: 46px;
  width: 100%;
  padding: 9px 12px;
  font-size: 16px;
}

select {
  padding-right: 24px;
}

.codeinput {
  text-transform: uppercase;
  font: 700 1.25rem ui-monospace,monospace!important;
  letter-spacing: .18em;
}

.fields.two,.modepick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

fieldset {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}

legend {
  margin-bottom: 6px;
}

.modepick label {
  position: relative;
}

.modepick input {
  position: absolute;
  opacity: 0;
}

.modepick span {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--sub);
  cursor: pointer;
}

.modepick input:checked+span {
  background: var(--pale);
  border: 2px solid var(--brand);
  color: var(--brand);
}

.modepick input:focus-visible+span {
  outline: 3px solid #c58847;
}

.options {
  border-top: 1px solid var(--line);
  padding: 5px 0;
}

.options>summary {
  min-height: 44px;
}

.options>label,.options>.fields,.options>form,.options>.actions {
  margin: 4px 0 10px;
}

.tick {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  font-weight: 500;
}

.tick input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.error {
  margin: 0 18px 18px;
  padding: 9px 12px;
  background: #f1d4cf;
  color: #6b241c;
  border-radius: 6px;
}

.textlink {
  font-weight: 650;
}

.directoryrow {
  padding: 6px 0;
  flex-wrap: wrap;
}

.rulebook>p {
  margin: 6px 0 10px;
}

.rulebook .options {
  margin-top: 12px;
}

.alphabet {
  display: grid;
  grid-template-columns: repeat(6,minmax(0,1fr));
  gap: 6px;
}

.alphabet button {
  padding: 8px 0;
}

.exchange {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin: 14px 0;
}

.exchange button {
  width: 44px;
  min-height: 46px;
  font: 700 1.25rem var(--serif);
}

.exchange button[aria-pressed=true] {
  background: var(--brand);
  color: var(--brandwhite);
}

.toast {
  position: fixed;
  bottom: max(14px,env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  background: #1a382e;
  color: white;
  box-shadow: 0 4px 15px #0003;
  padding: 10px 16px;
  border-radius: 9px;
  display: none;
  max-width: min(480px,94vw);
  width: max-content;
  font-size: .92rem;
}

.toast.show {
  display: block;
}

#connection {
  background: #fbdfa3;
  color: #4f3a12;
  padding: 5px 12px;
  text-align: center;
  font-size: .86rem;
}

#timer {
  white-space: nowrap;
  font-weight: 700;
  color: var(--brand);
}

#displayresult input {
  font-size: .85rem;
}

.result .brass {
  color: #23412d;
}

@media(min-width:851px) {
  .playgrid {
    max-width: 1060px;
    margin-inline: auto;
  }
  .playleft>.boardbar,.playleft>#rackdock {
    max-width: min(100%,max(370px,calc(100svh - 412px)));
    margin-inline: auto;
  }
  .lobbygrid .launch {
    align-self: stretch;
  }
  .hero-art {
    mask-image: linear-gradient(to right,transparent 0,#000 7%,#000 100%);
  }
}

@media(max-width:850px) {
  .wrap {
    width: calc(100% - 32px);
  }
  .mast nav {
    height: 60px;
  }
  .playgrid {
    grid-template-columns: minmax(0,1fr);
  }
  .playgrid aside {
    grid-template-columns: repeat(2,minmax(0,1fr));
  }
  .playgrid aside>.legend {
    grid-column: 1/-1;
  }
  .hero-copy {
    width: 61%;
    padding: 32px;
  }
  .hero-art {
    width: 43%;
  }
  .artframe {
    width: 390px;
    left: 6%;
    top: 0;
  }
  .hero {
    min-height: 310px;
  }
  .lobbygrid {
    grid-template-columns: 1fr 1fr;
  }
  .invite {
    padding: 22px;
    flex-wrap: wrap;
  }
  .qr {
    width: 120px;
  }
  .board-shell:not(.focused) {
    max-width: min(100%,620px);
  }
  .sq.tile {
    font-size: clamp(15px,4vw,27px);
  }
  .gamehead {
    flex-wrap: wrap;
    gap: 6px;
  }
}

@media(max-width:580px) {
  .wrap {
    width: calc(100% - 24px);
  }
  .brand {
    font-size: 24px;
    gap: 9px;
  }
  .brandmark {
    width: 29px;
    height: 30px;
    font-size: 21px;
  }
  .mast nav {
    height: 52px;
  }
  .navtools {
    gap: 0;
  }
  .plain {
    padding: 7px;
  }
  .iconbtn {
    min-width: 42px;
  }
  .hero {
    display: block;
    min-height: 0;
    border-radius: 14px;
  }
  .hero-copy {
    padding: 25px 21px 15px;
    width: 100%;
  }
  .hero h1 {
    font-size: clamp(51px,13vw,72px);
    margin: 10px 0;
  }
  .hero p {
    max-width: 24ch;
    font-size: 1rem;
    margin: 10px 0 17px;
  }
  .hero-art {
    width: 29%;
    top: 10px;
    bottom: 114px;
    mask-image: linear-gradient(to right,transparent,#000 23%);
    opacity: .9;
  }
  .artframe {
    left: 23%;
    top: 4px;
    width: 235px;
    border-width: 4px;
    padding: 4px;
  }
  .arttile {
    font-size: 23px;
  }
  .loose {
    display: none;
  }
  .hero .actions {
    gap: 8px;
  }
  .hero .actions button {
    padding: 10px 11px;
  }
  .herolink {
    margin-top: 6px;
  }
  .hero-star {
    display: none;
  }
  main {
    padding: 14px 0 24px;
  }
  .publicbox {
    padding: 14px 16px 16px;
    margin-top: 14px;
  }
  .secttop h2 {
    font-size: 1.5rem;
  }
  .empty {
    padding: 18px 0 0;
    gap: 10px;
  }
  .return {
    padding: 9px 11px;
  }
  .lobbygrid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .pagetop,.gamehead {
    margin-bottom: 8px;
  }
  .pagetop>button {
    display: none;
  }
  .invite {
    flex-wrap: nowrap;
  }
  .card {
    padding: 14px;
  }
  .roomcode {
    font-size: 2.7rem;
  }
  .qr {
    width: 108px;
  }
  .gamehead h1 {
    font-size: 1.55rem;
  }
  .gamehead .eyebrow {
    font-size: .65rem;
  }
  .gamehead {
    align-items: center;
    gap: 5px;
  }
  .gamehead>.actions {
    gap: 3px;
  }
  .gamehead .secondary {
    min-height: 40px;
    padding: 6px 8px;
    font-size: .8rem;
  }
  .gamehead .codebtn .ico {
    display: none;
  }
  .playgrid {
    gap: 11px;
  }
  .playgrid aside {
    grid-template-columns: 1fr;
  }
  .boardbar {
    margin-bottom: 1px;
  }
  .boardtools .iconbtn,.boardtools .tertiary {
    min-height: 38px;
  }
  .board-shell {
    padding: 2px;
    border-radius: 5px;
  }
  .board-shell.focused .viewport {
    height: clamp(210px,calc(100svh - 330px),455px);
  }
  .board-shell.focused #board {
    width: 710px;
    min-height: 710px;
  }
  .sq.tile {
    font-size: clamp(13px,3.8vw,22px);
  }
  .axis {
    font-size: 8px;
  }
  .sq {
    font-size: clamp(6px,1.7vw,10px);
  }
  .focused .axis {
    font-size: 12px;
  }
  .focused .sq.tile {
    font-size: 27px;
  }
  .rackbox {
    padding: 4px 8px 6px;
    margin-top: 6px;
    border-radius: 9px;
  }
  .racktop h2 {
    font-size: 1.18rem;
  }
  .racktop .tertiary {
    font-size: .82rem;
    min-height: 36px;
  }
  .rack {
    gap: 4px;
    margin-top: 0;
  }
  .racktile {
    font-size: 1.65rem;
    max-height: 55px;
  }
  .draftline {
    font-size: .78rem;
    margin: 2px 0 5px;
  }
  .rackactions .primary {
    min-width: 105px;
  }
  .rackactions>button {
    padding: 8px 10px;
  }
  .racktop .tertiary .ico {
    width: 16px;
  }
  .rackactions .ico {
    width: 17px;
  }
  .playleft {
    position: relative;
  }
  #rackdock:not(:empty) {
    position: sticky;
    z-index: 4;
    bottom: 0;
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--paper);
  }
  .boardtools .ico {
    width: 18px;
  }
  .dialoghead {
    padding: 7px 12px 7px 17px;
  }
  #dialogbody {
    padding: 14px 16px 18px;
  }
  .toast {
    bottom: max(8px,env(safe-area-inset-bottom));
  }
  .gamephone .toast {
    bottom: max(175px,calc(175px + env(safe-area-inset-bottom)));
  }
}

@media(max-width:355px) {
  .gamehead .eyebrow {
    max-width: 120px;
  }
  .hero-art {
    width: 22%;
  }
  .plain {
    font-size: .84rem;
  }
  .rackactions .secondary {
    padding: 8px;
  }
  .rackactions {
    gap: 4px;
  }
}

@media(max-height:500px) and (orientation:landscape) {
  .mast nav {
    height: 44px;
  }
  .board-shell.focused .viewport {
    height: 52svh;
  }
  .playgrid {
    grid-template-columns: minmax(0,1fr) minmax(140px,27%);
  }
  .playgrid aside {
    display: grid;
    grid-template-columns: 1fr;
  }
  .rackbox {
    position: static;
  }
  .hero {
    min-height: 250px;
  }
}

@media(prefers-reduced-motion:no-preference) {
  button {
    transition: background-color .14s,box-shadow .14s;
  }
  .result {
    animation: arrive .35s ease-out;
  }
  @keyframes arrive {
    from {
      transform: translateY(5px);
      opacity: .5;
    }
    to {
      transform: none;
      opacity: 1;
    }
  }
}

.brand {
  white-space: nowrap;
}

.navtools,.boardtools {
  flex-wrap: nowrap;
}

.bag {
  white-space: nowrap;
}

.racktile {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 0;
}

.focused #board>.axis:nth-child(-n+16) {
  position: sticky;
  top: 0;
  z-index: 3;
}

.focused #board>.axis:nth-child(16n+1) {
  position: sticky;
  left: 0;
  z-index: 3;
}

.focused #board>.axis.corner {
  z-index: 4;
}

@media(min-width:851px) {
  .displaygame .mast {
    display: none;
  }
  .displaygame main.wrap {
    width: min(1550px,100% - 50px);
    padding-top: 18px;
  }
  .displaygame .playgrid {
    max-width: 1450px;
    grid-template-columns: minmax(0,1fr) clamp(255px,27%,410px);
  }
  .displaygame .playleft>.boardbar,.displaygame .board-shell:not(.focused) {
    max-width: min(100%,max(440px,calc(100svh - 170px)));
  }
  .displaygame .scores li {
    padding: 15px 0;
  }
  .displaygame .scores strong,.displaygame .history strong {
    font-size: 1.16rem;
  }
  .displaygame .sq.tile {
    font-size: clamp(20px,2.25vw,44px);
  }
}

@media(max-width:580px) {
  .gamehead {
    display: grid;
    grid-template-columns: minmax(0,1fr) auto;
  }
  .gamehead .eyebrow {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }
  .gamehead h1 {
    overflow-wrap: anywhere;
  }
  .gamehead>.actions {
    flex-wrap: nowrap;
  }
  .rackbox {
    margin-top: 5px;
  }
  .board-shell.focused .viewport {
    height: clamp(176px,calc(100svh - 354px),455px);
  }
  .racktop>.tertiary,.boardtools {
    flex-wrap: nowrap;
  }
  .boardtools>.tertiary {
    padding-inline: 6px;
  }
  .boardbar {
    gap: 4px;
  }
  .gamephone .boardtools button {
    min-height: 44px;
  }
  .gamephone .racktop .tertiary {
    min-height: 42px;
  }
  .boardtools .iconbtn {
    min-width: 44px;
  }
  .gamephone .gamehead .secondary {
    min-height: 44px;
  }
  .rack {
    align-items: stretch;
  }
  .racktile {
    aspect-ratio: auto;
    height: clamp(44px,13vw,53px);
  }
}

@media(max-width:465px) {
  .navtext {
    display: none;
  }
  .mast .plain {
    min-width: 44px;
  }
  .mobile-short .btnlabel {
    display: none;
  }
  .mobile-short:after {
    content: attr(data-short);
  }
  .gamehead .codebtn {
    letter-spacing: .1em;
  }
  .eyebrow b {
    display: inline;
  }
  .gamephone .gamehead {
    margin-inline: 3px;
  }
  .gamephone .gamehead .actions {
    gap: 4px;
  }
}

@media(max-width:355px) {
  .gamephone main.wrap {
    width: 100%;
    padding-inline: 0;
  }
  .gamephone .boardbar,.gamephone .gamehead {
    padding-inline: 5px;
  }
  .rackbox {
    padding-inline: 2px;
  }
  .rack {
    gap: 1px;
  }
  .racktop,.rackactions {
    padding-inline: 6px;
  }
  .board-shell:not(.focused) {
    margin-inline: 3px;
  }
}

@media(max-width:580px) and (max-height:630px) {
  #rackdock:not(:empty) {
    position: static;
  }
  .racktop .tertiary {
    min-height: 38px;
  }
  .rackbox {
    padding-bottom: 4px;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (min-width:600px) and (max-width:1000px) and (max-height:500px) and (orientation:landscape) {
  .gamephone main.wrap {padding-top: 6px;}
  .gamephone .boardtools {flex-wrap: nowrap;}
  .gamephone .boardtools button {min-height: 44px; white-space: nowrap; padding-inline: 5px;}
  .gamephone .playgrid {display: block;}
  .gamephone .playleft {
    display: grid;
    grid-template-columns: minmax(0,1fr) minmax(331px,.9fr);
    align-items: start;
    gap: 4px 10px;
  }
  .gamephone .playleft>.boardbar {grid-area: 1 / 1; margin: 0;}
  .gamephone .playleft>.board-shell {grid-area: 2 / 1; width: 100%; margin: 0;}
  .gamephone .board-shell.focused .viewport {height: clamp(142px,calc(100svh - 172px),310px);}
  .gamephone .board-shell:not(.focused) {justify-self: center; max-width: max(150px,calc(100svh - 172px));}
  .gamephone .playleft>#rackdock {
    grid-area: 1 / 2 / span 2;
    position: static;
    width: 100%;
    max-width: none;
    margin: 0;
  }
  .gamephone .rackbox {margin: 0; padding: 7px 4px;}
  .gamephone .rack {gap: 2px;}
  .gamephone .racktile {min-height: 44px;}
  .gamephone .gamehead {margin-block: 5px;}
  .gamephone .gamehead h1 {font-size: 1.5rem;}
  .gamephone .playgrid aside {grid-template-columns: repeat(2,minmax(0,1fr));margin-top: 10px;}
}
