/*
 * Card Table. Built for players who do not see well: large type, strong contrast, big buttons, and nothing that
 * matters shown small. Sizes follow the screen, so a phone, a zoomed phone and a tablet all get the same layout.
 */
:root {
  --felt: #0f3d33;
  --felt-light: #17574a;
  --felt-dark: #0a2a23;
  --paper: #fffdf6;
  --ink: #14110d;
  --gold: #f2c14e;
  --gold-deep: #b98613;
  --cream: #f6efdc;
  --warn: #ffd9a8;
  --spade: #14110d;
  --heart: #c4122f;
  --diamond: #0a55c9;
  --club: #0b6b2c;
  font-size: clamp(16px, min(4.6vw, 3.4dvh), 24px);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--felt-dark);
  color: var(--cream);
  font-family:
    system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

#app {
  max-width: 760px;
  margin: 0 auto;
  min-height: 100dvh;
}

h1,
h2 {
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 700;
  margin: 0;
  color: #fff;
}

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.25rem;
  margin-top: 1.2rem;
  color: var(--gold);
}

.suit {
  width: 1em;
  height: 1em;
  vertical-align: -0.12em;
}

.suit-S {
  color: var(--spade);
}
.suit-H {
  color: var(--heart);
}
.suit-D {
  color: var(--diamond);
}
.suit-C {
  color: var(--club);
}

/* ---------- pages: home and lobby ---------- */

.page {
  padding: max(1rem, env(safe-area-inset-top)) 1rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.brand img {
  width: 4.2rem;
  height: 4.2rem;
  border-radius: 22%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  flex: none;
}

.tiles {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.tile {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  width: 100%;
  padding: 0.8rem 0.9rem;
  border-radius: 0.9rem;
  border: 3px solid var(--gold);
  background: linear-gradient(160deg, var(--felt-light), var(--felt));
  color: #fff;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--gold-deep);
  touch-action: manipulation;
}

.tile:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--gold-deep);
}

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

.tile .art {
  flex: none;
  width: 3.6rem;
  height: 4.6rem;
  border-radius: 0.45rem;
  background: var(--paper);
  border: 2px solid #2a251c;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
  display: grid;
  place-items: center;
}

.tile .art.four {
  grid-template-columns: 1fr 1fr;
  padding: 0.35rem 0.25rem;
}

.tile .art.four .suit {
  width: 1.25rem;
  height: 1.25rem;
}

.tile .art.one {
  font-family: Georgia, serif;
  line-height: 1;
}

.tile .art.one b {
  font-size: 1.7rem;
}

.tile .art.one .suit {
  width: 1.7rem;
  height: 1.7rem;
}

.tile .words {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.tile .words b {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.45rem;
}

.tile .words i {
  font-style: normal;
  font-size: 0.95rem;
  line-height: 1.25;
  color: #dcebe4;
}

.lead {
  margin: 0;
  font-size: 1.1rem;
  color: var(--cream);
}

.hint {
  margin: 0;
  color: #cfe3da;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-weight: 600;
}

input[type='text'] {
  font: inherit;
  font-size: 1.3rem;
  padding: 0.7rem 0.8rem;
  border-radius: 0.6rem;
  border: 3px solid #cdbf9a;
  background: var(--paper);
  color: var(--ink);
  width: 100%;
}

input[type='text']:focus {
  outline: 4px solid var(--gold);
  border-color: var(--gold-deep);
}

#code {
  text-transform: uppercase;
  letter-spacing: 0.25em;
  font-weight: 700;
}

.btn {
  font: inherit;
  font-weight: 700;
  font-size: 1.15rem;
  min-height: 3.2rem;
  padding: 0.6rem 1.1rem;
  border-radius: 0.7rem;
  border: 3px solid var(--cream);
  background: var(--felt-light);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  touch-action: manipulation;
}

.btn:active {
  transform: translateY(2px);
}

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

