@font-face {
  font-family: 'Nutino';
  src: url('/fonts/nutino.woff2') format('woff2');
  font-style: normal;
  font-display: swap;
}

:root {
  --primary-color: #a78bfa;
  --primary-soft: #8b5cf6;
  --accent-2: #22d3ee;
  --container-width: 1871px;
  --border-color: #272d4d;
  --bg-surface: #161a30;
  --bg-muted: #12162a;
  --bg-body: #0e1020;
  --text-color: #e9e9f6;
  --text-muted: #9a9cc4;
  --bg-hover: #232a49;
  --scrollbar-bg: #12152a;
  --scrollbar-thumb: #39406b;
  color-scheme: dark;
  --card-game-border-radius: 16px;
  --shadow-angle: 1px 2px 3px 1px #05060f80;
  --shadow-close: 0px 3px 5px 3px #05060f80;
  --shadow-mid: 0px 8px 18px 2px #05060f99;
  --shadow-hover: 0px 14px 28px 4px #05060fb3;
  --shadow-far: 0px 22px 34px 8px #05060f99;
  --glow-primary: 0 0 0 1px #8b5cf64d, 0 8px 28px -6px #8b5cf666;
  --accent-gradient: linear-gradient(135deg, #a78bfa 0%, #22d3ee 100%);
  --logo-gradient: linear-gradient(120deg, #4ade80 0%, #facc15 28%, #fb7185 52%, #c084fc 76%, #38bdf8 100%);
  --header-bg: rgba(14, 16, 32, 1);
  --footer-gradient: linear-gradient(to top, #161a30 0%, #0e1020 100%);
  --bg-card: #1a1f3a;
  --bg-card-hover: #232a49;
  --button-play-bg: #6d5ff8;
  --text-warning: #fbbf24;
  --text-danger: #f87171;
  --border-gradient: linear-gradient(90deg, #ff4f5e 0%, #ff932f 18%, #ffd94d 36%, #71cb46 54%, #4aa2e8 74%, #9a63c8 100%);
  --font-family: 'Nutino', sans-serif;
  --intent-accent: #5cffab;
  --intent-background-image: linear-gradient(285deg, #171d2e 20%, #1d5657 100%);
}

html {
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-bg);
  /* Chỉ html là vùng cuộn → scrollbar sát mép phải, không bị header che */
  overflow-x: hidden;
  /* Màu nền tảng đặt ở html (lớp dưới cùng) */
  background: var(--bg-body);
}

html,
body {
  margin: 0;
  width: 100%;
  color: var(--text-color);
  min-height: 100vh;
}

/* Lớp nền gradient cố định theo viewport — không cuộn theo nội dung, không repaint khi cuộn.
   QUAN TRỌNG: body KHÔNG được đặt background (để trong suốt) thì lớp này mới hiện ra. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(circle at top left, rgba(255, 79, 94, 0.18), transparent 24%), 
  radial-gradient(circle at top right, rgba(74, 162, 232, 0.18), transparent 26%), 
  radial-gradient(circle at 50% 0%, rgba(113, 203, 70, 0.12), transparent 28%),
  linear-gradient(180deg, var(--bg-body) 0%, var(--bg-body) 100%);
}

.site-header {
  position: fixed;
  width: 100%;
  left: 0;
  top: 0;
  z-index: 10;
  /* background: var(--header-bg); */
  /* box-shadow: var(--shadow-angle); */
  background: radial-gradient(circle at top left, rgba(255, 79, 94, 0.18), transparent 24%), radial-gradient(circle at top right, rgba(74, 162, 232, 0.18), transparent 26%), radial-gradient(circle at 50% 0%, rgba(113, 203, 70, 0.12), transparent 28%), linear-gradient(180deg, #101827 0%, #0d1420 100%);
}

/* Đường accent màu logo trên cùng header */
.site-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: var(--border-gradient);
}

.header-inner {
  max-width: var(--container-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.5rem 1rem 0.68rem 1rem;
  /* Mốc định vị cho nút search overlay lên danh sách lịch sử */
  position: relative;
}

/* Logo + tên gom thành một ô gọn (pill), không co lại */
.header-inner .logo {
  flex: 0 0 auto;
}

.logo {
  display: grid;
  grid-auto-flow: column;
  align-items: center;
  gap: 9px;
  /* padding: 5px 15px 5px 6px; */
  /* border-radius: 13px; */
  /* background: rgba(255, 255, 255, 0.05); */
  text-decoration: none;
  color: inherit;
  font-weight: 600;
}

.logo img {
  width: 40px;
  height: 40px;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.logo:hover img {
  transform: scale(1.08) rotate(-3deg);
}

.brand,
.header-title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
  background: var(--logo-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--primary-color);
  font-family: var(--font-family);
}

/* Nút search: overlay tròn nổi lên góc phải danh sách lịch sử */
.search-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-inner .search-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 6;
  background: rgba(20, 24, 44, 0.72);
  box-shadow: var(--shadow-angle);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.header-inner .search-btn:hover {
  background: rgba(35, 42, 73, 0.9);
  transform: translateY(-50%) scale(1.08);
}


.site-main {
  min-height: calc(100dvh - 56px);
  /* Header cao hơn do chứa lịch sử game trên cùng một hàng */
  margin-top: 86px;
}

/* Lịch sử game nằm cùng hàng với logo và search trong header */
.header-history {
  position: relative;
  flex: 1 1 auto;
  /* Cho phép co lại và scroll ngang thay vì đẩy nút search ra ngoài */
  min-width: 0;
}

.header-history .game-history-wrapper {
  position: relative;
}

/* Fade phải để danh sách mờ dần rồi chui xuống dưới nút search overlay */
.header-history::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 64px;
  pointer-events: none;
  /* background: linear-gradient(to right, rgba(13, 20, 32, 0), #0d1420 78%); */
  z-index: 2;
}

/* Bỏ padding dọc của danh sách khi nằm trong header để giữ header gọn */
.header-history .game-history-list {
  padding: 0;
  gap: 0.6rem;
}

.header-history .game-history-list li {
  width: 52px;
}

/* Item cuối chừa một ô để tách khỏi nút search overlay bên phải */
.header-history .game-history-list li:last-child {
  margin-right: calc(52px + 0.6rem);
}

/* Nút điều hướng khớp chiều cao thẻ game trong header */
.header-history .game-history-nav {
  height: 52px;
}

/* Dời mũi tên next vào trong để không trùng vị trí nút search overlay */
.header-history .game-history-nav-next {
  right: 46px;
}

/* Mobile: ẩn chữ "Oki Game", chỉ giữ icon logo để dành chỗ cho lịch sử */
@media (max-width: 640px) {
  .header-title {
    display: none;
  }

  .logo {
    padding-right: 5px;
  }
}

/* WebKit scrollbar */
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: var(--scrollbar-bg);
}

*::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-thumb);
  border-radius: 8px;
  border: 2px solid var(--scrollbar-bg);
}

