:root {
  --vp-bg: #09090b;
  --vp-card-back: #18181b;
  --vp-card-front: #27272a;
  --vp-highlight: #8b6cff; /* Violet */
  --vp-cyan: #4cc9f0;
  --vp-red: #f43f5e;
  --vp-white: #fafafa;
  --deck-back-glow: rgba(139, 108, 255, 0.15); /* INSTÄLLNING - Ändra hur starkt kortlekens baksida glöder. */
  --card-back-pattern-opacity: 0.55; /* INSTÄLLNING - Ändra hur tydligt mönstret på nedvända kort syns. */
}

.solitaire-board {
  display: grid;
  grid-template-rows: var(--card-height, 104px) 1fr;
  gap: 32px;
  position: relative;
  background: radial-gradient(circle at 50% 10%, rgba(139,108,255,0.04), transparent 60%),
              #050507;
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 4px;
  box-shadow: inset 0 0 60px rgba(0,0,0,0.8),
              0 24px 60px rgba(0,0,0,0.5);
  padding: 24px;
  min-height: 540px;
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  overflow: hidden;
}

/* Piles Layout */
.top-piles {
  display: grid;
  grid-template-columns: repeat(7, var(--card-width, 72px));
  gap: var(--tableau-gap, 18px);
}

.tableau-piles {
  display: grid;
  grid-template-columns: repeat(7, var(--card-width, 72px));
  gap: var(--tableau-gap, 18px);
  min-height: 350px;
}

/* Card Styling */
.card-slot {
  width: var(--card-width, 72px);
  height: var(--card-height, 104px);
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.02);
  position: relative;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
}

.card {
  width: var(--card-width, 72px);
  height: var(--card-height, 104px);
  background: linear-gradient(135deg, #27272a, #18181b);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  position: absolute;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  padding: 8px;
  user-select: none;
  transition: transform 0.15s cubic-bezier(0.2, 0, 0.2, 1), box-shadow 0.15s ease;
  box-shadow: 0 4px 8px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.05);
}

.card.face-down {
  background:
    radial-gradient(circle at 50% 18%, rgba(139, 108, 255, 0.20), transparent 45%),
    linear-gradient(135deg, rgba(22, 22, 32, 0.96), rgba(8, 8, 14, 0.98));
  border: 1px solid rgba(139, 108, 255, 0.28);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 0 22px rgba(139, 108, 255, 0.10),
    0 10px 24px rgba(0, 0, 0, 0.28);
}

.card.face-down::before {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(45deg, rgba(139, 108, 255, 0.10) 25%, transparent 25%, transparent 50%, rgba(139, 108, 255, 0.10) 50%, rgba(139, 108, 255, 0.10) 75%, transparent 75%);
  background-size: 12px 12px;
  opacity: var(--card-back-pattern-opacity);
}

.card-slot.empty-stock {
  border-style: solid;
  background: rgba(255,255,255,0.01);
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.8);
}

.card.selected {
  border-color: #fbbf24;
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.3), 0 8px 24px rgba(0,0,0,0.6);
  transform: translateY(-8px);
  z-index: 10;
}

.card-top {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 1rem;
}

.card-suit-big {
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
}

.card.suit-hearts, .card.suit-diamonds {
  color: var(--vp-red);
}

.card.suit-spades, .card.suit-clubs {
  color: var(--vp-white);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

/* Empty slots aesthetic */
.card-slot::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(255,255,255,0.03), transparent);
  pointer-events: none;
}

/* Overlay */
.game-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(12, 12, 14, 0.9);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  text-align: center;
}

.game-overlay.hidden {
  display: none;
}

/* Dragging Styles */
.card.dragging {
  opacity: 0.9;
  z-index: 1000 !important;
  pointer-events: none;
  box-shadow: 0 20px 40px rgba(0,0,0,0.6), 0 0 20px rgba(139, 108, 255, 0.3);
  transform: scale(1.05);
}

.drag-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}



/* INSTÄLLNING - Global Mobile Fallback Fix */
html, body {
    overflow-x: hidden !important;
    max-width: 100vw;
}
@media (max-width: 800px) {
    canvas, .game-canvas, #game-container, #game-stage, #app {
        max-width: 100% !important;
        height: auto;
    }
    .panel, .sidebar, .menu, #ui, #overlay {
        max-width: 100% !important;
        box-sizing: border-box;
    }
}