.btn.primary {
  background: var(--gold);
  border-color: #fff3cf;
  color: var(--ink);
  box-shadow: 0 4px 0 var(--gold-deep);
}

.btn.big {
  width: 100%;
  font-size: 1.3rem;
  min-height: 3.6rem;
}

.btn.small {
  font-size: 1rem;
  min-height: 2.8rem;
  padding: 0.4rem 0.8rem;
  margin-left: auto;
}

.btn.small + .btn.small {
  margin-left: 0.5rem;
}

.join {
  display: flex;
  gap: 0.7rem;
  align-items: flex-end;
  margin-top: 0.6rem;
}

.join .field {
  flex: 1;
}

.notice {
  margin: 0;
  padding: 0.7rem 0.9rem;
  border-radius: 0.6rem;
  background: var(--warn);
  color: var(--ink);
  font-weight: 700;
}

.tablelist {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.tablerow {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 0.9rem;
  border-radius: 0.7rem;
  background: var(--felt);
  border: 3px solid var(--felt-light);
  color: #fff;
  text-decoration: none;
  font-size: 1.05rem;
}

.tablerow.yourturn {
  border-color: var(--gold);
  background: #1c5a4c;
}

.tablerow-main {
  flex: 1;
}

.pill,
.chip {
  display: inline-block;
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  background: var(--cream);
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

.yourturn .pill {
  background: var(--gold);
}

.back {
  color: var(--cream);
  font-weight: 700;
  text-decoration: none;
  font-size: 1.05rem;
  padding: 0.4rem 0;
}

.codebox {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.9rem;
  padding: 0.8rem 0.9rem;
  border-radius: 0.8rem;
  background: var(--felt);
  border: 3px solid var(--gold);
}

.codebox strong {
  font-size: 2.1rem;
  letter-spacing: 0.18em;
  color: #fff;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}

.codebox .btn {
  margin-left: auto;
}

.seatrow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.6rem 0.8rem;
  min-height: 3.6rem;
  margin-top: 0.5rem;
  border-radius: 0.7rem;
  background: var(--felt);
  border: 3px solid var(--felt-light);
  font-size: 1.15rem;
}

.seatrow .empty {
  color: #cfe3da;
  font-style: italic;
}

.final {
  margin: 0;
  font-size: 1.2rem;
  padding: 0.7rem 0.9rem;
  border-radius: 0.7rem;
  background: var(--felt);
}

/* ---------- the card ---------- */

.card {
  --w: 96px;
  position: relative;
  display: block;
  width: var(--w);
  height: calc(var(--w) * 1.42);
  padding: 0;
  border-radius: calc(var(--w) * 0.09);
  border: calc(var(--w) * 0.02) solid #2a251c;
  background: var(--paper);
  box-shadow: 0 calc(var(--w) * 0.03) calc(var(--w) * 0.07) rgba(0, 0, 0, 0.45);
  font-family: Georgia, 'Times New Roman', serif;
  overflow: hidden;
  flex: none;
}

.card .index {
  position: absolute;
  top: calc(var(--w) * 0.03);
  left: calc(var(--w) * 0.06);
  width: calc(var(--w) * 0.44);
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}

.card .index b {
  font-size: calc(var(--w) * 0.44);
  letter-spacing: -0.06em;
}

.card .index .suit {
  width: calc(var(--w) * 0.34);
  height: calc(var(--w) * 0.34);
  margin-top: calc(var(--w) * 0.02);
}

.card .pip {
  position: absolute;
  right: calc(var(--w) * 0.07);
  bottom: calc(var(--w) * 0.2);
  line-height: 0;
  opacity: 0.92;
}

.card .pip .suit {
  width: calc(var(--w) * 0.46);
  height: calc(var(--w) * 0.46);
}

.card .band {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--w) * 0.17);
  background: var(--gold);
  color: var(--ink);
  font-family: system-ui, sans-serif;
  font-weight: 800;
  font-size: calc(var(--w) * 0.105);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-left: calc(var(--w) * 0.08);
  white-space: nowrap;
}

