/* ================================================================
   smartgames.css — OyinBar Smart Games Pages
   Подключается в /smartgames/*.html как ../css/smartgames.css
================================================================ */

/* ── TOKENS ── */
:root {
  --accent:      #4fc3f7;
  --accent-glow: rgba(79,195,247,0.22);
  --accent-dim:  rgba(79,195,247,0.12);
  --gold:        #f0b429;
  --r:  10px;
  --rl: 16px;
  --rx: 20px;
  --tr: .22s ease;
}

[data-theme="light"] {
  --bg:     #f0f4f8;
  --bg2:    #e4eaf2;
  --card:   #ffffff;
  --cardh:  #f7fafd;
  --t1:     #1a2332;
  --t2:     #4a5d75;
  --tm:     #8fa3bb;
  --b:      rgba(30,60,100,0.10);
  --ba:     rgba(79,195,247,0.45);
  --sh:     0 2px 16px rgba(30,60,100,.09);
  --shh:    0 8px 32px rgba(30,60,100,.16);
  --hbg:    rgba(240,244,248,.94);
  --badge-bg:   rgba(79,195,247,0.12);
  --badge-text: #1a7aab;
}

[data-theme="dark"] {
  --bg:     #0f1117;
  --bg2:    #161b26;
  --card:   #1c2333;
  --cardh:  #222d42;
  --t1:     #e8eaf0;
  --t2:     #8b9ab5;
  --tm:     #4a5568;
  --b:      rgba(255,255,255,0.07);
  --ba:     rgba(79,195,247,0.3);
  --sh:     0 2px 18px rgba(0,0,0,.35);
  --shh:    0 8px 36px rgba(0,0,0,.5);
  --hbg:    rgba(15,17,23,.94);
  --badge-bg:   rgba(79,195,247,0.15);
  --badge-text: #4fc3f7;
}

/* ── RESET ── */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0;}
html{scroll-behavior:smooth;}
body{font-family:'Noto Sans',sans-serif;background:var(--bg);color:var(--t1);min-height:100vh;overflow-x:hidden;transition:background var(--tr),color var(--tr);}

/* ── HEADER ── */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--hbg);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--b);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  font-family: 'Rajdhani', sans-serif;
  font-size: 24px;
  font-weight: 700;
  text-decoration: none;
  color: var(--t1);
  letter-spacing: 2px;
  flex-shrink: 0;
}
.logo span { color: var(--accent); }

/* Breadcrumb in header */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--tm);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}
.breadcrumb a { color: var(--tm); text-decoration: none; transition: color var(--tr); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span:last-child { color: var(--t2); overflow: hidden; text-overflow: ellipsis; }

.header-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.theme-toggle {
  width: 38px; height: 38px;
  border-radius: 8px;
  border: 1px solid var(--b);
  background: var(--card);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: var(--t2);
  transition: all var(--tr);
}
.theme-toggle:hover { border-color: var(--ba); color: var(--accent); }

.fullscreen-btn-header {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border-radius: 7px;
  border: 1px solid var(--ba);
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 13px; font-weight: 600;
  font-family: inherit; cursor: pointer;
  transition: all var(--tr);
}
.fullscreen-btn-header:hover { background: var(--accent); color: #0f1117; }

@media(max-width:600px){
  .breadcrumb { display: none; }
  .fullscreen-btn-header { display: none; }
}

/* ── MAIN WRAP ── */
.game-page-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

/* ── GAME HEADER ── */
.game-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.game-page-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.game-emoji-badge {
  width: 64px; height: 64px;
  border-radius: var(--rl);
  background: var(--card);
  border: 1px solid var(--b);
  display: flex; align-items: center; justify-content: center;
  font-size: 36px;
  box-shadow: var(--sh);
  flex-shrink: 0;
}

.game-page-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: clamp(22px, 4vw, 34px);
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--t1);
  line-height: 1.1;
}

.game-page-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 13px;
  color: var(--tm);
  flex-wrap: wrap;
}

.meta-badge {
  padding: 2px 10px;
  border-radius: 20px;
  background: var(--badge-bg);
  color: var(--badge-text);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .7px;
  text-transform: uppercase;
}

.meta-sep { opacity: .4; }

/* Difficulty dots */
.diff-dots::before { content: ''; }
.diff-dots {
  display: inline-flex;
  gap: 3px;
  vertical-align: middle;
}

/* Built via JS */
.diff-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--b);
  display: inline-block;
}
.diff-dot.on { background: var(--accent); }

/* ── IFRAME SECTION ── */
.iframe-section {
  margin-bottom: 28px;
}

.iframe-wrapper {
  width: 100%;
  background: #000;
  border-radius: var(--rl);
  overflow: hidden;
  border: 1px solid var(--b);
  box-shadow: var(--shh);
  position: relative;
  padding-bottom: 56.25%; /* 16:9 */
}

.iframe-wrapper iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: none;
}

@media(max-width:600px){
  .iframe-wrapper { padding-bottom: 90%; }
}

