:root {
  color-scheme: light;
  --font-family: "Outfit", system-ui, -apple-system, sans-serif;
  font-family: var(--font-family);

  /* Modern Palette - Light */
  --bg-color: #f8fafc;
  --text-main: #0f172a;
  --text-title: #334155;
  --text-muted: #64748b;
  --primary: #0ea5e9;
  /* Sky blue */
  --primary-dark: #0284c7;
  --accent: #8b5cf6;
  /* Violet */
  --success: #10b981;

  --surface: rgba(255, 255, 255, 0.7);
  --surface-hover: rgba(255, 255, 255, 0.9);
  --border: rgba(148, 163, 184, 0.4);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
  --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);

  --gradient-bg: radial-gradient(at 0% 0%, hsla(253, 16%, 7%, 1) 0, transparent 50%),
    radial-gradient(at 50% 0%, hsla(225, 39%, 30%, 1) 0, transparent 50%),
    radial-gradient(at 100% 0%, hsla(339, 49%, 30%, 1) 0, transparent 50%);
  --page-bg: #f0f4f8;
  --blob-1: #e0f2fe;
  --blob-2: #f3e8ff;

  /* Hover tints */
  --card-hover-bg: linear-gradient(135deg, rgba(14, 165, 233, 0.08), rgba(139, 92, 246, 0.08));
}

html.theme-dark {
  color-scheme: dark;
  --bg-color: #0f172a;
  --text-main: #f1f5f9;
  --text-title: #e2e8f0;
  --text-muted: #94a3b8;
  --primary: #38bdf8;
  --primary-dark: #0ea5e9;
  --accent: #a78bfa;

  --surface: rgba(30, 41, 59, 0.7);
  --surface-hover: rgba(30, 41, 59, 0.9);
  --border: rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
  --card-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);

  --page-bg: #020617;
  --blob-1: #1e293b;
  --blob-2: #172554;

  /* Dark theme hover tint slightly stronger for contrast */
  --card-hover-bg: linear-gradient(135deg, rgba(56, 189, 248, 0.14), rgba(167, 139, 250, 0.14));
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--page-bg);
  background-image:
    radial-gradient(circle at 15% 50%, var(--blob-1) 0%, transparent 25%),
    radial-gradient(circle at 85% 30%, var(--blob-2) 0%, transparent 25%);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease;
}

/* Glassmorphism Utilities */
.glass {
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  box-shadow: var(--glass-shadow);
}

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

/* Header */
header.hero {
  position: relative;
  z-index: 100;
  transition: padding 0.3s ease;
}

.hero-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  max-width: 1600px;
  margin: 0 auto;
  padding: 1rem clamp(1rem, 5vw, 4rem) 0.75rem;
  width: 100%;
}