.card.is-trump {
  border-color: var(--gold-deep);
  box-shadow:
    0 0 0 calc(var(--w) * 0.025) var(--gold),
    0 calc(var(--w) * 0.03) calc(var(--w) * 0.07) rgba(0, 0, 0, 0.45);
}

/* ---------- the game ---------- */

.game {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  overflow: hidden;
  position: relative;
}

.scorebar {
  display: flex;
  align-items: stretch;
  gap: 0.4rem;
  padding: 0.4rem 0.5rem;
  background: var(--felt-dark);
  border-bottom: 3px solid var(--gold-deep);
}

.scorebar .home {
  display: flex;
  align-items: center;
  padding: 0 0.5rem;
  color: var(--cream);
  font-size: 1.5rem;
  font-weight: 700;
  text-decoration: none;
}

.score {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.05;
}

.score span {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #cfe3da;
}

.score b {
  font-size: 2rem;
  color: #fff;
  font-family: Georgia, serif;
}

.score i {
  white-space: nowrap;
  font-style: normal;
  font-size: 0.8rem;
  font-weight: 700;
  color: #cfe3da;
}

.trumpbox {
  flex: 1.5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.05;
  padding: 0.2rem 0.4rem;
  border-radius: 0.6rem;
  background: var(--paper);
  border: 3px solid var(--gold);
}

.trumpbox span {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #4a4335;
}

.trumpbox .suit {
  width: 1.9rem;
  height: 1.9rem;
}

.trumpbox b {
  font-size: 0.95rem;
  text-align: center;
}

.trumpbox.none {
  background: var(--felt);
  border-color: var(--felt-light);
}

.trumpbox.none span,
.trumpbox.none b {
  color: #cfe3da;
}

.felt {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.35rem 0.3rem;
  background: radial-gradient(ellipse at 50% 45%, var(--felt-light) 0%, var(--felt) 60%, var(--felt-dark) 100%);
}

.plates {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 0.3rem;
  align-items: start;
}

.plate {
  justify-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  max-width: 100%;
  min-height: 3.3rem;
  padding: 0.3rem 0.55rem;
  border-radius: 0.7rem;
  background: rgba(8, 30, 25, 0.82);
  border: 3px solid transparent;
  text-align: center;
}

.plate.at-left {
  justify-self: start;
}

.plate.at-right {
  justify-self: end;
}

.plate b {
  font-size: 1.05rem;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  white-space: nowrap;
}

.plate.turn {
  border-color: var(--gold);
  background: #2b2412;
  box-shadow: 0 0 0 4px rgba(242, 193, 78, 0.35);
}

.plate.won {
  border-color: #fff;
  background: var(--gold);
}

.plate.won b {
  color: var(--ink);
}

.chip.dealer {
  background: #fff;
}

.chip.maker {
  background: var(--gold);
}

.bubble {
  padding: 0.05rem 0.5rem;
  border-radius: 0.7rem;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  font-size: 0.95rem;
  line-height: 1.15;
}

.center {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: min(1.6vw, 10px);
}

.played {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}

.played .card {
  --w: min(21.5vw, 11dvh, 130px);
}

.played figcaption {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  max-width: calc(min(21.5vw, 130px) + 4px);
  overflow: hidden;
  text-overflow: ellipsis;
}

.played.winner .card {
  outline: 5px solid #fff;
  outline-offset: 1px;
}

.played.winner figcaption {
  background: var(--gold);
  color: var(--ink);
  border-radius: 0.4rem;
  padding: 0 0.35rem;
}

.upcard {
  display: flex;
  align-items: center;
}

.upcard .card {
  --w: min(27vw, 13.5dvh, 150px);
}

.upcard.down .card {
  filter: grayscale(0.7) brightness(0.75);
}

.status {
  margin: 0;
  padding: 0.45rem 0.7rem;
  min-height: 2.4rem;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 800;
  background: var(--felt-dark);
  color: #fff;
}

