/* ============================================
   taparcade.xyz — Playful Cartoon Bubble Theme
   Font: Nunito (Google Fonts)
   Colors: Cream #fff8e7, Coral #ff6b6b,
           Teal #4ecdc4, Yellow #ffd93d
   ============================================ */

/* Fonts loaded via <link> in HTML */

/* ---------- CSS Variables ---------- */
:root {
  --cream: #fff8e7;
  --coral: #ff6b6b;
  --coral-light: #ff8e8e;
  --coral-dark: #e05555;
  --teal: #4ecdc4;
  --teal-light: #7eddd7;
  --teal-dark: #3ab0a8;
  --yellow: #ffd93d;
  --yellow-light: #ffe680;
  --yellow-dark: #f0c020;
  --pink: #ff6b9d;
  --purple: #a66cff;
  --orange: #ff9f43;
  --blue: #45b7d1;
  --green: #51cf66;
  --white: #ffffff;
  --dark: #2d3436;
  --gray: #636e72;
  --light-gray: #dfe6e9;
  --bg: var(--cream);
  --card-bg: var(--white);
  --text: var(--dark);
  --text-light: var(--gray);
  --shadow-sm: 0 2px 8px rgba(255,107,107,0.12);
  --shadow: 0 6px 24px rgba(255,107,107,0.18);
  --shadow-lg: 0 12px 40px rgba(255,107,107,0.22);
  --radius-sm: 12px;
  --radius: 20px;
  --radius-lg: 28px;
  --radius-xl: 40px;
  --radius-pill: 9999px;
  --nav-height: 72px;
  --header-height: 64px;
  --font: 'Nunito', 'Segoe UI', system-ui, sans-serif;
  --transition: 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---------- Reset & Base ---------- */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
html{scroll-behavior:smooth;font-size:16px;overflow-x:hidden;width:100%;max-width:100%}
body{
  font-family:var(--font);
  background:var(--bg);
  color:var(--text);
  line-height:1.6;
  -webkit-font-smoothing:antialiased;
  overflow-x:hidden;
  width:100%;
  max-width:100%;
}
img{max-width:100%;display:block}
a{text-decoration:none;color:inherit}
ul{list-style:none}
button,input{font-family:var(--font);font-size:1rem}
button{cursor:pointer;border:none;background:none}
.container{max-width:1200px;width:100%;margin:0 auto;padding:0 16px}
:is(h1,h2,h3,h4,p,span,a,div){word-break:break-word;overflow-wrap:break-word}
.section-title{
  font-size:1.4rem;
  font-weight:800;
  margin-bottom:16px;
  display:flex;
  align-items:center;
  gap:8px;
  color:var(--dark)
}
.section-title .emoji{font-size:1.3rem}

/* ---------- Header ---------- */
.header{
  position:sticky;
  top:0;
  z-index:100;
  background:rgba(255,248,231,0.92);
  backdrop-filter:blur(12px);
  -webkit-backdrop-filter:blur(12px);
  padding:10px 16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  border-bottom:2px solid rgba(255,107,107,0.08)
}
.header-logo{
  display:flex;
  align-items:center;
  gap:8px;
  font-size:1.3rem;
  font-weight:900;
  color:var(--coral);
  white-space:nowrap
}
.header-logo .logo-icon{
  width:36px;
  height:36px;
  background:linear-gradient(135deg,var(--coral),var(--yellow));
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:1.2rem;
  color:#fff;
  flex-shrink:0
}
.header-search{
  flex:1;
  max-width:400px;
  position:relative
}
.header-search input{
  width:100%;
  padding:10px 16px 10px 40px;
  border:2px solid transparent;
  border-radius:var(--radius-pill);
  background:var(--white);
  font-size:0.9rem;
  transition:var(--transition);
  box-shadow:var(--shadow-sm)
}
.header-search input:focus{
  outline:none;
  border-color:var(--coral);
  box-shadow:0 0 0 4px rgba(255,107,107,0.15)
}
.header-search .search-icon{
  position:absolute;
  left:14px;
  top:50%;
  transform:translateY(-50%);
  color:var(--gray);
  font-size:1rem
}
.header-search .search-clear{
  position:absolute;
  right:12px;
  top:50%;
  transform:translateY(-50%);
  color:var(--gray);
  font-size:1.1rem;
  display:none;
  cursor:pointer
}
.header-search .search-clear.show{display:block}
.search-results{
  position:absolute;
  top:calc(100% + 6px);
  left:0;
  right:0;
  background:var(--white);
  border-radius:var(--radius);
  box-shadow:var(--shadow-lg);
  max-height:360px;
  overflow-y:auto;
  display:none;
  z-index:200
}
.search-results.active{display:block}
.search-results .sr-item{
  display:flex;
  align-items:center;
  gap:12px;
  padding:10px 14px;
  transition:var(--transition);
  cursor:pointer
}
.search-results .sr-item:hover{background:var(--cream)}
.search-results .sr-item img{
  width:40px;
  height:40px;
  border-radius:var(--radius-sm);
  object-fit:cover
}
.search-results .sr-item .sr-name{
  font-weight:700;
  font-size:0.9rem
}
.search-results .sr-item .sr-cat{
  font-size:0.75rem;
  color:var(--text-light)
}

/* Desktop Navigation */
.desktop-nav {
  display: none;
  align-items: center;
  gap: 4px;
}
.desktop-nav a {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-light);
  transition: all 0.2s;
}
.desktop-nav a:hover,
.desktop-nav a.active {
  background: rgba(255,107,107,0.08);
  color: var(--coral);
}