header.hero.scrolled {
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

header.hero.scrolled .hero-inner {
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.hero-brand {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.hero-brand > a {
  flex-shrink: 0;
}

.logo {
  width: 65px;
  height: 65px;
  border-radius: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.logo:hover {
  transform: rotate(-5deg) scale(1.05);
}

.hero-text h1 {
  margin: 0;
  font-size: clamp(1rem, 1.8vw, 1.35rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #334155;
}

html.theme-dark .hero-text h1 {
  color: #f1f5f9;
}

.hero-text p {
  margin: 0.25rem 0 0;
  padding: 0.25rem 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
}

.hero-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
}

.hero-user {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.hero-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.hero-nav a,
.hero-nav button.linklike,
.hero-user button.linklike {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: color 0.2s;
  white-space: nowrap;
}

.hero-nav a:hover,
.hero-nav button.linklike:hover,
.hero-user button.linklike:hover {
  color: var(--primary);
}

.logout-btn,
.login-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.welcome-user {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
}

/* Burger button — hidden on desktop/tablet */
.burger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  flex-shrink: 0;
  transition: background 0.2s;
}

.burger-btn:hover {
  background: var(--border);
}

.burger-bar {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-main);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
  transform-origin: center;
}

.burger-btn[aria-expanded="true"] .burger-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.burger-btn[aria-expanded="true"] .burger-bar:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.burger-btn[aria-expanded="true"] .burger-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 1024px) {
  .hero-inner {
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-start;
  }

  .hero-brand {
    flex: 1;
    min-width: 0;
  }

  .hero-text {
    min-width: 0;
    overflow: hidden;
  }

  .hero-text h1 {
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .hero-actions {
    flex-basis: 100%;
    justify-content: flex-end;
    gap: 1rem;
  }

  .hero-nav {
    gap: 0.75rem;
    flex-wrap: wrap;
  }

  .hero-nav a,
  .hero-nav button.linklike {
    font-size: 0.8rem;
  }
}

/* Main Layout */
main {
  flex: 1;
  padding: 0.25rem clamp(1rem, 5vw, 4rem);
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
}

section {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.welcome-text {
  text-align: left;
  color: #b8860b;
  font-size: 1rem;
  font-weight: 500;
  margin: 0;
  padding: 0.25rem 0 0 1ch;
}

.welcome-text-mobile {
  display: none;
}

.welcome-divider {
  border: none;
  border-top: 2px solid #1e40af;
  margin: 1rem 0;
}

html.theme-dark .welcome-divider {
  border-top-color: #001f5b;
}

/* Filter Bar */
.filter-bar {
  display: flex;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem;
  flex-wrap: wrap;
}

.filter-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 99px;
  padding: 0.4rem 1.1rem;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.filter-pill:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.filter-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.no-favourites-msg {
  text-align: center;
  color: var(--text-muted);
  padding: 3rem 1rem;
  font-size: 1rem;
}

/* Grid */
.games-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  padding: 0.5rem;
}

@media (max-width: 1024px) {
  .games-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .games-grid {
    grid-template-columns: 1fr;
  }
}

/* Game Card */
.game-card {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Visible card shadow in light mode for definition */
html:not(.theme-dark) .game-card {
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08), 0 1px 3px rgba(15, 23, 42, 0.06);
}

.game-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px -5px rgba(0, 0, 0, 0.15);
  border-color: var(--primary);
  background: var(--card-hover-bg), var(--surface-hover);
}

.game-card:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--primary);
}

.game-card .thumb {
  position: relative;
  padding-top: 62.5%; /* 16:10 ratio — reliable cross-browser including Safari */
  overflow: hidden;
}

.game-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease, opacity 0.3s ease;
  display: block;
}

/* Layered images: grayscale default, color on hover */
.game-card .thumb .grayscale,
.game-card .thumb .color {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
}

.game-card .thumb .color {
  opacity: 0;
}

.game-card:hover .thumb img {
  transform: scale(1.1);
}

.game-card:hover .thumb .color,
.game-card:focus-visible .thumb .color {
  opacity: 1;
}

.game-card:hover .thumb .grayscale,
.game-card:focus-visible .thumb .grayscale {
  opacity: 0;
}

.game-card .thumb .play {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(15, 23, 42, 0.3);
  display: grid;
  place-items: center;
  transition: background 0.3s ease;
}

.game-card:hover .thumb .play {
  background: rgba(15, 23, 42, 0.5);
}