.game.myturn .status {
  background: var(--gold);
  color: var(--ink);
}

.status.warn {
  background: var(--warn) !important;
  color: var(--ink) !important;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 0.6rem 0.2rem;
  min-height: 0.5rem;
}

.actions .btn {
  flex: 1 1 40%;
}

.actions .btn.big {
  flex-basis: 100%;
}

.cc {
  display: inline-flex;
  align-items: center;
  gap: 0.1em;
  padding: 0 0.35em;
  border-radius: 0.3em;
  background: var(--paper);
  border: 2px solid #2a251c;
  font-family: Georgia, serif;
  font-size: 1.25em;
  line-height: 1.25;
}

.actions .btn.quiet {
  flex-basis: 100%;
  min-height: 2.8rem;
  font-size: 1rem;
  background: transparent;
  border-width: 2px;
}

.watching .btn {
  margin-top: 0.4rem;
}

.actions .btn.third {
  flex: 0 1 22%;
  background: transparent;
}

.actions .btn.suitbtn {
  flex: 1 1 20%;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.35rem 0.2rem;
  background: var(--paper);
  border-color: currentColor;
  font-size: 0.8rem;
}

.btn.suitbtn.suit-S {
  color: var(--spade);
}
.btn.suitbtn.suit-H {
  color: var(--heart);
}
.btn.suitbtn.suit-D {
  color: var(--diamond);
}
.btn.suitbtn.suit-C {
  color: var(--club);
}

.btn.suitbtn .suit {
  width: 1.9rem;
  height: 1.9rem;
}

.btn.suitbtn[data-act='pass'] {
  background: var(--felt-light);
  border-color: var(--cream);
  font-size: 1.05rem;
}

.hand {
  flex: none;
  margin-bottom: 0.3rem;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}

.hand .card {
  position: relative;
  transition: transform 0.12s ease-out;
  cursor: default;
}

.hand .card.can {
  cursor: pointer;
  transform: translateY(-6%);
}

.hand .card.cannot {
  filter: brightness(0.55) saturate(0.6);
}

.hand .card.picked {
  transform: translateY(-13%);
  outline: 5px solid #fff;
  outline-offset: 1px;
}

.hand .card:focus-visible {
  outline: 5px solid #fff;
}