@media (min-width: 900px) {
  .desktop-nav { display: flex; }
  #drawerOpen { display: none; }
  .header { padding: 10px 24px; }
}

/* ---------- Mobile Drawer ---------- */
.drawer-overlay{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,0.4);
  z-index:998;
  opacity:0;
  visibility:hidden;
  transition:var(--transition)
}
.drawer-overlay.active{opacity:1;visibility:visible}
.drawer{
  position:fixed;
  top:0;
  left:0;
  bottom:0;
  width:300px;
  max-width:80%;
  background:var(--white);
  z-index:999;
  border-radius:0 var(--radius-lg) var(--radius-lg) 0;
  box-shadow:var(--shadow-lg);
  transform:translateX(-100%);
  transition:transform 0.35s cubic-bezier(0.34,1.56,0.64,1);
  overflow-y:auto;
  padding:20px
}
.drawer.active{transform:translateX(0)}
.drawer-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:20px;
  padding-bottom:12px;
  border-bottom:2px solid var(--cream)
}
.drawer-header h2{
  font-size:1.2rem;
  font-weight:800;
  color:var(--coral)
}
.drawer-close{
  width:36px;
  height:36px;
  border-radius:50%;
  background:var(--cream);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:1.2rem;
  color:var(--coral);
  transition:var(--transition)
}
.drawer-close:hover{background:var(--coral);color:#fff}
.drawer-cat-list{display:flex;flex-direction:column;gap:6px}
.drawer-cat-item{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 14px;
  border-radius:var(--radius);
  font-weight:700;
  font-size:0.95rem;
  transition:var(--transition);
  color:var(--text)
}
.drawer-cat-item:hover{background:var(--cream)}
.drawer-cat-item .cat-dot{
  width:14px;
  height:14px;
  border-radius:50%;
  flex-shrink:0
}

/* ---------- Hero ---------- */
.hero{
  text-align:center;
  padding:32px 20px 24px;
  position:relative;
  overflow:hidden
}
.hero::before{
  content:'';
  position:absolute;
  top:-80px;
  right:-60px;
  width:220px;
  height:220px;
  background:radial-gradient(circle,rgba(255,107,107,0.12),transparent 70%);
  border-radius:50%;
  pointer-events:none
}
.hero::after{
  content:'';
  position:absolute;
  bottom:-40px;
  left:-40px;
  width:180px;
  height:180px;
  background:radial-gradient(circle,rgba(78,205,196,0.1),transparent 70%);
  border-radius:50%;
  pointer-events:none
}
.hero-badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  background:linear-gradient(135deg,var(--yellow),var(--yellow-light));
  color:var(--dark);
  padding:6px 18px;
  border-radius:var(--radius-pill);
  font-size:0.82rem;
  font-weight:700;
  margin-bottom:12px;
  box-shadow:0 2px 8px rgba(255,217,61,0.3)
}
.hero h1{
  font-size:2rem;
  font-weight:900;
  line-height:1.2;
  margin-bottom:8px;
  background:linear-gradient(135deg,var(--coral),var(--teal));
  -webkit-background-clip:text;
  -webkit-text-fill-color:transparent;
  background-clip:text
}
.hero p{
  color:var(--text-light);
  font-size:0.95rem;
  max-width:480px;
  margin:0 auto 20px
}
.hero-cta{
  display:inline-flex;
  align-items:center;
  gap:10px;
  padding:14px 36px;
  background:linear-gradient(135deg,var(--coral),var(--coral-light));
  color:#fff;
  font-size:1.05rem;
  font-weight:800;
  border-radius:var(--radius-pill);
  box-shadow:0 6px 20px rgba(255,107,107,0.35);
  transition:var(--transition)
}
.hero-cta:hover{
  transform:translateY(-3px) scale(1.03);
  box-shadow:0 10px 30px rgba(255,107,107,0.4)
}
.hero-bubble{
  display:inline-flex;
  gap:8px;
  margin-top:20px;
  flex-wrap:wrap;
  justify-content:center
}
.hero-bubble span{
  display:inline-flex;
  align-items:center;
  gap:4px;
  padding:6px 16px;
  background:rgba(255,255,255,0.7);
  border-radius:var(--radius-pill);
  font-size:0.78rem;
  font-weight:600;
  color:var(--text-light);
  backdrop-filter:blur(4px)
}