/* ── CONTENT GRID ── */
.content-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 24px;
  align-items: start;
}

@media(max-width:860px){
  .content-grid { grid-template-columns: 1fr; }
  .game-sidebar { order: -1; }
}

/* ── ARTICLE ── */
.game-article {}

/* Quick facts */
.quick-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 28px;
}

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

.qf-item {
  background: var(--card);
  border: 1px solid var(--b);
  border-radius: var(--rl);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-shadow: var(--sh);
}

.qf-icon { font-size: 22px; flex-shrink: 0; margin-top: 2px; }
.qf-label { font-size: 11px; color: var(--tm); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 3px; }
.qf-value { font-size: 14px; color: var(--t1); font-weight: 500; line-height: 1.4; }

/* Article sections */
.article-section {
  background: var(--card);
  border: 1px solid var(--b);
  border-radius: var(--rl);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--sh);
}

.article-section h2 {
  font-family: 'Rajdhani', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--t1);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--accent-dim);
  letter-spacing: .5px;
}

.article-section p {
  font-size: 14.5px;
  color: var(--t2);
  line-height: 1.75;
  margin-bottom: 12px;
}

.article-section p:last-child { margin-bottom: 0; }

.article-section ul {
  padding-left: 20px;
  margin-bottom: 12px;
}

.article-section li {
  font-size: 14px;
  color: var(--t2);
  line-height: 1.65;
  margin-bottom: 8px;
}

.article-section strong { color: var(--t1); font-weight: 600; }

/* Tips grid */
.tips-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

.tip-card {
  background: var(--bg2);
  border: 1px solid var(--b);
  border-radius: var(--r);
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.tip-num {
  font-family: 'Rajdhani', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  opacity: .5;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 2px;
}

.tip-card strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--t1);
  margin-bottom: 4px;
}

.tip-card p {
  font-size: 12.5px;
  color: var(--t2);
  line-height: 1.5;
  margin: 0;
}

/* FAQ */
.faq-section h2 { margin-bottom: 16px; }

.faq-item {
  border: 1px solid var(--b);
  border-radius: var(--r);
  margin-bottom: 8px;
  overflow: hidden;
  transition: border-color var(--tr);
}

.faq-item:hover { border-color: var(--ba); }
.faq-item[open] { border-color: var(--ba); }

.faq-q {
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--t1);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--bg2);
  transition: background var(--tr);
}

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

.faq-q::after {
  content: '+';
  font-size: 20px;
  color: var(--tm);
  flex-shrink: 0;
  transition: transform var(--tr);
}

details[open] .faq-q::after { transform: rotate(45deg); color: var(--accent); }
details[open] .faq-q { background: var(--cardh); }

.faq-a {
  padding: 14px 16px;
  font-size: 13.5px;
  color: var(--t2);
  line-height: 1.7;
  border-top: 1px solid var(--b);
  margin: 0;
}

/* ── SIDEBAR ── */
.game-sidebar { position: sticky; top: 80px; }

.sidebar-play-card {
  background: linear-gradient(135deg, var(--accent-dim), rgba(79,195,247,0.05));
  border: 1px solid var(--ba);
  border-radius: var(--rl);
  padding: 20px;
  text-align: center;
  margin-bottom: 14px;
  box-shadow: var(--sh);
}

.sidebar-emoji { font-size: 44px; margin-bottom: 10px; }
.sidebar-play-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--t1);
  margin-bottom: 14px;
  letter-spacing: .5px;
}

.play-now-btn {
  width: 100%;
  padding: 12px 0;
  background: var(--accent);
  color: #0f1117;
  font-family: 'Rajdhani', sans-serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--tr);
  box-shadow: 0 0 20px var(--accent-glow);
}
.play-now-btn:hover { transform: translateY(-2px); box-shadow: 0 0 32px var(--accent-glow); }

/* only show on mobile/tablet */
@media(min-width:860px){ .sidebar-play-card { display: none; } }

.sidebar-block {
  background: var(--card);
  border: 1px solid var(--b);
  border-radius: var(--rl);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--sh);
}

.sidebar-block-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--tm);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--b);
}

.info-rows {}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--b);
  font-size: 13px;
}
.info-row:last-child { border-bottom: none; padding-bottom: 0; }

.info-row-label { color: var(--tm); }
.info-row-value { color: var(--t1); font-weight: 500; }
.info-row-value.accent { color: var(--accent); font-weight: 600; }

/* Related games */
.related-list { display: flex; flex-direction: column; gap: 8px; }

.rel-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: background var(--tr);
  cursor: pointer;
}
.rel-item:hover { background: var(--cardh); }

.rel-thumb {
  width: 40px; height: 40px;
  border-radius: 8px;
  background: var(--bg2);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.rel-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--t1);
  line-height: 1.3;
}

.rel-cat {
  font-size: 11px;
  color: var(--tm);
  margin-top: 2px;
}