.container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 16px;
}

.card {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-surface);
}

.btn {
  height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-muted);
  cursor: pointer;
}

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

.card-game,
.search-history-game {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--card-game-border-radius);
  overflow: hidden;
  background: var(--bg-muted);
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s ease-in-out;
  box-shadow: var(--shadow-mid);
}

.card-game:hover,
.search-history-game:hover {
  transform: translateY(-4px);
  /* box-shadow: var(--shadow-hover), var(--glow-primary); */
}

.card-game img,
.search-history-game img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
  border-radius: var(--card-game-border-radius);
  background: var(--bg-surface);
}

.card-game-title,
.search-history-title {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100%;
  margin: 0;
  padding: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.5), transparent);
  border-radius: var(--card-game-border-radius);
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
  text-align: center;
  overflow: hidden;
  box-sizing: border-box;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  font-family: var(--font-family);
}

.search-history-title {
  font-size: 11px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
  line-height: 1.4;
}

.card-game:hover .card-game-title,
.search-history-game:hover .search-history-title {
  opacity: 1;
}

/* Video preview khi hover (chỉ PC, kích hoạt qua JS thêm class is-previewing) */
.card-game-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--card-game-border-radius);
  background: var(--bg-surface);
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
  z-index: 1;
  pointer-events: none;
}