.watching {
  padding: 1rem;
  text-align: center;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: rgba(4, 16, 13, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.sheet {
  width: 100%;
  max-width: 30rem;
  padding: 1.2rem 1.1rem;
  border-radius: 1rem;
  background: var(--paper);
  color: var(--ink);
  border: 4px solid var(--gold);
  text-align: center;
}

.sheet h2 {
  color: var(--ink);
  font-size: 1.9rem;
  margin: 0 0 0.5rem;
}

.sheet p {
  margin: 0.4rem 0;
  font-size: 1.15rem;
}

.recap {
  list-style: none;
  margin: 0 0 0.6rem;
  padding: 0;
  text-align: left;
  font-size: 1rem;
  line-height: 1.3;
}

.recap li {
  padding: 0.3rem 0;
  border-bottom: 1px solid #d9cfb6;
}

.recap li.more {
  color: #5a5245;
  font-style: italic;
}

.recap .cc {
  font-size: 1em;
}

.sheet .inline {
  font-weight: 800;
  white-space: nowrap;
}

.sheet .gain {
  font-size: 1.35rem;
  font-weight: 800;
}

.sheet .total {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

@media (prefers-reduced-motion: reduce) {
  .hand .card {
    transition: none;
  }
}

/* the cards on the table take the room there is: never taller than the felt left under the name plates */
@supports (width: 1cqh) {
  .center {
    container-type: size;
  }

  .played .card {
    --w: min(21.5vw, 130px, calc((100cqh - 1.5rem) / 1.42));
  }

  .upcard .card {
    --w: min(27vw, 150px, calc(100cqh / 1.42));
  }
}

/* ---------- solitaire ---------- */

.card.back {
  background:
    linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.14) 25%,
        transparent 25% 50%,
        rgba(255, 255, 255, 0.14) 50% 75%,
        transparent 75%
      )
      0 0 / 10px 10px,
    #8a1a2b;
  border-color: #fff;
  box-shadow:
    inset 0 0 0 calc(var(--w) * 0.05) #8a1a2b,
    inset 0 0 0 calc(var(--w) * 0.075) rgba(255, 255, 255, 0.75),
    0 1px 3px rgba(0, 0, 0, 0.45);
}

.sol .card {
  --w: var(--sw);
}

.card.mini .row {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: var(--strip, calc(var(--w) * 0.54));
  padding: 0 calc(var(--w) * 0.07);
  display: flex;
  align-items: center;
  justify-content: space-between;
  line-height: 1;
}

.card.mini .row b {
  font-size: min(calc(var(--w) * 0.5), calc(var(--strip, 200px) * 1.02));
}

.card.mini .row.ten b {
  letter-spacing: -0.09em;
  margin-left: calc(var(--w) * -0.03);
}

.card.mini .row .suit {
  width: min(calc(var(--w) * 0.38), calc(var(--strip, 200px) * 0.8));
  height: min(calc(var(--w) * 0.38), calc(var(--strip, 200px) * 0.8));
  flex: none;
}

.card.mini .row.ten .suit {
  width: min(calc(var(--w) * 0.34), calc(var(--strip, 200px) * 0.8));
  height: min(calc(var(--w) * 0.34), calc(var(--strip, 200px) * 0.8));
}

.card.mini .pip {
  left: 50%;
  right: auto;
  top: 72%;
  bottom: auto;
  transform: translate(-50%, -50%);
}

.card.mini .pip .suit {
  width: calc(var(--w) * 0.54);
  height: calc(var(--w) * 0.54);
}

.game.sol {
  gap: 0.35rem;
  background: radial-gradient(ellipse at 50% 40%, var(--felt-light) 0%, var(--felt) 55%, var(--felt-dark) 100%);
}

.solbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.3rem 0.6rem;
  background: var(--felt-dark);
  border-bottom: 3px solid var(--gold-deep);
}

.solbar .home {
  color: var(--cream);
  font-size: 1.5rem;
  font-weight: 700;
  text-decoration: none;
  padding: 0 0.4rem;
}

.solbar .says {
  flex: 1;
  margin: 0;
  min-height: 2.5rem;
  display: flex;
  align-items: center;
  padding: 0.1rem 0.5rem;
  border-radius: 0.5rem;
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 700;
  font-size: 1.3rem;
  line-height: 1.12;
  color: #fff;
}

.solbar .says.say {
  font-family: inherit;
  font-size: 1rem;
  background: var(--gold);
  color: var(--ink);
}

/* the New button's place when the screen is too short for three buttons at the side */
.solbar .barnew {
  display: none;
  min-height: 1.9rem;
  padding: 0.1rem 0.8rem;
  font-size: 1rem;
}

.solbar .moves {
  font-size: 0.95rem;
  color: #cfe3da;
  font-weight: 700;
}

.solbar .moves b {
  color: #fff;
  font-size: 1.15rem;
}

.toprow {
  display: flex;
  justify-content: center;
}

.founds {
  display: grid;
  grid-template-columns: repeat(4, var(--sw));
}

.draws {
  display: grid;
  grid-template-columns: calc(var(--sw) * 2 + var(--gap)) var(--sw);
}

.tableau {
  display: grid;
  grid-template-columns: repeat(7, var(--sw));
  justify-content: center;
}

.tableau {
  flex: 1;
  min-height: 0;
}

.slot {
  position: relative;
  width: var(--sw);
  height: calc(var(--sw) * 1.42);
  padding: 0;
  border-radius: calc(var(--sw) * 0.09);
  border: 2px dashed rgba(255, 255, 255, 0.4);
  background: rgba(0, 0, 0, 0.15);
  font: inherit;
  color: inherit;
  display: block;
}