.game-card .thumb .play .bubble {
  padding: 0.6rem 1.4rem;
  background: var(--primary);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  color: #fff;
  font-family: var(--font-family);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.game-card:hover .thumb .play .bubble {
  transform: scale(1.05);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.game-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: white;
  padding: 0.35rem 0.85rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  z-index: 2;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.launching-soon-banner {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, rgba(24, 119, 242, 0.88), rgba(10, 60, 140, 0.88));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
  text-align: center;
  padding: 0.45rem 0.75rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  z-index: 3;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.game-card .info {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.game-card h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-title);
}

.game-card p.desc {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.game-card:hover p.desc {
  -webkit-line-clamp: unset;
  overflow: visible;
}

/* Touch devices (tablets/phones) — no hover, always show full description */
@media (hover: none) {
  .game-card p.desc {
    -webkit-line-clamp: unset;
    overflow: visible;
  }
}

.info .meta {
  margin-top: auto;
  padding-top: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.info .meta span {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.info .meta .lang [aria-hidden="true"] {
  position: relative;
  top: 1px;
  line-height: 1;
}

.fav-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
transition: color 0.2s ease, transform 0.2s ease;
}

.fav-btn:hover {
  color: #e11d48;
  transform: scale(1.2);
}

.fav-btn.fav-active {
  color: #e11d48;
}

/* Footer */
.site-footer {
  margin-top: auto;
  padding: 1rem clamp(1rem, 5vw, 4rem);
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.footer-inner {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.footer-brand {
  font-weight: 600;
  color: var(--text-title);
  white-space: nowrap;
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  justify-content: flex-end;
}

.site-footer a,
.site-footer button.linklike {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.2s;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.site-footer a:hover,
.site-footer button.linklike:hover {
  color: var(--primary);
}

.footer-imprint {
  max-width: 1600px;
  margin: 0.75rem auto 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.6;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem 2rem;
}

.footer-imprint-col {
  min-width: 0;
}


.footer-imprint-col:not(:last-child) {
  border-right: 1px solid var(--border);
  padding-right: 2rem;
}

.footer-imprint-col:not(:first-child) {
  padding-left: 0;
}

.footer-imprint strong {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--text-title);
}

.footer-imprint address {
  font-style: normal;
  margin: 0.25rem 0;
}

.footer-imprint p {
  margin: 0.25rem 0;
}

.footer-imprint a {
  color: var(--text-muted);
  text-decoration: none;
}

.footer-imprint a:hover {
  color: var(--primary);
}

/* Theme Toggle */
.theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-main);
  width: 33px;
  height: 33px;
  min-width: 33px;
  min-height: 33px;
  flex-shrink: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0;
}

.theme-toggle:hover {
  background: var(--surface-hover);
  border-color: var(--text-muted);
  transform: rotate(15deg);
}

.theme-toggle .icon {
  font-size: 1rem;
  display: block;
}

/* Buttons */
.primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border: none;
  border-radius: 99px;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
  transition: all 0.2s ease;
}

.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(14, 165, 233, 0.4);
}

.secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-main);
  border-radius: 99px;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.secondary:hover {
  background: var(--surface-hover);
  border-color: var(--text-muted);
}

/* Switch-game confirm modal */
.confirm-modal {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 2000;
  display: none;
  place-items: center;
  padding: 1rem;
}

.confirm-modal.open {
  display: grid;
}

.confirm-backdrop {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fadeIn 0.2s ease;
}

.confirm-dialog {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border-radius: 20px;
  box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.35), 0 0 0 1px var(--border);
  padding: 2rem 1.75rem 1.5rem;
  text-align: center;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.confirm-icon {
  margin-bottom: 0.75rem;
  line-height: 1;
  display: flex;
  justify-content: center;
}

.confirm-icon img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.confirm-title {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}

.confirm-message {
  margin: 0 0 1.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.confirm-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.confirm-actions button {
  flex: 1;
  max-width: 140px;
}

/* Cookie Modal */
.cookie-modal {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 1000;
  display: none;
  padding: 1rem;
}

.cookie-modal.open {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
}

.cookie-backdrop {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  -webkit-animation: fadeIn 0.3s ease;
  animation: fadeIn 0.3s ease;
}

.cookie-dialog {
  position: relative;
  width: 100%;
  max-width: 640px;
  background: var(--surface);
  border-radius: 28px;
  box-shadow: 0 40px 80px -12px rgba(0, 0, 0, 0.3), 0 0 0 1px var(--border);
  display: flex;
  flex-direction: column;
  max-height: 85vh;
  overflow: hidden;
  -webkit-animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.cookie-head {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
}

.cookie-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  letter-spacing: -0.02em;
}

.cookie-body {
  padding: 2rem;
  overflow-y: auto;
}

.cookie-intro {
  margin-top: 0;
  color: var(--text-muted);
  line-height: 1.6;
  font-size: 1rem;
  margin-bottom: 1.5rem;
}

.cookie-row {
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 16px;
  margin-bottom: 1rem;
  transition: background 0.2s ease;
}

.cookie-row-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.cookie-row:hover {
  background: rgba(255, 255, 255, 0.08);
}

.cookie-row:last-child {
  margin-bottom: 0;
}

.cookie-row label {
  font-weight: 700;
  display: block;
  margin-bottom: 0.35rem;
  font-size: 1.05rem;
}

.cookie-row-info {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--primary);
  font-size: 1rem;
  padding: 0 0.2rem;
  vertical-align: middle;
  line-height: 1;
}

