/* PlayLines.ru — тёплая тема (v6: шапка с паттерном, нелипкий хедер, центрированный заголовок игры) */
:root {
  --bg: #fff8e7;
  --card: #ffffff;
  --text: #2b2114;
  --muted: #8a7a63;
  --accent: #ef6c00;
  --accent-2: #d85f00;
  --amber: #ffab00;
  --amber-light: #ffcb80;
  --star: #ffab00;
  --line: #f2e3c9;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(230, 81, 0, .08), 0 6px 20px rgba(230, 81, 0, .08);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 18px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}
img { max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }
.wrap { max-width: 1400px; margin: 0 auto; padding: 0 20px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 8px; top: 8px; background: #fff; padding: 8px 12px; z-index: 100; border-radius: 8px; }

/* Шапка: тематический баннер с шариками (паттерн с shariki.win), без прилипания */
.site-head {
  padding: 14px 0 0;
  padding-top: calc(14px + env(safe-area-inset-top));
}
.head-card {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(120, 60, 0, .14);
}
.head-line {
  background: #fff;
  display: flex; align-items: center; gap: 20px;
  padding: 12px 24px; min-height: 76px;
}
.logo { display: flex; align-items: center; gap: 11px; cursor: pointer; flex: 0 0 auto; }
.logo-balls { display: inline-flex; align-items: center; gap: 4px; }
.logo-balls .b { border-radius: 50%; display: inline-block; box-shadow: inset -3px -4px 0 rgba(0, 0, 0, .13); transition: transform .2s; }
.b1 { width: 20px; height: 20px; background: #e5453a; }
.b2 { width: 25px; height: 25px; background: var(--amber); }
.b3 { width: 20px; height: 20px; background: #2f80ed; }
.logo:hover .b1 { transform: translateY(-3px); }
.logo:hover .b2 { transform: translateY(-5px); }
.logo:hover .b3 { transform: translateY(-3px); }
.logo-text { font-size: 30px; font-weight: 800; color: #3b2a12; letter-spacing: -.5px; white-space: nowrap; }
.logo-text b { color: var(--accent); }
.cats { display: flex; gap: 4px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.cats a {
  padding: 10px 17px; white-space: nowrap; border-radius: 999px;
  color: #3b2a12; font-weight: 600; font-size: 17px;
}
.cats a:hover { background: #fff3dc; color: var(--accent); }
.cats a.on { background: var(--accent); color: #fff; }
.rnd-btn {
  margin-left: auto; flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 8px;
  background: #ffefd0; color: var(--accent); border: 0; cursor: pointer;
  font: 600 16px/1 inherit; font-family: inherit; padding: 11px 17px; border-radius: 999px;
  transition: background .15s, transform .1s;
}
.rnd-btn:hover { background: #ffe3ae; }
.rnd-btn:active { transform: scale(.96); }
.rnd-btn svg { transition: transform .3s; }
.rnd-btn:hover svg { transform: rotate(180deg); }

/* Хиро и блоки */
.hero { text-align: center; padding: 34px 0 10px; }
.hero h1 { font-size: clamp(30px, 4.5vw, 46px); line-height: 1.15; margin: 0 0 14px; letter-spacing: -.6px; color: #3b2a12; }
.hero-sub { color: var(--muted); max-width: 840px; margin: 0 auto; font-size: 19px; }
.hero-cat { text-align: left; padding-top: 12px; }
.search-box { margin: 24px auto 8px; max-width: 560px; }
#gameSearch {
  width: 100%; padding: 15px 22px; font-size: 18px;
  border: 2px solid var(--amber-light); border-radius: 999px; background: var(--card);
  box-shadow: var(--shadow); outline: none; font-family: inherit; color: var(--text);
}
#gameSearch:focus { border-color: var(--accent); }
.block { margin: 34px 0; }
.block h2 {
  font-size: 26px; margin: 0 0 18px; letter-spacing: -.4px; color: #3b2a12;
  display: flex; align-items: center; gap: 12px;
}
.block h2::before {
  content: ''; width: 12px; height: 28px; border-radius: 6px;
  background: var(--amber); flex: 0 0 auto;
  box-shadow: 0 1px 3px rgba(230, 81, 0, .3);
}
.h-link { color: #3b2a12; }
.h-link:hover { color: var(--accent); }
.more { margin: 14px 0 0; font-size: 17px; }
.more a { font-weight: 600; }
.no-results { text-align: center; color: var(--muted); padding: 30px 0; font-size: 18px; }

/* Сетка карточек */
.grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
}
.grid-top { grid-template-columns: repeat(auto-fill, minmax(235px, 1fr)); }
.card {
  position: relative;
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 10px 28px rgba(230, 81, 0, .2); }
.card img { width: 100%; aspect-ratio: 230/200; object-fit: cover; display: block; }
.card-name {
  padding: 13px 12px 4px; font-weight: 700; font-size: 17px;
  color: var(--accent); line-height: 1.35; text-align: center;
}
.card-name:last-child { padding-bottom: 16px; }
.card:hover .card-name { text-decoration: underline; }
.card-meta { padding: 0 12px 14px; color: var(--muted); font-size: 15px; text-align: center; }
.card-meta::first-letter { color: var(--star); }
.card-big .card-name { font-size: 19px; }
.card[hidden] { display: none; }

/* Сердечко избранного */
.fav-btn {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255, 255, 255, .93); border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #d9c2a3; transition: transform .12s, color .15s;
  opacity: 0; box-shadow: 0 1px 4px rgba(120, 60, 0, .25);
}
.card:hover .fav-btn, .fav-btn.on { opacity: 1; }
.fav-btn:hover { transform: scale(1.15); color: #e5453a; }
.fav-btn.on { color: #e5453a; }
.fav-btn.on svg path { fill: #e5453a; }
@media (hover: none) { .fav-btn { opacity: 1; } }

/* Хлебные крошки */
.crumbs { padding: 16px 0 0; font-size: 16px; color: var(--muted); }
.crumbs span { margin: 0 7px; }
.crumbs b { font-weight: 600; }

/* Страница игры: центрированный заголовок без плашки */
.game-page { padding-bottom: 24px; }
.game-head {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  margin: 22px 0 18px; text-align: center;
}
.game-head h1 {
  font-size: clamp(28px, 4vw, 42px); margin: 0; letter-spacing: -.5px;
  color: #3b2a12;
}
.rating-widget { display: flex; align-items: center; gap: 12px; }
.stars { display: inline-flex; }
.star {
  background: none; border: 0; padding: 0 3px; font-size: 31px; line-height: 1;
  color: #e6d6ba; cursor: pointer; transition: transform .1s;
}
.star.lit { color: var(--star); }
.star:hover { transform: scale(1.15); }
.rating-widget.voted .star { cursor: default; }
.rating-widget.voted .star:hover { transform: none; }
.rating-info { color: var(--muted); font-size: 16px; }
.rating-info b { color: var(--text); font-size: 19px; }

/* Игровая область */
.game-stage {
  position: relative; margin: 0 auto; width: 100%;
  background: #ffffff; border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
}
.game-stage iframe, .game-stage .ruffle-host {
  position: absolute; left: 0; top: 0; border: 0;
  transform-origin: 0 0; background: #ffffff;
}
.game-poster {
  position: absolute; inset: 0; width: 100%; height: 100%;
  border: 0; padding: 0; cursor: pointer; background: #ffffff;
}
.game-poster img {
  width: 100%; height: 100%; object-fit: cover; opacity: .85; display: block;
}
.play-btn {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: inline-flex; align-items: center; gap: 12px;
  background: var(--accent); color: #fff; font-size: 24px; font-weight: 700;
  padding: 18px 40px; border-radius: 999px;
  box-shadow: 0 6px 24px rgba(239, 108, 0, .6);
  transition: transform .15s ease, background .15s;
}
.game-poster:hover .play-btn { transform: translate(-50%, -50%) scale(1.06); background: var(--accent-2); }

.game-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
  margin: 16px 0; justify-content: center;
}
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--accent); color: #fff; border: 0; cursor: pointer;
  font-size: 17px; font-weight: 700; padding: 13px 24px; border-radius: 999px;
  font-family: inherit; box-shadow: 0 2px 8px rgba(239, 108, 0, .3);
}
.btn:hover { background: var(--accent-2); color: #fff; }
.controls-hint { color: var(--muted); font-size: 16px; }

/* Псевдо-полноэкранный режим (iPhone/iPad и как fallback) */
body.fs-lock { overflow: hidden; }
.game-stage.pseudo-fs {
  position: fixed; inset: 0; z-index: 1000; max-width: none !important;
  width: 100vw; height: 100vh; height: 100dvh; border-radius: 0;
  aspect-ratio: auto !important; margin: 0;
}
.fs-close {
  position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 12px; z-index: 1002;
  background: rgba(60, 35, 5, .72); color: #fff; border: 0; border-radius: 999px;
  width: 48px; height: 48px; font-size: 24px; cursor: pointer; display: none;
}
.game-stage.pseudo-fs .fs-close, .game-stage:fullscreen .fs-close { display: block; }

/* Описание */
.game-descr {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 26px 32px; margin: 22px 0; overflow-wrap: break-word;
  font-size: 18px;
}
.game-descr h2, .game-descr h3 {
  margin: 22px 0 10px; font-size: 23px; letter-spacing: -.3px; color: #3b2a12;
}
.game-descr p { margin: 12px 0; }
.game-descr ul { margin: 12px 0; padding-left: 26px; }
.game-descr li::marker { color: var(--amber); }
.game-descr a { text-decoration: underline; }
.game-descr img { border-radius: 12px; }

/* Реклама */
.ad-box { margin: 24px auto; text-align: center; min-height: 0; }

/* SEO-текст */
.seo-text {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 26px 32px; margin: 36px 0; color: #57493a; font-size: 17px;
}
.seo-text h2 { margin-top: 0; font-size: 23px; color: #3b2a12; }
.seo-intro { margin: 24px 0 6px; padding: 20px 28px; font-size: 16.5px; }
.seo-intro p { margin: 8px 0; }

/* Подвал: оранжевая полоса */
.site-foot { margin-top: 40px; padding-bottom: 24px; background: none; border: 0; }
.foot-in {
  background: var(--accent); border-radius: var(--radius);
  padding: 22px 28px calc(22px + env(safe-area-inset-bottom));
  box-shadow: 0 2px 10px rgba(120, 60, 0, .2);
}
.foot-nav { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-bottom: 10px; }
.foot-nav a { font-size: 16px; color: #fff; font-weight: 600; }
.foot-nav a:hover { text-decoration: underline; color: #fff; }
.copy { color: rgba(255, 255, 255, .85); font-size: 15px; margin: 0; }

/* Мини-игра «Лопай шарики» (по клику на шапку) */
.pop-overlay {
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(255, 248, 231, .96);
  touch-action: none;
}
.pop-canvas { position: absolute; inset: 0; cursor: crosshair; }
.pop-hud {
  position: absolute; top: 0; left: 0; right: 0; z-index: 2;
  display: flex; justify-content: center; gap: 28px; align-items: center;
  padding: 14px 70px; font-size: 19px; color: #3b2a12; pointer-events: none;
}
.pop-hud b { color: var(--accent); font-size: 22px; }
#popTime {
  background: var(--accent); color: #fff; font-weight: 700;
  min-width: 52px; text-align: center; padding: 6px 12px; border-radius: 999px;
}
.pop-close {
  position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 12px; z-index: 3;
  background: rgba(60, 35, 5, .7); color: #fff; border: 0; border-radius: 999px;
  width: 46px; height: 46px; font-size: 22px; cursor: pointer;
}
.pop-end {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 2;
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 28px 36px; text-align: center; font-size: 20px; color: #3b2a12;
}
.pop-end b { color: var(--accent); }

/* Мобильная адаптация */
@media (max-width: 700px) {
  body { font-size: 17px; }
  .site-head { padding-top: calc(8px + env(safe-area-inset-top)); }
  .wrap { padding: 0 12px; }
  .head-line { flex-wrap: wrap; gap: 8px 12px; padding: 10px 14px; min-height: 62px; }
  .logo-text { font-size: 23px; }
  .b1, .b3 { width: 16px; height: 16px; }
  .b2 { width: 20px; height: 20px; }
  .cats { order: 3; width: 100%; }
  .cats a { font-size: 15.5px; padding: 8px 12px; }
  .rnd-btn { padding: 9px 12px; font-size: 15px; }
  .rnd-btn .rnd-label { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .grid-top { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .card-name { font-size: 15.5px; padding-top: 10px; }
  .card-meta { font-size: 14px; }
  .game-descr { padding: 18px 20px; font-size: 17px; }
  .play-btn { font-size: 19px; padding: 14px 28px; }
  .hero-sub { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