/* ---------- Game Horizontal Strip ---------- */
.game-strip{
  padding:12px 0;
  overflow:hidden;
  width:100%;
  max-width:100vw
}
.game-strip-inner{
  display:flex;
  gap:12px;
  overflow-x:auto;
  padding:0 16px 12px 16px;
  -webkit-overflow-scrolling:touch;
  scroll-snap-type:x mandatory;
  width:100%;
  box-sizing:border-box
}
.game-strip-inner::-webkit-scrollbar{display:none}
.game-card{
  flex-shrink:0;
  width:160px;
  background:var(--card-bg);
  border-radius:var(--radius);
  padding:10px;
  box-shadow:var(--shadow-sm);
  transition:var(--transition);
  cursor:pointer;
  scroll-snap-align:start;
  position:relative;
  border:2px solid transparent;
  box-sizing:border-box
}
.game-card:hover{
  transform:translateY(-5px);
  box-shadow:var(--shadow);
  border-color:rgba(255,107,107,0.15)
}
.game-card .thumb{
  width:100%;
  aspect-ratio:1;
  border-radius:var(--radius-sm);
  object-fit:cover;
  background:var(--light-gray)
}
.game-card .info{padding:8px 2px 2px}
.game-card .name{
  font-size:0.85rem;
  font-weight:800;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  margin-bottom:2px
}
.game-card .meta{
  display:flex;
  align-items:center;
  justify-content:space-between
}
.game-card .cat-tag{
  font-size:0.6rem;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:0.5px;
  color:var(--coral);
  background:rgba(255,107,107,0.08);
  padding:2px 8px;
  border-radius:var(--radius-pill)
}
.game-card .rating{
  display:flex;
  align-items:center;
  gap:2px;
  font-size:0.7rem;
  font-weight:700;
  color:var(--yellow-dark)
}
.game-card .rating .star{color:var(--yellow)}

/* ---------- Game Grid (Category/Load More) ---------- */
.game-grid{
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:14px;
  padding:0 16px;
  margin-bottom:24px
}
.game-grid .game-card{width:100%}

/* ---------- Load More ---------- */
.load-more-wrap{text-align:center;padding:8px 16px 32px}
.load-more-btn{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:14px 40px;
  background:linear-gradient(135deg,var(--teal),var(--teal-light));
  color:#fff;
  font-weight:800;
  font-size:1rem;
  border-radius:var(--radius-pill);
  box-shadow:0 4px 16px rgba(78,205,196,0.3);
  transition:var(--transition)
}
.load-more-btn:hover{
  transform:translateY(-3px);
  box-shadow:0 8px 24px rgba(78,205,196,0.35)
}
.load-more-btn:disabled{
  opacity:0.5;
  cursor:not-allowed;
  transform:none
}
.load-more-count{
  font-size:0.8rem;
  color:var(--text-light);
  margin-top:6px;
  font-weight:600
}

