* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: #f5f5f7;
  color: #1d1d1f;
  min-height: 100vh;
  overflow-x: hidden;
}
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,0.8);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid #e0e0e5;
}
.topbar-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: .7rem 1.5rem;
}
.logo {
  font-size: 1.2rem; font-weight: 600; color: #1d1d1f; text-decoration: none;
}
.topbar nav { display: flex; gap: 1.2rem; }
.topbar nav a {
  font-size: .85rem; color: #6e6e73; text-decoration: none;
  transition: color .2s;
}
.topbar nav a:hover { color: #0071e3; }
.game-area {
  max-width: 1100px; margin: 1.5rem auto; padding: 0 1rem;
  display: flex; flex-direction: column; gap: 1.5rem;
}
.foundations {
  display: flex; gap: .75rem; justify-content: center;
}
.tableau {
  display: flex; gap: .75rem; justify-content: center;
}
.card {
  width: 80px; height: 112px;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.05);
  display: flex; flex-direction: column;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  user-select: none;
  position: relative;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,.12); }
.card.selected { box-shadow: 0 0 0 2.5px #0071e3, 0 4px 16px rgba(0,113,227,.15); transform: translateY(-3px); }
.card.face-down {
  background: linear-gradient(135deg, #1d1d1f 0%, #2c2c2e 100%);
  cursor: pointer;
}
.card.face-down::after {
  content: ''; position: absolute; inset: 6px;
  border-radius: 6px; border: 2px solid rgba(255,255,255,.15);
}
.card-value {
  font-size: .85rem; font-weight: 600; padding: 6px 6px 0;
}
.card-suit-small { font-size: .8rem; }
.card-center {
  flex: 1; display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
}
.card-value-bottom {
  font-size: .85rem; font-weight: 600; padding: 0 6px 6px;
  align-self: flex-end;
  transform: rotate(180deg);
}
.red { color: #ff3b30; }
.black { color: #1d1d1f; }
.foundation-slot, .stock-slot {
  width: 80px; height: 112px;
  border-radius: 10px;
  border: 2px dashed #d2d2d7;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; color: #d2d2d7;
  transition: border-color .2s, background .2s;
}
.foundation-slot.has-card { border-style: solid; border-color: transparent; }
.stock-slot { cursor: pointer; background: rgba(255,255,255,.5); }
.stock-slot:hover { background: rgba(255,255,255,.8); }
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.3);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; opacity: 0; pointer-events: none;
  transition: opacity .3s;
}
.modal-overlay.visible { opacity: 1; pointer-events: auto; }
.modal {
  background: #fff; border-radius: 20px; padding: 2.5rem;
  max-width: 380px; width: 90%; text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  transform: scale(.95); transition: transform .3s;
}
.modal-overlay.visible .modal { transform: scale(1); }
.modal h2 { font-size: 1.8rem; margin-bottom: .8rem; }
.modal p { color: #6e6e73; font-size: 1.05rem; line-height: 1.6; }
.history h2 { font-size: 1.4rem; margin-bottom: 1rem; }
.history table { width: 100%; border-collapse: collapse; }
.history th, .history td { padding: .5rem .8rem; text-align: left; border-bottom: 1px solid #f0f0f0; }
.history th { font-weight: 600; font-size: .8rem; color: #86868b; text-transform: uppercase; letter-spacing: .03em; }
.history tr:last-child td { border-bottom: none; }
@media (max-width: 768px) {
  .card, .foundation-slot, .stock-slot { width: 52px; height: 73px; }
  .card-value { font-size: .6rem; }
  .card-suit-small { font-size: .6rem; }
  .card-center { font-size: 1.2rem; }
  .card-value-bottom { font-size: .6rem; }
  .foundations, .tableau { gap: .4rem; }
  .game-area { padding: 0 .5rem; }
}
@media (max-width: 480px) {
  .card, .foundation-slot, .stock-slot { width: 44px; height: 62px; }
  .card-value { font-size: .5rem; }
  .card-suit-small { font-size: .5rem; }
  .card-center { font-size: 1rem; }
}