/* =========================================================
   Rifpelit – etusivun tyylit
   Yhtenäinen, brändin mukainen design-token-järjestelmä
   ========================================================= */

:root {
  /* Brändi – punainen */
  --brand: #ff1919;
  --brand-bright: #ff3b3b;
  --brand-deep: #cc1414;
  --brand-darker: #8f0d0d;
  --brand-glow: rgba(255, 25, 25, 0.35);
  --brand-tint: rgba(255, 25, 25, 0.12);

  /* Pinnat / taustat */
  --bg: #0a0a0a;
  --surface-1: #141414;
  --surface-2: #1b1b1b;
  --surface-3: #232323;
  --border: #2a2a2a;
  --border-soft: rgba(255, 255, 255, 0.06);

  /* Teksti */
  --text: #f5f5f5;
  --text-muted: #b4b4b4;
  --text-dim: #7c7c7c;
  --text-faint: #555;

  /* Pyöristykset */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-pill: 999px;

  /* Varjot */
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 12px 34px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 10px 30px rgba(255, 25, 25, 0.28);

  /* Sisältöleveys */
  --maxw: 1200px;

  --transition: 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Poppins', 'Inter', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Hienovarainen tunnelmavalo koko taustalle */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(820px 520px at 12% -5%, rgba(255, 25, 25, 0.07), transparent 60%),
    radial-gradient(720px 520px at 88% 12%, rgba(255, 25, 25, 0.05), transparent 60%);
}

::selection {
  background: var(--brand);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--brand-bright);
  outline-offset: 3px;
  border-radius: 4px;
}

img {
  max-width: 100%;
}

/* =========================================================
   Header
   ========================================================= */
.header {
  position: relative;
  text-align: center;
  padding: 76px 20px 84px;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(1100px 420px at 50% -15%, rgba(255, 70, 70, 0.55), transparent 62%),
    linear-gradient(165deg, #ff2020 0%, var(--brand-deep) 48%, var(--brand-darker) 100%);
}

/* Pehmeä valokeila */
.header::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 28% 38%, rgba(255, 255, 255, 0.14) 0%, transparent 45%),
    radial-gradient(circle at 80% 70%, rgba(0, 0, 0, 0.18) 0%, transparent 50%);
  pointer-events: none;
}

/* Sulava liukuma tummaan taustaan */
.header::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 130px;
  background: linear-gradient(to bottom, transparent, var(--bg));
  pointer-events: none;
}

.header-content {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
}

.brand-logo {
  width: 116px;
  height: 116px;
  border-radius: 50%;
  display: block;
  margin: 0 auto 20px;
  background: #0d0d0d;
  border: 3px solid rgba(255, 255, 255, 0.9);
  box-shadow:
    0 0 0 8px rgba(255, 255, 255, 0.08),
    0 14px 38px rgba(0, 0, 0, 0.45);
  transition: transform var(--transition);
}

.brand-logo:hover {
  transform: scale(1.04) rotate(-2deg);
}

.header h1 {
  margin: 0 0 14px;
  font-size: 3.25rem;
  font-weight: 800;
  letter-spacing: -1.5px;
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}

.subtitle {
  font-size: 1.18rem;
  margin: 0 auto 28px;
  max-width: 620px;
  opacity: 0.96;
  font-weight: 400;
}

.stats {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.stat-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 255, 255, 0.16);
  padding: 9px 18px;
  border-radius: var(--r-pill);
  font-size: 0.92rem;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}

.stat-item strong {
  font-weight: 700;
}

/* =========================================================
   Osiot
   ========================================================= */
.games-section {
  max-width: var(--maxw);
  margin: 64px auto;
  padding: 0 20px;
}

.section-header {
  text-align: center;
  margin-bottom: 38px;
}

.section-title {
  display: inline-block;
  font-size: 2.05rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
  margin-bottom: 10px;
}

/* Brändin korostusviiva otsikon alle */
.section-header .section-title::after {
  content: '';
  display: block;
  width: 64px;
  height: 4px;
  margin: 14px auto 0;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--brand), var(--brand-bright));
  box-shadow: 0 2px 10px var(--brand-glow);
}

.section-subtitle {
  color: var(--text-dim);
  font-size: 1rem;
  font-weight: 400;
  margin-top: 4px;
}

/* =========================================================
   Peliruudukko
   ========================================================= */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 26px;
}

