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

html {
  scroll-behavior: smooth;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.5;
  color: #333;
  background-color: #f0f2f5;
  margin: 0;
  padding-top: 170px;
}

a:focus-visible,
button:focus-visible,
.game-card:focus-visible,
summary:focus-visible {
  outline: 3px solid #0a66c2;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  min-height: 170px;
  display: flex;
  align-items: center;
  padding: 0 2rem;
  background-image: url("assets/header-bg.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  z-index: 1000;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
}

.logo {
  height: 64px;
  width: 64px;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

header h1 {
  font-size: 2rem;
  color: #fff;
  font-weight: 700;
  margin: 0 0 0.4rem 0;
  line-height: 1.1;
}

.tagline {
  font-size: 1rem;
  color: #e6f1ff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.35);
}

footer {
  width: 100%;
  background-color: #fff;
  border-top: 1px solid #e0e0e0;
  box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.05);
}

footer > p {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
  text-align: center;
  font-size: 0.9rem;
  color: #666;
}

.container {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) 180px;
  gap: 1rem;
  max-width: 1400px;
  margin: 1.5rem auto;
  padding: 0 1rem;
  align-items: start;
}

.sidebar {
  background-color: #fff;
  padding: 0;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  width: 180px;
  min-height: 620px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  overflow: hidden;
}

.sidebar iframe {
  width: 160px !important;
  height: 600px !important;
  border: 0;
  display: block;
}

main {
  background-color: #fff;
  padding: 1rem 1rem 2rem;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
}

.hero {
  text-align: center;
  margin-bottom: 1.25rem;
}

.hero h2 {
  font-size: 1.6rem;
  color: #333;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  justify-items: center;
  margin-bottom: 2.25rem;
}

.game-card {
  display: block;
  width: 100%;
  max-width: 220px;
  aspect-ratio: 4 / 5;
  background-color: #e8ebed;
  border-radius: 10px;
  border: 3px solid #c9cdd1;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.game-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.game-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.12);
  background-color: #dfe3e6;
}

.game-card.ad-placeholder {
  grid-column: span 2;
  width: 300px;
  height: 250px;
  max-width: 100%;
  border: 2px dashed #bbb;
  background-color: #f5f5f5;
  display: grid;
  place-items: center;
}

.game-card.ad-placeholder iframe {
  width: 100% !important;
  height: 100% !important;
  border: 0;
}

.faq {
  margin-top: 2.75rem;
}

.faq h2 {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}

.faq details {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: #fafafa;
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.faq summary {
  cursor: pointer;
  list-style: none;
  padding: 1rem;
  font-weight: 600;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::before {
  content: "+";
  font-weight: 700;
}

.faq details[open] summary::before {
  content: "–";
}

.faq details p {
  padding: 0 1rem 1rem 1rem;
  color: #444;
  line-height: 1.6;
}

@media (max-width: 1024px) {
  .container {
    max-width: 1000px;
  }
}

@media (max-width: 768px) {
  header {
    min-height: 190px;
    padding: 0 1rem;
  }

  body {
    padding-top: 190px;
  }

  .container {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .games-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
  }

  .game-card {
    max-width: 280px;
  }

  .game-card.ad-placeholder {
    grid-column: auto;
    width: 100%;
    max-width: 320px;
    height: auto;
    aspect-ratio: 6 / 5;
  }
}

/* Solitaire */
.solitaire-board {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
}

.foundations {
  display: flex;
  gap: 0.5rem;
}

.foundation-slot {
  width: 70px;
  height: 100px;
  background-color: #e8ebed;
  border: 2px dashed #bbb;
  border-radius: 6px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.stock-waste {
  display: flex;
  gap: 0.5rem;
  flex-direction: column;
  align-items: center;
}

.stock-slot,
.waste-slot {
  width: 70px;
  height: 100px;
  border-radius: 6px;
  background-color: #e8ebed;
  border: 2px solid #ccc;
  position: relative;
  cursor: pointer;
  transition: background-color 0.2s;
}

.stock-slot.empty,
.waste-slot.empty {
  opacity: 0.5;
}

.tableau {
  flex: 1;
  display: flex;
  gap: 0.5rem;
}

.tableau-pile {
  width: 70px;
  min-height: 100px;
  background-color: #e8ebed;
  border: 2px solid #ccc;
  border-radius: 6px;
  padding: 4px;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: background-color 0.2s;
}

.tableau-pile.empty {
  opacity: 0.5;
  background-color: #002847;
}

.tableau-pile.pile-highlight {
  background-color: #f9f0b3;
}

.card {
  width: 70px;
  height: 100px;
  border-radius: 6px;
  position: absolute;
  left: 0;
  top: 0;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  user-select: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 6px;
  background-color: #fff;
  border: 1px solid #aaa;
  transition: transform 0.2s ease;
}

.card.black {
  color: #222;
}

.card.red {
  color: #c33;
}

.card .rank,
.card .suit {
  font-size: 1.2rem;
}

.card .suit {
  font-size: 1.4rem;
  text-align: center;
  margin-top: auto;
}

.card-back {
  width: 70px;
  height: 100px;
  border-radius: 6px;
  background-color: #004d99;
  position: absolute;
  left: 0;
  top: 0;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.stack-offset {
  position: relative;
  margin-top: 30px;
}

.card.highlight {
  outline: 3px solid #ffeb3b;
  z-index: 10;
}

.card.dragging {
  opacity: 0.6;
  transform: scale(1.05);
}

.card.correct {
  background-color: #d4edda;
}

.card.incorrect {
  background-color: #f8d7da;
}

/* Crosswords */
.crossword-grid {
  display: grid;
  grid-template-columns: repeat(10, 40px);
  grid-template-rows: repeat(10, 40px);
  gap: 2px;
  margin-bottom: 1rem;
}

.crossword-cell {
  position: relative;
  width: 40px;
  height: 40px;
  background: #fff;
  border: 1px solid #ccc;
}

.crossword-cell.block {
  background: #333;
}

.crossword-cell .cell-number {
  position: absolute;
  top: 2px;
  left: 2px;
  font-size: 0.6rem;
  color: #555;
}

.crossword-cell input {
  width: 100%;
  height: 100%;
  border: none;
  text-align: center;
  font-size: 1rem;
  text-transform: uppercase;
}

.crossword-cell.highlight {
  background-color: #ffeb3b;
}

.crossword-cell.correct input {
  background-color: #d4edda;
}

.crossword-cell.incorrect input {
  background-color: #f8d7da;
}

.clue-item.active {
  background: #ffeb3b;
}