.slot .card,
.col .card,
.waste .card {
  position: absolute;
  top: 0;
  left: 0;
}

.slot:not(.empty) {
  border-color: transparent;
  background: none;
}

.slot .ghost {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  opacity: 0.4;
}

.slot .ghost .suit {
  width: 60%;
  height: 60%;
}

.slot.stock {
  cursor: pointer;
}

.slot .left {
  position: absolute;
  right: -2px;
  bottom: -2px;
  min-width: 1.5em;
  padding: 0 0.25em;
  border-radius: 0.6em;
  background: var(--cream);
  color: var(--ink);
  font-size: calc(var(--sw) * 0.3);
  font-weight: 800;
  line-height: 1.4;
  text-align: center;
}

.slot .again {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--sw) * 0.7);
  color: #fff;
}

.waste {
  position: relative;
  height: calc(var(--sw) * 1.42);
}

.waste .card {
  left: auto;
}

.col {
  position: relative;
  height: 100%;
  border-radius: calc(var(--sw) * 0.09);
}

.col.empty::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: var(--sw);
  height: calc(var(--sw) * 1.42);
  border-radius: calc(var(--sw) * 0.09);
  border: 2px dashed rgba(255, 255, 255, 0.4);
  background: rgba(0, 0, 0, 0.15);
}

.sol button.card {
  cursor: pointer;
}

.sol .card.picked {
  outline: 4px solid #fff;
  outline-offset: -1px;
  filter: brightness(1.06);
}

.sol .card.hinted,
.slot.hinted {
  outline: 4px solid var(--gold);
  outline-offset: -1px;
  animation: nudge 0.9s ease-in-out infinite alternate;
}

.col.target::after,
.slot.target::after {
  content: '';
  position: absolute;
  inset: -3px;
  border: 4px solid var(--gold);
  border-radius: calc(var(--sw) * 0.12);
  pointer-events: none;
  box-shadow: 0 0 12px rgba(242, 193, 78, 0.8);
}

@keyframes nudge {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-4px);
  }
}

.solactions {
  padding-bottom: 0.5rem;
}

.solactions .btn {
  flex: 1 1 28%;
  padding-left: 0.4rem;
  padding-right: 0.4rem;
}

.btn:disabled {
  opacity: 0.45;
}

.sheet .btn {
  margin-top: 0.6rem;
}

.btn.plain {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}

@media (prefers-reduced-motion: reduce) {
  .sol .card.hinted,
  .slot.hinted {
    animation: none;
  }
}

/* ---------- a phone held sideways: wide and short ---------- */

@media (orientation: landscape) and (max-height: 560px) {
  :root {
    font-size: clamp(14px, 4.2dvh, 20px);
  }

  #app {
    max-width: none;
  }

  /* euchre: score and names along the top, the table on the left, what to do on the right, the hand below */
  .game:not(.sol) {
    display: grid;
    grid-template-columns: 54fr 46fr;
    grid-template-rows: auto auto 1fr auto;
    grid-template-areas:
      'score plates'
      'center status'
      'center actions'
      'hand hand';
    column-gap: 0.4rem;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    background: radial-gradient(ellipse at 30% 45%, var(--felt-light) 0%, var(--felt) 60%, var(--felt-dark) 100%);
  }

  .game:not(.sol) .scorebar {
    grid-area: score;
    padding: 0.25rem 0.3rem;
    border-bottom: none;
    background: none;
  }

  .game:not(.sol) .felt {
    display: contents;
  }

  .game:not(.sol) .plates {
    grid-area: plates;
    align-self: center;
    padding-right: 0.3rem;
  }

  .game:not(.sol) .center {
    grid-area: center;
    padding: 0.2rem 0.3rem;
  }

  .game:not(.sol) .status {
    grid-area: status;
    margin: 0.15rem 0.3rem 0 0;
    border-radius: 0.6rem;
  }

  .game:not(.sol) .actions {
    grid-area: actions;
    align-content: flex-start;
    padding: 0.4rem 0.3rem 0 0;
  }

  .game:not(.sol) .hand,
  .game:not(.sol) .watching {
    grid-area: hand;
    margin-bottom: 0.2rem;
  }

  .game:not(.sol) .score {
    flex-direction: row;
    align-items: baseline;
    gap: 0.35rem;
  }

  .game:not(.sol) .score b {
    font-size: 1.6rem;
  }

  .game:not(.sol) .trumpbox {
    flex-direction: row;
    gap: 0.35rem;
    padding: 0.15rem 0.5rem;
  }

  .game:not(.sol) .trumpbox .suit {
    width: 1.5rem;
    height: 1.5rem;
  }

  .game:not(.sol) .plate {
    min-height: 0;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.1rem 0.35rem;
    padding: 0.2rem 0.5rem;
  }

  .played .card {
    --w: min(11.5vw, 130px);
  }

  .upcard .card {
    --w: min(13vw, 150px);
  }

  @supports (width: 1cqh) {
    .played .card {
      --w: min(11.5vw, 130px, calc((100cqh - 1.5rem) / 1.42));
    }

    .upcard .card {
      --w: min(13vw, 150px, calc(100cqh / 1.42));
    }
  }

  .played figcaption {
    max-width: calc(min(11.5vw, 130px) + 4px);
  }
}

