* { box-sizing: border-box; }

html, body { height: 100%; }
html {
  background: #5a8edd url('../../Windows XP Background.svg') center center / cover no-repeat fixed;
}
body {
  margin: 0;
  min-height: 100vh;
  background: transparent;
  font-family: Tahoma, "Segoe UI", "MS Sans Serif", Arial, sans-serif;
  font-size: 11px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  color: #000;
}

/* ─── XP window chrome ─── */
.xp-window {
  background: linear-gradient(to bottom, #0058e6 0%, #245edb 9%, #245edb 100%);
  border-radius: 8px 8px 0 0;
  padding: 0 3px 3px;
  box-shadow: 0 0 0 1px #003a99, 0 18px 32px rgba(0,0,0,0.35);
  width: 100%;
  max-width: 920px;
}

.xp-titlebar {
  background: linear-gradient(to bottom,
    #0058e6 0%, #3893ff 3%, #1d72e0 9%, #0c5fd5 50%, #045fda 90%, #0455b7 100%);
  color: #fff;
  padding: 3px 4px 3px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: bold;
  font-size: 13px;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.35);
  height: 28px;
  border-radius: 6px 6px 0 0;
}
.xp-titlebar-left { display: flex; align-items: center; gap: 6px; }
.xp-icon { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; }
.xp-icon svg { display: block; }
.xp-titlebar-buttons { display: flex; gap: 2px; }
.xp-tb-btn {
  width: 22px; height: 22px;
  background: linear-gradient(to bottom, #4791ed 0%, #2772d4 50%, #205fc4 100%);
  border: 1px solid rgba(0,0,0,0.55);
  border-radius: 3px;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: default;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.55), inset 0 -1px 0 rgba(0,0,0,0.18);
}
.xp-tb-btn.close {
  background: linear-gradient(to bottom, #e96d65 0%, #c93630 50%, #9d1410 100%);
  border-color: #500000;
}
.xp-tb-btn:hover { filter: brightness(1.12); }
a.xp-tb-btn { text-decoration: none; }

.xp-menubar {
  background: #ece9d8;
  padding: 2px 6px;
  border-bottom: 1px solid #aca899;
  font-size: 11px;
  display: flex;
  gap: 4px;
}
.xp-menubar span {
  padding: 3px 8px;
  cursor: default;
  color: #000;
}
.xp-menubar span:hover { background: #316ac5; color: #fff; }

.xp-toolbar {
  background: linear-gradient(to bottom, #f7f6ef 0%, #ece9d8 100%);
  padding: 5px 8px;
  border-bottom: 1px solid #d4d0c8;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.toolbar-spacer { flex: 1; }
.toolbar-stat {
  font-size: 11px;
  color: #003399;
  background: #fff;
  border: 1px inset #aca899;
  padding: 2px 8px;
  border-radius: 2px;
  font-variant-numeric: tabular-nums;
}
.toolbar-stat b { color: #000; }

.xp-body {
  background: #008000;
  padding: 16px;
  min-height: 540px;
  position: relative;
  background-image:
    repeating-linear-gradient(45deg, transparent 0, transparent 8px, rgba(0,0,0,0.05) 8px, rgba(0,0,0,0.05) 9px),
    radial-gradient(ellipse at 30% 20%, #2ba33b 0%, #008000 70%);
}

/* ─── XP button ─── */
.xp-btn {
  font-family: Tahoma, sans-serif;
  font-size: 11px;
  background: linear-gradient(to bottom,
    #f6f6f6 0%, #ece9d8 45%, #ddd9c0 55%, #d6d2c2 100%);
  border: 1px solid #003c74;
  border-radius: 3px;
  padding: 3px 12px;
  color: #000;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), inset 0 -1px 0 rgba(0,0,0,0.05);
  min-width: 75px;
  min-height: 22px;
}
.xp-btn:hover:not(:disabled) {
  background: linear-gradient(to bottom,
    #fff7d2 0%, #ffe589 45%, #ffb04a 55%, #ffa12d 100%);
  border-color: #c66902;
}
.xp-btn:active:not(:disabled) {
  background: linear-gradient(to bottom, #d6d2c2 0%, #ddd9c0 45%, #ece9d8 55%, #f6f6f6 100%);
}
.xp-btn:disabled { color: #888; border-color: #aca899; cursor: default; opacity: 0.6; }

/* ─── Solitaire board ─── */
.solitaire-board {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.board-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.board-spacer { flex: 1; min-width: 8px; }
.top-row .board-spacer { min-width: 24px; }

/* ─── Card slot (empty placeholder) ─── */
.card-slot {
  width: 72px;
  height: 100px;
  border: 1px dashed rgba(255,255,255,0.55);
  border-radius: 6px;
  background: rgba(0,0,0,0.18);
  position: relative;
  flex-shrink: 0;
}
.card-slot.foundation {
  border-style: solid;
  border-color: rgba(255,255,255,0.4);
}
.card-slot.foundation::before {
  content: attr(data-label);
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(255,255,255,0.4);
  font-size: 10px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: center;
  line-height: 1.3;
}
.card-slot.stock::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 24px; height: 24px;
  margin: -12px 0 0 -12px;
  border: 2px solid rgba(255,255,255,0.55);
  border-radius: 50%;
}
.card-slot.stock::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 0; height: 0;
  margin: -4px 0 0 -3px;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 9px solid rgba(255,255,255,0.65);
}
.card-slot.stock.empty::before,
.card-slot.stock.empty::after { opacity: 0.35; }

/* ─── Cards ─── */
.card {
  width: 72px;
  height: 100px;
  background: #fff;
  border: 1px solid #555;
  border-radius: 6px;
  position: absolute;
  top: 0; left: 0;
  cursor: pointer;
  box-shadow: 1px 2px 3px rgba(0,0,0,0.35);
  user-select: none;
  display: flex;
  flex-direction: column;
  padding: 4px 6px;
  font-family: Tahoma, sans-serif;
  overflow: hidden;
  transition: transform 0.08s;
}
.card.face-down {
  background:
    repeating-linear-gradient(45deg, #1659c4 0 4px, #0a3d99 4px 8px);
  border-color: #052974;
}
.card.face-down::after {
  content: '';
  position: absolute;
  inset: 6px;
  border: 1.5px solid rgba(255,255,255,0.4);
  border-radius: 3px;
}
.card.red { color: #c01818; }
.card.black { color: #000; }
.card.selected {
  outline: 2px solid #ffd700;
  outline-offset: -1px;
  box-shadow: 1px 2px 6px rgba(255,215,0,0.6);
  z-index: 50 !important;
}
.card.hint {
  outline: 2px solid #4791ed;
  outline-offset: -1px;
}
.card-corner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1;
}
.card-rank {
  font-size: 13px;
  font-weight: bold;
  line-height: 1;
}
.card-suit {
  font-size: 9px;
  font-weight: bold;
  line-height: 1;
  margin-top: 2px;
  letter-spacing: 0.05em;
}
.card-keyword {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: bold;
  text-align: center;
  overflow-wrap: break-word;
  hyphens: auto;
  line-height: 1.15;
  padding: 2px;
  margin-top: -4px;
}
.card-corner-bot {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1;
  transform: rotate(180deg);
}

/* Tableau columns – cards stack vertically with offset */
.tableau-col {
  width: 72px;
  min-height: 100px;
  position: relative;
  flex-shrink: 0;
}
.tableau-col.empty {
  border: 1px dashed rgba(255,255,255,0.5);
  border-radius: 6px;
}

/* Foundation, stock, waste each hold a single card on top */
.card-slot .card { position: absolute; top: 0; left: 0; }

/* ─── Game over / win dialog ─── */
.game-over-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 200;
}
.game-over-overlay.active { display: flex; }
.game-over-dialog {
  width: 100%;
  max-width: 300px;
  background: linear-gradient(to bottom, #0058e6 0%, #245edb 9%, #245edb 100%);
  border-radius: 6px 6px 0 0;
  padding: 0 3px 3px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.55);
  color: #000;
}
.game-over-titlebar {
  background: linear-gradient(to bottom,
    #0058e6 0%, #3893ff 3%, #1d72e0 9%, #0c5fd5 50%, #045fda 90%, #0455b7 100%);
  color: #fff;
  font-weight: bold;
  font-size: 12px;
  padding: 4px 8px;
  height: 26px;
  border-radius: 4px 4px 0 0;
  display: flex; align-items: center; gap: 6px;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.35);
}
.go-icon { display: inline-flex; align-items: center; }
.go-icon svg { display: block; }
.game-over-body {
  background: #ece9d8;
  padding: 14px 16px 12px;
  text-align: center;
}
.go-headline {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: bold;
  color: #003399;
}
.go-stat { margin: 2px 0; font-size: 11px; color: #000; }
.go-newbest {
  display: none;
  margin: 8px 0 0;
  padding: 4px 8px;
  background: linear-gradient(to bottom, #fffbe1 0%, #fff5b3 100%);
  border: 1px solid #c08000;
  border-radius: 2px;
  font-size: 11px;
  font-weight: bold;
  color: #6a4400;
}
.go-newbest.show { display: block; }
.game-over-footer {
  background: linear-gradient(to bottom, #f7f6ef 0%, #ece9d8 100%);
  border-top: 1px solid #d4d0c8;
  box-shadow: inset 0 1px 0 #fff;
  padding: 8px 10px;
  text-align: center;
}

/* ─── Status bar ─── */
.xp-statusbar {
  background: #ece9d8;
  border-top: 1px solid #919b9c;
  padding: 3px 8px;
  font-size: 11px;
  color: #333;
  display: flex;
  justify-content: space-between;
}
.status-cell { border-left: 1px solid #aca899; padding-left: 8px; margin-left: 8px; }
.xp-start-tag {
  display: inline-block;
  background: linear-gradient(to bottom, #3ca33c 0%, #2c8f2c 50%, #207020 100%);
  color: #fff;
  font-style: italic;
  font-weight: bold;
  padding: 2px 12px 2px 8px;
  border-radius: 0 12px 12px 0;
  font-size: 11px;
  box-shadow: inset 1px 1px 0 rgba(255,255,255,0.3);
  margin-right: 4px;
}

/* ─── Responsive: scale cards on small screens ─── */
@media (max-width: 760px) {
  body { padding: 4px; }
  .xp-body { padding: 10px 6px; min-height: 0; }
  .board-row { gap: 4px; }
  .top-row .board-spacer { min-width: 4px; }
  .card-slot, .card, .tableau-col { width: 44px; height: 62px; }
  .card { padding: 2px 3px; border-radius: 3px; }
  .card-rank { font-size: 11px; }
  .card-suit { font-size: 7px; margin-top: 1px; }
  .card-keyword { font-size: 7px; }
  .card-corner-bot { display: none; }
  .toolbar-stat { font-size: 10px; padding: 1px 6px; }
}
