/* Solitaire — classic Klondike on a green felt table. Full-bleed canvas. */
*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  -webkit-tap-highlight-color: transparent;
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0d5b3b;
  font-family: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  touch-action: none;
  overscroll-behavior: none;
}

#canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: default; }

/* ---------- top controls ---------- */
.controls {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 96vw;
}

.stat-chip {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #ffe7a8;
  background: rgba(4, 30, 18, 0.55);
  border: 1px solid rgba(255, 231, 168, 0.3);
  padding: 8px 13px;
  border-radius: 999px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.ctrl-btn {
  appearance: none;
  font-family: inherit;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #eafff2;
  background: rgba(4, 30, 18, 0.55);
  border: 1px solid rgba(234, 255, 242, 0.24);
  padding: 8px 13px;
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease;
}
.ctrl-btn:hover { border-color: rgba(234, 255, 242, 0.6); }
.ctrl-btn:active { background: rgba(4, 30, 18, 0.8); }
.ctrl-btn[aria-pressed="false"] { color: #8fb8a2; }
.ctrl-btn:disabled { opacity: 0.4; cursor: default; }

/* ---------- win overlay ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(120% 90% at 50% 40%, rgba(5, 40, 26, 0.9), rgba(2, 16, 10, 0.96));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: opacity 260ms ease;
}
.overlay[hidden] { display: none; }
.overlay.is-hidden { opacity: 0; pointer-events: none; }

.panel {
  text-align: center;
  max-width: 440px;
  padding: 34px 30px 32px;
  border-radius: 24px;
  background: rgba(6, 26, 17, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.72);
  animation: pop 340ms cubic-bezier(0.2, 0.9, 0.25, 1) both;
}
@keyframes pop { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.panel__title {
  margin: 0 0 6px;
  font-size: clamp(2.6rem, 11vw, 4.6rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 0.95;
  padding-bottom: 0.16em;
  background: linear-gradient(176deg, #fff6cf 0%, #ffd76a 46%, #f2a33a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter: drop-shadow(0 6px 30px rgba(255, 215, 106, 0.4));
}
.panel__text { margin: 0 0 26px; font-size: clamp(0.98rem, 3.4vw, 1.12rem); line-height: 1.55; font-weight: 500; color: #d3e6da; }

.play-btn {
  appearance: none;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 800;
  color: #0a3421;
  background: linear-gradient(180deg, #ffe07a, #f2b23a);
  border: 0;
  padding: 16px 40px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 10px 30px -6px rgba(242, 178, 58, 0.6);
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.play-btn:hover { transform: translateY(-2px); box-shadow: 0 16px 40px -8px rgba(242, 178, 58, 0.7); }
.play-btn:active { transform: translateY(0); }

/* ---------- frame + hint ---------- */
.frame { position: fixed; inset: 0; z-index: 4; pointer-events: none; }
.frame__corner {
  position: absolute;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(234, 255, 242, 0.55);
}
.frame__corner--tl { top: max(14px, env(safe-area-inset-top)); left: 16px; }
.frame__corner--tr { top: max(14px, env(safe-area-inset-top)); right: 16px; }
.frame__corner--bl { bottom: 14px; left: 16px; }
.frame__corner a { color: inherit; text-decoration: none; pointer-events: auto; }
.frame__corner a:hover { color: #ffe7a8; }

.hint {
  position: fixed;
  bottom: 13px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  margin: 0;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: rgba(234, 255, 242, 0.5);
  pointer-events: none;
  white-space: nowrap;
  transition: opacity 300ms ease;
}
.hint.is-gone { opacity: 0; }

@media (max-width: 560px) {
  .frame__corner--bl, .hint { display: none; }
  .ctrl-btn, .stat-chip { font-size: 0.6rem; padding: 7px 10px; }
}