@media (orientation: landscape) and (max-height: 560px) {
  /* solitaire: foundations on the left, the stock, the turned cards and the buttons on the right */
  .game.sol {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto auto 1fr;
    grid-template-areas:
      'bar bar bar'
      'founds tableau draws'
      'founds tableau actions';
    gap: 0.3rem var(--gap);
    padding: env(safe-area-inset-top) max(0.4rem, env(safe-area-inset-right)) env(safe-area-inset-bottom)
      max(0.4rem, env(safe-area-inset-left));
  }

  .solbar {
    grid-area: bar;
    padding: 0.1rem 0.4rem;
  }

  .solbar .says {
    min-height: 1.9rem;
    font-size: 1.15rem;
  }

  .sol .toprow {
    display: contents;
  }

  .sol .founds {
    grid-area: founds;
    grid-template-columns: repeat(2, var(--sw));
    align-content: start;
  }

  .sol .draws {
    grid-area: draws;
    grid-template-columns: var(--sw) var(--sw);
    align-content: start;
  }

  .sol .tableau {
    grid-area: tableau;
  }

  .sol .solactions {
    grid-area: actions;
    flex-direction: column;
    flex-wrap: nowrap;
    justify-content: flex-end;
    padding: 0 0 0.4rem;
    width: calc(var(--sw) * 2 + var(--gap));
  }

  .sol .solactions .btn {
    flex: none;
    min-height: 2.7rem;
    padding: 0.2rem 0.3rem;
    font-size: 1.05rem;
  }
}

@media (orientation: landscape) and (max-height: 299px) {
  .solbar .barnew {
    display: inline-flex;
  }

  .sol .solactions [data-act='sol-ask-new'] {
    display: none;
  }

  .sol .solactions .btn {
    min-height: 2.4rem;
  }
}

/* a sheet never grows past the screen; on a sideways phone its buttons stand side by side */
.sheet {
  max-height: 96%;
  overflow-y: auto;
}

@media (orientation: landscape) and (max-height: 560px) {
  .sheet {
    max-width: 46rem;
    padding: 0.6rem 0.9rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0 0.5rem;
  }

  .sheet h2 {
    flex-basis: 100%;
    font-size: 1.5rem;
    margin-bottom: 0.2rem;
  }

  .sheet p,
  .sheet ul {
    flex-basis: 100%;
    margin: 0.15rem 0;
  }

  .sheet .total {
    margin-bottom: 0.3rem;
  }

  .sheet .btn.big {
    flex: 1 1 30%;
    width: auto;
    min-height: 2.8rem;
    font-size: 1.1rem;
    margin-top: 0.3rem;
  }
}
