/* Garden Club: approved theme A. Geometry and hit areas remain runtime-owned. */
@font-face {
  font-family: Inter;
  src: url("assets/inter.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("assets/space-grotesk.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}
:root {
  --felt: #174b41;
  --felt-low: #103e36;
  --paper: #fff8e8;
  --ink: #19392e;
  --muted: #566456;
  --frame: #bd9e69;
  --red: #b43935;
  --focus: #ffcf67;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--ink);
  color: var(--paper);
  font-family: Inter, system-ui, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.hidden {
  display: none !important;
}

.invisible {
  visibility: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Layout ---------- */

.app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
}

.hud {
flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 56px;
  padding: 6px 10px;
  background: var(--paper);
  color: var(--ink);
  border-bottom: 1px solid var(--frame);
}

.stats {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.pill {
display: flex;
  align-items: baseline;
  gap: 5px;
  margin: 0;
  padding: 7px 11px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 15px;
  white-space: nowrap;
}

.pill strong {
  font-variant-numeric: tabular-nums;
  font-size: 17px;
}

.pill-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.pill.mode {
color: var(--paper);
  background: var(--felt);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 14px;
  background: #f3e9d5;
  color: var(--ink);
  cursor: pointer;
}

.icon-btn svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.icon-btn:hover {
  background: #e4d5b7;
}

.icon-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.pill-btn {
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--focus);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s ease;
}

.icon-btn:focus-visible,
.pill-btn:focus-visible,
.btn:focus-visible,
.seg:focus-visible,
.toggle:focus-visible,
.link-btn:focus-visible {
  outline: 3px solid #3255d8;
  outline-offset: 3px;
}

/* ---------- Table (felt) ---------- */

.table {
position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background:
    repeating-linear-gradient(90deg, rgb(255 255 255 / 0.012) 0 1px, transparent 1px 4px),
    radial-gradient(ellipse at 45% 10%, rgb(255 255 255 / 0.075), transparent 65%),
    linear-gradient(150deg, var(--felt), var(--felt-low));
  box-shadow: inset 0 0 0 3px var(--frame), inset 0 0 0 5px #204b3c;
  touch-action: none;
  outline: none;
  --cw: 60px;
}

.table:focus-visible {
  box-shadow: inset 0 0 0 3px var(--focus);
}

.table.nope {
  animation: nope 0.3s ease;
}

.slot {
position: absolute;
  left: 0;
  top: 0;
  width: var(--cw);
  height: calc(var(--cw) * 1.4);
  display: grid;
  place-items: center;
  border: 1px dashed rgb(237 224 181 / 0.45);
  border-radius: calc(var(--cw) * 0.1);
  background: rgb(0 0 0 / 0.08);
  color: #cad7bd;
  font-weight: 800;
  font-size: calc(var(--cw) * 0.42);
  pointer-events: none;
}

.slot.waste {
  border-style: dotted;
  opacity: 0.6;
}

.slot.stock svg {
  display: none;
  width: 55%;
  height: 55%;
}

.slot.stock.recycle svg {
  display: block;
}

/* ---------- Cards ---------- */

.card {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--cw);
  height: calc(var(--cw) * 1.4);
  border-radius: calc(var(--cw) * 0.1);
  background: linear-gradient(155deg, #fffdf4, var(--paper));
  color: var(--ink);
  box-shadow:
    inset 0 0 0 1px #ded4b9,
    0 1px 0 #a79b77,
    0 3px 6px rgb(0 0 0 / 0.2);
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.3, 1);
  will-change: transform;
  pointer-events: none;
}

.card.red {
  color: var(--red);
}

/* Rank and suit side by side, so a fanned card's visible strip shows both. */
.corner {
  position: absolute;
  left: 7%;
  top: 4%;
  display: flex;
  align-items: baseline;
  gap: 1px;
  line-height: 1;
}

.corner b {
  font-size: calc(var(--cw) * 0.33);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.corner i {
  font-style: normal;
  font-size: calc(var(--cw) * 0.26);
}

.pip {
  position: absolute;
  right: 8%;
  bottom: 6%;
  font-size: calc(var(--cw) * 0.5);
  font-weight: 800;
  line-height: 1;
}

.card.down {
background: url("assets/botanical-back.svg") center / 92% 92% no-repeat, #17473b;
  box-shadow:
    inset 0 0 0 calc(var(--cw) * 0.045) var(--paper),
    0 1px 0 #b3a580,
    0 2px 5px rgb(0 0 0 / 0.24);
}

.card.down > span {
  display: none;
}

.card.selected {
  box-shadow:
    0 0 0 3px var(--focus),
    0 0 0 6px rgb(31 33 32 / 0.55),
    0 6px 14px rgb(0 0 0 / 0.35);
}

.card.dragging {
  transition: none;
  box-shadow:
    0 0 0 3px var(--focus),
    0 12px 22px rgb(0 0 0 / 0.4);
}

.table.instant .card,
.table.instant .slot {
  transition: none;
}

.table.won .card {
  transition-duration: 0.7s;
}

.cursor {
  position: absolute;
  left: -5px;
  top: -5px;
  z-index: 3000;
  width: calc(var(--cw) + 10px);
  height: calc(var(--cw) * 1.4 + 10px);
  border: 3px solid var(--focus);
  border-radius: calc(var(--cw) * 0.1 + 5px);
  box-shadow: 0 0 0 3px rgb(31 33 32 / 0.6);
  pointer-events: none;
  transition: transform 0.12s ease;
}

/* ---------- Screens ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  padding: 20px 16px;
  text-align: center;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 0% 100%, rgb(198 170 114 / 0.18), transparent 60%),
    linear-gradient(145deg, #fffdf4, #f4ead6);
  overflow-y: auto;
}

/* Centred while it fits, scrollable from the top when it doesn't (short phones). */
.overlay > :first-child {
  margin-top: auto;
}

.overlay > :last-child {
  margin-bottom: auto;
}

.overlay h1,
.overlay h2 {
  font-family: "Space Grotesk", Inter, sans-serif;
  margin: 0;
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.overlay h1 {
  font-size: clamp(32px, 8.5vmin, 60px);
}

.overlay h2 {
  font-size: clamp(28px, 7vmin, 46px);
}

.goal {
  margin: 0;
  max-width: 36ch;
  color: var(--ink);
  font-size: clamp(15px, 2.8vmin, 19px);
  text-wrap: balance;
}

.hint {
  margin: 0;
  max-width: 40ch;
  color: var(--muted);
  font-size: 14px;
}

.record {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

.logo-cards {
  display: flex;
  gap: 6px;
}

.mini {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 56px;
  border-radius: 7px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 800;
  font-size: 17px;
  box-shadow: 0 3px 0 rgb(0 0 0 / 0.3);
}

.mini.red {
  color: var(--red);
}

.logo-cards .mini:nth-child(1) {
  transform: rotate(-10deg) translateY(4px);
}

.logo-cards .mini:nth-child(3) {
  transform: rotate(10deg) translateY(4px);
}

.menu {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  width: min(100%, 320px);
}

.btn {
  min-width: 160px;
  min-height: 52px;
  padding: 12px 24px;
  border: 0;
  border-radius: 999px;
  background: var(--felt);
  color: var(--paper);
  font: inherit;
  font-size: 19px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 0 #0b3027;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.btn:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 #0b3027;
}

.btn.alt {
  background: #efe2c6;
  color: var(--ink);
  box-shadow: 0 6px 0 #bba276;
}

.btn.alt:active {
  box-shadow: 0 3px 0 #bba276;
}

.menu-row {
  display: flex;
  gap: 10px;
}

.menu-row .btn {
  flex: 1 1 0;
  min-width: 0;
  padding-left: 10px;
  padding-right: 10px;
}

.record.daily {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: #f3e9d5;
  border: 1px solid #d8c9ab;
}

.seg {
  flex: 1;
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.seg[aria-pressed="true"] {
  background: var(--felt);
  color: var(--paper);
}

.seg[aria-pressed="true"]::before {
  content: "\2713\00a0";
}

.toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  border: 1px solid #d8c9ab;
  border-radius: 999px;
  background: #f3e9d5;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.toggle .box {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 2px solid var(--muted);
  border-radius: 6px;
}

.toggle[aria-pressed="true"] .box {
  border-color: var(--focus);
  background: var(--focus);
}

.toggle[aria-pressed="true"] .box::after {
  content: "\2713";
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
}

.overlay.result {
  background: rgb(12 45 36 / 0.72);
}

.card-panel {
  width: min(100%, 340px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 18px 14px;
  border: 1px solid var(--frame);
  border-radius: 24px;
  background: #f3e9d5;
  box-shadow: 0 18px 50px rgb(0 0 0 / 0.55);
  animation: panel-in 0.35s cubic-bezier(0.2, 1.4, 0.4, 1);
}

.card-panel h2 {
  font-size: clamp(26px, 5vmin, 36px);
}

.sub {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  text-wrap: balance;
}

.match {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.tally {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: #e5dac0;
  font-size: 16px;
  font-weight: 700;
}

.next {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
}

.row {
  display: flex;
  gap: 10px;
  width: 100%;
  margin-top: 4px;
}

.btn.small {
  flex: 1 1 0;
  min-width: 0;
  min-height: 48px;
  padding: 10px;
  font-size: 16px;
  white-space: nowrap;
}

.link-btn {
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* Small phones: the HUD keeps 44 px targets and drops the labels it can live without. */
@media (max-width: 420px) {
  .pill.mode,
  .pill-label {
    display: none;
  }

  .pill {
    padding: 7px 9px;
  }

  .hud {
    padding: 6px 8px;
    gap: 4px;
  }

  .tools {
    gap: 4px;
  }

  .pill-btn {
    padding: 0 10px;
    font-size: 14px;
  }
}

@media (max-width: 340px) {
  .stats {
    gap: 4px;
  }

  .icon-btn {
    width: 44px;
  }
}

/* Auto-finish adds a fourth tool. Keep all actions and the original HUD height on phones. */
@media (max-width: 420px) {
  .hud:has(#finish-button:not(.hidden)) .stats {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
  }

  .hud:has(#finish-button:not(.hidden)) .pill {
    padding: 0 3px;
  }

  .hud:has(#finish-button:not(.hidden)) .pill strong {
    font-size: 14px;
  }

  .pill-btn {
    padding: 0 7px;
    font-size: 12px;
  }
}

@media (max-height: 620px) {
  .logo-cards {
    display: none;
  }

  .overlay > .logo-cards + h1 {
    margin-top: auto;
  }
}

@media (max-height: 460px) {
  .hud {
    min-height: 50px;
    padding-top: 3px;
    padding-bottom: 3px;
  }

  .overlay {
    gap: 8px;
    padding: 10px 16px;
  }

  .logo-cards,
  .goal {
    display: none;
  }

  .btn {
    min-height: 46px;
    padding: 8px 20px;
  }
}

/* Pause freezes every running CSS animation. */
.is-paused *,
.is-paused *::before,
.is-paused *::after {
  animation-play-state: paused !important;
}

@keyframes beckon {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.06);
  }
}

@keyframes nope {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-4px);
  }
  75% {
    transform: translateX(4px);
  }
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

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

  .pill-btn,
  .card-panel,
  .table.nope {
    animation: none;
  }
}
