:root {
  --page-pad: clamp(8px, 2.5vw, 24px);
  --card-width: clamp(38px, 9.5vw, 96px);
  --card-height: calc(var(--card-width) * 1.34);
  --board-gap: clamp(4px, 1.8vw, 22px);
  --row-gap: clamp(20px, 5vw, 42px);
  --stack-offset: clamp(15px, 3.6vw, 34px);
  --font-size: clamp(11px, 1.8vw, 18px);
  --font-family: "SF Mono", "IBM Plex Mono", "Roboto Mono", "Cascadia Mono", "Menlo", "Consolas", monospace;
  --card-cut: clamp(5px, 1.2vw, 10px);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #fff;
  color: #000;
  font-family: var(--font-family);
  font-size: var(--font-size);
  font-weight: 450;
  overflow-x: hidden;
}

button {
  border: 1px solid #000;
  border-radius: 0;
  background: #fff;
  color: #000;
  font: inherit;
  padding: 4px 8px;
  cursor: pointer;
}

button:active {
  background: #000;
  color: #fff;
}

.app {
  width: 100vw;
  min-height: 100vh;
  min-height: 100dvh;
  padding: var(--page-pad);
}

.header {
  position: relative;
  min-height: clamp(130px, 24.5vw, 245px);
  margin-bottom: clamp(10px, 2vh, 18px);
}

.logo {
  position: absolute;
  top: 0;
  left: 50%;
  display: block;
  width: clamp(252px, 49vw, 470px);
  max-height: clamp(176px, 31vw, 310px);
  object-fit: contain;
  transform: translateX(-50%);
}

.run-info {
  width: max-content;
  max-width: 42vw;
}

h1,
p {
  margin: 0 0 8px;
  font-size: var(--font-size);
  font-weight: 450;
}

h1,
button {
  text-transform: uppercase;
}

.editable-seed {
  cursor: text;
}

.seed-input {
  width: 16ch;
  border: 1px solid #000;
  border-radius: 0;
  background: #fff;
  color: #000;
  font: inherit;
  padding: 0 2px;
}

.seed-status {
  display: inline-block;
  min-width: 3ch;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 8px;
  margin-top: 12px;
}

.status {
  min-height: 18px;
  margin-top: 10px;
}

.share-panel {
  width: max-content;
  max-width: 42vw;
  margin-top: 10px;
}

.share-panel button {
  margin-top: 4px;
}

.copy-status {
  display: inline-block;
  min-width: 6ch;
  margin-left: 8px;
}

.share-panel[hidden] {
  display: none;
}

.top-row {
  display: grid;
  grid-template-columns: repeat(7, var(--card-width));
  gap: var(--board-gap);
  align-items: start;
  width: max-content;
  max-width: 100%;
  margin-right: auto;
  margin-left: auto;
  margin-bottom: var(--row-gap);
}

.pile-label {
  width: var(--card-width);
  min-height: clamp(26px, 7vw, 32px);
  margin-bottom: clamp(5px, 1.5vw, 8px);
  line-height: 1.15;
  text-align: center;
  overflow-wrap: anywhere;
}

.slot,
.tableau-pile {
  position: relative;
  width: var(--card-width);
  min-height: var(--card-height);
  border: 1px dashed #000;
  border-radius: 0;
}

.pile.has-cards {
  border-color: transparent;
}

.suit-placeholder::before,
.foundation-slot::before {
  content: "♥♣♦♠";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  font-size: clamp(10px, 1.6vw, 16px);
  letter-spacing: 0;
  pointer-events: none;
}

.suit-placeholder.has-cards::before,
.foundation-slot.has-cards::before {
  content: "";
}


.tableau {
  display: grid;
  grid-template-columns: repeat(7, var(--card-width));
  gap: var(--board-gap);
  align-items: start;
  width: max-content;
  max-width: 100%;
  margin-right: auto;
  margin-left: auto;
}

.tableau-pile {
  min-height: var(--card-height);
}

.card {
  position: absolute;
  width: var(--card-width);
  height: var(--card-height);
  border: 1px solid #000;
  border-radius: 0;
  clip-path: polygon(
    var(--card-cut) 0,
    calc(100% - var(--card-cut)) 0,
    100% var(--card-cut),
    100% calc(100% - var(--card-cut)),
    calc(100% - var(--card-cut)) 100%,
    var(--card-cut) 100%,
    0 calc(100% - var(--card-cut)),
    0 var(--card-cut)
  );
  background: #fff;
  color: #000;
  display: grid;
  grid-template-rows: 1fr auto 1fr;
  padding: clamp(4px, 1.1vw, 8px);
  line-height: 1;
  user-select: none;
  touch-action: none;
  cursor: grab;
}

.card-mark {
  align-self: start;
  justify-self: start;
  font-size: clamp(10px, 1.7vw, 16px);
}

.card-mark-bottom {
  align-self: end;
  justify-self: end;
  transform: rotate(180deg);
}

.card-center {
  align-self: center;
  justify-self: center;
  font-size: clamp(14px, 3.2vw, 26px);
}

.card.red .card-mark,
.card.red .card-center {
  color: #7a3a3a;
}

@media (max-width: 520px) {
  .header {
    min-height: 0;
  }

  .logo {
    position: static;
    width: clamp(252px, 92vw, 372px);
    margin: 0 auto 10px;
    transform: none;
  }

  .run-info {
    max-width: none;
  }

  .share-panel {
    max-width: none;
  }

  .top-row {
    align-items: start;
  }

  .pile-label {
    min-height: 34px;
  }

  .tableau-pile {
    min-height: var(--card-height);
  }
}

.card.red {
  color: #000;
}

.card.face-down {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(#000, #000) center / 1px 65% no-repeat,
    linear-gradient(90deg, #000, #000) center / 65% 1px no-repeat,
    #fff;
  cursor: default;
}

.card.dragging {
  pointer-events: none;
  cursor: grabbing;
  will-change: transform;
}

.drop-target {
  outline: 2px solid #000;
  outline-offset: 3px;
}
