:root {
  --cream: #fff6e6;
  --cream-deep: #ffecc9;
  --card: #fffdf8;
  --ink: #2d1b4e;
  --ink-soft: #5b4a78;
  --lime: #b8e64a;
  --lime-deep: #8fc02a;
  --coral: #ff6f5e;
  --coral-deep: #e04f3f;
  --line: #2d1b4e;
  --radius: 22px;
  --shadow: 0 6px 0 var(--ink);
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Trebuchet MS", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--cream);
  background-image: radial-gradient(rgba(45, 27, 78, 0.07) 1.5px, transparent 1.5px);
  background-size: 22px 22px;
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

main {
  flex: 1;
}

a {
  color: inherit;
}

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

.container {
  width: min(1120px, 100% - 32px);
  margin-inline: auto;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

:focus-visible {
  outline: 3px solid var(--coral);
  outline-offset: 3px;
}

/* ---------- Üst bar ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 246, 230, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 2px solid rgba(45, 27, 78, 0.1);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  font-size: 19px;
  text-decoration: none;
  letter-spacing: -0.3px;
}

.logo svg {
  width: 34px;
  height: 34px;
  flex: none;
  transition: transform 0.2s;
}

.logo:hover svg {
  transform: rotate(-10deg) scale(1.08);
}

.site-nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

/* ---------- Dil seçici ---------- */
.lang-switch {
  display: inline-flex;
  flex: none;
  padding: 3px;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 999px;
}

.lang-switch button {
  min-width: 40px;
  padding: 5px 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.5px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}

.lang-switch button:hover {
  background: var(--lime);
}

.lang-switch button[aria-pressed="true"] {
  color: var(--cream);
  background: var(--ink);
}

.site-nav a {
  padding: 8px 14px;
  font-weight: 800;
  font-size: 15px;
  text-decoration: none;
  border-radius: 999px;
}

.site-nav a:hover {
  background: var(--lime);
}

/* ---------- Düğmeler ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font: inherit;
  font-weight: 900;
  font-size: 17px;
  color: var(--ink);
  text-decoration: none;
  background: var(--card);
  border: 3px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 4px 0 var(--ink);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 var(--ink);
}

.btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--ink);
}

.btn-primary {
  background: var(--coral);
  color: #fff;
}

.btn-lime {
  background: var(--lime);
}

.btn-small {
  padding: 8px 16px;
  font-size: 15px;
}

/* ---------- Hero ---------- */
.hero {
  padding: 56px 0 40px;
}

.hero .container {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  align-items: center;
  gap: 40px;
}

.eyebrow {
  display: inline-block;
  margin: 0 0 18px;
  padding: 6px 14px;
  font-weight: 800;
  font-size: 14px;
  background: var(--lime);
  border: 2px solid var(--line);
  border-radius: 999px;
  transform: rotate(-2deg);
}

.hero h1 {
  margin: 0;
  font-size: clamp(48px, 9vw, 104px);
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: -2px;
}

.hero h1 .accent {
  color: var(--coral);
  -webkit-text-stroke: 0;
  text-shadow: 4px 4px 0 var(--ink);
}

.lead {
  max-width: 30em;
  margin: 22px 0 28px;
  font-size: clamp(17px, 2.2vw, 20px);
  color: var(--ink-soft);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.hero-art {
  position: relative;
}

.hero-art svg {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 8px 0 rgba(45, 27, 78, 0.9));
}

.hero-art .bounce {
  animation: bounce 1.6s ease-in-out infinite;
  transform-origin: 50% 100%;
  transform-box: fill-box;
}

.hero-art .twinkle {
  animation: twinkle 2.4s ease-in-out infinite;
  transform-origin: center;
  transform-box: fill-box;
}

.hero-art .twinkle:nth-of-type(2) {
  animation-delay: 0.8s;
}

.hero-art .twinkle:nth-of-type(3) {
  animation-delay: 1.6s;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-18px); }
}

@keyframes twinkle {
  0%, 100% { transform: scale(1) rotate(0); }
  50% { transform: scale(1.18) rotate(12deg); }
}

@media (prefers-reduced-motion: reduce) {
  .hero-art .bounce,
  .hero-art .twinkle {
    animation: none;
  }

  html {
    scroll-behavior: auto;
  }
}

/* ---------- Bölümler ---------- */
.section {
  padding: 40px 0 56px;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}

.section h2 {
  margin: 0;
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 900;
  letter-spacing: -1px;
}

.section h2 .dot {
  color: var(--coral);
}