.games-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 18px;
}

/* =========================================================
   Pelikortit
   ========================================================= */
.game-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 30px 24px 26px;
  text-align: center;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

/* Yläreunan korostuspalkki */
.game-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--brand), var(--brand-bright));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition);
}

.game-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-md), 0 0 0 1px var(--brand-tint);
  border-color: var(--brand);
}

.game-card:hover::before {
  transform: scaleX(1);
}

.game-card.featured {
  background:
    linear-gradient(180deg, rgba(255, 25, 25, 0.08), transparent 40%),
    linear-gradient(135deg, #1a1414 0%, #201919 100%);
  border-color: var(--brand);
  box-shadow: var(--shadow-md), 0 0 0 1px var(--brand-tint);
}

.game-card.featured::before {
  transform: scaleX(1);
  height: 5px;
}

/* Merkki / badge */
.badge {
  position: absolute;
  top: 14px;
  right: 14px;
  background: linear-gradient(135deg, var(--brand), var(--brand-bright));
  color: #fff;
  padding: 4px 12px;
  border-radius: var(--r-pill);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  box-shadow: 0 3px 12px var(--brand-glow);
  z-index: 2;
}

.badge.new {
  animation: pulse-badge 2.2s ease-in-out infinite;
}

@keyframes pulse-badge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.07); }
}

/* Kortin sisältö */
.game-icon {
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: 18px;
  margin: 0 auto 18px;
  display: block;
  background: #0a0a0a;
  border: 3px solid var(--brand);
  box-shadow: 0 6px 18px rgba(255, 25, 25, 0.22);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.game-card:hover .game-icon {
  transform: scale(1.08) rotate(-3deg);
  box-shadow: 0 10px 26px rgba(255, 25, 25, 0.42);
  border-color: #fff;
}

.game-card h3 {
  margin: 0 0 8px;
  font-size: 1.32rem;
  font-weight: 700;
  color: #fff;
}

.game-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0 0 18px;
  line-height: 1.55;
  min-height: 42px;
}

/* Korttien napit asettuvat alas tasaisesti */
.game-card .button-link {
  margin-top: auto;
}

.games-grid.compact .game-card {
  padding: 26px 18px 22px;
}

.games-grid.compact .game-card h3 {
  font-size: 1.08rem;
  margin-bottom: 16px;
}

.games-grid.compact .game-icon {
  width: 66px;
  height: 66px;
}

.games-grid.compact .game-desc {
  display: none;
}

/* =========================================================
   Napit
   ========================================================= */
.button-link {
  display: inline-block;
  background: linear-gradient(135deg, var(--brand), var(--brand-bright));
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  padding: 12px 28px;
  font-size: 0.98rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  box-shadow: 0 6px 16px rgba(255, 25, 25, 0.3);
  transition: transform var(--transition), box-shadow var(--transition);
}

/* Kiiltoanimaatio */
.button-link::before {
  content: '';
  position: absolute;
  top: 0;
  left: -120%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.28), transparent);
  transition: left 0.55s ease;
}

.button-link:hover::before {
  left: 120%;
}

.button-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(255, 25, 25, 0.5);
}

.button-link:active {
  transform: translateY(0);
}

/* =========================================================
   Jako-osio
   ========================================================= */
.share-container {
  max-width: 600px;
  margin: 72px auto 40px;
  padding: 36px 24px;
  text-align: center;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.share-title {
  display: block;
  margin-bottom: 22px;
  font-weight: 700;
  color: var(--brand);
  font-size: 1.15rem;
  letter-spacing: 0.2px;
}

.share-buttons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: var(--r-md);
  background: var(--surface-3);
  border: 1px solid var(--border);
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.share-btn img {
  width: 30px;
  height: 30px;
}

.share-btn:hover {
  transform: translateY(-3px);
  border-color: var(--brand);
  box-shadow: var(--shadow-glow);
}

.copy-link-btn {
  padding: 0 22px;
  height: 56px;
  border-radius: var(--r-md);
  border: none;
  background: linear-gradient(135deg, var(--brand), var(--brand-bright));
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.95rem;
  font-family: inherit;
  transition: transform var(--transition), box-shadow var(--transition);
}

.copy-link-btn:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-glow);
}

/* =========================================================
   Footer
   ========================================================= */