.card-game.is-previewing .card-game-video {
  opacity: 1;
}

/* Tiêu đề luôn nằm trên video */
.card-game-title {
  z-index: 2;
}

.menu-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(172px, 1fr));
  gap: 1rem;
  list-style: none;
  padding: 0;
}

.menu-item {
  /* background: var(--bg-card); */
  background: var(--intent-background-image);
  background-clip: padding-box;
  color: var(--intent-accent);
  box-shadow: var(--shadow-mid);
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  gap: 8px;
  font-size: 10px;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: var(--card-game-border-radius);
  border: 2px solid transparent;
  padding-right: 8px;
  line-height: 1.6;
  /* color: var(--text-muted); */
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease,
    transform 0.2s ease;
}

.menu-item:hover {
  border: 2px solid var(--intent-accent);
  /* border-color: var(--primary-soft); */
  color: var(--primary-color);
  transform: translateY(-2px);
}

.menu-title {
  flex: 1;
  font-family: var(--font-family);
  color: var(--intent-accent);
}

.game-about {
  /* background: var(--bg-card); */
  box-shadow: var(--shadow-mid);
  border-radius: var(--card-game-border-radius);
  padding: 1rem;
}

.article-content p,
.article-content li {
  color: var(--text-muted);
  margin-top: 0.5rem;
  font-size: 0.875rem;
}

.game-about-title {
  font-size: 12px;
  text-transform: uppercase;
  text-decoration: none;
}

.site-footer {
  position: relative;
  margin-top: 2rem;
  padding: 3rem 0 2.5rem;
  overflow: hidden;
}

/* ── Footer pixel art scene ── */
.footer-pixel-scene {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.footer-pixel-ground {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  height: 10px;
  opacity: 0.55;
}

.footer-pixel-tile {
  flex: 1;
  min-width: 0;
  height: 100%;
  background: #2d6a4f;
  border-top: 2px solid #40916c;
  box-shadow: inset 0 -2px 0 #1b4332;
}

.footer-pixel-tile:nth-child(even) {
  background: #40916c;
  border-top-color: #52b788;
}

.footer-pixel-tile:nth-child(3n) {
  background: #1b4332;
  border-top-color: #2d6a4f;
}

.footer-pixel-sprite {
  position: absolute;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  bottom: 10px;
  filter: drop-shadow(0 2px 4px rgba(5, 6, 15, 0.45));
}

.footer-pixel-sprite--coin {
  left: 4%;
  animation: pixel-bounce 2.4s ease-in-out infinite;
}

.footer-pixel-sprite--star {
  left: 14%;
  bottom: 48px;
  animation: pixel-twinkle 1.8s ease-in-out infinite;
}

.footer-pixel-sprite--heart {
  right: 6%;
  bottom: 36px;
  animation: pixel-float 3s ease-in-out infinite;
}

.footer-pixel-sprite--slime {
  left: 22%;
  animation: pixel-hop 2.8s ease-in-out infinite;
}

.footer-pixel-sprite--pad {
  right: 18%;
  bottom: 12px;
  animation: pixel-wiggle 4s ease-in-out infinite;
}

.footer-pixel-sprite--sparkle {
  top: 18%;
  right: 12%;
  bottom: auto;
  animation: pixel-twinkle 2.2s ease-in-out infinite 0.3s;
}

.footer-pixel-sprite--sparkle-2 {
  top: 32%;
  left: 8%;
  bottom: auto;
  animation: pixel-twinkle 1.6s ease-in-out infinite 0.8s;
}

.pad-btn--a {
  animation: pad-press-a 4s ease-in-out infinite;
}

.pad-btn--b {
  animation: pad-press-b 4s ease-in-out infinite 0.5s;
}

@keyframes pixel-bounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  30% { transform: translateY(-14px) rotate(-8deg); }
  50% { transform: translateY(-6px) rotate(4deg); }
  70% { transform: translateY(-10px) rotate(-4deg); }
}