/* ---------- Arama ve filtre ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.search {
  position: relative;
  flex: 1 1 260px;
  max-width: 420px;
}

.search svg {
  position: absolute;
  left: 16px;
  top: 50%;
  width: 20px;
  height: 20px;
  transform: translateY(-50%);
  pointer-events: none;
}

.search input {
  width: 100%;
  padding: 12px 16px 12px 46px;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  background: var(--card);
  border: 3px solid var(--line);
  border-radius: 999px;
}

.search input::placeholder {
  color: #9a8bb3;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 8px 16px;
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
  background: transparent;
  border: 2px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}

.chip:hover {
  background: var(--cream-deep);
}

.chip[aria-pressed="true"] {
  background: var(--ink);
  color: var(--cream);
}

.result-count {
  margin: 0 0 18px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-soft);
}

/* ---------- Oyun kartları ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.game-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: var(--card);
  border: 3px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.15s;
}

.game-card:hover {
  transform: translateY(-4px) rotate(-0.5deg);
}

.thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10;
  background: var(--lime);
  border-bottom: 3px solid var(--line);
}

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

.thumb .letter {
  display: grid;
  place-items: center;
  height: 100%;
  font-size: 72px;
  font-weight: 900;
}

.thumb .live {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--lime);
  border: 2px solid var(--line);
  border-radius: 999px;
}

.card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  padding: 18px 20px 20px;
}

.category {
  align-self: flex-start;
  font-size: 13px;
  font-weight: 900;
  color: var(--coral-deep);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.game-card h3 {
  margin: 0;
  font-size: 26px;
  font-weight: 900;
  line-height: 1.1;
}

.game-card p {
  margin: 0;
  color: var(--ink-soft);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tags li {
  padding: 3px 10px;
  font-size: 13px;
  font-weight: 800;
  background: var(--cream-deep);
  border-radius: 999px;
}

.game-card .btn {
  margin-top: auto;
  align-self: flex-start;
}

/* ---------- Boş durum / hata ---------- */
.empty {
  padding: 40px 24px;
  text-align: center;
  background: var(--card);
  border: 3px dashed var(--line);
  border-radius: var(--radius);
}

.empty .big {
  font-size: 48px;
  line-height: 1;
}

.empty h3 {
  margin: 12px 0 6px;
  font-size: 24px;
}

.empty p {
  margin: 0 0 18px;
  color: var(--ink-soft);
}

/* ---------- Nasıl oynanır ---------- */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  position: relative;
  padding: 22px 20px 20px;
  background: var(--card);
  border: 3px solid var(--line);
  border-radius: var(--radius);
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: 12px;
  font-weight: 900;
  font-size: 20px;
  background: var(--lime);
  border: 3px solid var(--line);
  border-radius: 50%;
}

.steps li:nth-child(even)::before {
  background: var(--coral);
  color: #fff;
}

.steps h3 {
  margin: 0 0 6px;
  font-size: 19px;
}

.steps p {
  margin: 0;
  color: var(--ink-soft);
}

kbd {
  display: inline-block;
  min-width: 28px;
  padding: 1px 8px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--line);
  border-bottom-width: 4px;
  border-radius: 8px;
}

/* ---------- Alt bilgi ---------- */
.site-footer {
  padding: 26px 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--cream);
  background: var(--ink);
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}