.cookie-row p {
  margin: 0.5rem 0 0;
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.cookie-actions {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
/* Flex gap fallback: vertical spacing between .left and .right in column layout */
.cookie-actions .left {
  margin-bottom: 1rem;
}
/* Flex gap fallback: horizontal spacing between action buttons */
.cookie-actions .right > * + * {
  margin-left: 0.75rem;
}

@media (min-width: 640px) {
  .cookie-actions {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
  .cookie-actions .left {
    margin-bottom: 0;
  }
  .cookie-actions .right {
    display: flex;
  }
}

.close-x {
  background: rgba(15, 23, 42, 0.05);
  border: none;
  width: 36px;
  height: 36px;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  font-size: 1.25rem;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.2s;
}

.close-x:hover {
  background: var(--surface-hover);
  color: var(--text-main);
  transform: rotate(90deg);
}

/* Modern Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 32px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border);
  transition: .3s cubic-bezier(0.4, 0.0, 0.2, 1);
  border-radius: 34px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.slider:before {
  position: absolute;
  content: "";
  height: 24px;
  width: 24px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .3s cubic-bezier(0.4, 0.0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

input:checked+.slider {
  background-color: var(--success);
}

input:checked+.slider:before {
  transform: translateX(20px);
}

/* Always on badge */
.badge.on {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.2);
  padding: 0.35rem 0.75rem;
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* Age Banner */
.age-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  padding: 1rem clamp(1rem, 5vw, 4rem);
  z-index: 900;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
  font-size: 0.9rem;
}

.age-banner,
.cookie-bar {
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.2s ease;
}

/* Shared 3-column bar layout for age & cookie bars */
.bar-inner {
  display: grid;
  grid-template-columns: 40px 1fr 380px;
  align-items: center;
  gap: 1rem;
  width: 100%;
  height: 100%;
}

.bar-inner > :first-child {
  display: flex;
  justify-content: center;
}

.bar-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: flex-end;
}

.bar-actions button {
  min-width: 130px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.age-badge {
  background: var(--text-main);
  color: var(--bg-color);
  font-weight: 800;
  padding: 0.2rem 0.4rem;
  border-radius: 6px;
  font-size: 0.75rem;
  white-space: nowrap;
}

/* Cookie preferences bar */
.cookie-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  padding: 1rem clamp(1rem, 5vw, 4rem);
  z-index: 901;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
  font-size: 0.9rem;
}

.cookie-bar-badge {
  background: var(--primary);
  color: #fff;
  padding: 0.4rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

/* Animations */
@-webkit-keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@-webkit-keyframes slideUp {
  from {
    opacity: 0;
    -webkit-transform: translateY(20px);
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    -webkit-transform: translateY(0);
    transform: translateY(0);
  }
}
@keyframes slideUp {
  from {
    opacity: 0;
    -webkit-transform: translateY(20px);
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    -webkit-transform: translateY(0);
    transform: translateY(0);
  }
}

.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Game Player - Split View Layout */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Playing mode: game area + sidebar */
body.playing-mode main {
  flex-direction: row;
  padding: 0;
}

body.playing-mode header.hero {
  padding: 0;
}

body.playing-mode .hero-inner {
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
  padding-left: 0;
  padding-right: 0;
}

/* Games sidebar when playing - positioned on the right */
#games-view {
  transition: all 0.3s ease;
}

body.playing-mode #games-view {
  order: 2; /* Move sidebar to the right */
  width: 280px;
  min-width: 280px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  border-left: 1px solid var(--border);
  background: var(--surface);
  padding: 0.5rem;
}

/* Game player on the left */
body.playing-mode #game-player {
  order: 1;
}


