@import url("https://fonts.googleapis.com/css2?family=Crimson+Pro:wght@400;600&family=JetBrains+Mono:wght@400&display=swap");

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #1a1f25;
  --card-white: #faf9f6;
  --card-shadow: rgba(0, 0, 0, 0.35);
  --red: #c23b3b;
  --black: #1a1a1a;
  --gold: #d4a84b;
  --empty-slot: rgba(255, 255, 255, 0.06);
  --empty-border: rgba(255, 255, 255, 0.12);
  --highlight: rgba(212, 168, 75, 0.4);
  --card-w: 72px;
  --card-h: 100px;
  --card-radius: 6px;
}

html,
body {
  height: 100%;
  font-family: "Crimson Pro", Georgia, serif;
  background: var(--bg);
  color: #e8e6e1;
  overflow: hidden;
  user-select: none;
}

body {
  display: flex;
  flex-direction: column;
  background: radial-gradient(
      ellipse at 50% 0%,
      rgba(30, 53, 47, 0.8) 0%,
      transparent 60%
    ),
    var(--bg);
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

h1 {
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.7);
}

.controls {
  display: flex;
  gap: 16px;
  align-items: center;
}

button {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.6);
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

button:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.stats {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  display: flex;
  gap: 20px;
}

#game {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px;
  gap: 28px;
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
}

.top-row {
  display: flex;
  justify-content: space-between;
}

.stock-waste {
  display: flex;
  gap: 12px;
}

.foundations {
  display: flex;
  gap: 8px;
}

.tableau {
  display: flex;
  justify-content: space-between;
  flex: 1;
}

.pile {
  position: relative;
  width: var(--card-w);
  min-height: var(--card-h);
}

.waste {
  width: 110px;
}

.slot {
  width: var(--card-w);
  height: var(--card-h);
  border-radius: var(--card-radius);
  background: var(--empty-slot);
  border: 1px dashed var(--empty-border);
  position: relative;
}

.slot.foundation::after {
  content: attr(data-suit);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 28px;
  opacity: 0.3;
}

.slot.stock-slot {
  cursor: pointer;
}

.slot.stock-slot::after {
  content: "•••";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 16px;
  letter-spacing: 2px;
  opacity: 0.25;
}

.slot.free-cell {
  border-color: var(--gold);
  border-style: solid;
  background: rgba(212, 168, 75, 0.08);
}

.slot.free-cell::after {
  content: "FREE";
  font-family: "JetBrains Mono", monospace;
  font-size: 9px;
  letter-spacing: 1px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.4;
  color: var(--gold);
}

.card {
  position: absolute;
  width: var(--card-w);
  height: var(--card-h);
  border-radius: var(--card-radius);
  background: var(--card-white);
  box-shadow: 0 2px 4px var(--card-shadow);
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  display: flex;
  flex-direction: column;
  padding: 5px 6px;
  font-family: "Crimson Pro", serif;
}

.card.face-down {
  background: repeating-linear-gradient(
    45deg,
    #2a4a42,
    #2a4a42 2px,
    #234039 2px,
    #234039 4px
  );
  cursor: pointer;
}

.card.face-down * {
  display: none;
}

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

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

.card .rank {
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
}

.card .suit {
  font-size: 13px;
  line-height: 1;
  margin-top: -1px;
}

.card .center-suit {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 32px;
  opacity: 0.85;
}

.card:hover:not(.face-down):not(.dragging) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--card-shadow);
}

.card.selected {
  box-shadow: 0 0 0 3px var(--gold), 0 4px 12px var(--card-shadow);
}

.card.dragging {
  z-index: 1000;
  box-shadow: 0 12px 28px var(--card-shadow);
  cursor: grabbing;
  pointer-events: none;
  transition: none;
}

.card.drag-child {
  pointer-events: none;
  transition: none;
}

.slot.highlight {
  box-shadow: inset 0 0 0 2px var(--gold);
  background: var(--highlight);
}

.card.highlight {
  box-shadow: 0 0 0 3px var(--gold), 0 4px 12px var(--card-shadow);
}

#win-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 24px;
  z-index: 2000;
}

#win-overlay.show {
  display: flex;
}

#win-overlay h2 {
  font-size: 48px;
  font-weight: 400;
  color: var(--gold);
  letter-spacing: 4px;
}

#win-overlay .win-stats {
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
}

.shortcut {
  display: inline-block;
  font-family: "JetBrains Mono", monospace;
  font-size: 9px;
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 5px;
  border-radius: 3px;
  margin-left: 6px;
  vertical-align: middle;
}