/* ---------- Oynama sayfası ---------- */
.play-page {
  padding: 28px 0 56px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  font-weight: 800;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

.play-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.play-head h1 {
  margin: 4px 0 0;
  font-size: clamp(36px, 6vw, 60px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -1px;
}

.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: calc(100vh - 140px);
  margin-inline: auto;
  overflow: hidden;
  background: var(--ink);
  border: 3px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stage iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.stage .exit-fs {
  display: none;
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
}

.stage:fullscreen,
.stage.pseudo-fs {
  max-height: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.stage:fullscreen {
  width: 100%;
  height: 100%;
}

/* iPhone gibi gerçek tam ekranı desteklemeyen cihazlar için */
.stage.pseudo-fs {
  position: fixed;
  inset: 0;
  z-index: 100;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
}

.stage.pseudo-fs .exit-fs {
  display: inline-flex;
}

body.no-scroll {
  overflow: hidden;
}

.play-hint {
  margin: 12px 0 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-soft);
}

.play-info {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
  margin-top: 28px;
}

.panel {
  padding: 22px 22px 20px;
  background: var(--card);
  border: 3px solid var(--line);
  border-radius: var(--radius);
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 24px;
  font-weight: 900;
}

.panel p {
  margin: 0;
  color: var(--ink-soft);
}

.controls-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.controls-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

.controls-list .keys {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-width: 150px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
}

.touch-note {
  margin-top: 14px !important;
  padding: 10px 14px;
  font-weight: 700;
  background: var(--cream-deep);
  border-radius: 14px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

/* ---------- Mobil ---------- */
@media (max-width: 820px) {
  .hero {
    padding-top: 32px;
  }

  .hero .container {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .hero-art {
    max-width: 460px;
    margin-inline: auto;
  }

  .play-info {
    grid-template-columns: 1fr;
  }
}

/* Dar ekranda: üstte logo + dil, altta menü */
@media (max-width: 560px) {
  .site-header .container {
    flex-wrap: wrap;
    row-gap: 2px;
    padding: 8px 0 6px;
  }

  .lang-switch {
    margin-left: auto;
  }

  .site-nav {
    order: 3;
    width: 100%;
    margin-left: 0;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .logo span {
    font-size: 17px;
  }

  .site-nav a {
    padding: 8px 10px;
    font-size: 14px;
  }

  .hero h1 {
    letter-spacing: -1px;
  }

  .hero-actions .btn {
    flex: 1 1 100%;
  }

  .search {
    max-width: none;
  }

  .controls-list .keys {
    min-width: 0;
  }
}

/* ---------- Katalog portalı (kompakt başlık + oyun ızgarası) ---------- */
.container.wide {
  width: min(1280px, 100% - 32px);
}

.hero.hero-compact {
  padding: 22px 0 6px;
}

.hero-compact .container {
  grid-template-columns: 1fr auto;
  gap: 24px;
}

.hero-compact .eyebrow {
  margin-bottom: 10px;
  font-size: 13px;
}

.hero-compact h1 {
  font-size: clamp(30px, 4.6vw, 56px);
  line-height: 1.02;
  letter-spacing: -1px;
}

.hero-compact h1 .accent {
  text-shadow: 3px 3px 0 var(--ink);
}

.hero-compact h1 .accent-lime {
  color: var(--lime-deep);
}

.hero-compact .lead {
  margin: 10px 0 0;
  font-size: clamp(15px, 1.6vw, 18px);
}

.hero-compact .hero-art {
  width: 210px;
}

.catalog {
  padding-top: 18px;
}

.catalog-panel {
  padding: clamp(16px, 2.4vw, 28px);
  background: var(--card);
  border: 3px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.catalog .section-head {
  align-items: baseline;
  margin-bottom: 14px;
}

.catalog .result-count {
  margin: 0;
}

.catalog .toolbar {
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  margin-bottom: 22px;
}

.catalog .search {
  flex: none;
  max-width: 560px;
}

.catalog .search input {
  padding-top: 14px;
  padding-bottom: 14px;
  font-size: 17px;
  background: var(--cream);
}

.filters {
  display: grid;
  gap: 10px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.filter-label {
  flex: none;
  min-width: 92px;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--ink-soft);
}

.filter-group .chips {
  min-width: 0;
}

.grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.thumb {
  aspect-ratio: 16 / 10;
}

.tags .tag-collection {
  background: var(--lime);
}

@media (max-width: 1000px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }
}

@media (max-width: 820px) {
  .hero-compact .container {
    grid-template-columns: 1fr;
  }

  .hero-compact .hero-art {
    display: none;
  }
}

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

  /* Çok sayıda çip olursa yatay kaydırılır, sayfa taşmaz */
  .filter-group {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .filter-group .chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .chip {
    flex: none;
  }

  .catalog-panel {
    border-radius: 22px;
  }
}

/* ---------- Oyun çerçevesi: oyun bazında oran ve mobil yükseklik ---------- */
.stage {
  aspect-ratio: var(--stage-ar, 16 / 9);
}

/* Dar ekranda 16:9 çok basık kalır; games.json'daki mobileHeight kullanılır */
@media (max-width: 700px) {
  .stage.has-mobile-h {
    aspect-ratio: auto;
    height: clamp(480px, calc(100vh - 24px), var(--stage-mobile-h));
    max-height: none;
  }

  /* Tam ekranda ve sayfayı kaplayan görünümde tüm ekranı kullan */
  .stage.has-mobile-h.pseudo-fs {
    height: 100%;
  }
}

.stage.has-mobile-h:fullscreen {
  height: 100%;
}

/* ---------- Mobil taşma düzeltmesi ----------
   Büyük doğal genişlikli kapak görselleri (ör. 1200px SVG/PNG) ızgara sütununu
   genişletip sayfayı daraltıyordu. Sütunlar minmax(0, 1fr), kapsayıcılar min-width: 0;
   kapak görseli kutusuna mutlak yerleşir, doğal genişliği yerleşime katılmaz. */
.container,
.catalog,
.catalog-panel,
.section-head,
.toolbar,
.search,
.filters,
.filter-group,
.hero-text,
.play-info,
.panel {
  min-width: 0;
}

.search input {
  min-width: 0;
  max-width: 100%;
}

.grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid > li,
.game-card {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.thumb {
  position: relative;
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.thumb img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb .live {
  z-index: 1;
}

.hero .container,
.hero-compact .container {
  grid-template-columns: minmax(0, 1fr) auto;
}

.play-info {
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
}

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

@media (max-width: 820px) {
  .hero .container,
  .hero-compact .container,
  .play-info {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 600px) {
  .grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.hidden {
  display: none !important;
}