body.playing-mode .welcome-text,
body.playing-mode .welcome-divider {
  display: none;
}

body.playing-mode .games-grid {
  grid-template-columns: 1fr;
  gap: 0.75rem;
  padding: 0.25rem;
}

/* Compact card style in sidebar */
body.playing-mode .game-card {
  border-radius: 12px;
}

body.playing-mode .game-card .thumb {
  padding-top: 56.25%; /* 16:9 ratio — reliable cross-browser including Safari */
}

body.playing-mode .game-card .info {
  padding: 0.75rem;
  gap: 0.25rem;
}

body.playing-mode .game-card h3 {
  font-size: 0.95rem;
}

body.playing-mode .game-card p.desc {
  display: none;
}

body.playing-mode .game-card .meta {
  padding-top: 0.5rem;
  font-size: 0.75rem;
}

body.playing-mode .game-card .meta .lang {
  display: none;
}

body.playing-mode .game-badge {
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.2rem 0.5rem;
  font-size: 0.65rem;
}

body.playing-mode .game-card .thumb .play,
body.playing-mode .game-badge {
  display: none;
}

/* Compact footer in playing mode */
body.playing-mode .site-footer {
  padding: 0.75rem clamp(1rem, 5vw, 4rem);
}

body.playing-mode .footer-inner {
  gap: 0.5rem;
}

body.playing-mode .site-footer a,
body.playing-mode .site-footer button.linklike {
  font-size: 0.95rem;
}

body.playing-mode .footer-brand {
  font-size: 1rem;
}

body.playing-mode .footer-imprint {
  display: none;
}

/* Sidebar hidden state */
body.sidebar-hidden #games-view {
  display: none;
}

/* Hide currently playing game in sidebar */
body.playing-mode .game-card.active-game,
body.playing-mode .game-card[aria-hidden="true"] {
  display: none !important;
}

#game-player {
  display: none;
  flex-direction: column;
  flex: 1;
  width: 100%;
  animation: fadeIn 0.3s ease;
}

#game-player.active {
  display: flex;
}

.player-controls {
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.player-controls h2 {
  color: #f1f5f9;
}

.player-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: #f1f5f9;
}

.player-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #f1f5f9;
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

/* Full view mode */
#game-player.fullview {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 1000;
  background: #0b1120;
}

#game-player.fullview .player-controls {
  padding: 0.75rem 1.25rem;
}

#game-player.fullview .game-frame-container {
  padding: 0.5rem;
}

#game-player.fullview .game-frame {
  border-radius: 12px;
}

body.fullview-mode {
  overflow: hidden;
}

body.fullview-mode #games-view {
  display: none;
}

.game-frame {
  flex: 1;
  width: 100%;
  border: none;
  background: #000;
  min-height: 500px;
  overflow: auto;
}

/* Responsive: hide sidebar on small screens when playing */
@media (max-width: 768px) {
  body.playing-mode #games-view {
    display: none;
  }

  #sidebar-toggle {
    display: none;
  }
}

/* Tablet bar layout */
@media (min-width: 641px) and (max-width: 1024px) {
  .bar-inner {
    grid-template-columns: 40px 1fr auto;
  }

  .bar-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
  }

  .bar-actions button {
    min-width: 120px;
    width: 100%;
  }

  .game-card p.desc {
    -webkit-line-clamp: unset;
    overflow: visible;
  }
}