/* ---------- Game Detail Page ---------- */
.game-detail{padding-bottom:24px}
.game-frame-wrap{
  background:var(--dark);
  position:relative;
  width:100%;
  aspect-ratio:16/9;
  max-height:60vh;
  overflow:hidden;
  border-radius:0 0 var(--radius-lg) var(--radius-lg)
}
.game-frame-wrap iframe{
  width:100%;
  height:100%;
  border:none
}
.game-frame-loading{
  position:absolute;
  inset:0;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:12px;
  color:var(--white);
  font-weight:700;
  font-size:0.95rem;
  background:var(--dark)
}
.game-frame-loading .spinner{
  width:40px;
  height:40px;
  border:4px solid rgba(255,255,255,0.1);
  border-top-color:var(--coral);
  border-radius:50%;
  animation:spin 0.8s linear infinite
}
@keyframes spin{to{transform:rotate(360deg)}}
.game-info{
  padding:20px 16px 0
}
.game-info h1{
  font-size:1.4rem;
  font-weight:900;
  margin-bottom:4px
}
.game-info .game-sub-meta{
  display:flex;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
  margin-bottom:12px;
  font-size:0.85rem;
  color:var(--text-light)
}
.game-info .game-sub-meta .badge{
  display:inline-flex;
  align-items:center;
  gap:4px;
  padding:3px 12px;
  border-radius:var(--radius-pill);
  background:rgba(255,107,107,0.08);
  color:var(--coral);
  font-weight:700;
  font-size:0.75rem
}
.game-info .game-sub-meta .badge.teal{
  background:rgba(78,205,196,0.08);
  color:var(--teal-dark)
}
.game-desc{
  color:var(--text-light);
  font-size:0.9rem;
  line-height:1.7;
  margin-bottom:16px
}
.game-actions{
  display:flex;
  gap:10px;
  margin-bottom:24px;
  flex-wrap:wrap
}
.game-actions .btn-play{
  padding:12px 32px;
  background:linear-gradient(135deg,var(--coral),var(--coral-light));
  color:#fff;
  font-weight:800;
  border-radius:var(--radius-pill);
  font-size:1rem;
  box-shadow:0 4px 16px rgba(255,107,107,0.3);
  transition:var(--transition);
  display:flex;
  align-items:center;
  gap:8px
}
.game-actions .btn-play:hover{
  transform:translateY(-2px);
  box-shadow:0 8px 24px rgba(255,107,107,0.35)
}
.game-actions .btn-share{
  padding:12px 20px;
  background:var(--cream);
  color:var(--coral);
  font-weight:700;
  border-radius:var(--radius-pill);
  transition:var(--transition);
  display:flex;
  align-items:center;
  gap:6px;
  border:2px solid rgba(255,107,107,0.12)
}
.game-actions .btn-share:hover{background:var(--coral);color:#fff}

/* ---------- Section on Detail ---------- */
.detail-section{
  padding:0 16px;
  margin-bottom:24px
}
.detail-section .section-title{font-size:1.15rem}

/* ---------- 404 / Pages ---------- */
.page-404{
  text-align:center;
  padding:80px 20px
}
.page-404 .big-emoji{font-size:5rem;display:block;margin-bottom:12px}
.page-404 h1{font-size:2rem;font-weight:900;color:var(--coral);margin-bottom:8px}
.page-404 p{color:var(--text-light);margin-bottom:24px}
.page-404 a{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:12px 28px;
  background:linear-gradient(135deg,var(--teal),var(--teal-light));
  color:#fff;
  font-weight:800;
  border-radius:var(--radius-pill);
  transition:var(--transition)
}
.page-404 a:hover{transform:translateY(-3px);box-shadow:var(--shadow)}

/* ---------- Privacy / Terms ---------- */
.static-page{
  padding:32px 16px 60px;
  max-width:720px;
  margin:0 auto
}
.static-page h1{
  font-size:1.6rem;
  font-weight:900;
  color:var(--coral);
  margin-bottom:8px
}
.static-page .updated{
  color:var(--text-light);
  font-size:0.85rem;
  margin-bottom:24px
}
.static-page h2{
  font-size:1.15rem;
  font-weight:800;
  margin:20px 0 8px;
  color:var(--teal-dark)
}
.static-page p{
  color:var(--text-light);
  font-size:0.9rem;
  line-height:1.7;
  margin-bottom:12px
}
.static-page ul{
  margin:8px 0 16px;
  padding-left:20px;
  list-style:disc
}
.static-page ul li{
  color:var(--text-light);
  font-size:0.9rem;
  line-height:1.7;
  margin-bottom:4px
}

/* ---------- Footer ---------- */
.footer{
  background:var(--white);
  border-radius:var(--radius-lg) var(--radius-lg) 0 0;
  padding:32px 16px 20px;
  margin-top:32px;
  box-shadow:0 -4px 20px rgba(255,107,107,0.06);
  text-align:center
}
.footer-logo{
  font-size:1.2rem;
  font-weight:900;
  color:var(--coral);
  margin-bottom:8px
}
.footer-links{
  display:flex;
  justify-content:center;
  gap:20px;
  flex-wrap:wrap;
  margin-bottom:12px
}
.footer-links a{
  color:var(--text-light);
  font-size:0.85rem;
  font-weight:600;
  transition:var(--transition)
}
.footer-links a:hover{color:var(--coral)}
.footer-copy{
  color:var(--light-gray);
  font-size:0.75rem;
  font-weight:600
}

/* ---------- Toast ---------- */
.toast{
  position:fixed;
  bottom:24px;
  left:50%;
  transform:translateX(-50%) translateY(20px);
  background:var(--dark);
  color:#fff;
  padding:12px 24px;
  border-radius:var(--radius-pill);
  font-weight:700;
  font-size:0.85rem;
  opacity:0;
  visibility:hidden;
  transition:all 0.35s ease;
  z-index:2000;
  white-space:nowrap
}
.toast.show{
  opacity:1;
  visibility:visible;
  transform:translateX(-50%) translateY(0)
}

/* ---------- Tablet+ ---------- */
@media(min-width:600px){
  .game-grid{grid-template-columns:repeat(3,1fr);gap:16px}
  .game-card{width:180px}
  .hero h1{font-size:2.5rem}
  .hero{padding:40px 24px 32px}
}

@media(min-width:900px){
  .game-grid{grid-template-columns:repeat(4,1fr);gap:20px}
  .game-card{width:200px}
  .hero{padding:48px 24px 36px}
  .hero h1{font-size:3rem}
  .game-frame-wrap{border-radius:0 0 var(--radius-xl) var(--radius-xl)}
  .container{padding:0 24px}
}

@media(min-width:1200px){
  .game-grid{grid-template-columns:repeat(5,1fr);gap:20px}
  .game-card{width:210px}
  .hero{padding:56px 32px 40px}
}

/* ============================================
   MOBILE: Small screens (< 480px)
   ============================================ */
@media(max-width:480px){
  .hero{padding:28px 14px 20px}
  .hero h1{font-size:1.5rem}
  .hero-cta{padding:10px 20px;font-size:0.85rem}
  .header-logo{font-size:1rem;gap:4px}
  .header-logo .logo-icon{width:30px;height:30px;font-size:1rem}
  .header-search{max-width:none}
  .game-card{width:150px;padding:10px}
  .game-card .thumb{border-radius:10px}
  .game-card .name{font-size:0.78rem}
  .game-card .cat-tag{font-size:0.55rem}
  .game-card .rating{font-size:0.6rem}
  .game-strip-inner{gap:12px;padding:0 14px 12px 14px}
  .hero-badge{font-size:0.72rem;padding:4px 14px}
  .load-more-btn{padding:12px 28px;font-size:0.9rem}
  .game-info h1{font-size:1.15rem}
  .game-actions .btn-play{padding:10px 20px;font-size:0.9rem}
  .game-actions .btn-share{padding:10px 16px;font-size:0.85rem}
}

/* ============================================
   MOBILE: iPhone SE / small screens (≤ 400px)
   ============================================ */
@media(max-width:400px){
  .header{gap:8px;padding:8px 10px}
  .header-logo{font-size:0.85rem;gap:3px}
  .header-logo .logo-icon{width:26px;height:26px;font-size:0.85rem}
  .header-search input{padding:8px 12px 8px 34px;font-size:0.8rem}
  .hero{padding:20px 10px 16px}
  .hero h1{font-size:1.3rem}
  .hero-cta{padding:8px 16px;font-size:0.8rem;gap:6px}
  .hero-badge{padding:4px 12px;font-size:0.65rem}
  .hero-bubble{gap:4px;margin-top:12px}
  .hero-bubble span{padding:4px 12px;font-size:0.7rem}
  .game-grid{gap:10px;padding:0 10px}
  .game-card{width:135px;padding:8px}
  .game-card .name{font-size:0.72rem}
  .game-card .cat-tag{font-size:0.5rem;padding:1px 6px}
  .game-card .rating{font-size:0.55rem}
  .container{padding:0 10px}
  .game-strip-inner{gap:10px;padding:0 10px 8px}
  .load-more-btn{padding:10px 20px;font-size:0.8rem;gap:6px}
  .footer{padding:24px 10px 16px}
  .footer-links{gap:12px}
  .footer-links a{font-size:0.75rem}
  .game-info{padding:16px 10px 0}
  .game-info h1{font-size:1rem}
  .detail-section{padding:0 10px}
  .game-actions .btn-play{padding:8px 16px;font-size:0.8rem}
  .game-actions .btn-share{padding:8px 14px;font-size:0.75rem}
}

/* ============================================
   MOBILE: Very small screens (< 360px)
   ============================================ */
@media(max-width:360px){
  .game-grid{gap:10px}
  .hero h1{font-size:1.3rem}
  .game-card{width:130px;padding:8px}
  .game-strip-inner{gap:8px}
  .game-strip-inner{padding:0 12px 12px 12px}
}