.back-to-brain {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: var(--r);
  border: 1px solid var(--b);
  background: var(--card);
  color: var(--t2);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all var(--tr);
  width: 100%;
  justify-content: center;
  box-shadow: var(--sh);
}
.back-to-brain:hover { border-color: var(--ba); color: var(--accent); }

/* ── FOOTER ── */
footer {
  border-top: 1px solid var(--b);
  padding: 28px 20px;
  text-align: center;
}
.footer-inner { max-width: 1100px; margin: 0 auto; }
.footer-logo {
  font-family: 'Rajdhani', sans-serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 2px;
  margin-bottom: 8px;
  color: var(--t1);
}
.footer-logo span { color: var(--accent); }
.footer-nav {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.footer-nav a { color: var(--t2); text-decoration: none; font-size: 13px; transition: color var(--tr); }
.footer-nav a:hover { color: var(--accent); }
.footer-text { font-size: 12px; color: var(--tm); }

/* ── ANIMATIONS ── */
@keyframes fadeInUp { from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:none} }

@media(prefers-reduced-motion:reduce){ *{animation:none!important;transition-duration:.01ms!important;} }

/* =========================================
   FLOATING BACK BUTTON
========================================= */
.floating-back-btn {
  position: fixed;
  bottom: 30px;
  left: 30px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-surface, #ffffff);
  color: var(--text-main, #111111);
  padding: 12px 24px;
  border-radius: 50px; /* Сопақша (pill) пішін */
  font-family: 'Noto Sans', sans-serif;
  font-weight: 600;
  font-size: 16px;
  text-decoration: none;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(128, 128, 128, 0.1);
  transition: all 0.3s ease;
  backdrop-filter: blur(10px); /* Заманауи шыны эффектісі */
}

/* Тінтуірді апарғандағы эффект (Hover) */
.floating-back-btn:hover {
  transform: translateY(-4px); /* Сәл жоғары көтеріледі */
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
  color: #0288d1; /* Акцент түсіне өзгереді */
}

/* ТҮНГІ РЕЖИМ (Dark Mode) ҮШІН */
[data-theme="dark"] .floating-back-btn {
  background-color: rgba(30, 30, 30, 0.9);
  color: #f5f5f5;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .floating-back-btn:hover {
  color: #29b6f6;
}

/* МОБИЛЬДІ ҚҰРЫЛҒЫЛАРҒА БЕЙІМДЕЛУ (Телефондар) */
@media (max-width: 768px) {
  .floating-back-btn {
    bottom: 20px;
    left: 50%; /* Ортаға қою */
    transform: translateX(-50%); 
    padding: 10px 20px;
    font-size: 15px;
    /* Телефонда iframe толық экран болғанда кедергі жасамау үшін 
       аздап мөлдірлеу жасауға болады */
    background-color: rgba(255, 255, 255, 0.95); 
  }
  
  [data-theme="dark"] .floating-back-btn {
    background-color: rgba(30, 30, 30, 0.95);
  }

  .floating-back-btn:hover {
    transform: translate(-50%, -2px);
  }
}

/* =========================================
   MOBILE ADAPTATION FIXES
========================================= */

@media (max-width: 992px) {
    .game-sidebar{
        position: relative;
        margin-bottom: 80px;
    }
}

@media (max-width: 992px) {
  /* 1. Сайдбар мен негізгі контенттің бір-біріне мінуін тоқтату */
  .content-grid {
    display: flex;
    flex-direction: column; /* Сайдбарды мазмұнның астына жібереміз */
    gap: 20px;
  }

  .game-article {
    width: 100%; /* Мақала толық енді алады */
  }

  .game-sidebar {
    width: 100%; /* Сайдбар да толық енді алады */
    min-width: unset;
    border-left: none;
    border-top: 1px solid rgba(128, 128, 128, 0.1); /* Астына түскенде жоғарыдан сызық қосамыз */
    padding-top: 20px;
  }

  /* 2. Сайдбардағы артық элементті жасыру (тек мобилкада) */
  /* Өйткені ойын жоғарыда тұр, сайдбардағы "Ойнау" картасы мобилкада керек емес */
  .sidebar-play-card {
    display: none;
  }
}

@media (max-width: 768px) {
  /* 3. Floating Back Button түзеу */
  .floating-back-btn {
    bottom: 15px;
    left: 20px;
    transform: none; /* Ортадан сол жаққа жылжытамыз, экраннан шығып кетпеуі үшін */
    padding: 10px 16px;
    font-size: 14px;
    max-width: fit-content;
    white-space: nowrap;
    box-sizing: border-box;
  }

  /* Егер батырма бәрібір "выползать" етсе, мынаны қолдан: */
  .floating-back-btn span {
    display: none; /* Мәтінді жасырып, тек иконканы қалдыру (орын үнемдеу) */
  }
  
  .floating-back-btn {
    border-radius: 50%; /* Дөңгелек батырма */
    width: 50px;
    height: 50px;
    justify-content: center;
    padding: 0;
  }
}