/* Mobile footer */
@media (max-width: 640px) {
  .footer-inner {
    flex-direction: column-reverse;
    align-items: center;
    gap: 0.75rem;
    text-align: center;
  }

  .footer-right {
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
  }

  .footer-links {
    justify-content: center;
    gap: 0.5rem 1.25rem;
  }

  .site-footer a,
  .site-footer button.linklike {
    font-size: 0.85rem;
  }

  .welcome-text:not(.welcome-text-mobile) {
    display: none;
  }

  .welcome-text-mobile {
    display: block;
    font-size: 0.8rem;
  }

  .game-card h3 {
    font-size: 1rem;
  }

  .game-card p.desc {
    font-size: 0.8rem;
    -webkit-line-clamp: unset;
    overflow: visible;
  }

  .footer-imprint {
    grid-template-columns: 1fr;
  }

  .footer-imprint-col:not(:last-child) {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding-right: 0;
    padding-bottom: 0.75rem;
    margin-bottom: 0.25rem;
  }

  .bar-inner {
    grid-template-columns: 40px 1fr;
    grid-template-rows: auto auto;
  }

  .bar-inner .bar-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .bar-inner .bar-actions {
    align-items: stretch;
  }

  .bar-actions button {
    min-width: 0;
    flex: 1;
    white-space: nowrap;
    font-size: 0.75rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }

  /* Compact cookie modal */
  .cookie-dialog {
    border-radius: 16px;
    max-height: 90vh;
  }

  .cookie-head {
    padding: 0.6rem 0.875rem;
  }

  .cookie-title {
    font-size: 0.875rem;
  }

  .close-x {
    width: 28px;
    height: 28px;
    font-size: 1rem;
  }

  .cookie-body {
    padding: 0.6rem 0.875rem;
  }

  .cookie-intro {
    font-size: 0.72rem;
    margin-bottom: 0.6rem;
    line-height: 1.4;
  }

  .cookie-row {
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.4rem;
    border-radius: 10px;
  }

  .cookie-row p {
    display: none;
    font-size: 0.72rem;
    line-height: 1.4;
  }

  .cookie-row.expanded p {
    display: block;
    margin-top: 0.4rem;
  }

  .cookie-row label {
    font-size: 0.8rem;
    margin-bottom: 0;
  }

  .cookie-row-info {
    display: inline;
    font-size: 0.8rem;
  }

  .cookie-actions {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
  }

  .cookie-actions .left {
    font-size: 0.72rem;
    margin-bottom: 0.5rem;
  }

  .cookie-actions button {
    font-size: 0.75rem;
    padding: 0.4rem 0.75rem;
  }

  .cookie-actions .right > * + * {
    margin-left: 0.5rem;
  }

  .cookie-caption {
    font-size: 0.72rem;
    line-height: 1.4;
    margin-top: 0.5rem;
  }

  .switch {
    width: 40px;
    height: 24px;
  }

  .slider:before {
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
  }

  input:checked + .slider:before {
    transform: translateX(16px);
  }

  .badge.on {
    font-size: 0.7rem;
    padding: 0.2rem 0.45rem;
  }
}

/* Mobile burger nav */
@media (max-width: 640px) {
  .logo {
    width: 42px;
    height: 42px;
    border-radius: 10px;
  }

  .burger-btn {
    display: flex;
  }

  .hero-inner {
    align-items: center;
  }

  .hero-actions {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.5rem 0 0.75rem;
    border-top: 1px solid var(--border);
  }

  .hero-actions.is-open {
    display: flex;
  }

  .hero-user {
    padding: 0.5rem 0 0.75rem;
    justify-content: flex-start;
    border-bottom: 1px solid var(--border);
  }

  .hero-nav {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }

  .hero-nav a,
  .hero-nav button.linklike {
    padding: 0.65rem 0;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border);
    width: 100%;
    text-align: left;
  }

  .hero-nav a:last-child,
  .hero-nav button.linklike:last-child {
    border-bottom: none;
  }

  .hero-text p {
    font-size: 0.75rem;
  }
}

/* Loading overlay for iframe */
.game-loading-overlay {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  background: var(--bg-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  z-index: 10;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.game-loading-overlay.active {
  opacity: 1;
  visibility: visible;
}

.loading-text {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-muted);
}

.loading-bar-container {
  width: 200px;
  height: 4px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.loading-bar {
  height: 100%;
  width: 30%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 4px;
  animation: loadingSlide 1.2s ease-in-out infinite;
}

@keyframes loadingSlide {
  0% {
    transform: translateX(-100%);
  }
  50% {
    transform: translateX(250%);
  }
  100% {
    transform: translateX(-100%);
  }
}

/* Make game player container relative for overlay positioning */
.game-frame-container {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.game-frame-container .game-frame {
  flex: 1;
}
