/* Tiny Arcade Global Theme */
:root {
  --bg: #0a0a0a;
  --panel: #121212;
  --text: #e6f7ff;
  --muted: #8aa6b3;
  --neon-cyan: #28e0f7;
  --neon-magenta: #ff2bd6;
  --neon-green: #7dff6a;
  --card-glow: 0 0 12px rgba(40, 224, 247, 0.4);
  --accent: var(--neon-cyan);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: radial-gradient(1200px 800px at 80% -20%, rgba(255,43,214,0.06), transparent),
              radial-gradient(1000px 700px at -10% 110%, rgba(40,224,247,0.06), transparent),
              var(--bg);
  color: var(--text);
}

/* Header */
.ta-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(6px);
  background: rgba(10,10,10,0.7);
  border-bottom: 1px solid rgba(40,224,247,0.2);
}
.ta-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.brand .logo {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-magenta));
  box-shadow: 0 0 10px rgba(255,43,214,0.5), 0 0 18px rgba(40,224,247,0.45);
}
.brand h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 1px;
}
.brand .tag {
  font-size: 12px; color: var(--muted);
}

.ta-actions { margin-left: auto; display: flex; gap: 8px; }
.btn { cursor: pointer; border: 1px solid rgba(40,224,247,0.4); color: var(--text); background: transparent; padding: 8px 12px; border-radius: 8px; }
.btn:hover { border-color: var(--neon-cyan); box-shadow: 0 0 8px rgba(40,224,247,0.35) inset; }
.btn.primary { border-color: var(--neon-magenta); }

/* Layout */
.container { max-width: 1200px; margin: 0 auto; padding: 16px; }

/* Game Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.game-card {
  background: linear-gradient(180deg, rgba(18,18,18,0.9), rgba(10,10,10,0.9));
  border: 1px solid rgba(40,224,247,0.2);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
  box-shadow: var(--card-glow);
  display: block;
  text-decoration: none;
  color: inherit;
}
.game-card:hover {
  transform: translateY(-2px);
  border-color: var(--neon-magenta);
  box-shadow: 0 0 20px rgba(255,43,214,0.25), 0 0 24px rgba(40,224,247,0.25);
}
.thumb {
  height: 140px;
  background: radial-gradient(400px 160px at 70% 20%, rgba(255,43,214,0.25), rgba(255,43,214,0.05) 60%, transparent),
              radial-gradient(420px 160px at 10% 90%, rgba(40,224,247,0.25), rgba(40,224,247,0.05) 60%, transparent),
              #0f0f0f;
  display: grid;
  place-items: center;
}
.thumb .emoji {
  font-size: 54px; filter: drop-shadow(0 0 8px rgba(40,224,247,0.45));
}
.card-body { padding: 12px; }
.title { font-size: 16px; margin: 0 0 6px; letter-spacing: 0.4px; }
.desc { font-size: 13px; color: var(--muted); margin: 0; }

/* Player View */
.player-view { display: none; gap: 12px; align-items: stretch; }
/* Use minmax(0,1fr) to prevent grid sizing quirks that can collapse the center */
.player-view.active { display: grid; grid-template-columns: 180px minmax(0, 1fr) 180px; }
.skyscraper { display: flex; align-items: center; justify-content: center; }

.frame-wrap {
  background: var(--panel);
  border: 1px solid rgba(40,224,247,0.2);
  border-radius: 12px;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 70vh;
  /* Ensure grid item can grow/shrink correctly in some WebViews */
  min-width: 0;
}
.frame-header {
  display: flex; gap: 8px; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-bottom: 1px solid rgba(40,224,247,0.15);
  background: linear-gradient(180deg, rgba(18,18,18,0.95), rgba(10,10,10,0.95));
}
.frame-title { font-weight: 600; letter-spacing: 0.4px; }
.frame-actions { display: flex; gap: 8px; }
iframe.game-frame { display:block; width: 100%; height: 70vh; border: 0; background: #000; }

.bottom-ads { display: none; margin-top: 12px; justify-content: center; gap: 12px; }

/* Ad Slots */
.ad-slot {
  border: 1px dashed rgba(125,255,106,0.6);
  color: #baffb3;
  background: rgba(125,255,106,0.06);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  font-size: 12px;
}
.ad-728x90 { width: 728px; height: 90px; }
.ad-336x280 { width: 336px; height: 280px; }
.ad-300x250 { width: 300px; height: 250px; }
.ad-300x50 { width: 300px; height: 50px; }
.ad-160x600 { width: 160px; height: 600px; }

/* Responsiveness */
@media (max-width: 1100px) {
  .player-view.active { grid-template-columns: 1fr; }
  .skyscraper { display: none; }
  .bottom-ads { display: flex; }
  iframe.game-frame { height: 68vh; }
}

/* Utility applied inside game if linked */
.ta-game-body {
  background: var(--bg) !important;
  color: var(--text) !important;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
}
.ta-game-canvas { border: 1px solid rgba(230,247,255,0.35); background: #000; }