.footer {
  background: var(--surface-1);
  border-top: 1px solid var(--border);
  padding: 44px 20px;
  margin-top: 72px;
}

.footer-content {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.developer-info {
  display: flex;
  align-items: center;
  gap: 16px;
  text-align: left;
}

.developer-avatar {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 3px solid var(--brand);
  box-shadow: 0 6px 18px rgba(255, 25, 25, 0.3);
}

.developer-info h3 {
  margin: 0 0 4px;
  color: var(--brand);
  font-size: 1.2rem;
  font-weight: 700;
}

.developer-info p,
.developer-info .footer-text {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-link {
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
  transition: color var(--transition);
}

.footer-link:hover {
  color: var(--brand-bright);
  text-decoration: underline;
}

.footer-divider {
  color: var(--text-faint);
}

.footer-text {
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* =========================================================
   Palaute-osio
   ========================================================= */
.feedback-section {
  margin: 80px auto 24px;
  padding: 0 20px;
}

.feedback-section .container {
  max-width: 520px;
  margin: 0 auto;
}

.feedback-section .section-title {
  display: block;
  text-align: center;
  margin-bottom: 24px;
  font-size: 1.85rem;
}

.feedback-section .section-title::after {
  content: '';
  display: block;
  width: 64px;
  height: 4px;
  margin: 14px auto 0;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--brand), var(--brand-bright));
  box-shadow: 0 2px 10px var(--brand-glow);
}

.feedback-form {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  padding: 34px 28px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
}

.form-group select,
.form-group textarea {
  width: 100%;
  padding: 13px 14px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border);
  background: var(--surface-3);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-group select:hover,
.form-group textarea:hover {
  border-color: #3a3a3a;
}

.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-tint);
}

.form-group textarea {
  resize: vertical;
  min-height: 110px;
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--brand), var(--brand-bright));
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  padding: 14px 0;
  font-size: 1.08rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 6px 16px rgba(255, 25, 25, 0.3);
  transition: transform var(--transition), box-shadow var(--transition);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(255, 25, 25, 0.5);
}

.btn-primary:active {
  transform: translateY(0);
}

/* =========================================================
   Quiz-modal (säilytetään toiminta)
   ========================================================= */
.quiz-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.quiz-content {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  padding: 28px;
  max-width: 480px;
  width: 100%;
}

/* =========================================================
   Sisääntuloanimaatio
   ========================================================= */
@media (prefers-reduced-motion: no-preference) {
  .game-card {
    animation: fade-up 0.5s cubic-bezier(0.4, 0, 0.2, 1) both;
  }

  .games-grid .game-card:nth-child(2) { animation-delay: 0.05s; }
  .games-grid .game-card:nth-child(3) { animation-delay: 0.1s; }
  .games-grid .game-card:nth-child(4) { animation-delay: 0.15s; }
  .games-grid .game-card:nth-child(5) { animation-delay: 0.2s; }
  .games-grid .game-card:nth-child(6) { animation-delay: 0.25s; }

  @keyframes fade-up {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: translateY(0); }
  }
}

/* =========================================================
   Responsiivisuus
   ========================================================= */
@media (max-width: 768px) {
  .header {
    padding: 56px 18px 70px;
  }

  .brand-logo {
    width: 92px;
    height: 92px;
  }

  .header h1 {
    font-size: 2.25rem;
  }

  .subtitle {
    font-size: 1.02rem;
  }

  .stats {
    gap: 10px;
  }

  .stat-item {
    font-size: 0.84rem;
    padding: 7px 14px;
  }

  .games-section {
    margin: 48px auto;
  }

  .section-title {
    font-size: 1.7rem;
  }

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

  .games-grid.compact {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
  }

  .game-card {
    padding: 24px 18px;
  }

  .developer-info {
    flex-direction: column;
    text-align: center;
  }

  .footer-links {
    flex-direction: column;
    gap: 12px;
  }
}

@media (max-width: 480px) {
  .header {
    padding: 44px 16px 64px;
  }

  .header h1 {
    font-size: 1.9rem;
  }

  .games-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .games-grid.compact {
    grid-template-columns: repeat(2, 1fr);
  }

  .game-icon {
    width: 72px;
    height: 72px;
  }

  .button-link {
    padding: 11px 22px;
  }

  .share-container,
  .feedback-form {
    padding: 26px 18px;
  }

  .copy-link-btn {
    width: 100%;
  }
}