@keyframes pixel-hop {
  0%, 100% { transform: translateY(0) scaleX(1); }
  15% { transform: translateY(0) scaleX(1.08) scaleY(0.92); }
  35% { transform: translateY(-16px) scaleX(0.95) scaleY(1.05); }
  55% { transform: translateY(0) scaleX(1.05) scaleY(0.95); }
  70% { transform: translateY(-8px) scaleX(1) scaleY(1); }
}

@keyframes pixel-float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-10px) scale(1.08); }
}

@keyframes pixel-twinkle {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.1); }
}

@keyframes pixel-wiggle {
  0%, 100% { transform: rotate(0deg) translateY(0); }
  25% { transform: rotate(-3deg) translateY(-2px); }
  75% { transform: rotate(3deg) translateY(-2px); }
}

@keyframes pad-press-a {
  0%, 100%, 70% { fill: #22d3ee; }
  75%, 85% { fill: #0891b2; }
}

@keyframes pad-press-b {
  0%, 100%, 40% { fill: #f87171; }
  45%, 55% { fill: #dc2626; }
}

@media (max-width: 767px) {
  .footer-pixel-sprite--slime,
  .footer-pixel-sprite--pad {
    display: none;
  }

  .footer-pixel-sprite--coin {
    left: 2%;
    width: 22px;
    height: 22px;
  }

  .footer-pixel-sprite--star {
    left: 18%;
    bottom: 36px;
    width: 18px;
    height: 18px;
  }

  .footer-pixel-sprite--heart {
    right: 4%;
    width: 20px;
    height: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .footer-pixel-sprite,
  .pad-btn--a,
  .pad-btn--b {
    animation: none;
  }
}

.footer-inner {
  position: relative;
  z-index: 1;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 1rem;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.footer-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
  color: var(--text-color);
}

.footer-heading {
  font-size: 0.875rem;
  font-weight: 600;
  margin: 0;
  color: var(--text-color);
  text-transform: uppercase;
}

.footer-text {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0;
}


.footer-link {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-link:hover {
  color: var(--text-color);
}

.footer-bottom {
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
  text-align: center;
}

.footer-copyright {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0;
}

.game-about-content {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.game-about-content p {
  line-height: 1.6;
}

.game-about-content a {
  color: var(--primary-color);
}

.game-about-content h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--text-color);
}

.button-exit {
  background: transparent;
  color: var(--text-danger);
  border: none;
  border-radius: 50%;
  display: none;
  border: 1px solid var(--text-danger);
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;

  @media (orientation: landscape) and (hover: none) and (pointer: coarse) {
    width: 28px;
    height: 28px;
  }
}

.is-mobile .button-exit {
  display: flex;
}

.is-hidden {
  display: none !important;
}

.game-about-header {
  margin-top: 0;
}

:where(h1) {
  margin-block: 0.67em;
  font-size: 2em;
}

/* Footer Styles */
.footer-container {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

@media (min-width: 768px) {
  .footer-container {
    flex-direction: row;
  }
}

.footer-left {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-brand {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: flex-end;
  gap: 0.5rem;
  text-decoration: none;
  font-weight: 700;
  color: var(--text-color);
}

@media (min-width: 768px) {
  .footer-brand {
    justify-content: flex-start;
  }
}

.footer-title-text {
  font-size: 1.25rem;
  text-transform: uppercase;
  font-weight: 900;
}

.footer-nav {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 0.875rem;
  gap: 0.5rem 1.5rem;
}

.footer-menu-link {
  color: var(--text-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-menu-link:hover {
  color: var(--primary-color);
}

.footer-copyright-text {
  text-align: center;
  font-size: 0.875rem;
}

@media (min-width: 768px) {
  .footer-copyright-text {
    text-align: left;
  }
}

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

@media (min-width: 768px) {
  .footer-right {
    align-items: flex-end;
  }
}

.footer-social {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

@media (min-width: 768px) {
  .footer-social {
    justify-content: flex-end;
  }
}

.footer-social-link {
  color: var(--text-muted);
  transition: color 0.2s ease;
  text-decoration: none;
}

.footer-social-link:hover {
  color: var(--primary-color);
}

.footer-social-icon {
  width: 1.25rem;
  height: 1.25rem;
}

/* Search Styles */
.search-portal {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  pointer-events: none;
  opacity: 0;
  /* visibility: hidden; */
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.search-portal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.search-portal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(8, 9, 20, 0.65);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.search-portal.is-open .search-portal-overlay {
  opacity: 1;
}

.search-portal-content {
  position: absolute;
  top: 8px;
  right: 8px;
  bottom: 8px;
  width: calc(100% - 16px);
  max-width: 680px;
  height: auto;
  background: var(--bg-surface);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(5, 6, 15, 0.5);
  opacity: 0;
  visibility: hidden;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.search-portal.is-open .search-portal-content {
  opacity: 1;
  visibility: visible;
}

.search-portal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  gap: 0.5rem;
  flex-shrink: 0;
}

.search-portal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: transparent;
  border-radius: 50%;
  color: var(--text-muted);
  cursor: pointer;
  border: 3px solid var(--border-color);
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.search-portal-close:hover {
  border-color: var(--primary-soft);
  color: var(--primary-color);
}

.search-portal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Search Input */
.search-input-wrapper {
  position: relative;
  width: 100%;
  flex: 1;
}

.search-input {
  width: 100%;
  height: 44px;
  padding: 0 44px 0 16px;
  border-radius: 22px;
  background: var(--bg-muted);
  color: var(--text-color);
  font-size: 16px;
  outline: none;
  border: 3px solid var(--border-color);
  transition: border-color 0.2s, background 0.2s;
  box-sizing: border-box;
  font-weight: 600;
}

.search-input:focus {
  border-color: var(--primary-soft);
  background: var(--bg-surface);
}

.search-input::placeholder {
  color: var(--text-muted);
  opacity: 0.5;
}

.search-input-icon {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
  z-index: 1;
}

.search-input-icon:hover {
  color: var(--text-color);
}

.search-input-icon svg {
  display: block;
}

/* Search Results */
.search-results {
  flex: 1;
  min-height: 0;
}

/* Empty State */
.search-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  text-align: center;
  min-height: 300px;
  color: var(--text-muted);
}

.search-empty-state svg {
  margin-bottom: 1rem;
  opacity: 0.5;
}

.search-empty-state p {
  margin: 0;
  font-size: 16px;
}

/* Loading State */
.search-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  gap: 1rem;
  min-height: 300px;
  color: var(--text-muted);
}

.search-loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.search-loading p {
  margin: 0;
  font-size: 14px;
}

/* Search History Grid */
.search-history-header {
  margin-bottom: 1rem;
}

.search-history-section-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-color);
}

.search-history-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1rem;
}

.search-history-placeholder {
  width: 100%;
  height: 100%;
  background: var(--bg-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 32px;
}

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

@media (max-width: 640px) {
  .search-portal-content {
    top: 8px;
    right: 8px;
    bottom: 8px;
    left: 8px;
    width: auto;
    max-width: none;
    border-radius: 12px;
  }

  .search-history-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
  }

  .search-history-section-title {
    font-size: 16px;
  }
}

.clear-icon {
  background-color: var(--bg-card);
  border-radius: 50%;
  padding: 4px;
}

/* Language Selector */
.language-selector {
  position: relative;
  display: inline-block;
}

.language-selector-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border: none;
  border-radius: 22px;
  background: transparent;
  color: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.language-selector-btn:hover {
  background: var(--bg-hover);
  border-color: var(--primary-color);
}

.language-selector-btn:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: var(--shadow-mid);
}

.language-selector-icon {
  display: flex;
  align-items: center;
  opacity: 0.8;
}

.language-selector-text {
  font-weight: 500;
  color: var(--text-muted);
}

.language-selector-arrow {
  display: flex;
  align-items: center;
  opacity: 0.7;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.language-selector-btn[aria-expanded="true"] .language-selector-arrow {
  transform: rotate(180deg);
}

.language-selector-popup {
  display: none;
  position: fixed;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-mid);
  z-index: 1000;
  min-width: 280px;
  max-width: 600px;
  max-height: 500px;
  transform-origin: top left;
  overflow: hidden;
}

.language-selector-popup.active {
  display: block;
}

.language-selector-list {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 0.25rem;
  padding: 0.75rem;
  overflow-y: auto;
  max-height: 500px;
}

/* Multi-column layout trên PC */
@media (min-width: 640px) {
  .language-selector-popup {
    min-width: 500px;
    max-width: 700px;
  }

  .language-selector-list {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.25rem;
  }
}

@media (min-width: 1024px) {
  .language-selector-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

.language-selector-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0.625rem 0.875rem;
  border: none;
  background: transparent;
  color: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s ease, transform 0.1s ease;
  font-family: inherit;
  text-align: left;
  width: 100%;
  gap: 0.5rem;
}

.language-selector-item:hover {
  background: var(--bg-hover);
}

.language-selector-item:active {
  transform: scale(0.98);
}

.language-selector-item:focus {
  outline: none;
  background: var(--bg-hover);
}

.language-selector-item.active {
  background: var(--bg-hover);
  font-weight: 600;
  color: var(--primary-color);
}

.language-selector-item-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.language-selector-item-check {
  display: flex;
  align-items: center;
  color: var(--primary-color);
  margin-left: auto;
  flex-shrink: 0;
  animation: checkIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.language-selector-item-flag {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

@keyframes checkIn {
  from {
    opacity: 0;
    transform: scale(0) rotate(-180deg);
  }

  to {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

/* Responsive */
@media (max-width: 640px) {
  .language-selector-popup {
    min-width: 280px;
    max-width: calc(100vw - 2rem);
    max-height: 400px;
  }

  .language-selector-list {
    grid-template-columns: repeat(1, 1fr);
    padding: 0.5rem;
    max-height: 400px;
  }

  .language-selector-item {
    padding: 0.65rem 0.75rem;
    font-size: 0.85rem;
  }

  .language-selector-item-flag {
    width: 18px;
    height: 18px;
  }
}

/* Ad Container Styles */
.ad-container {
  width: 100%;
}

.ad-container .adsbygoogle {
  width: 100%;
  display: block;
}

/* Ad Label Styles */
.ad-label {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

.is-mobile {
  display: none;
}

@media (max-width: 48rem) {
  .is-mobile {
    display: block;
  }
}

ins.adsbygoogle[data-ad-status="unfilled"] {
  display: none !important;
}

.ads-title1,
.ads-title2,
.ads-title3 {
  display: none !important;
}

.ads1:has(ins.adsbygoogle[data-ad-status="filled"]) .ads-title1 {
  display: block !important;
}

.ads2:has(ins.adsbygoogle[data-ad-status="filled"]) .ads-title2 {
  display: block !important;
}

.ads3:has(ins.adsbygoogle[data-ad-status="filled"]) .ads-title3 {
  display: block !important;
}

.ads:has(ins.adsbygoogle[data-ad-status="unfilled"]),
.ads1:has(ins.adsbygoogle[data-ad-status="unfilled"]),
.ads2:has(ins.adsbygoogle[data-ad-status="unfilled"]),
.ads3:has(ins.adsbygoogle[data-ad-status="unfilled"]) {
  display: none !important;
}